# Material

from pandac.PandaModules import Material

Class : Material
Description : Defines the way an object appears in the presence of lighting. A material is only necessary if lighting is to be enabled; otherwise, the material isn't used.

## Inheritance:

Material: TypedWritableReferenceCount Namable
TypedWritableReferenceCount: TypedWritable ReferenceCount
TypedWritable: TypedObject
TypedObject: MemoryBase
MemoryBase:
ReferenceCount: MemoryBase
Namable:

## Methods of Material:

clearAmbient
clearDiffuse
clearEmission
clearSpecular
compareTo
getAmbient
getClassType
getDefault
getDiffuse
getEmission
getLocal
getShininess
getSpecular
getTwoside
hasAmbient
hasDiffuse
hasEmission
hasSpecular
operator !=
operator <
operator =
operator ==
output
setAmbient
setDiffuse
setEmission
setLocal
setShininess
setSpecular
setTwoside
write

## Methods of TypedWritableReferenceCount:

getClassType

## Methods of TypedWritable:

getClassType

## Methods of TypedObject:

getClassType
getType
getTypeIndex
isExactType
isOfType

## Methods of ReferenceCount:

getClassType
getRefCount
ref
testRefCountIntegrity
testRefCountNonzero
unref

## Methods of Namable:

clearName
getClassType
getName
hasName
operator =
output
setName

clearAmbient void Material::clear_ambient(void); Description: Removes the explicit ambient color from the material.

clearDiffuse void Material::clear_diffuse(void); Description: Removes the explicit diffuse color from the material.

clearEmission void Material::clear_emission(void); Description: Removes the explicit emission color from the material.

clearSpecular void Material::clear_specular(void); Description: Removes the explicit specular color from the material.

compareTo int Material::compare_to(Material const &other) const; Description: 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.

getAmbient LVecBase4f const &Material::get_ambient(void) const; Description: Returns the ambient color setting, if it has been set. Returns (0,0,0,0) if the ambient color has not been set.

getClassType static TypeHandle Material::get_class_type(void); Undocumented function.

getDefault static Material *Material::get_default(void); Description: Returns the default material.

getDiffuse LVecBase4f const &Material::get_diffuse(void) const; Description: Returns the diffuse color setting, if it has been set. Returns (1,1,1,1) if the diffuse color has not been set.

getEmission LVecBase4f const &Material::get_emission(void) const; Description: Returns the emission color setting, if it has been set. Returns (0,0,0,0) if the emission color has not been set.

getLocal bool Material::get_local(void) const; Description: Returns the local viewer flag. Set set_local().

getShininess float Material::get_shininess(void) const; Description: Returns the shininess exponent of the material.

getSpecular LVecBase4f const &Material::get_specular(void) const; Description: Returns the specular color setting, if it has been set. Returns (0,0,0,0) if the specular color has not been set.

getTwoside bool Material::get_twoside(void) const; Description: Returns the state of the two-sided lighting flag. See set_twoside().

hasAmbient bool Material::has_ambient(void) const; Description: Returns true if the ambient color has been explicitly set for this material, false otherwise.

hasDiffuse bool Material::has_diffuse(void) const; Description: Returns true if the diffuse color has been explicitly set for this material, false otherwise.

hasEmission bool Material::has_emission(void) const; Description: Returns true if the emission color has been explicitly set for this material, false otherwise.

hasSpecular bool Material::has_specular(void) const; Description: Returns true if the specular color has been explicitly set for this material, false otherwise.

operator != bool Material::operator !=(Material const &other) const; Description:

operator < bool Material::operator <(Material const &other) const; Description:

operator = void Material::operator =(Material const &copy); Description:

operator == bool Material::operator ==(Material const &other) const; Description:

output void Material::output(ostream &out) const; Description:

setAmbient void Material::set_ambient(LVecBase4f const &color); Description: 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.

setDiffuse void Material::set_diffuse(LVecBase4f const &color); Description: 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.

setEmission void Material::set_emission(LVecBase4f const &color); Description: 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.

setLocal void Material::set_local(bool local); Description: Sets the local viewer flag. Set this true to enable camera-relative specular highlights, or false to use orthogonal specular highlights. The default value is true. Applications that use orthogonal projection should specify false.

setShininess void Material::set_shininess(float shininess); Description: 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.

setSpecular void Material::set_specular(LVecBase4f const &color); Description: 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.

setTwoside void Material::set_twoside(bool twoside); Description: Set this true to enable two-sided lighting. When two-sided lighting is on, both sides of a polygon will be lit by this material. The default is for two-sided lighting to be off, in which case only the front surface is lit.

write void Material::write(ostream &out, int indent) const; Description:

getClassType static TypeHandle TypedWritableReferenceCount::get_class_type(void); Undocumented function.

getClassType static TypeHandle TypedWritable::get_class_type(void); Undocumented function.

getClassType static TypeHandle TypedObject::get_class_type(void); Undocumented function.

getType virtual TypeHandle TypedObject::get_type(void) const = 0; Derived classes should override this function to return get_class_type().

getTypeIndex int TypedObject::get_type_index(void) const; Description: 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().

isExactType bool TypedObject::is_exact_type(TypeHandle handle) const; Description: Returns true if the current object is the indicated type exactly.

isOfType bool TypedObject::is_of_type(TypeHandle handle) const; Description: Returns true if the current object is or derives from the indicated type.

getClassType static TypeHandle ReferenceCount::get_class_type(void); Undocumented function.

getRefCount int ReferenceCount::get_ref_count(void) const; Description: Returns the current reference count.

ref void ReferenceCount::ref(void) const; Description: 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.

testRefCountIntegrity bool ReferenceCount::test_ref_count_integrity(void) const; Description: Does some easy checks to make sure that the reference count isn't completely bogus. Returns true if ok, false otherwise.

testRefCountNonzero bool ReferenceCount::test_ref_count_nonzero(void) const; Description: Does some easy checks to make sure that the reference count isn't zero, or completely bogus. Returns true if ok, false otherwise.

unref bool ReferenceCount::unref(void) const; Description: 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 true if the new reference count is nonzero, false if it is zero.

clearName void Namable::clear_name(void); Description: Resets the Namable's name to empty.

getClassType static TypeHandle Namable::get_class_type(void); Undocumented function.

getName string const &Namable::get_name(void) const; Description:

hasName bool Namable::has_name(void) const; Description: Returns true if the Namable has a nonempty name set, false if the name is empty.

operator = Namable &Namable::operator =(Namable const &other); Description:

output void Namable::output(ostream &out) const; In the absence of any definition to the contrary, outputting a Namable will write out its name. Description: Outputs the Namable. This function simply writes the name to the output stream; most Namable derivatives will probably redefine this.

setName void Namable::set_name(string const &name); Description: