Game Development Reference
In-Depth Information
Using resource templates
Build styles allow us to make decisions on how the resources for our game are
processed on a global level; but sometimes we want a little more fine-grained control
so we can treat different types of resources in different ways.
This is where resource templates come into play. Put simply, all a resource template
allows us to do is alter the default settings that are applied when processing textures,
materials, 3D models, animations, and GROUP files.
Resource templates can be defined in an ITX file that we parse before attempting to
load any resources. Since these are only required in Windows debug builds, we do
not need to load this file if we won't be building resources.
Marmalade provides a handy define, IW_BUILD_RESOURCES , which is only defined
in Windows debug builds. Using this define, we can reduce the size of our compiled
code by excluding any resource processing code. For example, if our resource
template definitions are contained in a file called restemplates.itx , we could use
the following code snippet to load the file:
#ifdef IW_BUILD_RESOURCES
IwGetTextParserITX()->ParseFile("restemplates.itx");
#endif
The following code provides an example of what the restemplates.itx file might
look like. We'll discuss the different resource template types in greater detail in the
coming sections; but notice how a template called default is defined for each type.
This is so we can revert to normal loading behavior should we want to.
CIwResTemplateImage
{
name "default"
formatHW FORMAT_UNDEFINED
formatSW FORMAT_UNDEFINED
}
CIwResTemplateImage
{
name "rgba4444_nomipmap"
formatHW RGBA_4444
mipMapping false
}
CIwResTemplateMTL
 
Search WWH ::




Custom Search