Cocos2d-x  v3.17
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups Pages
UniformValue Class Reference

Uniform Value, which is used to store to value send to openGL pipe line by glUniformXXX. More...

Public Member Functions

 UniformValue ()
 Constructor. More...
 
 UniformValue (Uniform *uniform, GLProgram *glprogram)
 Constructor with uniform and glprogram. More...
 
 UniformValue ( var uniform, var glprogram)
 Constructor with uniform and glprogram. More...
 
 ~UniformValue ()
 Destructor. More...
 
void setCallback (const std::function< void(GLProgram *, Uniform *)> &callback)
 Set call back to uniform value, which could be used for array and struct. More...
 
var setCallback ( var callback)
 Set call back to uniform value, which could be used for array and struct. More...
 
void setTexture (GLuint textureId, GLuint textureUnit)
 Set texture to uniform value. More...
 
var setTexture ( var textureId, var textureUnit)
 Set texture to uniform value. More...
 
void setTexture (Texture2D *texture, GLuint textureUnit)
 Set texture to uniform value. More...
 
void apply ()
 Apply the uniform value to openGL pipeline. More...
 
void setFloat (float value)

Detailed Description

Uniform Value, which is used to store to value send to openGL pipe line by glUniformXXX.

Constructor & Destructor Documentation

Constructor.

The Uniform and Glprogram will be nullptr.

var UniformValue ( )

Constructor.

The Uniform and Glprogram will be nullptr.

UniformValue ( Uniform uniform,
GLProgram glprogram 
)

Constructor with uniform and glprogram.

Parameters
uniformUniform to apply the value.
glprogramSpecify the owner GLProgram of this uniform and uniform value.
var UniformValue ( var  uniform,
var  glprogram 
)

Constructor with uniform and glprogram.

Parameters
uniformUniform to apply the value.
glprogramSpecify the owner GLProgram of this uniform and uniform value.

Destructor.

var ~UniformValue ( )

Destructor.

Member Function Documentation

void setFloat ( float  value)

Set data to Uniform value. Generally, there are many type of data could be supported, including float, int, Vec2/3/4, Mat4.

Parameters
valueValue to be sent, support float, int, Vec2/3/4, Mat4.
var setFloat ( var  value)

Set data to Uniform value. Generally, there are many type of data could be supported, including float, int, Vec2/3/4, Mat4.

Parameters
valueValue to be sent, support float, int, Vec2/3/4, Mat4.
void setCallback ( const std::function< void(GLProgram *, Uniform *)> &  callback)

Set call back to uniform value, which could be used for array and struct.

Parameters
callbackCallback function to send data to OpenGL pipeline.
var setCallback ( var  callback)

Set call back to uniform value, which could be used for array and struct.

Parameters
callbackCallback function to send data to OpenGL pipeline.
void setTexture ( GLuint  textureId,
GLuint  textureUnit 
)

Set texture to uniform value.

Parameters
textureIdThe texture handle.
textureUnitThe binding texture unit to be used in shader.
var setTexture ( var  textureId,
var  textureUnit 
)

Set texture to uniform value.

Parameters
textureIdThe texture handle.
textureUnitThe binding texture unit to be used in shader.
void setTexture ( Texture2D texture,
GLuint  textureUnit 
)

Set texture to uniform value.

Parameters
textureThe texture.
textureUnitThe binding texture unit to be used in shader.
var setTexture ( var  texture,
var  textureUnit 
)

Set texture to uniform value.

Parameters
textureThe texture.
textureUnitThe binding texture unit to be used in shader.
void apply ( )

Apply the uniform value to openGL pipeline.

var apply ( )

Apply the uniform value to openGL pipeline.


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