00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef EGGMATERIAL_H
00020 #define EGGMATERIAL_H
00021
00022 #include <pandabase.h>
00023
00024 #include "eggNode.h"
00025
00026 #include <luse.h>
00027
00028
00029
00030
00031
00032 class EXPCL_PANDAEGG EggMaterial : public EggNode {
00033 public:
00034 EggMaterial(const string &mref_name);
00035 EggMaterial(const EggMaterial ©);
00036
00037 virtual void write(ostream &out, int indent_level) const;
00038
00039 enum Equivalence {
00040 E_attributes = 0x001,
00041 E_mref_name = 0x002,
00042 };
00043
00044 bool is_equivalent_to(const EggMaterial &other, int eq) const;
00045 bool sorts_less_than(const EggMaterial &other, int eq) const;
00046
00047 INLINE void set_diff(const Colorf &diff);
00048 INLINE void clear_diff();
00049 INLINE bool has_diff() const;
00050 INLINE Colorf get_diff() const;
00051
00052 INLINE void set_amb(const Colorf &amb);
00053 INLINE void clear_amb();
00054 INLINE bool has_amb() const;
00055 INLINE Colorf get_amb() const;
00056
00057 INLINE void set_emit(const Colorf &emit);
00058 INLINE void clear_emit();
00059 INLINE bool has_emit() const;
00060 INLINE Colorf get_emit() const;
00061
00062 INLINE void set_spec(const Colorf &spec);
00063 INLINE void clear_spec();
00064 INLINE bool has_spec() const;
00065 INLINE Colorf get_spec() const;
00066
00067 INLINE void set_shininess(double shininess);
00068 INLINE void clear_shininess();
00069 INLINE bool has_shininess() const;
00070 INLINE double get_shininess() const;
00071
00072 INLINE void set_local(bool local);
00073 INLINE void clear_local();
00074 INLINE bool has_local() const;
00075 INLINE bool get_local() const;
00076
00077 private:
00078 enum Flags {
00079 F_diff = 0x001,
00080 F_amb = 0x002,
00081 F_emit = 0x004,
00082 F_spec = 0x008,
00083 F_shininess = 0x010,
00084 F_local = 0x020
00085 };
00086
00087 Colorf _diff;
00088 Colorf _amb;
00089 Colorf _emit;
00090 Colorf _spec;
00091 double _shininess;
00092 bool _local;
00093 int _flags;
00094
00095
00096 public:
00097 static TypeHandle get_class_type() {
00098 return _type_handle;
00099 }
00100 static void init_type() {
00101 EggNode::init_type();
00102 register_type(_type_handle, "EggMaterial",
00103 EggNode::get_class_type());
00104 }
00105 virtual TypeHandle get_type() const {
00106 return get_class_type();
00107 }
00108 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00109
00110 private:
00111 static TypeHandle _type_handle;
00112 };
00113
00114
00115
00116
00117
00118
00119
00120
00121 class EXPCL_PANDAEGG UniqueEggMaterials {
00122 public:
00123 INLINE UniqueEggMaterials(int eq = ~0);
00124 INLINE bool operator ()(const EggMaterial *t1, const EggMaterial *t2) const;
00125
00126 int _eq;
00127 };
00128
00129 #include "eggMaterial.I"
00130
00131 #endif