Panda3D
|
00001 // Filename: eggAttributes.h 00002 // Created by: drose (16Jan99) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef EGGATTRIBUTES_H 00016 #define EGGATTRIBUTES_H 00017 00018 #include "pandabase.h" 00019 00020 #include "eggMorphList.h" 00021 #include "eggParameters.h" 00022 #include "typedObject.h" 00023 #include "luse.h" 00024 #include "pnotify.h" 00025 00026 //////////////////////////////////////////////////////////////////// 00027 // Class : EggAttributes 00028 // Description : The set of attributes that may be applied to vertices 00029 // as well as polygons, such as surface normal and 00030 // color. 00031 // 00032 // This class cannot inherit from EggObject, because it 00033 // causes problems at the EggPolygon level with multiple 00034 // appearances of the EggObject base class. And making 00035 // EggObject a virtual base class is just no fun. 00036 //////////////////////////////////////////////////////////////////// 00037 class EXPCL_PANDAEGG EggAttributes : public MemoryBase { 00038 PUBLISHED: 00039 EggAttributes(); 00040 EggAttributes(const EggAttributes ©); 00041 EggAttributes &operator = (const EggAttributes ©); 00042 virtual ~EggAttributes(); 00043 00044 INLINE bool has_normal() const; 00045 INLINE const LNormald &get_normal() const; 00046 INLINE void set_normal(const LNormald &normal); 00047 INLINE void clear_normal(); 00048 INLINE bool matches_normal(const EggAttributes &other) const; 00049 INLINE void copy_normal(const EggAttributes &other); 00050 00051 INLINE bool has_color() const; 00052 INLINE LColor get_color() const; 00053 INLINE void set_color(const LColor &Color); 00054 INLINE void clear_color(); 00055 INLINE bool matches_color(const EggAttributes &other) const; 00056 INLINE void copy_color(const EggAttributes &other); 00057 00058 void write(ostream &out, int indent_level) const; 00059 INLINE bool sorts_less_than(const EggAttributes &other) const; 00060 int compare_to(const EggAttributes &other) const; 00061 00062 void transform(const LMatrix4d &mat); 00063 00064 EggMorphNormalList _dnormals; 00065 EggMorphColorList _drgbas; 00066 00067 private: 00068 enum Flags { 00069 F_has_normal = 0x001, 00070 F_has_color = 0x002, 00071 }; 00072 00073 int _flags; 00074 LNormald _normal; 00075 LColor _color; 00076 00077 00078 public: 00079 static TypeHandle get_class_type() { 00080 return _type_handle; 00081 } 00082 static void init_type() { 00083 register_type(_type_handle, "EggAttributes"); 00084 } 00085 00086 private: 00087 static TypeHandle _type_handle; 00088 }; 00089 00090 #include "eggAttributes.I" 00091 00092 #endif 00093