Panda3D
|
Indicates which, if any, material should be applied to geometry. More...
#include "materialAttrib.h"
Public Member Functions | |
virtual int | complete_pointers (TypedWritable **plist, BamReader *manager) |
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin(). | |
virtual TypeHandle | force_init_type () |
Material * | get_material () const |
If the MaterialAttrib is not an 'off' MaterialAttrib, returns the material that is associated. | |
virtual int | get_slot () const |
virtual TypeHandle | get_type () const |
bool | is_off () const |
Returns true if the MaterialAttrib is an 'off' MaterialAttrib, indicating that it should disable the use of materials. | |
virtual void | output (ostream &out) const |
virtual void | write_datagram (BamWriter *manager, Datagram &dg) |
Writes the contents of this object to the datagram for shipping out to a Bam file. | |
Static Public Member Functions | |
static | CPT (RenderAttrib) make(Material *material) |
static | CPT (RenderAttrib) make_off() |
static | CPT (RenderAttrib) make_default() |
static int | get_class_slot () |
static TypeHandle | get_class_type () |
static void | init_type () |
static void | register_with_read_factory () |
Tells the BamReader how to create objects of type MaterialAttrib. | |
Protected Member Functions | |
virtual int | compare_to_impl (const RenderAttrib *other) const |
Intended to be overridden by derived MaterialAttrib types to return a unique number indicating whether this MaterialAttrib is equivalent to the other one. | |
virtual | CPT (RenderAttrib) get_auto_shader_attrib_impl(const RenderState *state) const |
void | fillin (DatagramIterator &scan, BamReader *manager) |
This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new MaterialAttrib. | |
virtual size_t | get_hash_impl () const |
Intended to be overridden by derived RenderAttrib types to return a unique hash for these particular properties. | |
Static Protected Member Functions | |
static TypedWritable * | make_from_bam (const FactoryParams ¶ms) |
This function is called by the BamReader's factory when a new object of type MaterialAttrib is encountered in the Bam file. |
Indicates which, if any, material should be applied to geometry.
The material is used primarily to control lighting effects, and isn't necessary (or useful) in the absence of lighting.
Definition at line 30 of file materialAttrib.h.
int MaterialAttrib::compare_to_impl | ( | const RenderAttrib * | other | ) | const [protected, virtual] |
Intended to be overridden by derived MaterialAttrib types to return a unique number indicating whether this MaterialAttrib is equivalent to the other one.
This should return 0 if the two MaterialAttrib objects are equivalent, a number less than zero if this one should be sorted before the other one, and a number greater than zero otherwise.
This will only be called with two MaterialAttrib objects whose get_type() functions return the same.
Reimplemented from RenderAttrib.
Definition at line 94 of file materialAttrib.cxx.
int MaterialAttrib::complete_pointers | ( | TypedWritable ** | p_list, |
BamReader * | manager | ||
) | [virtual] |
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
Returns the number of pointers processed.
Reimplemented from TypedWritable.
Definition at line 166 of file materialAttrib.cxx.
void MaterialAttrib::fillin | ( | DatagramIterator & | scan, |
BamReader * | manager | ||
) | [protected, virtual] |
This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new MaterialAttrib.
Reimplemented from RenderAttrib.
Definition at line 204 of file materialAttrib.cxx.
References BamReader::read_pointer().
Referenced by make_from_bam().
size_t MaterialAttrib::get_hash_impl | ( | ) | const [protected, virtual] |
Intended to be overridden by derived RenderAttrib types to return a unique hash for these particular properties.
RenderAttribs that compare the same with compare_to_impl(), above, should return the same hash; RenderAttribs that compare differently should return a different hash.
Reimplemented from RenderAttrib.
Definition at line 118 of file materialAttrib.cxx.
References pointer_hash::add_hash().
Material * MaterialAttrib::get_material | ( | ) | const [inline] |
If the MaterialAttrib is not an 'off' MaterialAttrib, returns the material that is associated.
Otherwise, return NULL.
Definition at line 46 of file materialAttrib.I.
Referenced by ShaderGenerator::analyze_renderstate(), and GraphicsStateGuardian::fetch_specified_part().
bool MaterialAttrib::is_off | ( | ) | const [inline] |
Returns true if the MaterialAttrib is an 'off' MaterialAttrib, indicating that it should disable the use of materials.
Definition at line 34 of file materialAttrib.I.
Referenced by ShaderGenerator::analyze_renderstate(), GraphicsStateGuardian::fetch_specified_part(), and NodePath::has_material().
TypedWritable * MaterialAttrib::make_from_bam | ( | const FactoryParams & | params | ) | [static, protected] |
This function is called by the BamReader's factory when a new object of type MaterialAttrib is encountered in the Bam file.
It should create the MaterialAttrib and extract its information from the file.
Definition at line 186 of file materialAttrib.cxx.
References fillin().
Referenced by register_with_read_factory().
void MaterialAttrib::register_with_read_factory | ( | ) | [static] |
Tells the BamReader how to create objects of type MaterialAttrib.
Definition at line 141 of file materialAttrib.cxx.
References BamReader::get_factory(), make_from_bam(), and Factory< Type >::register_factory().
Writes the contents of this object to the datagram for shipping out to a Bam file.
Reimplemented from RenderAttrib.
Definition at line 152 of file materialAttrib.cxx.
References BamWriter::write_pointer().