fluidvis
Public Member Functions | List of all members
sx::RenderObject Class Reference
Inheritance diagram for sx::RenderObject:
sx::SXResource

Public Member Functions

EX RenderObject (const string &id)
 
EX ~RenderObject ()
 
EX void load ()
 
EX bool isLoaded () const
 
EX void setVisible (bool visible)
 
EX bool isVisible () const
 
EX void setMesh (Mesh &mesh)
 
EX MeshgetMesh ()
 
EX void setShader (Shader *shader)
 
EX ShadergetShader ()
 
EX void addUniform (Uniform &uniform)
 
EX void removeUniform (const string &name)
 
EX void removeUniforms ()
 
EX void setInstanceBuffers (const vector< BufferedMesh * > &instanceBuffers)
 
EX void removeInstanceBuffers ()
 
EX unordered_map< string, Uniform * > & getUniformSet (const int id)
 
EX void removeUniformSet (const int id)
 
EX void removeUniformSets ()
 
EX void render (Shader *passShader)
 
- Public Member Functions inherited from sx::SXResource
virtual EX ~SXResource ()
 
EX const string & getID () const
 

Additional Inherited Members

- Protected Attributes inherited from sx::SXResource
string id
 

Constructor & Destructor Documentation

EX sx::RenderObject::RenderObject ( const string &  id)

constructor

EX sx::RenderObject::~RenderObject ( )

deconstructor

Member Function Documentation

EX void sx::RenderObject::addUniform ( Uniform uniform)

Adds a uniform variable to the RenderObject. The uniform's name must be unique in the RenderObject, if another variable with the same name exists, it's replaced by uniform.

EX Mesh* sx::RenderObject::getMesh ( )

getter

EX Shader* sx::RenderObject::getShader ( )

getter

EX unordered_map<string, Uniform *>& sx::RenderObject::getUniformSet ( const int  id)

Returns the set of uniform variables associated with an integer key. If such a set hasn't existed yet, its created. For each uniform set the mesh with the RenderObject's shader and uniform variables in uniforms and the uniform set is rendered once.

Parameters
idunique integer associated with the uniform set returned
Returns
uniform set associated with key name
EX bool sx::RenderObject::isLoaded ( ) const
virtual

as this is always loaded, the return value is always true

Implements sx::SXResource.

EX bool sx::RenderObject::isVisible ( ) const

getter

EX void sx::RenderObject::load ( )
virtual

as this is always loaded, this method has no effect on this

Implements sx::SXResource.

EX void sx::RenderObject::removeInstanceBuffers ( )

undoes the changes of setInstanceBuffers

EX void sx::RenderObject::removeUniform ( const string &  name)

Removes the uniform named name. If such a uniform variable doesn't exist, the method does nothing.

EX void sx::RenderObject::removeUniforms ( )

removes all uniforms

EX void sx::RenderObject::removeUniformSet ( const int  id)

Removes the uniform set associated to id. If such a uniform set doesn't exist, the method does nothing.

EX void sx::RenderObject::removeUniformSets ( )

removes all uniform sets

EX void sx::RenderObject::render ( Shader passShader)

Renders the RenderObject. If no shader is attached to the RenderObject, the shader passShader in the parameter is used. If uniformSets is nonempty, the mesh is rendered once for each set in uniformSets. If instanceBuffers is nonempty, and mesh is a BufferedMesh, the mesh is rendered once for the first k vertices in instanceBuffers, if k is the amount of vertices of the BufferedMesh with the minimum amount of vertices in instanceBuffers. If visible is false, render doesn't do anything. Iff both shaders are null, or mesh is null, render doesn't do anything.

Parameters
passShaderShader provided by the pass rendering the RenderObject, may be null. If a shader is attached to the RenderObject, its used instead of passShader.
EX void sx::RenderObject::setInstanceBuffers ( const vector< BufferedMesh * > &  instanceBuffers)

Assigns a set BufferedMeshes to this. this is rendered once for each vertex in instanceBuffers. When this is rendered the k. time the k. vertex of each VertexBuffer can be accessed in the shader as a vertex attribute. If mesh is not a BufferedMesh, this method does not affect the behaviour of method render().

EX void sx::RenderObject::setMesh ( Mesh mesh)

setter

EX void sx::RenderObject::setShader ( Shader shader)

setter

EX void sx::RenderObject::setVisible ( bool  visible)

setter


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