Class KX_PolygonMaterial (2.48)


Methods
activate setTexture
setCustomMaterial updateTexture
 
Variables
diffuse texture
drawingmode tface
gl_texture tile
lightlayer tilexrep
material tileyrep
shininess transparent
specular triangle
specularity zsort
 
Constants
---------- ----------

Inherited Methods:  Class PyObjectPlus
isA ----------





Methods



Notes


Note:
To access these functions, Texture Face Materials must be checked.

Note:
You also need PyOpenGL and GLEWPy to use this Class

PyOpenGL (used to bind OpenGL to the API)
 http://pyopengl.sourceforge.net/
GLEWPy (brings advanced OpenGL extensions to Python)
http://glewpy.sourceforge.net/

Note:
There's isn't any sample code.

List of functions


# get the currrent controller
controller = GameLogic.getCurrentController()

# get object that owns this controller
obj = controller.getOwner()
 
# get the first mesh of the object 
mesh = obj.getMesh(0)

# get the materials on the first mesh   
for mat in mesh.materials:

print dir(mat)

activate

activate(rasty, cachingInfo)

From the official documentation:

Sets material parameters for this object for rendering.

Material Parameters set:
1. Texture
2. Backface Culling
3. Line drawing
4. Specular Colour
5. Shininess
6. Diffuse Color
7. Polygon Offset

rasty(CObject) Rasterizer instance

cachingInfo (CObject) Material cache instance

setCustomMaterial

setCustomMaterial(material)

From the official documentation:

Sets the material state setup object.

Using this method, you can extend of completely replace the game engine material to do your own advanced multipass effects.

material (instance)  The material object.

setTexture

setTexture(tface)

From the official documentation:

Sets texture render state

tface (CObject)  Texture face

updateTexture

updateTexture(tface, rasty)

From the official documentation:

Updates a realtime animation.

tface (CObject) Texture face (eg. mat.tface)
rasty (CObject) Rasterizer



Variables



From the official documentation:

diffuse
The diffuse color of the material

drawingmode
Drawing mode for the material

gl_texture
OpenGL texture handle

lightlayer
Light layers this material affects

material
Material name

shininess
The shininess (specular exponent) of the material

specular
The specular color of the material

specularity
The amount of specular of the material

texture
Texture name

tface
Texture face properties

tile
Texture is tiling

tilexrep
Number of tile repetitions in the x direction

tileyrep
Number of tile repetitions in the y direction

transparent
This material is transparent

triangle
Mesh data with this material is triangles

zsort
Transparent polygons in meshes with this material will be sorted back to front before rendering



Blender 3D
Game Engine