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

A class that encapsulates a set of textures associated with TextureUsage types. More...

#include <omGraphicsTextureSet.h>

Inheritance diagram for om::graphics::textures::TextureSet:
om::graphics::devices::GraphicsContextObject

Public Member Functions

 TextureSet ()
 Create a new empty texture set. More...
 
Size getTextureCount () const
 Return the number of textures in this texture set. More...
 
TexturegetTexture (Index textureIndex) const
 Return the texture at the specified index in this texture set. More...
 
Bool setTexture (Index textureIndex, Texture *texture)
 Set the texture at the specified index in this texture set. More...
 
TexturegetTexture (TextureUsage::Enum usage) const
 Return a pointer to the texture with the specified usage in this texture set. More...
 
TexturegetTexture (const TextureUsage &usage) const
 Return a pointer to the texture with the specified usage in this texture set. More...
 
Bool setTexture (TextureUsage::Enum usage, Texture *texture)
 Set the texture with the specified usage in this texture set. More...
 
Bool setTexture (const TextureUsage &usage, Texture *texture)
 Set the texture with the specified usage in this texture set. More...
 
const TextureUsagegetTextureUsage (Index textureIndex) const
 Return the usage type of the texture at the specified index in this texture set. More...
 
Bool setTextureUsage (Index textureIndex, const TextureUsage &newUsage)
 Set the usage of the texture at the specified index in this texture set. More...
 
Bool addTexture (const TextureUsage &usage, Texture *texture)
 Add a texture with the specified usage to this texture set. More...
 
Bool removeTexture (const Texture *texture)
 Remove the first texture with the specified address from this texture set. More...
 
Bool removeTexture (const TextureUsage &usage)
 Remove the texture with the specified usage from this texture set. More...
 
void clearTextures ()
 Clear all textures from this texture set. More...
 
void setContext (devices::GraphicsContext *context)
 Prepare this texture set and its textures for rendering with the specified context. More...
 
virtual void upload (UploadRequest &request)
 Upload this texture set's CPU representation to the GPU device. More...
 
virtual void download (DownloadRequest &request)
 Download the texture set's 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 texture set. 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 encapsulates a set of textures associated with TextureUsage types.

This class allows the user to provide external texture data to a ShaderPass without having to modify the texture bindings of the shader pass. This is useful when a shader pass is shared among many objects that may each have different textures.

At render time, an object's texture set is used to provide texture data to the shader pass with which it is being rendered by connecting the TextureUsage of each texture with shader inputs of the same usage types.

Constructor & Destructor Documentation

om::graphics::textures::TextureSet::TextureSet ( )

Create a new empty texture set.

Member Function Documentation

Size om::graphics::textures::TextureSet::getTextureCount ( ) const
inline

Return the number of textures in this texture set.

Texture* om::graphics::textures::TextureSet::getTexture ( Index  textureIndex) const
inline

Return the texture at the specified index in this texture set.

Bool om::graphics::textures::TextureSet::setTexture ( Index  textureIndex,
Texture texture 
)
inline

Set the texture at the specified index in this texture set.

Texture* om::graphics::textures::TextureSet::getTexture ( TextureUsage::Enum  usage) const
inline

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

Texture* om::graphics::textures::TextureSet::getTexture ( const TextureUsage usage) const

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

Bool om::graphics::textures::TextureSet::setTexture ( TextureUsage::Enum  usage,
Texture texture 
)
inline

Set the texture with the specified usage in this texture set.

Bool om::graphics::textures::TextureSet::setTexture ( const TextureUsage usage,
Texture texture 
)

Set the texture with the specified usage in this texture set.

const TextureUsage& om::graphics::textures::TextureSet::getTextureUsage ( Index  textureIndex) const
inline

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

Bool om::graphics::textures::TextureSet::setTextureUsage ( Index  textureIndex,
const TextureUsage newUsage 
)
inline

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

Bool om::graphics::textures::TextureSet::addTexture ( const TextureUsage usage,
Texture texture 
)

Add a texture with the specified usage to this texture set.

Bool om::graphics::textures::TextureSet::removeTexture ( const Texture texture)

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

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

Bool om::graphics::textures::TextureSet::removeTexture ( const TextureUsage usage)

Remove the texture with the specified usage from this texture set.

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

void om::graphics::textures::TextureSet::clearTextures ( )

Clear all textures from this texture set.

void om::graphics::textures::TextureSet::setContext ( devices::GraphicsContext context)
virtual

Prepare this texture set and its textures for rendering with the specified context.

The method propagates the context to the set's textures and regenerates any context-specific data for the new context if the upload flag is TRUE. The method returns whether or not the context can be successfully used for rendering this texture set.

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

virtual void om::graphics::textures::TextureSet::upload ( UploadRequest request)
virtual

Upload this texture set's CPU representation to the GPU device.

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

virtual void om::graphics::textures::TextureSet::download ( DownloadRequest request)
virtual

Download the texture set's GPU representation to CPU memory.

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

Member Data Documentation

const ResourceType om::graphics::textures::TextureSet::RESOURCE_TYPE
static

The resource type for a graphics texture set.


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