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