Module GameTypes :: Class BL_Shader
[frames] | no frames]

Class BL_Shader

PyObjectPlus --+
               |
              BL_Shader

BL_Shader GLSL shaders.

TODO - Description

Instance Methods
 
setUniformfv(name, fList)
Set a uniform with a list of float values
 
delSource()
Clear the shader.
string
getFragmentProg()
Returns the fragment program.
string
getVertexProg()
Get the vertex program.
bool
isValid()
Check if the shader is valid.
 
setAttrib(enum)
Set attribute location.
 
setNumberOfPasses(max_pass)
Set the maximum number of passes.
 
setSampler(name, index)
Set uniform texture sample index.
 
setSource(vertexProgram, fragmentProgram)
Set the vertex and fragment programs
 
setUniform1f(name, fx)
Set a uniform with 1 float value.
 
setUniform1i(name, ix)
Set a uniform with an integer value.
 
setUniform2f(name, fx, fy)
Set a uniform with 2 float values
 
setUniform2i(name, ix, iy)
Set a uniform with 2 integer values
 
setUniform3f(name, fx, fy, fz)
Set a uniform with 3 float values.
 
setUniform3i(name, ix, iy, iz)
Set a uniform with 3 integer values
 
setUniform4f(name, fx, fy, fz, fw)
Set a uniform with 4 float values.
 
setUniform4i(name, ix, iy, iz, iw)
Set a uniform with 4 integer values
 
setUniformDef(name, type)
Define a new uniform
 
setUniformMatrix3(name, mat, transpose)
Set a uniform with a 3x3 matrix value
 
setUniformMatrix4(name, mat, transpose)
Set a uniform with a 4x4 matrix value
 
setUniformiv(name, iList)
Set a uniform with a list of integer values
 
validate()
Validate the shader object.
bool
isA(game_type)
Check if this is a type or a subtype game_type. (Inherited from GameTypes.PyObjectPlus)
Instance Variables
bool invalid
Test if the object has been freed by the game engine and is no longer valid. (Inherited from GameTypes.PyObjectPlus)
Method Details

setUniformfv(name, fList)

 

Set a uniform with a list of float values

Parameters:
  • name (string) - the uniform name
  • fList (list[float]) - a list (2, 3 or 4 elements) of float values

delSource()

 

Clear the shader. Use this method before the source is changed with setSource.

getFragmentProg()

 

Returns the fragment program.

Returns: string
The fragment program.

getVertexProg()

 

Get the vertex program.

Returns: string
The vertex program.

isValid()

 

Check if the shader is valid.

Returns: bool
True if the shader is valid

setAttrib(enum)

 

Set attribute location. (The parameter is ignored a.t.m. and the value of "tangent" is always used.)

Parameters:
  • enum (integer) - attribute location value

setNumberOfPasses(max_pass)

 

Set the maximum number of passes. Not used a.t.m.

Parameters:
  • max_pass (integer) - the maximum number of passes

setSampler(name, index)

 

Set uniform texture sample index.

Parameters:
  • name (string) - Uniform name
  • index (integer) - Texture sample index.

setSource(vertexProgram, fragmentProgram)

 

Set the vertex and fragment programs

Parameters:
  • vertexProgram (string) - Vertex program
  • fragmentProgram (string) - Fragment program

setUniform1f(name, fx)

 

Set a uniform with 1 float value.

Parameters:
  • name (string) - the uniform name
  • fx (float) - Uniform value

setUniform1i(name, ix)

 

Set a uniform with an integer value.

Parameters:
  • name (string) - the uniform name
  • ix (integer) - the uniform value

setUniform2f(name, fx, fy)

 

Set a uniform with 2 float values

Parameters:
  • name (string) - the uniform name
  • fx (float) - first float value
  • fy (float) - second float value

setUniform2i(name, ix, iy)

 

Set a uniform with 2 integer values

Parameters:
  • name (string) - the uniform name
  • ix (integer) - first integer value
  • iy (integer) - second integer value

setUniform3f(name, fx, fy, fz)

 

Set a uniform with 3 float values.

Parameters:
  • name (string) - the uniform name
  • fx (float) - first float value
  • fy (float) - second float value
  • fz (float) - third float value

setUniform3i(name, ix, iy, iz)

 

Set a uniform with 3 integer values

Parameters:
  • name (string) - the uniform name
  • ix (integer) - first integer value
  • iy (integer) - second integer value
  • iz (integer) - third integer value

setUniform4f(name, fx, fy, fz, fw)

 

Set a uniform with 4 float values.

Parameters:
  • name (string) - the uniform name
  • fx (float) - first float value
  • fy (float) - second float value
  • fz (float) - third float value
  • fw (float) - fourth float value

setUniform4i(name, ix, iy, iz, iw)

 

Set a uniform with 4 integer values

Parameters:
  • name (string) - the uniform name
  • ix (integer) - first integer value
  • iy (integer) - second integer value
  • iz (integer) - third integer value
  • iw (integer) - fourth integer value

setUniformDef(name, type)

 

Define a new uniform

Parameters:
  • name (string) - the uniform name
  • type (UNI_NONE, UNI_INT, UNI_FLOAT, UNI_INT2, UNI_FLOAT2, UNI_INT3, UNI_FLOAT3, UNI_INT4, UNI_FLOAT4, UNI_MAT3, UNI_MAT4, UNI_MAX) - uniform type

setUniformMatrix3(name, mat, transpose)

 

Set a uniform with a 3x3 matrix value

Parameters:
  • name (string) - the uniform name
  • mat (3x3 matrix) - A 3x3 matrix [[f,f,f], [f,f,f], [f,f,f]]
  • transpose (bool) - set to True to transpose the matrix

setUniformMatrix4(name, mat, transpose)

 

Set a uniform with a 4x4 matrix value

Parameters:
  • name (string) - the uniform name
  • mat (4x4 matrix) - A 4x4 matrix [[f,f,f,f], [f,f,f,f], [f,f,f,f], [f,f,f,f]]
  • transpose (bool) - set to True to transpose the matrix

setUniformiv(name, iList)

 

Set a uniform with a list of integer values

Parameters:
  • name (string) - the uniform name
  • iList (list[integer]) - a list (2, 3 or 4 elements) of integer values