#include <vtkShader.h>
During each render, the vtkShaderProgram calls Compile(), PassShaderVariables(), Bind() and after the actor has been rendered, calls Unbind(), in that order.
Definition at line 58 of file vtkShader.h.
int | GetScope () |
vtkShader () | |
~vtkShader () | |
Public Types | |
typedef vtkObject | Superclass |
Public Member Functions | |
virtual const char * | GetClassName () |
virtual int | IsA (const char *type) |
virtual void | PrintSelf (ostream &os, vtkIndent indent) |
virtual int | Compile ()=0 |
virtual void | PassShaderVariables (vtkActor *actor, vtkRenderer *ren) |
virtual void | Bind () |
virtual void | Unbind () |
virtual void | ReleaseGraphicsResources (vtkWindow *) |
int | HasShaderVariable (const char *name) |
int | GetShaderVariableSize (const char *name) |
int | GetShaderVariableType (const char *name) |
void | SetXMLShader (vtkXMLShader *) |
virtual vtkXMLShader * | GetXMLShader () |
void | AddShaderVariable (const char *name, int num_of_elements, const int *values) |
void | AddShaderVariable (const char *name, int num_of_elements, const float *values) |
void | AddShaderVariable (const char *name, int num_of_elements, const double *values) |
int | GetShaderVariable (const char *name, int *values) |
int | GetShaderVariable (const char *name, float *values) |
int | GetShaderVariable (const char *name, double *values) |
Static Public Member Functions | |
static int | IsTypeOf (const char *type) |
static vtkShader * | SafeDownCast (vtkObject *o) |
Protected Types | |
enum | MatrixOrders { RowMajor, ColumnMajor } |
Protected Member Functions | |
void | SetUniformParameter (vtkActor *, vtkRenderer *, vtkXMLDataElement *) |
void | SetCameraParameter (vtkActor *, vtkRenderer *, vtkXMLDataElement *) |
void | SetPropertyParameter (vtkActor *, vtkRenderer *, vtkXMLDataElement *) |
void | SetLightParameter (vtkActor *, vtkRenderer *, vtkXMLDataElement *) |
void | SetMatrixParameter (vtkActor *, vtkRenderer *, vtkXMLDataElement *) |
void | SetSamplerParameter (vtkActor *, vtkRenderer *, vtkXMLDataElement *) |
void | SetApplicationParameter (vtkXMLDataElement *) |
virtual void | SetShaderParameters (vtkActor *, vtkRenderer *, vtkXMLDataElement *) |
virtual void | SetUniformParameter (const char *name, int numValues, const int *value)=0 |
virtual void | SetUniformParameter (const char *name, int numValues, const float *value)=0 |
virtual void | SetUniformParameter (const char *name, int numValues, const double *value)=0 |
virtual void | SetMatrixParameter (const char *name, int numValues, int order, const float *value)=0 |
virtual void | SetMatrixParameter (const char *name, int numValues, int order, const double *value)=0 |
virtual void | SetMatrixParameter (const char *name, const char *state_matix_type, const char *transform_type)=0 |
virtual void | SetSamplerParameter (const char *name, vtkTexture *texture, int textureIndex)=0 |
Protected Attributes | |
vtkXMLShader * | XMLShader |
vtkShaderInternals * | Internals |
vtkTimeStamp | PassShaderVariablesTime |
typedef vtkObject vtkShader::Superclass |
Reimplemented from vtkObject.
Reimplemented in vtkCgShader, and vtkGLSLShader.
Definition at line 61 of file vtkShader.h.
enum vtkShader::MatrixOrders [protected] |
vtkShader::vtkShader | ( | ) | [protected] |
Returns the scope of the shader i.e. if it's a vertex or fragment shader. (vtkXMLShader::SCOPE_VERTEX or vtkXMLShader::SCOPE_FRAGMENT).
vtkShader::~vtkShader | ( | ) | [protected] |
Returns the scope of the shader i.e. if it's a vertex or fragment shader. (vtkXMLShader::SCOPE_VERTEX or vtkXMLShader::SCOPE_FRAGMENT).
virtual const char* vtkShader::GetClassName | ( | ) | [virtual] |
static int vtkShader::IsTypeOf | ( | const char * | name | ) | [static] |
Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.
Reimplemented from vtkObject.
Reimplemented in vtkCgShader, and vtkGLSLShader.
virtual int vtkShader::IsA | ( | const char * | name | ) | [virtual] |
Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.
Reimplemented from vtkObject.
Reimplemented in vtkCgShader, and vtkGLSLShader.
virtual void vtkShader::PrintSelf | ( | ostream & | os, | |
vtkIndent | indent | |||
) | [virtual] |
Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.
Reimplemented from vtkObject.
Reimplemented in vtkCgShader, and vtkGLSLShader.
virtual int vtkShader::Compile | ( | ) | [pure virtual] |
Called to compile the shader code. The subclasses must only compile the code in this method. Returns if the compile was successful. Subclasses should compile the code only if it was not already compiled.
Implemented in vtkCgShader, and vtkGLSLShader.
virtual void vtkShader::PassShaderVariables | ( | vtkActor * | actor, | |
vtkRenderer * | ren | |||
) | [virtual] |
Called to pass VTK actor/property/light values and other Shader variables over to the shader. This is called by the ShaderProgram during each render.
Reimplemented in vtkCgShader.
virtual void vtkShader::Bind | ( | ) | [inline, virtual] |
In this method the shader can enable/bind itself. This is applicable only to Cg, since in GLSL, individual shaders in a program can't be enabled/bound.
Reimplemented in vtkCgShader.
Definition at line 78 of file vtkShader.h.
virtual void vtkShader::Unbind | ( | ) | [inline, virtual] |
Called to unbind the shader. As with Bind(), this is only applicable to Cg.
Reimplemented in vtkCgShader.
Definition at line 82 of file vtkShader.h.
virtual void vtkShader::ReleaseGraphicsResources | ( | vtkWindow * | ) | [inline, virtual] |
Release any graphics resources that are being consumed by this actor. The parameter window could be used to determine which graphic resources to release.
Reimplemented in vtkCgShader, and vtkGLSLShader.
Definition at line 87 of file vtkShader.h.
void vtkShader::SetXMLShader | ( | vtkXMLShader * | ) |
Get/Set the XMLShader representation for this shader. A shader is not valid without a XMLShader.
virtual vtkXMLShader* vtkShader::GetXMLShader | ( | ) | [virtual] |
Get/Set the XMLShader representation for this shader. A shader is not valid without a XMLShader.
int vtkShader::HasShaderVariable | ( | const char * | name | ) |
Indicates if a variable by the given name exists.
void vtkShader::AddShaderVariable | ( | const char * | name, | |
int | num_of_elements, | |||
const int * | values | |||
) |
Methods to add shader variables to this shader. The shader variable type must match with that declared in the Material xml, otherwise, the variable is not made available to the shader.
void vtkShader::AddShaderVariable | ( | const char * | name, | |
int | num_of_elements, | |||
const float * | values | |||
) |
Methods to add shader variables to this shader. The shader variable type must match with that declared in the Material xml, otherwise, the variable is not made available to the shader.
void vtkShader::AddShaderVariable | ( | const char * | name, | |
int | num_of_elements, | |||
const double * | values | |||
) |
Methods to add shader variables to this shader. The shader variable type must match with that declared in the Material xml, otherwise, the variable is not made available to the shader.
int vtkShader::GetShaderVariableSize | ( | const char * | name | ) |
Get number of elements in a Shader variable. Return 0 if failed to find the shader variable.
int vtkShader::GetShaderVariableType | ( | const char * | name | ) |
Returns the type of a Shader variable with the given name. Return 0 on error.
int vtkShader::GetShaderVariable | ( | const char * | name, | |
int * | values | |||
) |
Methods to get the value of shader variables with the given name. Values must be at least the size of the shader variable (obtained by GetShaderVariableSize(). Returns if the operation was successful.
int vtkShader::GetShaderVariable | ( | const char * | name, | |
float * | values | |||
) |
Methods to get the value of shader variables with the given name. Values must be at least the size of the shader variable (obtained by GetShaderVariableSize(). Returns if the operation was successful.
int vtkShader::GetShaderVariable | ( | const char * | name, | |
double * | values | |||
) |
Methods to get the value of shader variables with the given name. Values must be at least the size of the shader variable (obtained by GetShaderVariableSize(). Returns if the operation was successful.
int vtkShader::GetScope | ( | ) |
Returns the scope of the shader i.e. if it's a vertex or fragment shader. (vtkXMLShader::SCOPE_VERTEX or vtkXMLShader::SCOPE_FRAGMENT).
virtual void vtkShader::SetShaderParameters | ( | vtkActor * | , | |
vtkRenderer * | , | |||
vtkXMLDataElement * | ||||
) | [protected, virtual] |
Runs throught the XML element children to locate uniform variable elements and process them.
void vtkShader::SetUniformParameter | ( | vtkActor * | , | |
vtkRenderer * | , | |||
vtkXMLDataElement * | ||||
) | [protected] |
Processes <Uniform> elements.
void vtkShader::SetCameraParameter | ( | vtkActor * | , | |
vtkRenderer * | , | |||
vtkXMLDataElement * | ||||
) | [protected] |
Processes <CameraUniform>
void vtkShader::SetPropertyParameter | ( | vtkActor * | , | |
vtkRenderer * | , | |||
vtkXMLDataElement * | ||||
) | [protected] |
Processes <PropertyUniform>
void vtkShader::SetLightParameter | ( | vtkActor * | , | |
vtkRenderer * | , | |||
vtkXMLDataElement * | ||||
) | [protected] |
Processes <LightUniform>
void vtkShader::SetMatrixParameter | ( | vtkActor * | , | |
vtkRenderer * | , | |||
vtkXMLDataElement * | ||||
) | [protected] |
Process <MatrixUniform>
void vtkShader::SetSamplerParameter | ( | vtkActor * | , | |
vtkRenderer * | , | |||
vtkXMLDataElement * | ||||
) | [protected] |
Process <SamplerUniform>
void vtkShader::SetApplicationParameter | ( | vtkXMLDataElement * | ) | [protected] |
Process <ApplicationUniform>
virtual void vtkShader::SetUniformParameter | ( | const char * | name, | |
int | numValues, | |||
const int * | value | |||
) | [protected, pure virtual] |
Equivalent to cgGLSetParameter and glUniform. Subclasses must override these and perform GLSL or Cg calls.
Implemented in vtkCgShader, and vtkGLSLShader.
virtual void vtkShader::SetUniformParameter | ( | const char * | name, | |
int | numValues, | |||
const float * | value | |||
) | [protected, pure virtual] |
Equivalent to cgGLSetParameter and glUniform. Subclasses must override these and perform GLSL or Cg calls.
Implemented in vtkCgShader, and vtkGLSLShader.
virtual void vtkShader::SetUniformParameter | ( | const char * | name, | |
int | numValues, | |||
const double * | value | |||
) | [protected, pure virtual] |
Equivalent to cgGLSetParameter and glUniform. Subclasses must override these and perform GLSL or Cg calls.
Implemented in vtkCgShader, and vtkGLSLShader.
virtual void vtkShader::SetMatrixParameter | ( | const char * | name, | |
int | numValues, | |||
int | order, | |||
const float * | value | |||
) | [protected, pure virtual] |
Equivalent to cgGLSetMatrixParameterfc and glUniformMatrix. Subclasses must override these and perform GLSL or Cg calls.
Implemented in vtkCgShader, and vtkGLSLShader.
virtual void vtkShader::SetMatrixParameter | ( | const char * | name, | |
int | numValues, | |||
int | order, | |||
const double * | value | |||
) | [protected, pure virtual] |
Equivalent to cgGLSetMatrixParameterfc and glUniformMatrix. Subclasses must override these and perform GLSL or Cg calls.
Implemented in vtkCgShader, and vtkGLSLShader.
virtual void vtkShader::SetMatrixParameter | ( | const char * | name, | |
const char * | state_matix_type, | |||
const char * | transform_type | |||
) | [protected, pure virtual] |
Equivalent to cgGLSetMatrixParameterfc and glUniformMatrix. Subclasses must override these and perform GLSL or Cg calls.
Implemented in vtkCgShader, and vtkGLSLShader.
virtual void vtkShader::SetSamplerParameter | ( | const char * | name, | |
vtkTexture * | texture, | |||
int | textureIndex | |||
) | [protected, pure virtual] |
Establishes the given texture as the uniform sampler to perform lookups on. The textureIndex argument corresponds to the indices of the textures in a vtkProperty. Subclass may have to cast the texture to vtkOpenGLTexture to obtain the GLuint for texture this texture. Subclasses must override these and perform GLSL or Cg calls.
Implemented in vtkCgShader, and vtkGLSLShader.
vtkXMLShader* vtkShader::XMLShader [protected] |
Definition at line 137 of file vtkShader.h.
vtkShaderInternals* vtkShader::Internals [protected] |
Definition at line 138 of file vtkShader.h.
vtkTimeStamp vtkShader::PassShaderVariablesTime [protected] |
Definition at line 210 of file vtkShader.h.