#include <material.h>
Inheritance diagram for Material:
Public Member Functions | |
Material () | |
Material (const Material ©) | |
void | operator= (const Material ©) |
~Material () | |
bool | has_ambient () const |
Returns true if the ambient color has been explicitly set for this material, false otherwise. | |
const Colorf & | get_ambient () const |
Returns the ambient color setting, if it has been set. | |
void | set_ambient (const Colorf &color) |
Specifies the ambient color setting of the material. | |
void | clear_ambient () |
Removes the explicit ambient color from the material. | |
bool | has_diffuse () const |
Returns true if the diffuse color has been explicitly set for this material, false otherwise. | |
const Colorf & | get_diffuse () const |
Returns the diffuse color setting, if it has been set. | |
void | set_diffuse (const Colorf &color) |
Specifies the diffuse color setting of the material. | |
void | clear_diffuse () |
Removes the explicit diffuse color from the material. | |
bool | has_specular () const |
Returns true if the specular color has been explicitly set for this material, false otherwise. | |
const Colorf & | get_specular () const |
Returns the specular color setting, if it has been set. | |
void | set_specular (const Colorf &color) |
Specifies the diffuse color setting of the material. | |
void | clear_specular () |
Removes the explicit specular color from the material. | |
bool | has_emission () const |
Returns true if the emission color has been explicitly set for this material, false otherwise. | |
const Colorf & | get_emission () const |
Returns the emmission color setting, if it has been set. | |
void | set_emission (const Colorf &color) |
Specifies the emission color setting of the material. | |
void | clear_emission () |
Removes the explicit emission color from the material. | |
float | get_shininess () const |
Returns the shininess exponent of the material. | |
void | set_shininess (float shininess) |
Sets the shininess exponent of the material. | |
bool | get_local () const |
void | set_local (bool local) |
bool | get_twoside () const |
void | set_twoside (bool twoside) |
bool | operator== (const Material &other) const |
bool | operator!= (const Material &other) const |
bool | operator< (const Material &other) const |
int | compare_to (const Material &other) const |
Returns a number less than zero if this material sorts before the other one, greater than zero if it sorts after, or zero if they are equivalent. | |
void | output (ostream &out) const |
void | write (ostream &out, int indent) const |
virtual void | write_datagram (BamWriter *manager, Datagram &me) |
Function to write the important information in the particular object to a Datagram. | |
virtual TypeHandle | get_type () const |
virtual TypeHandle | force_init_type () |
virtual int | complete_pointers (TypedWritable **p_list, BamReader *manager) |
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin(). | |
virtual void | finalize () |
Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed. | |
int | get_type_index () const |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. | |
bool | is_of_type (TypeHandle handle) const |
Returns true if the current object is or derives from the indicated type. | |
bool | is_exact_type (TypeHandle handle) const |
Returns true if the current object is the indicated type exactly. | |
int | get_ref_count () const |
Returns the current reference count. | |
int | ref () const |
Explicitly increments the reference count. | |
int | unref () const |
Explicitly decrements the reference count. | |
void | test_ref_count_integrity () const |
Does some easy checks to make sure that the reference count isn't completely bogus. | |
Static Public Member Functions | |
void | register_with_read_factory () |
Factory method to generate a Material object. | |
TypeHandle | get_class_type () |
void | init_type () |
Static Public Attributes | |
TypedWritable *const | Null = (TypedWritable*)0L |
Protected Member Functions | |
void | fillin (DatagramIterator &scan, BamReader *manager) |
Function that reads out of the datagram (or asks manager to read) all of the data that is needed to re-create this object and stores it in the appropiate place. | |
Static Protected Member Functions | |
TypedWritable * | make_Material (const FactoryParams ¶ms) |
Factory method to generate a Material object. | |
Private Types | |
enum | Flags { F_ambient = 0x001, F_diffuse = 0x002, F_specular = 0x004, F_emission = 0x008, F_local = 0x010, F_twoside = 0x020 } |
Private Attributes | |
Colorf | _ambient |
Colorf | _diffuse |
Colorf | _specular |
Colorf | _emission |
float | _shininess |
int | _flags |
Static Private Attributes | |
TypeHandle | _type_handle |
A material is only necessary if lighting is to be enabled; otherwise, the material isn't used.
Definition at line 45 of file material.h.
|
Definition at line 96 of file material.h. |
|
Definition at line 31 of file material.I. References INLINE, and operator=(). |
|
Definition at line 44 of file material.I. References INLINE. |
|
Definition at line 56 of file material.I. |
|
Removes the explicit ambient color from the material.
Definition at line 100 of file material.I. References _diffuse, _flags, Colorf, F_diffuse, INLINE, and zero. |
|
Removes the explicit diffuse color from the material.
Definition at line 145 of file material.I. References _flags, and F_specular. |
|
Removes the explicit emission color from the material.
Definition at line 235 of file material.I. |
|
Removes the explicit specular color from the material.
Definition at line 190 of file material.I. |
|
Returns a number less than zero if this material sorts before the other one, greater than zero if it sorts after, or zero if they are equivalent. The sorting order is arbitrary and largely meaningless, except to differentiate different materials. Definition at line 196 of file material.cxx. Referenced by set_shininess(). |
|
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin(). Returns the number of pointers processed. This is the callback function that is made by the BamReader at some later point, after all of the required pointers have been filled in. It is necessary because there might be forward references in a bam file; when we call read_pointer() in fillin(), the object may not have been read from the file yet, so we do not have a pointer available at that time. Thus, instead of returning a pointer, read_pointer() simply reserves a later callback. This function provides that callback. The calling object is responsible for keeping track of the number of times it called read_pointer() and extracting the same number of pointers out of the supplied vector, and storing them appropriately within the object. Reimplemented in AnimBundleNode, AnimGroup, PartBundleNode, PartGroup, Character, CharacterJoint, CollisionNode, GeomSprite, PiecewiseCurve, ClipPlaneAttrib, FogAttrib, LensNode, LightAttrib, MaterialAttrib, RenderEffects, RenderState, TextureAttrib, Person, and Child. Definition at line 94 of file typedWritable.cxx. Referenced by RenderState::do_invert_compose(). |
|
Function that reads out of the datagram (or asks manager to read) all of the data that is needed to re-create this object and stores it in the appropiate place.
Reimplemented from TypedWritable. Definition at line 341 of file material.cxx. |
|
Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed.
Reimplemented in PartBundle, RenderAttrib, RenderEffect, RenderEffects, RenderState, and TransformState. Definition at line 112 of file typedWritable.cxx. Referenced by BamReader::skip_pointer(). |
|
Reimplemented from TypedWritableReferenceCount. Definition at line 126 of file material.h. |
|
Returns the ambient color setting, if it has been set. Returns (0,0,0,0) if the ambient color has not been set. Definition at line 87 of file material.I. |
|
Reimplemented from TypedWritableReferenceCount. Definition at line 115 of file material.h. |
|
Returns the diffuse color setting, if it has been set. Returns (0,0,0,0) if the diffuse color has not been set. Definition at line 132 of file material.I. References _flags, _specular, Colorf, F_specular, INLINE, and zero. |
|
Returns the emmission color setting, if it has been set. Returns (0,0,0,0) if the emmission color has not been set. Definition at line 222 of file material.I. |
|
Definition at line 283 of file material.I. |
|
Returns the current reference count.
Definition at line 183 of file referenceCount.I. Referenced by RenderState::determine_bin_index(), RenderEffects::determine_show_bounds(), FontPool::ns_garbage_collect(), TexturePool::ns_garbage_collect(), MaterialPool::ns_get_material(), and TexturePool::ns_release_texture(). |
|
Returns the shininess exponent of the material.
Definition at line 248 of file material.I. |
|
Returns the specular color setting, if it has been set. Returns (0,0,0,0) if the specular color has not been set. Definition at line 177 of file material.I. References _flags, F_emission, and INLINE. Referenced by set_emission(). |
|
Definition at line 311 of file material.I. |
|
Reimplemented from TypedWritableReferenceCount. Definition at line 123 of file material.h. |
|
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. This is equivalent to get_type().get_index(). Definition at line 71 of file typedObject.I. References TypeHandle::get_name(), TypedObject::get_type(), and INLINE. |
|
Returns true if the ambient color has been explicitly set for this material, false otherwise.
Definition at line 70 of file material.I. |
|
Returns true if the diffuse color has been explicitly set for this material, false otherwise.
Definition at line 115 of file material.I. References _flags, F_specular, and INLINE. |
|
Returns true if the emission color has been explicitly set for this material, false otherwise.
Definition at line 205 of file material.I. |
|
Returns true if the specular color has been explicitly set for this material, false otherwise.
Definition at line 160 of file material.I. References _emission, _flags, Colorf, F_emission, INLINE, and zero. |
|
Reimplemented from TypedWritableReferenceCount. Definition at line 118 of file material.h. |
|
Returns true if the current object is the indicated type exactly.
Definition at line 101 of file typedObject.I. Referenced by PT(), and CollisionNode::xform(). |
|
|
Factory method to generate a Material object.
Definition at line 316 of file material.cxx. |
|
Definition at line 351 of file material.I. |
|
Definition at line 363 of file material.I. |
|
Definition at line 48 of file material.cxx. Referenced by Material(). |
|
Definition at line 339 of file material.I. |
|
Definition at line 227 of file material.cxx. References _ambient, _diffuse, _emission, _flags, _shininess, _specular, Datagram::add_float32(), and Datagram::add_int32(). Referenced by get_type(). |
|
Explicitly increments the reference count. User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it. The return value is the new reference count. Definition at line 225 of file referenceCount.I. Referenced by ClientDevice::ClientDevice(), EggGroupNode::find_textures(), EggGroupNode::r_apply_texmats(), EggGroupNode::r_flatten_transforms(), and EggGroupNode::reverse_vertex_ordering(). |
|
Factory method to generate a Material object.
Definition at line 283 of file material.cxx. |
|
Specifies the ambient color setting of the material. This will be the multiplied by any ambient lights in effect on the material to set its base color. This is the color of the object as it appears in the absence of direct light. If this is not set, the object color will be used. Definition at line 80 of file material.cxx. |
|
Specifies the diffuse color setting of the material. This will be multiplied by any lights in effect on the material to get the color in the parts of the object illuminated by the lights. This is the primary color of an object; the color of the object as it appears in direct light, in the absence of highlights. If this is not set, the object color will be used. Definition at line 112 of file material.cxx. References _emission, _flags, and F_emission. |
|
Specifies the emission color setting of the material. This is the color of the object as it appears in the absence of any light whatsover, including ambient light. It is as if the object is glowing by this color (although of course it will not illuminate neighboring objects). If this is not set, the object will not glow by its own light and will only appear visible in the presence of one or more lights. Definition at line 174 of file material.cxx. References get_specular(). |
|
Definition at line 295 of file material.I. |
|
Sets the shininess exponent of the material. This controls the size of the specular highlight spot. In general, larger number produce a smaller specular highlight, which makes the object appear shinier. Smaller numbers produce a larger highlight, which makes the object appear less shiny. Definition at line 271 of file material.I. References compare_to(). |
|
Specifies the diffuse color setting of the material. This will be multiplied by any lights in effect on the material to compute the color of specular highlights on the object. This is the highlight color of an object: the color of small highlight reflections. If this is not set, highlights will not appear. Definition at line 142 of file material.cxx. |
|
Definition at line 323 of file material.I. |
|
Does some easy checks to make sure that the reference count isn't completely bogus.
Definition at line 328 of file referenceCount.I. References INLINE. Referenced by EggNode::determine_bin(), and ReferenceCount::~ReferenceCount(). |
|
Explicitly decrements the reference count. Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic; plus, we don't have a virtual destructor anyway.) However, see the helper function unref_delete(). User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it. The return value is the new reference count. Definition at line 293 of file referenceCount.I. References INLINE. Referenced by RenderState::determine_bin_index(), and RenderEffects::determine_show_bounds(). |
|
Definition at line 254 of file material.cxx. References _ambient, _diffuse, _emission, _flags, _shininess, _specular, DatagramIterator::get_float32(), and DatagramIterator::get_int32(). |
|
Function to write the important information in the particular object to a Datagram.
Implements TypedWritableReferenceCount. Definition at line 298 of file material.cxx. |
|
Definition at line 90 of file material.h. Referenced by has_ambient(), output(), and write(). |
|
Definition at line 91 of file material.h. Referenced by clear_ambient(), output(), set_ambient(), and write(). |
|
Definition at line 93 of file material.h. Referenced by has_specular(), output(), set_diffuse(), and write(). |
|
Definition at line 104 of file material.h. Referenced by clear_ambient(), clear_diffuse(), clear_emission(), get_ambient(), get_diffuse(), get_emission(), get_shininess(), get_specular(), has_ambient(), has_diffuse(), has_specular(), output(), set_ambient(), set_diffuse(), write(), and ~Material(). |
|
Definition at line 94 of file material.h. |
|
Definition at line 92 of file material.h. Referenced by get_diffuse(), output(), and write(). |
|
Reimplemented from TypedWritableReferenceCount. Definition at line 38 of file material.cxx. |
|
Definition at line 25 of file typedWritable.cxx. Referenced by Child::complete_pointers(), Parent::complete_pointers(), Person::complete_pointers(), LoaderFileTypeBam::get_extension(), PartGroup::pick_channel_index(), BamReader::read_pointer(), and AnimGroup::write_datagram(). |