Table of Contents

Coordinate Systems

Core Library

Because the SpeedTree run-time is not an engine in and of itself, it must work well with multiple engines and engine configurations. This means working with numerous coordinate systems.

The default coordinate system used by the SDK is right-handed with Z considered “up.” If this is your coordinate system, no changes will be necessary. If not, you'll need to use the system described below to establish your coordinate system. Example code is provided for the following coordinate systems:


Accessing Materials

#include “Core/CoordSys.h” to access the coordinate conversion system. The CCoordSys class is used for most operations, starting with selecting the desired coordinate system. CCoordSys::SetCoordSys() allow the client application to select a preset coordinate system or define their own. The presets are in the enumeration ECoordSysType:

The SDK defines an abstract base class for defining a coordinate system conversion object. The listing is below:









Note that the shader source uses the macros SPEEDTREE_Z_UP and SPEEDTREE_LHCS that are set at shader compilation time, based on the coordinate converter functions CCoordSysBase::IsYAxisUp() and CCoordSysBase::IsLeftHanded(). Difficulties may arise here with custom coordinate systems.


Shaders

The SpeedTree shaders are also designed to operate in different coordinate systems. This is done through the definition of two types of macros during shader compilation: