Panda3D
|
Public Types | |
enum | Equivalence { E_attributes = 0x001, E_mref_name = 0x002 } |
Public Member Functions | |
EggMaterial (const string &mref_name) | |
EggMaterial (const EggMaterial ©) | |
void | clear_amb () |
void | clear_diff () |
void | clear_emit () |
void | clear_local () |
void | clear_shininess () |
void | clear_spec () |
virtual TypeHandle | force_init_type () |
LColor | get_amb () const |
It is legal to call this even if has_amb() returns false. | |
LColor | get_diff () const |
It is legal to call this even if has_diff() returns false. | |
LColor | get_emit () const |
It is legal to call this even if has_emit() returns false. | |
bool | get_local () const |
double | get_shininess () const |
LColor | get_spec () const |
It is legal to call this even if has_spec() returns false. | |
virtual TypeHandle | get_type () const |
bool | has_amb () const |
bool | has_diff () const |
bool | has_emit () const |
bool | has_local () const |
bool | has_shininess () const |
bool | has_spec () const |
bool | is_equivalent_to (const EggMaterial &other, int eq) const |
Returns true if the two materials are equivalent in all relevant properties (according to eq), false otherwise. | |
void | set_amb (const LColor &amb) |
void | set_diff (const LColor &diff) |
void | set_emit (const LColor &emit) |
void | set_local (bool local) |
void | set_shininess (double shininess) |
void | set_spec (const LColor &spec) |
bool | sorts_less_than (const EggMaterial &other, int eq) const |
An ordering operator to compare two materials for sorting order. | |
virtual void | write (ostream &out, int indent_level) const |
Writes the material definition to the indicated output stream in Egg format. | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
This function is declared non-inline to work around a compiler bug in g++ 2.96. |
Definition at line 28 of file eggMaterial.h.
LColor EggMaterial::get_amb | ( | ) | const [inline] |
It is legal to call this even if has_amb() returns false.
If so, it simply returns the default amb color.
Definition at line 102 of file eggMaterial.I.
Referenced by is_equivalent_to(), sorts_less_than(), and write().
LColor EggMaterial::get_diff | ( | ) | const [inline] |
It is legal to call this even if has_diff() returns false.
If so, it simply returns the default diff color.
Definition at line 55 of file eggMaterial.I.
Referenced by is_equivalent_to(), XFileMaterial::set_from_egg(), sorts_less_than(), and write().
LColor EggMaterial::get_emit | ( | ) | const [inline] |
It is legal to call this even if has_emit() returns false.
If so, it simply returns the default emit color.
Definition at line 149 of file eggMaterial.I.
Referenced by is_equivalent_to(), XFileMaterial::set_from_egg(), sorts_less_than(), and write().
LColor EggMaterial::get_spec | ( | ) | const [inline] |
It is legal to call this even if has_spec() returns false.
If so, it simply returns the default spec color.
Definition at line 196 of file eggMaterial.I.
Referenced by is_equivalent_to(), XFileMaterial::set_from_egg(), sorts_less_than(), and write().
static void EggMaterial::init_type | ( | ) | [inline, static] |
This function is declared non-inline to work around a compiler bug in g++ 2.96.
Making it inline seems to cause problems in the optimizer.
Reimplemented from EggNode.
Definition at line 96 of file eggMaterial.h.
References EggNode::init_type().
bool EggMaterial::is_equivalent_to | ( | const EggMaterial & | other, |
int | eq | ||
) | const |
Returns true if the two materials are equivalent in all relevant properties (according to eq), false otherwise.
The Equivalence parameter, eq, should be set to the bitwise OR of the following properties, according to what you consider relevant:
EggMaterial::E_attributes: All material attributes (diff, spec, etc.) except MRef name.
EggMaterial::E_mref_name: The MRef name.
Definition at line 147 of file eggMaterial.cxx.
References get_amb(), get_diff(), get_emit(), and get_spec().
Referenced by EggMaterialCollection::create_unique_material().
bool EggMaterial::sorts_less_than | ( | const EggMaterial & | other, |
int | eq | ||
) | const |
An ordering operator to compare two materials for sorting order.
This imposes an arbitrary ordering useful to identify unique materials, according to the indicated Equivalence factor. See is_equivalent_to().
Definition at line 179 of file eggMaterial.cxx.
References LVecBase4f::compare_to(), get_amb(), get_diff(), get_emit(), and get_spec().
Referenced by EggPolysetMaker::sorts_less().
void EggMaterial::write | ( | ostream & | out, |
int | indent_level | ||
) | const [virtual] |
Writes the material definition to the indicated output stream in Egg format.
Implements EggNode.
Definition at line 60 of file eggMaterial.cxx.
References get_amb(), get_diff(), get_emit(), get_spec(), and EggNamedObject::write_header().