Game Development Reference
In-Depth Information
Here is an example of what an MTL file might look like:
CIwMaterial
{
name "red"
colAmbient { 255 0 0 128 }
alphaMode BLEND
}
CIwMaterial
{
name "grid"
colAmbient { 128 128 128 128 }
texture0 "grid.png"
alphaMode ADD
shadeMode FLAT
filtering false
}
This example generates a semi-transparent red material equivalent to that created in
the previous section, and also a material using a texture named
grid.png
, which is
drawn flat shaded with additive transparency at half the original image brightness
and without bilinear filtering.
You may have noticed that the image is specified using an attribute
called
texture0
. Marmalade materials can actually be assigned two
textures that can be blended together when rendering a polygon and
they are referred to as
texture0
and
texture1
. In this topic we
will only be concerned with single texture materials.
There are far too many attribute names to list here, so for a complete list take a look
at the Marmalade documentation page for the
CIwMaterial
class. This page lists all
of them.
To make these materials available in our code, we just need to reference the MTL file
inside a GROUP file that we are loading. We can then get hold of the materials by
searching for them by name using the resource manager functions described earlier
in this chapter.
Search WWH ::
Custom Search