TSLastDetail

Engine/source/ts/tsLastDetail.h

This neat little class renders the object to a texture so that when the object is far away, it can be drawn as a billboard instead of a mesh.

More...

Protected Attributes

This is the path of the object, which is where we'll be storing our cache for rendered imposters.

The center offset for the bounding sphere used to render the imposter.

The square dimensions of each captured imposter image.

The shape detail level to capture into the imposters.

The combined imposter state and corner data vertex format used for rendering with multiple streams.

bool

If true we captures polar images in the imposter texture.

The material for this imposter.

The material instance used to render this imposter.

The number steps around the equator of the globe at which we capture an imposter.

The number of steps to go from equator to each polar region (0 means equator only) at which we capture an imposter.

The angle in radians of sub-polar regions.

The bounding radius of the shape used to size the billboard.

The shape which we're impostering.

Protected Static Attributes

This is a global list of all the TSLastDetail objects in the system.

The maximum texture size for a billboard texture.

Public Static Attributes

bool

Global preference for rendering imposters to shadows.

Protected Functions

Helper which returns the imposter diffuse map path.

Helper which returns the imposter normal map path.

This update actually regenerates the imposter images.

Public Functions

TSLastDetail(TSShape * shape, const String & cachePath, U32 numEquatorSteps, U32 numPolarSteps, F32 polarAngle, bool includePoles, S32 dl, S32 dim)

Helper function which deletes the cached imposter texture files from disk.

Returns the material instance used to render this imposter.

Returns the radius.

render(const TSRenderState & rdata, F32 alpha)

Internal function called from TSShapeInstance to submit an imposter render instance.

update(bool forceUpdate)

Loads the imposter images by reading them from the disk or generating them if the TSShape is more recient than the cached imposter textures.

Public Static Functions

updateImposterImages(bool forceUpdate)

Calls update on all TSLastDetail objects in the system.

Detailed Description

This neat little class renders the object to a texture so that when the object is far away, it can be drawn as a billboard instead of a mesh.

This happens when the model is first loaded as to keep the realtime render as fast as possible. It also renders the model from a few different perspectives so that it would actually pass as a model instead of a silly old billboard. In other words, this is an imposter.

Protected Attributes

String mCachePath 

This is the path of the object, which is where we'll be storing our cache for rendered imposters.

Point3F mCenter 

The center offset for the bounding sphere used to render the imposter.

S32 mDim 

The square dimensions of each captured imposter image.

S32 mDl 

The shape detail level to capture into the imposters.

GFXVertexFormat mImposterVertDecl 

The combined imposter state and corner data vertex format used for rendering with multiple streams.


bool mIncludePoles 

If true we captures polar images in the imposter texture.

SimObjectPtr< Material > mMaterial 

The material for this imposter.

BaseMatInstance * mMatInstance 

The material instance used to render this imposter.

U32 mNumEquatorSteps 

The number steps around the equator of the globe at which we capture an imposter.

U32 mNumPolarSteps 

The number of steps to go from equator to each polar region (0 means equator only) at which we capture an imposter.

F32 mPolarAngle 

The angle in radians of sub-polar regions.

F32 mRadius 

The bounding radius of the shape used to size the billboard.

TSShape * mShape 

The shape which we're impostering.

Protected Static Attributes

Vector< TSLastDetail * > smLastDetails 

This is a global list of all the TSLastDetail objects in the system.

const U32 smMaxTexSize 

The maximum texture size for a billboard texture.

Public Static Attributes

bool smCanShadow 

Global preference for rendering imposters to shadows.

Protected Functions

_getDiffuseMapPath()

Helper which returns the imposter diffuse map path.

_getNormalMapPath()

Helper which returns the imposter normal map path.

_update()

This update actually regenerates the imposter images.

_validateDim()

Public Functions

TSLastDetail(TSShape * shape, const String & cachePath, U32 numEquatorSteps, U32 numPolarSteps, F32 polarAngle, bool includePoles, S32 dl, S32 dim)

~TSLastDetail()

deleteImposterCacheTextures()

Helper function which deletes the cached imposter texture files from disk.

getMatInstance()

Returns the material instance used to render this imposter.

getRadius()

Returns the radius.

render(const TSRenderState & rdata, F32 alpha)

Internal function called from TSShapeInstance to submit an imposter render instance.

update(bool forceUpdate)

Loads the imposter images by reading them from the disk or generating them if the TSShape is more recient than the cached imposter textures.

This should not be called from within any rendering code.

Parameters:

forceUpdate

If true the disk cache is invalidated and new imposter images are rendered.

Public Static Functions

updateImposterImages(bool forceUpdate)

Calls update on all TSLastDetail objects in the system.