C4 Engine
C4 Engine API Documentation

class MaterialObject

Defined in:  C4MaterialObjects.h
The MaterialObject class encapsulates a set of material properties.

class MaterialObject final : public Object, public MapElement<MaterialObject>, public ListElement<MaterialObject>

Member Functions
MaterialObject::CloneMaterialObject Clones a material object.
MaterialObject::GetMaterialFlags Returns the material flags.
MaterialObject::SetMaterialFlags Sets the material flags.
MaterialObject::GetMaterialSubstance Returns the material substance type.
MaterialObject::SetMaterialSubstance Sets the material substance type.
MaterialObject::GetAttributeList Returns a pointer to the material's attribute list.
MaterialObject::GetFirstAttribute Returns a pointer to the first material attribute.
MaterialObject::FindAttribute Returns an attribute having a specific type.
MaterialObject::AddAttribute Adds an attribute to a material.
MaterialObject::PurgeAttributes Purges all of a material's attributes.
MaterialObject::GetTexcoordScale Returns the scale for a texcoord.
MaterialObject::SetTexcoordScale Sets the scale for a texcoord.
MaterialObject::GetTexcoordOffset Returns the offset for a texcoord.
MaterialObject::SetTexcoordOffset Sets the offset for a texcoord.
MaterialObject::GetTexcoordVelocity Returns the animation velocity for a texcoord.
MaterialObject::SetTexcoordVelocity Sets the animation velocity for a texcoord.
MaterialObject::GetFirstRegisteredSubstance Returns the first registered substance.
MaterialObject::GetLastRegisteredSubstance Returns the first registered substance.
MaterialObject::FindRegisteredSubstance Returns a specific registered substance.
MaterialObject::RegisterSubstance Registers a substance with the engine.


The MaterialObject class holds all of the information pertaining to a paticular material used for shading. Individual material attributes are added to a material object using the MaterialObject::AddAttribute function.

One material object can be shared by many Geometry nodes in a world. A material object is assigned to a Geometry node by calling the Geometry::SetMaterialObject function. This increments the material object's reference count, so it is okay to release the material object afterwards. Since the MaterialObject class is a shared object, it is released by calling the Shared::Release function.
Base Classes
Object A MaterialObject is an object that can be shared by multiple geometry nodes.
MapElement<MaterialObject> Used internally by the World Manager.
ListElement<MaterialObject> Used internally by the World Editor.
See Also