-=[Material reference]=-


--=[ Index | Materials | GLSL ]=--
-=[ Material | Shaders | Example | Changes | How-to | Scripts ]=-

Quick Jump


getShader()
getMaterialIndex()
setBlending(src, dest)
getTexture()
setTexture()



Accessing a material.

mesh_index = 0
mesh = obj.getMesh(mesh_index)
material_num_on_mesh =0

while mesh != None:
        for mat in mesh.materials:
                if not hasattr(mat, "getMaterialIndex"):
                        return
                
                # material to operate on
                a_material = mat
                
        mesh_index += 1
        mesh = obj.getMesh(mesh_index)

Functions


getShader()

Returns a empty shader object, or the currently installed shader if the shader has already been linked.
Note:
If an error occurred during the linking process, further calls to this function will return None

shader = material.getShader()
if shader != None:
        #do stuff



getMaterialIndex()

Returns the current index of the material [0-15]

setBlending(src, dest)

Sets the materials blending type. Acts like (glBlendFunc(src, dest))

Blending operations
import GameLogic
...
material.setBlending(GameLogic.BL_ONE, GameLogic.BL_ONE)
Note... Bug: If transparent blending is wanted you will need to set either Texface Add or Texface Alpha.



getTexture()

TODO



setTexture()

TODO


--[- snailrose -]--