cocos2d-x  3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
UniformValue Class Reference

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

#include <CCGLProgramState.h>

Classes

union  U
 

Public Member Functions

 ~UniformValue ()
 Destructor. More...
 
void apply ()
 Apply the uniform value to openGL pipeline. More...
 
 UniformValue ()
 UniformValue (Uniform *uniform, GLProgram *glprogram)
 UniformValue ( local uniform, local glprogram)
void setFloat (float value)
void setInt (int value)
void setVec2 (const Vec2 &value)
local setVec2 ( local value)
void setVec3 (const Vec3 &value)
void setVec4 (const Vec4 &value)
void setMat4 (const Mat4 &value)
void setCallback (const std::function< void(GLProgram *, Uniform *)> &callback)
void setTexture (GLuint textureId, GLuint textureUnit)

Protected Attributes

Uniform_uniform
 Weak reference to Uniform. More...
 
GLProgram_glprogram
 Weak reference to GLprogram. More...
 
bool _useCallback
 Whether or not callback is used. More...
 
Uniform Value Uniform
union cocos2d::UniformValue::U _value

Friends

class GLProgram
class GLProgramState

Detailed Description

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

Constructor & Destructor Documentation

Construtor. If contruct the UniformValue with no param, the Uniform and Glprogram will be nullptr.

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

Construtor. If contruct the UniformValue with no param, the Uniform and Glprogram will be nullptr.

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

Construtor. If contruct the UniformValue with no param, the Uniform and Glprogram will be nullptr.

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

Destructor.

var ~UniformValue ( )

Destructor.

local ~UniformValue ( )

Destructor.

Member Function Documentation

void apply ( )

Apply the uniform value to openGL pipeline.

var apply ( )

Apply the uniform value to openGL pipeline.

local apply ( )

Apply the uniform value to openGL pipeline.

void setCallback ( const std::function< void(GLProgram *, Uniform *)> &  callback)
var setCallback ( var  callback)
local setCallback ( local  callback)
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 and texture. Besides of this, there are also custom call back functions for sending data when you want to send struct or array data. If we want to send texture to uniform, there are two value to send, first one is texture handle ID, the second one the texture unit.

Parameters
valueValue to be sent, support float, int, Vec2/3/4, Mat4.
textureIDThe texture handle.
textureUnitThe binding texture unit to be used in shader.
callbackCallback function to send data to OpenGL pipeline.
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 and texture. Besides of this, there are also custom call back functions for sending data when you want to send struct or array data. If we want to send texture to uniform, there are two value to send, first one is texture handle ID, the second one the texture unit.

Parameters
valueValue to be sent, support float, int, Vec2/3/4, Mat4.
textureIDThe texture handle.
textureUnitThe binding texture unit to be used in shader.
callbackCallback function to send data to OpenGL pipeline.
local setFloat ( local  value)

Set data to Uniform value. Generally, there are many type of data could be supported, including float, int, Vec2/3/4, Mat4 and texture. Besides of this, there are also custom call back functions for sending data when you want to send struct or array data. If we want to send texture to uniform, there are two value to send, first one is texture handle ID, the second one the texture unit.

Parameters
valueValue to be sent, support float, int, Vec2/3/4, Mat4.
textureIDThe texture handle.
textureUnitThe binding texture unit to be used in shader.
callbackCallback function to send data to OpenGL pipeline.
void setInt ( int  value)
var setInt ( var  value)
local setInt ( local  value)
void setMat4 ( const Mat4 value)
var setMat4 ( var  value)
local setMat4 ( local  value)
void setTexture ( GLuint  textureId,
GLuint  textureUnit 
)
var setTexture ( var  textureId,
var  textureUnit 
)
local setTexture ( local  textureId,
local  textureUnit 
)
void setVec2 ( const Vec2 value)
var setVec2 ( var  value)
local setVec2 ( local  value)
void setVec3 ( const Vec3 value)
var setVec3 ( var  value)
local setVec3 ( local  value)
void setVec4 ( const Vec4 value)
var setVec4 ( var  value)
local setVec4 ( local  value)

Friends And Related Function Documentation

friend class GLProgram
friend
var GLProgram
friend
local GLProgram
friend
friend class GLProgramState
friend
var GLProgramState
friend
local GLProgramState
friend

Member Data Documentation

GLProgram* _glprogram
protected

Weak reference to GLprogram.

var _glprogram
protected

Weak reference to GLprogram.

local _glprogram
protected

Weak reference to GLprogram.

Uniform* _uniform
protected

Weak reference to Uniform.

bool _useCallback
protected

Whether or not callback is used.

var _useCallback
protected

Whether or not callback is used.

local _useCallback
protected

Whether or not callback is used.

union cocos2d::UniformValue::U
_value
protected
var _value
protected
local _value
protected

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