CrystalSpace

Public API Reference

csShaderVariable Class Reference
[3D]

Storage class for "shader vars", inheritable variables in the shader system. More...

#include <csgfx/shadervar.h>

Inheritance diagram for csShaderVariable:

List of all members.

Public Types

enum  VariableType {
  UNKNOWN = 0, INT = 1, FLOAT, TEXTURE,
  RENDERBUFFER, VECTOR2, VECTOR3, VECTOR4,
  MATRIX3X3 , TRANSFORM, ARRAY, MATRIX4X4,
  COLOR = VECTOR4
}
 

Data types that can be stored.

More...

Public Member Functions

 csShaderVariable (CS::ShaderVarStringID name)
 Construct with name.
 csShaderVariable ()
 Construct without a name.
size_t FindArrayElement (const csRef< csShaderVariable > &sv)
 Find a specific element in an array variable.
iShaderVariableAccessorGetAccessor () const
 Get the accessor.
intptr_t GetAccessorData () const
 Get the extra accessor data.
csShaderVariableGetArrayElement (size_t element)
 Get a specific element in an array variable Do not hold on to this for long, since it might change if the array size changes.
size_t GetArraySize ()
 Get the number of elements in an array variable.
CS::ShaderVarStringID GetName () const
 Get the name of the variable.
VariableType GetType ()
 Get type of data stored.
bool GetValue (CS::Math::Matrix4 &value)
 Retrieve a CS::Math::Matrix4.
bool GetValue (csReversibleTransform &value)
 Retrieve a csReversibleTransform.
bool GetValue (csMatrix3 &value)
 Retrieve a csMatrix3.
bool GetValue (csQuaternion &value)
 Retrieve a csQuaternion.
bool GetValue (csVector4 &value)
 Retrieve a csVector4.
bool GetValue (csColor &value)
 Retrieve a csColor.
bool GetValue (csVector3 &value)
 Retrieve a csVector3.
bool GetValue (csVector2 &value)
 Retrieve a csVector2.
bool GetValue (iRenderBuffer *&value)
 Retrieve a iRenderBuffer.
bool GetValue (iTextureWrapper *&value)
 Retrieve a texture wrapper.
bool GetValue (iTextureHandle *&value)
 Retrieve a texture handle.
bool GetValue (csRGBpixel &value)
 Retrieve a color.
bool GetValue (float &value)
 Retrieve a float.
bool GetValue (int &value)
 Retrieve an int.
void SetAccessor (iShaderVariableAccessor *a, intptr_t extraData=0)
 Set an accessor to use when getting the value.
void SetArrayElement (size_t element, csShaderVariable *variable)
 Set a specific element in an array variable.
void SetArraySize (size_t size)
 Set the number of elements in an array variable.
void SetName (CS::ShaderVarStringID newName)
 Set the name of the variable.
void SetType (VariableType t)
 Set type (calling this after SetValue will cause undefined behaviour).
bool SetValue (const CS::Math::Matrix4 &value)
 Store a CS::Math::Matrix4.
bool SetValue (const csReversibleTransform &value)
 Store a csReversibleTransform.
bool SetValue (const csMatrix3 &value)
 Store a csMatrix3.
bool SetValue (const csVector4 &value)
 Store a csVector4.
bool SetValue (const csColor4 &value)
 Store a csColor4.
bool SetValue (const csColor &value)
 Store a csColor.
bool SetValue (const csVector3 &value)
 Store a csVector3.
bool SetValue (const csVector2 &value)
 Store a csVector2.
bool SetValue (iRenderBuffer *value)
 Store a render buffer.
bool SetValue (iTextureWrapper *value)
 Store a texture wrapper.
bool SetValue (iTextureHandle *value)
 Store a texture handle.
bool SetValue (const csRGBpixel &value)
 Store a color.
bool SetValue (float value)
 Store a float.
bool SetValue (int value)
 Store an int.

Detailed Description

Storage class for "shader vars", inheritable variables in the shader system.

Shader vars are a primary system to transport information from the engine/meshes/etc. to the renderer.

Definition at line 95 of file shadervar.h.


Member Enumeration Documentation

Data types that can be stored.

Data storage and retrieval is not strict - data stored as INT, FLOAT or any VECTORx data can also be retrieved as any other of those.

Enumerator:
UNKNOWN 

No value was yet set, hence the type is unknown.

INT 

Integer.

FLOAT 

Float.

TEXTURE 

Texture.

RENDERBUFFER 

Renderbuffer.

VECTOR2 

Vector with 2 components.

VECTOR3 

Vector with 3 components.

VECTOR4 

Vector with 4 components.

MATRIX3X3 

3x3 Matrix

TRANSFORM 

Transform.

ARRAY 

Array.

MATRIX4X4 

4x4 Matrix

COLOR 

Color.

Deprecated:
Same as VECTOR4.

Definition at line 103 of file shadervar.h.


Constructor & Destructor Documentation

csShaderVariable::csShaderVariable (  ) 

Construct without a name.

SetName() must be called before the variable can be used.

csShaderVariable::csShaderVariable ( CS::ShaderVarStringID  name  ) 

Construct with name.


Member Function Documentation

size_t csShaderVariable::FindArrayElement ( const csRef< csShaderVariable > &  sv  )  [inline]

Find a specific element in an array variable.

Returns:
The index of the found element, or csArrayItemNotFound if not found.

Definition at line 697 of file shadervar.h.

iShaderVariableAccessor* csShaderVariable::GetAccessor (  )  const [inline]

Get the accessor.

Definition at line 198 of file shadervar.h.

intptr_t csShaderVariable::GetAccessorData (  )  const [inline]

Get the extra accessor data.

Definition at line 204 of file shadervar.h.

csShaderVariable* csShaderVariable::GetArrayElement ( size_t  element  )  [inline]

Get a specific element in an array variable Do not hold on to this for long, since it might change if the array size changes.

Definition at line 675 of file shadervar.h.

size_t csShaderVariable::GetArraySize (  )  [inline]

Get the number of elements in an array variable.

Definition at line 665 of file shadervar.h.

CS::ShaderVarStringID csShaderVariable::GetName (  )  const [inline]

Get the name of the variable.

Definition at line 190 of file shadervar.h.

VariableType csShaderVariable::GetType (  )  [inline]

Get type of data stored.

Definition at line 154 of file shadervar.h.

bool csShaderVariable::GetValue ( CS::Math::Matrix4 value  )  [inline]

Retrieve a CS::Math::Matrix4.

Definition at line 413 of file shadervar.h.

bool csShaderVariable::GetValue ( csReversibleTransform value  )  [inline]

Retrieve a csReversibleTransform.

Definition at line 397 of file shadervar.h.

bool csShaderVariable::GetValue ( csMatrix3 value  )  [inline]

Retrieve a csMatrix3.

Definition at line 381 of file shadervar.h.

bool csShaderVariable::GetValue ( csQuaternion value  )  [inline]

Retrieve a csQuaternion.

Definition at line 368 of file shadervar.h.

bool csShaderVariable::GetValue ( csVector4 value  )  [inline]

Retrieve a csVector4.

Definition at line 350 of file shadervar.h.

bool csShaderVariable::GetValue ( csColor value  )  [inline]

Retrieve a csColor.

Definition at line 337 of file shadervar.h.

bool csShaderVariable::GetValue ( csVector3 value  )  [inline]

Retrieve a csVector3.

Definition at line 324 of file shadervar.h.

bool csShaderVariable::GetValue ( csVector2 value  )  [inline]

Retrieve a csVector2.

Definition at line 311 of file shadervar.h.

bool csShaderVariable::GetValue ( iRenderBuffer *&  value  )  [inline]

Retrieve a iRenderBuffer.

Definition at line 301 of file shadervar.h.

bool csShaderVariable::GetValue ( iTextureWrapper *&  value  )  [inline]

Retrieve a texture wrapper.

Definition at line 285 of file shadervar.h.

bool csShaderVariable::GetValue ( iTextureHandle *&  value  )  [inline]

Retrieve a texture handle.

Definition at line 263 of file shadervar.h.

bool csShaderVariable::GetValue ( csRGBpixel value  )  [inline]

Retrieve a color.

Definition at line 236 of file shadervar.h.

bool csShaderVariable::GetValue ( float &  value  )  [inline]

Retrieve a float.

Definition at line 223 of file shadervar.h.

bool csShaderVariable::GetValue ( int &  value  )  [inline]

Retrieve an int.

Definition at line 210 of file shadervar.h.

void csShaderVariable::SetAccessor ( iShaderVariableAccessor a,
intptr_t  extraData = 0 
) [inline]

Set an accessor to use when getting the value.

Definition at line 169 of file shadervar.h.

void csShaderVariable::SetArrayElement ( size_t  element,
csShaderVariable variable 
) [inline]

Set a specific element in an array variable.

Definition at line 687 of file shadervar.h.

void csShaderVariable::SetArraySize ( size_t  size  )  [inline]

Set the number of elements in an array variable.

Definition at line 656 of file shadervar.h.

void csShaderVariable::SetName ( CS::ShaderVarStringID  newName  )  [inline]

Set the name of the variable.

Warning:
Changing the name of a variable while it's in use can cause unexpected behaviour.

Definition at line 181 of file shadervar.h.

void csShaderVariable::SetType ( VariableType  t  )  [inline]

Set type (calling this after SetValue will cause undefined behaviour).

Definition at line 163 of file shadervar.h.

bool csShaderVariable::SetValue ( const CS::Math::Matrix4 value  )  [inline]

Store a CS::Math::Matrix4.

Definition at line 633 of file shadervar.h.

bool csShaderVariable::SetValue ( const csReversibleTransform value  )  [inline]

Store a csReversibleTransform.

Definition at line 622 of file shadervar.h.

bool csShaderVariable::SetValue ( const csMatrix3 value  )  [inline]

Store a csMatrix3.

Definition at line 611 of file shadervar.h.

bool csShaderVariable::SetValue ( const csVector4 value  )  [inline]

Store a csVector4.

Definition at line 586 of file shadervar.h.

bool csShaderVariable::SetValue ( const csColor4 value  )  [inline]

Store a csColor4.

Definition at line 573 of file shadervar.h.

bool csShaderVariable::SetValue ( const csColor value  )  [inline]

Store a csColor.

Definition at line 560 of file shadervar.h.

bool csShaderVariable::SetValue ( const csVector3 value  )  [inline]

Store a csVector3.

Definition at line 547 of file shadervar.h.

bool csShaderVariable::SetValue ( const csVector2 value  )  [inline]

Store a csVector2.

Definition at line 534 of file shadervar.h.

bool csShaderVariable::SetValue ( iRenderBuffer value  )  [inline]

Store a render buffer.

Definition at line 517 of file shadervar.h.

bool csShaderVariable::SetValue ( iTextureWrapper value  )  [inline]

Store a texture wrapper.

Definition at line 496 of file shadervar.h.

bool csShaderVariable::SetValue ( iTextureHandle value  )  [inline]

Store a texture handle.

Definition at line 476 of file shadervar.h.

bool csShaderVariable::SetValue ( const csRGBpixel value  )  [inline]

Store a color.

Definition at line 463 of file shadervar.h.

bool csShaderVariable::SetValue ( float  value  )  [inline]

Store a float.

Definition at line 450 of file shadervar.h.

bool csShaderVariable::SetValue ( int  value  )  [inline]

Store an int.

Definition at line 440 of file shadervar.h.


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

Generated for Crystal Space 2.0 by doxygen 1.6.1