Moai SDK  1.5 revision 1 (MoaiEdition)
MOAIShader Class Reference
Inheritance diagram for MOAIShader:
MOAINode MOAIGfxResource MOAIInstanceEventSource MOAIGfxState MOAIEventSource

List of all members.

Function List

  clearUniform
  declareUniform
  declareUniformFloat
  declareUniformInt
  declareUniformSampler
  load
  reserveUniforms
  setVertexAttribute

Function Documentation

Clears a uniform mapping.


function clearUniform ( MOAIShader self, number idx )
Parameters:
self ( MOAIShader )
idx ( number )
Returns:
nil

Declares a uniform mapping.


function declareUniform ( MOAIShader self, number idx, string name [, number type ] )
Parameters:
self ( MOAIShader )
idx ( number )
name ( string )
type ( number ) Optional. One of MOAIShader.UNIFORM_COLOR, MOAIShader.UNIFORM_FLOAT, MOAIShader.UNIFORM_INT, MOAIShader.UNIFORM_TRANSFORM, MOAIShader.UNIFORM_PEN_COLOR, MOAIShader.UNIFORM_VIEW_PROJ, MOAIShader.UNIFORM_WORLD, MOAIShader.UNIFORM_WORLD_VIEW, MOAIShader.UNIFORM_WORLD_VIEW_PROJ
Returns:
nil

Declares an float uniform.


function declareUniformFloat ( MOAIShader self, number idx, string name [, number value ] )
Parameters:
self ( MOAIShader )
idx ( number )
name ( string )
value ( number ) Optional. Default value is 0.
Returns:
nil

Declares an integer uniform.


function declareUniformInt ( MOAIShader self, number idx, string name [, number value ] )
Parameters:
self ( MOAIShader )
idx ( number )
name ( string )
value ( number ) Optional. Default value is 0.
Returns:
nil

Declares an uniform to be used as a texture unit index. This uniform is internally an int, but when loaded into the shader the number one subtracted from its value. This allows the user to maintain consistency with Lua's convention of indexing from one.


function declareUniformSampler ( MOAIShader self, number idx, string name [, number textureUnit ] )
Parameters:
self ( MOAIShader )
idx ( number )
name ( string )
textureUnit ( number ) Optional. Default value is 1.
Returns:
nil

Load a shader program.


function load ( MOAIShader self, string vertexShaderSource, string fragmentShaderSource )
Parameters:
self ( MOAIShader )
vertexShaderSource ( string )
fragmentShaderSource ( string )
Returns:
nil

Reserve shader uniforms.


function reserveUniforms ( MOAIShader self [, number nUniforms ] )
Parameters:
self ( MOAIShader )
nUniforms ( number ) Optional. Default value is 0.
Returns:
nil

Names a shader vertex attribute.


function setVertexAttribute ( MOAIShader self, number index, string name )
Parameters:
self ( MOAIShader )
index ( number ) Default value is 1.
name ( string ) Name of attribute.
Returns:
nil