Game Development Reference
In-Depth Information
Defining model templates
When loading a 3D model from a GEO file, we can use an instance of the
CIwResTemplateGEO resource template to control how the model is processed. Many
of the options available allow us to increase rendering performance when we know
that a particular model will be used under certain conditions; for example, it will
only ever be rendered using OpenGL ES or it may have been exported with normals,
which are not required as the model will never be rendered with lighting enabled.
Some of the more useful settings are shown in the following table, but there
are a great many more, so check out the Marmalade documentation for
CIwResTemplateGEO for more details:
Parameter
Description
scale
Allows a floating point value that will be used to scale all the
vertices of the model, to be specified. Can be useful to allow
3D models to be created in a modeling package with one scale
and used at a different scale in the game.
buildCols ,
buildNorms ,
buildUVs , and
buildUV1s
If set to true , the processed model data will include vertex
colors, normals, and UV information, assuming it exists in
the exported model. This can be useful to save memory in the
game if lighting or textures are not required on the model.
triStrip
If set to true , a model will be conditioned for rendering
using triangle strips. The default is false , which will cause
triangle lists to be generated. Only takes effect if the model is
being conditioned for rendering with OpenGL ES.
calculateNorms
If set to true , the model builder will attempt to generate
vertex normals for lighting purposes. Useful if the source
model was exported without normals for any reason.
chunked
If set to true , the model will be subdivided into smaller
"chunks" for rendering using binary space partitioning. This
can be useful when rendering a model much larger than screen
size, as it allows whole sections of the model which are off-
screen to be ignored.
maxPrimsPerChunk
Used in conjunction with the chunked parameter to specify
the maximum number of polygons each chunk of the model
should contain.
Search WWH ::




Custom Search