Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | Static Public Attributes | List of all members
om::graphics::materials::Material Class Reference

A class that contains a set of techniques for drawing the visual appearance of an object. More...

#include <omGraphicsMaterial.h>

Inheritance diagram for om::graphics::materials::Material:
om::graphics::devices::GraphicsContextObject

Public Member Functions

 Material ()
 Create a default material with no name and no techniques. More...
 
 Material (Technique *newTechnique)
 Create a material with no name that uses the specified technique. More...
 
virtual ~Material ()
 Destroy this material, releasing all resources. More...
 
Size getTechniqueCount () const
 Return the total number of material techniques that are part of this material. More...
 
TechniquegetTechnique (Index index) const
 Return a pointer to the material technique at the specified index in this material. More...
 
void setTechnique (Index index, Technique *newTechnique)
 Set a pointer to the material technique at the specified index in this material. More...
 
TechniquegetTechniqueForPass (RenderPass::Flag pass) const
 Return a technique for this material for the specified render pass. More...
 
Bool addTechnique (Technique *newTechnique)
 Add a new material technique to this material with the specified usage. More...
 
Bool removeTechnique (Index index)
 Remove the technique with the specified index from this material. More...
 
void clearTechniques ()
 Remove all material techniques from this material. More...
 
Size getConstantCount () const
 Return the number of constants that are stored in this material. More...
 
ConstantSetgetConstants ()
 Return the object that contains the constants for this material. More...
 
const ConstantSetgetConstants () const
 Return the object that contains the constants for this material. More...
 
const UBytegetConstantData (Index constantIndex) const
 Return a pointer to the storage for the specified constant index. More...
 
const AttributeTypegetConstantType (Index constantIndex) const
 Return the type of the constant at the specified index. More...
 
template<typename T >
const T * getConstant (ConstantUsage::Enum usage) const
 Return a pointer to the storage for the specified constant usage if it is part of this material. More...
 
template<typename T >
const T * getConstant (const ConstantUsage &usage) const
 Return a pointer to the storage for the specified constant usage if it is part of this material. More...
 
Bool getConstant (Index constantIndex, AttributeValue &value) const
 Get the value for the specified constant index if it is part of this material. More...
 
Bool getConstant (ConstantUsage::Enum usage, AttributeValue &value) const
 Get the value for the specified constant usage if it is part of this material. More...
 
Bool getConstant (const ConstantUsage &usage, AttributeValue &value) const
 Get the value for the specified constant usage if it is part of this material. More...
 
Bool getConstant (Index constantIndex, const AttributeType &outputType, void *value) const
 Get the value for the specified constant index if it is part of this material. More...
 
Bool getConstant (ConstantUsage::Enum usage, const AttributeType &outputType, void *value) const
 Get the value for the specified constant usage if it is part of this material. More...
 
Bool getConstant (const ConstantUsage &usage, const AttributeType &outputType, void *value) const
 Get the value for the specified constant usage if it is part of this material. More...
 
template<typename T >
Bool setConstant (ConstantUsage::Enum usage, const T &value)
 Set the value of the stored constant with the given usage. More...
 
template<typename T >
Bool setConstant (const ConstantUsage &usage, const T &value)
 Set the value of the stored constant with the given usage. More...
 
Bool setConstant (ConstantUsage::Enum usage, const AttributeValue &value)
 Set the value of the stored constant with the given usgae. More...
 
Bool setConstant (const ConstantUsage &usage, const AttributeValue &value)
 Set the value of the stored constant with the given usgae. More...
 
const ConstantUsagegetConstantUsage (Index constantIndex) const
 Return the usage of the constant at the specified index in this material. More...
 
void setConstantUsage (Index constantIndex, const ConstantUsage &newUsage)
 Set the usage of the constant at the specified index in this material. More...
 
template<typename T >
Bool addConstant (const ConstantUsage &usage, const T &value)
 Add a new constant with the specified usage and value to this material. More...
 
Bool addConstant (const ConstantUsage &usage, const AttributeValue &value)
 Add a new constant with the specified usage and value to this material. More...
 
Bool addConstant (const ConstantUsage &usage, const AttributeType &type, const void *value)
 Add a new constant with the specified usage and value to this material. More...
 
void clearConstants ()
 Remove all stored constants from this constant set object. More...
 
Size getTextureCount () const
 Return the number of textures in this material. More...
 
TextureSetgetTextures ()
 Return the object that contains the textures for this material. More...
 
const TextureSetgetTextures () const
 Return the object that contains the textures for this material. More...
 
TexturegetTexture (Index textureIndex) const
 Return the texture at the specified index in this material. More...
 
Bool setTexture (Index textureIndex, Texture *texture)
 Set the texture at the specified index in this material. More...
 
TexturegetTexture (TextureUsage::Enum usage) const
 Return a pointer to the texture with the specified usage in this material. More...
 
TexturegetTexture (const TextureUsage &usage) const
 Return a pointer to the texture with the specified usage in this material. More...
 
Bool setTexture (TextureUsage::Enum usage, Texture *texture)
 Set the texture with the specified usage in this material. More...
 
Bool setTexture (const TextureUsage &usage, Texture *texture)
 Set the texture with the specified usage in this material. More...
 
const TextureUsagegetTextureUsage (Index textureIndex) const
 Return the usage type of the texture at the specified index in this material. More...
 
Bool setTextureUsage (Index textureIndex, const TextureUsage &newUsage)
 Set the usage of the texture at the specified index in this material. More...
 
Bool addTexture (const TextureUsage &usage, Texture *texture)
 Add a texture with the specified usage to this material. More...
 
Bool removeTexture (const Texture *texture)
 Remove the first texture with the specified address from this material. More...
 
Bool removeTexture (const TextureUsage &usage)
 Remove the texture with the specified usage from this material. More...
 
void clearTextures ()
 Clear all textures from this material. More...
 
virtual void setContext (devices::GraphicsContext *newContext)
 Set a pointer to the graphics context this material and its techniques should use to do rendering. More...
 
virtual void upload (UploadRequest &request)
 Upload this material and its techniques' current CPU representation to the GPU device. More...
 
virtual void download (DownloadRequest &request)
 Download the material and its technique' GPU representation to CPU memory. More...
 
- Public Member Functions inherited from om::graphics::devices::GraphicsContextObject
virtual ~GraphicsContextObject ()
 Destory this graphics context object. More...
 
GraphicsContextgetContext () const
 Return a pointer to the graphics context this context object is using to do rendering. More...
 
void clearContext ()
 Clear the previous context from this object. More...
 
void upload ()
 Upload this resource's CPU representation to the GPU device. More...
 
void download ()
 Upload this resource's CPU representation to the GPU device. More...
 
virtual Bool isUploaded () const
 Return whether or not this graphics resource has been successfully created and uploaded to the device. More...
 
virtual Bool isDownloaded () const
 Return whether or not this graphics resource has a copy of its data stored in CPU-side memory. More...
 
virtual Bool isValid () const
 Return whether or not the state of this graphics resource is valid (either on CPU or GPU) and able to be used for rendering. More...
 

Static Public Attributes

static const ResourceType RESOURCE_TYPE
 The resource type for a graphics material. More...
 

Additional Inherited Members

- Protected Member Functions inherited from om::graphics::devices::GraphicsContextObject
 GraphicsContextObject ()
 Create a new graphics context object that doesn't have an associated graphics context. More...
 
 GraphicsContextObject (GraphicsContext *newContext)
 Create a new graphics context object that uses the specified context for rendering. More...
 
- Protected Attributes inherited from om::graphics::devices::GraphicsContextObject
GraphicsContextcontext
 A pointer to the graphics context this object is using. More...
 

Detailed Description

A class that contains a set of techniques for drawing the visual appearance of an object.

Each technique represents a particular way of drawing an object. A material is a set of techniques, where each technique is associated with a usage type. The usage allows the renderer to pick the correct technique to render an object.

Constructor & Destructor Documentation

om::graphics::materials::Material::Material ( )

Create a default material with no name and no techniques.

om::graphics::materials::Material::Material ( Technique newTechnique)

Create a material with no name that uses the specified technique.

virtual om::graphics::materials::Material::~Material ( )
virtual

Destroy this material, releasing all resources.

Member Function Documentation

Size om::graphics::materials::Material::getTechniqueCount ( ) const
inline

Return the total number of material techniques that are part of this material.

Technique* om::graphics::materials::Material::getTechnique ( Index  index) const
inline

Return a pointer to the material technique at the specified index in this material.

void om::graphics::materials::Material::setTechnique ( Index  index,
Technique newTechnique 
)
inline

Set a pointer to the material technique at the specified index in this material.

Technique* om::graphics::materials::Material::getTechniqueForPass ( RenderPass::Flag  pass) const

Return a technique for this material for the specified render pass.

If there is no technique for that pass, NULL is returned.

Bool om::graphics::materials::Material::addTechnique ( Technique newTechnique)

Add a new material technique to this material with the specified usage.

If the technique pointer is NULL, the method fails and FALSE is returned. Otherwise, the technique is added and TRUE is returned.

Bool om::graphics::materials::Material::removeTechnique ( Index  index)

Remove the technique with the specified index from this material.

This causes all techniques stored after the given index to be moved one index back in this internal list of techniques. The method returns whether or not the remove operation was successful.

void om::graphics::materials::Material::clearTechniques ( )

Remove all material techniques from this material.

Size om::graphics::materials::Material::getConstantCount ( ) const
inline

Return the number of constants that are stored in this material.

ConstantSet& om::graphics::materials::Material::getConstants ( )
inline

Return the object that contains the constants for this material.

const ConstantSet& om::graphics::materials::Material::getConstants ( ) const
inline

Return the object that contains the constants for this material.

const UByte* om::graphics::materials::Material::getConstantData ( Index  constantIndex) const
inline

Return a pointer to the storage for the specified constant index.

const AttributeType& om::graphics::materials::Material::getConstantType ( Index  constantIndex) const
inline

Return the type of the constant at the specified index.

template<typename T >
const T* om::graphics::materials::Material::getConstant ( ConstantUsage::Enum  usage) const
inline

Return a pointer to the storage for the specified constant usage if it is part of this material.

template<typename T >
const T* om::graphics::materials::Material::getConstant ( const ConstantUsage usage) const
inline

Return a pointer to the storage for the specified constant usage if it is part of this material.

Bool om::graphics::materials::Material::getConstant ( Index  constantIndex,
AttributeValue value 
) const
inline

Get the value for the specified constant index if it is part of this material.

Bool om::graphics::materials::Material::getConstant ( ConstantUsage::Enum  usage,
AttributeValue value 
) const
inline

Get the value for the specified constant usage if it is part of this material.

Bool om::graphics::materials::Material::getConstant ( const ConstantUsage usage,
AttributeValue value 
) const
inline

Get the value for the specified constant usage if it is part of this material.

Bool om::graphics::materials::Material::getConstant ( Index  constantIndex,
const AttributeType outputType,
void *  value 
) const
inline

Get the value for the specified constant index if it is part of this material.

Bool om::graphics::materials::Material::getConstant ( ConstantUsage::Enum  usage,
const AttributeType outputType,
void *  value 
) const
inline

Get the value for the specified constant usage if it is part of this material.

Bool om::graphics::materials::Material::getConstant ( const ConstantUsage usage,
const AttributeType outputType,
void *  value 
) const
inline

Get the value for the specified constant usage if it is part of this material.

template<typename T >
Bool om::graphics::materials::Material::setConstant ( ConstantUsage::Enum  usage,
const T &  value 
)
inline

Set the value of the stored constant with the given usage.

template<typename T >
Bool om::graphics::materials::Material::setConstant ( const ConstantUsage usage,
const T &  value 
)
inline

Set the value of the stored constant with the given usage.

Bool om::graphics::materials::Material::setConstant ( ConstantUsage::Enum  usage,
const AttributeValue value 
)
inline

Set the value of the stored constant with the given usgae.

Bool om::graphics::materials::Material::setConstant ( const ConstantUsage usage,
const AttributeValue value 
)
inline

Set the value of the stored constant with the given usgae.

const ConstantUsage& om::graphics::materials::Material::getConstantUsage ( Index  constantIndex) const
inline

Return the usage of the constant at the specified index in this material.

void om::graphics::materials::Material::setConstantUsage ( Index  constantIndex,
const ConstantUsage newUsage 
)
inline

Set the usage of the constant at the specified index in this material.

template<typename T >
Bool om::graphics::materials::Material::addConstant ( const ConstantUsage usage,
const T &  value 
)
inline

Add a new constant with the specified usage and value to this material.

Bool om::graphics::materials::Material::addConstant ( const ConstantUsage usage,
const AttributeValue value 
)
inline

Add a new constant with the specified usage and value to this material.

Bool om::graphics::materials::Material::addConstant ( const ConstantUsage usage,
const AttributeType type,
const void *  value 
)
inline

Add a new constant with the specified usage and value to this material.

void om::graphics::materials::Material::clearConstants ( )
inline

Remove all stored constants from this constant set object.

Size om::graphics::materials::Material::getTextureCount ( ) const
inline

Return the number of textures in this material.

TextureSet& om::graphics::materials::Material::getTextures ( )
inline

Return the object that contains the textures for this material.

const TextureSet& om::graphics::materials::Material::getTextures ( ) const
inline

Return the object that contains the textures for this material.

Texture* om::graphics::materials::Material::getTexture ( Index  textureIndex) const
inline

Return the texture at the specified index in this material.

Bool om::graphics::materials::Material::setTexture ( Index  textureIndex,
Texture texture 
)
inline

Set the texture at the specified index in this material.

Texture* om::graphics::materials::Material::getTexture ( TextureUsage::Enum  usage) const
inline

Return a pointer to the texture with the specified usage in this material.

Texture* om::graphics::materials::Material::getTexture ( const TextureUsage usage) const
inline

Return a pointer to the texture with the specified usage in this material.

Bool om::graphics::materials::Material::setTexture ( TextureUsage::Enum  usage,
Texture texture 
)
inline

Set the texture with the specified usage in this material.

Bool om::graphics::materials::Material::setTexture ( const TextureUsage usage,
Texture texture 
)

Set the texture with the specified usage in this material.

const TextureUsage& om::graphics::materials::Material::getTextureUsage ( Index  textureIndex) const
inline

Return the usage type of the texture at the specified index in this material.

Bool om::graphics::materials::Material::setTextureUsage ( Index  textureIndex,
const TextureUsage newUsage 
)
inline

Set the usage of the texture at the specified index in this material.

Bool om::graphics::materials::Material::addTexture ( const TextureUsage usage,
Texture texture 
)
inline

Add a texture with the specified usage to this material.

Bool om::graphics::materials::Material::removeTexture ( const Texture texture)
inline

Remove the first texture with the specified address from this material.

The method returns whether or not the texture was successfully removed.

Bool om::graphics::materials::Material::removeTexture ( const TextureUsage usage)
inline

Remove the texture with the specified usage from this material.

The method returns whether or not the texture was successfully removed.

void om::graphics::materials::Material::clearTextures ( )
inline

Clear all textures from this material.

virtual void om::graphics::materials::Material::setContext ( devices::GraphicsContext newContext)
virtual

Set a pointer to the graphics context this material and its techniques should use to do rendering.

The method propagates the context to the material's techniques and shaders and regenerates any context-specific data for the new context.

Reimplemented from om::graphics::devices::GraphicsContextObject.

virtual void om::graphics::materials::Material::upload ( UploadRequest request)
virtual

Upload this material and its techniques' current CPU representation to the GPU device.

Reimplemented from om::graphics::devices::GraphicsContextObject.

virtual void om::graphics::materials::Material::download ( DownloadRequest request)
virtual

Download the material and its technique' GPU representation to CPU memory.

Reimplemented from om::graphics::devices::GraphicsContextObject.

Member Data Documentation

const ResourceType om::graphics::materials::Material::RESOURCE_TYPE
static

The resource type for a graphics material.


The documentation for this class was generated from the following file: