Panda3D
eggAttributes.h
1 // Filename: eggAttributes.h
2 // Created by: drose (16Jan99)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef EGGATTRIBUTES_H
16 #define EGGATTRIBUTES_H
17 
18 #include "pandabase.h"
19 
20 #include "eggMorphList.h"
21 #include "eggParameters.h"
22 #include "typedObject.h"
23 #include "luse.h"
24 #include "pnotify.h"
25 
26 ////////////////////////////////////////////////////////////////////
27 // Class : EggAttributes
28 // Description : The set of attributes that may be applied to vertices
29 // as well as polygons, such as surface normal and
30 // color.
31 //
32 // This class cannot inherit from EggObject, because it
33 // causes problems at the EggPolygon level with multiple
34 // appearances of the EggObject base class. And making
35 // EggObject a virtual base class is just no fun.
36 ////////////////////////////////////////////////////////////////////
37 class EXPCL_PANDAEGG EggAttributes : public MemoryBase {
38 PUBLISHED:
39  EggAttributes();
40  EggAttributes(const EggAttributes &copy);
41  EggAttributes &operator = (const EggAttributes &copy);
42  virtual ~EggAttributes();
43 
44  INLINE bool has_normal() const;
45  INLINE const LNormald &get_normal() const;
46  INLINE void set_normal(const LNormald &normal);
47  INLINE void clear_normal();
48  INLINE bool matches_normal(const EggAttributes &other) const;
49  INLINE void copy_normal(const EggAttributes &other);
50 
51  INLINE bool has_color() const;
52  INLINE LColor get_color() const;
53  INLINE void set_color(const LColor &Color);
54  INLINE void clear_color();
55  INLINE bool matches_color(const EggAttributes &other) const;
56  INLINE void copy_color(const EggAttributes &other);
57 
58  void write(ostream &out, int indent_level) const;
59  INLINE bool sorts_less_than(const EggAttributes &other) const;
60  int compare_to(const EggAttributes &other) const;
61 
62  void transform(const LMatrix4d &mat);
63 
64  EggMorphNormalList _dnormals;
65  EggMorphColorList _drgbas;
66 
67 private:
68  enum Flags {
69  F_has_normal = 0x001,
70  F_has_color = 0x002,
71  };
72 
73  int _flags;
74  LNormald _normal;
75  LColor _color;
76 
77 
78 public:
79  static TypeHandle get_class_type() {
80  return _type_handle;
81  }
82  static void init_type() {
83  register_type(_type_handle, "EggAttributes");
84  }
85 
86 private:
87  static TypeHandle _type_handle;
88 };
89 
90 #include "eggAttributes.I"
91 
92 #endif
93 
This is a 4-by-4 transform matrix.
Definition: lmatrix.h:4716
The set of attributes that may be applied to vertices as well as polygons, such as surface normal and...
Definition: eggAttributes.h:37
This class is intended to be the base class of all objects in Panda that might be allocated and delet...
Definition: memoryBase.h:73
This is the base class for all three-component vectors and points.
Definition: lvecBase4.h:111
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
Definition: lvector3.h:760
An STL function object class, this is intended to be used on any ordered collection of class objects ...
Definition: stl_compares.h:79
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85