Main Page   Modules   Class Hierarchy   Compound List   Compound Members  

GAUGE3D::GModel::RenderInfo Class Reference

Provides information required to render a model. More...

#include <gauge3d/graphics/model.h>

Inherits GAUGE3D::GObject.

List of all members.

Public Methods

virtual ~RenderInfo ()
virtual int StartFrame (pAnimState animState,const GVector &viewPoint,const GQuaternion &viewAngle,const GFrustum &viewFrustum,float geoLod)=0
 Sets everything up to render a frame with the given parameters. More...

virtual void GetStaticInfo (RenderSet *target,int setNum)=0
 Fills in the static parts of the render set. More...

virtual void GetDynamicInfo (RenderSet *target,int setNum)=0
 Fills in the dynamic parts of the render set. More...


Detailed Description

Provides information required to render a model.

A RenderInfo object is bound to a particular GModel object and is used to request the information necessary to render the model. The renderer will need one RenderInfo for each sprite in the scene which uses a particular model. The idea here is to allow safe multithreaded access to this information. (So, the renderer could be drawing two different sprites that have the same model at the same time.)


Member Function Documentation

int GAUGE3D::GModel::RenderInfo::StartFrame ( pAnimState animState,
const GVector & viewPoint,
const GQuaternion & viewAngle,
const GFrustum & viewFrustum,
float geoLod ) [pure virtual]
 

Sets everything up to render a frame with the given parameters.

Parameters:
animState   The animation state of the model.
viewPoint   The position of the camera.
geoLod   The geometric level of detail in which to render the model. This is simply the area that an average triangle in the model should have, if it were one meter (one unit) from the camera. This value is *not* adjusted for distance from the viewpoint, so the model will have to do that internally. (hint: multiply by viewPoint.SquareMagnitude().) Note that a lower geoLOD value means a higher detail image (smaller triangles).
Returns:
The number of RenderSet structures needed to complete the model. The renderer will then call GetStaticInfo and GetDynamicInfo once for each RenderSet.

void GAUGE3D::GModel::RenderInfo::GetStaticInfo ( RenderSet * target,
int setNum ) [pure virtual]
 

Fills in the static parts of the render set.

Parameters:
target   The RenderSet to which the info will be written.
setNum   The number of the RenderSet which is to be filled in.

The renderer will use the values of the mDynamicFlags, mNumVertices, and mNumIndices fields of target to allocate buffers to store the dynamically generated parts of the model. Then, GetDynamicInfo will be called to fill in those buffers with the model data.

void GAUGE3D::GModel::RenderInfo::GetDynamicInfo ( RenderSet * target,
int setNum ) [pure virtual]
 

Fills in the dynamic parts of the render set.

Parameters:
target   The RenderSet to which the info will be written.
setNum   The number of the RenderSet which is to be filled in.

Before calling this, the renderer will fill in target with pointers to buffers where the dynamic data for the model should be written. For example, if target->mDynamicFlags was set to VERTEX_POSITION by GetStaticInfo, then when GetDynamicInfo is called, target->mVertices and target->mNormals will point to arrays of vertices allocated by the renderer, ready to be filled in with vertex data. This way, the renderer can efficiently handle allocating memory for dynamic model data.

Remarks:
When writing to the buffers which the renderer has allocated, a model plugin should write linearly and should not attempt to read from the buffers. This is because the buffers may be allocated in AGP RAM or even VRAM, and are therefore uncached. This means that the CPU will be able to write much more efficiently if it can combine several writes into one.


The documentation for this class was generated from the following file:
Generated at Tue Jan 30 17:07:34 2001 for gauge3d by doxygen1.2.4 written by Dimitri van Heesch, © 1997-2000