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

Class BL_Shader

source code

PyObjectPlus --+
               |
              BL_Shader

BL_Shader GLSL shaders.

TODO - Description

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

setUniformfv(name, fList)

source code 
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()

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

getFragmentProg()

source code 
Returns the fragment program.
Returns: string
The fragment program.

getVertexProg()

source code 
Get the vertex program.
Returns: string
The vertex program.

isValid()

source code 
Check if the shader is valid.
Returns: bool
True if the shader is valid

setAttrib(enum)

source code 
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)

source code 
Set the maximum number of passes. Not used a.t.m.
Parameters:
  • max_pass (integer) - the maximum number of passes

setSampler(name, index)

source code 
Set uniform texture sample index.
Parameters:
  • name (string) - Uniform name
  • index (integer) - Texture sample index.

setSource(vertexProgram, fragmentProgram)

source code 
Set the vertex and fragment programs
Parameters:
  • vertexProgram (string) - Vertex program
  • fragmentProgram (string) - Fragment program

setUniform1f(name, fx)

source code 
Set a uniform with 1 float value.
Parameters:
  • name (string) - the uniform name
  • fx (float) - Uniform value

setUniform1i(name, ix)

source code 
Set a uniform with an integer value.
Parameters:
  • name (string) - the uniform name
  • ix (integer) - the uniform value

setUniform2f(name, fx, fy)

source code 
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)

source code 
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)

source code 
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)

source code 
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)

source code 
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)

source code 
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)

source code 
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)

source code 
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)

source code 
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)

source code 
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