torque Torque Game Engine Documentation
TGE Version 1.5.2

SceneState Class Reference

#include <sceneState.h>


Detailed Description

The SceneState describes the state of the scene being rendered.

It keeps track of the information that objects need to render properly with regard to the camera position, any fog information, viewing frustum, the global environment map for reflections, viewable distance and portal information.


Public Member Functions

void setupClipPlanes (ZoneState &zone)
 Sets up the clipping planes using the parameters from a ZoneState.
 SceneState (SceneState *parent, const U32 numZones, F64 left, F64 right, F64 bottom, F64 top, F64 nearPlane, F64 farPlane, RectI viewport, const Point3F &camPos, const MatrixF &modelview, F32 fogDistance, F32 visibleDistance, ColorF fogColor, U32 numFogVolumes, FogVolume *fogVolumes, TextureHandle environmentMap, F32 visFactor)
 Constructor.
 ~SceneState ()
void setPortal (SceneObject *owner, const U32 idx)
 Sets the active portal.
void setImageRefPoint (SceneObject *obj, SceneRenderImage *image) const
 Assigns the reference point of the SceneRenderImage.
const Point3FgetCameraPosition () const
 Returns the camera position this SceneState is using.
F64 getNearPlane () const
 Returns the minimum distance something must be from the camera to not be culled.
F64 getFarPlane () const
 Returns the maximum distance something can be from the camera to not be culled.
void setFarPlane (F64 farPlane)
const ZoneStategetBaseZoneState () const
 Returns the base ZoneState.
ZoneStategetBaseZoneStateNC ()
 Returns the base ZoneState as a non-const reference.
const ZoneStategetZoneState (const U32 zoneId) const
 Returns the ZoneState for a particular zone ID.
ZoneStategetZoneStateNC (const U32 zoneId)
 Returns the ZoneState for a particular zone ID as a non-const reference.
void insertRenderImage (SceneRenderImage *image)
 Adds an image to be rendered by this SceneState into the proper category.
void insertTransformPortal (SceneObject *owner, U32 portalIndex, U32 globalZone, const Point3F &traversalStartPoint, const bool flipCull)
 Adds a new transform portal to the SceneState.
void enableTerrainOverride ()
 This enables terrain to be drawn inside interiors.
bool isTerrainOverridden () const
 Returns true if terrain is allowed to be drawn inside interiors.
void renderCurrentImages ()
 Sorts the list of images, builds the translucency BSP tree, sets up the portal, then renders all images in the state.
bool isObjectRendered (const SceneObject *obj)
 Returns true if the object in question is going to be rendered as opposed to being culled out.
void setupZoneProjection (const U32 zone)
 Sets the viewport and projection up for the given zone.
void setupObjectProjection (const SceneObject *object)
 Sets up the projection matrix based on the zone the specified object is in.
void setupBaseProjection ()
 Sets up the projection matrix based on the base ZoneState.
F32 getFogScale () const
 Returns the scale of the distance based fog [used for haze].
F32 getVisibleDistance () const
 Returns the distance at which objects are no longer visible.
F32 getFogDistance () const
 Returns how far away fog is (ie, when objects will be fully fogged).
ColorF getFogColor () const
 Returns the color of the fog in the scene.
TextureHandle getEnvironmentMap ()
 Returns a texture handle to the environment map in use.
void setupFog ()
 Sets up all the fog volumes in the Scene.
bool isBoxFogVisible (F32 dist, F32 top, F32 bottom)
 Returns true if the box specified is visible, taking fog into account.
F32 getHazeAndFog (float dist, float deltaZ) const
 Returns a value between 0.0 and 1.0 which indicates how obscured a point is by haze and fog.
F32 getFog (float dist, float deltaZ)
 Returns a value between 0.0 and 1.0 which indicates how obscured a point is by fog only.
F32 getFog (float dist, float deltaZ, S32 volKey)
 Returns a value between 0.0 and 1.0 which indicates how obscured a point is by fog only.
void getFogs (float dist, float deltaZ, ColorF *array, U32 &numFogs)
 Returns all fogs at a point.
F32 getHaze (F32 dist) const
 Returns a value between 0.0 and 1.0 which indicates how obscured a point is by haze only.
Vector< FogBand > * getPosFogBands ()
 Returns the fog bands above the world plane.
const Vector< FogBand > * getPosFogBands () const
 Returns the fog bands above the world plane [const].
Vector< FogBand > * getNegFogBands ()
 Returns the fog bands below the world planes.
const Vector< FogBand > * getNegFogBands () const
 Returns the fog bands below the world planes [const].

Data Fields

bool mFlipCull
 If true the portal clipping plane will be reversed.
MatrixF mModelview
 Modelview matrix this scene is based off of.

Private Member Functions

void sortRenderImages ()
 Sorts the render images.
void buildTranslucentBSP ()
 Builds the BSP tree of translucent images.
void insertIntoNode (RenderBSPNode &rNode, SceneRenderImage *image, bool rendered=true)
 Inserts a translucent image into the translucent BSP tree.
void renderNode (RenderBSPNode &rNode)
 Renders the translucency BSP tree.

Private Attributes

Vector< RenderBSPNodemTranslucentBSP
 The BSP tree for translucent objects.
Vector< ZoneStatemZoneStates
 Collection of ZoneStates in the scene.
Vector< SceneRenderImage * > mRenderImages
 Collection of images to render.
Vector< SceneRenderImage * > mTranslucentPlaneImages
 Collection of SortType::Plane images.
Vector< SceneRenderImage * > mTranslucentPointImages
 Collection of SortType::Point images.
Vector< SceneRenderImage * > mTranslucentBeginImages
 Collection of SortType::BeginImage images.
Vector< SceneRenderImage * > mTranslucentEndImages
 Collection of SortType::EndImage images.
bool mTerrainOverride
 If true, terrain is allowed to render inside interiors.
Vector< SceneState * > mSubsidiaries
 Transform portals which have been processed by the scene traversal process.
Vector< TransformPortalmTransformPortals
 Collection of TransformPortals.
Vector< FogBandmPosFogBands
 Fog bands above the world plane.
Vector< FogBandmNegFogBands
 Fog bands below the world plane.
ZoneState mBaseZoneState
 ZoneState of the base zone of the scene.
Point3F mCamPosition
 Camera position in this state.
F64 mNearPlane
 Minimum distance an object must be from the camera to get rendered.
F64 mFarPlane
 Maximum distance an object can be from the camera to get rendered.
F32 mVisFactor
 Visibility factor of the scene, used to modify fog.
SceneStatemParent
 This is used for portals, if this is not NULL, then this SceneState belongs to a portal, and not the main SceneState.
SceneObjectmPortalOwner
 SceneObject which owns the current portal.
U32 mPortalIndex
 Index the current portal is in the list of portals.
ColorF mFogColor
 Distance based, not volumetric, fog color.
F32 mFogDistance
 Distance to distance-fog.
F32 mVisibleDistance
 Visible distance of the scene.
F32 mFogScale
 Fog scale of the distance based fog.
U32 mNumFogVolumes
 Number of fog volumes in the scene.
FogVolumemFogVolumes
 Pointer to the array of fog volumes in the scene.
TextureHandle mEnvironmentMap
 Current environment map.

Friends

class SceneGraph

Data Structures

struct  FogBand
struct  RenderBSPNode
 Used to construct the BSP tree for sorting translucent images. More...
struct  TransformPortal
 Used to represent a portal which inserts a transformation into the scene. More...
struct  ZoneState


Constructor & Destructor Documentation

SceneState::SceneState ( SceneState parent,
const U32  numZones,
F64  left,
F64  right,
F64  bottom,
F64  top,
F64  nearPlane,
F64  farPlane,
RectI  viewport,
const Point3F camPos,
const MatrixF modelview,
F32  fogDistance,
F32  visibleDistance,
ColorF  fogColor,
U32  numFogVolumes,
FogVolume fogVolumes,
TextureHandle  environmentMap,
F32  visFactor 
)

Constructor.

See also:
SceneGraph::renderScene

SceneState::~SceneState (  ) 


Member Function Documentation

void SceneState::setupClipPlanes ( ZoneState zone  ) 

Sets up the clipping planes using the parameters from a ZoneState.

Parameters:
zone ZoneState to initalize clipping to

void SceneState::setPortal ( SceneObject owner,
const U32  idx 
)

Sets the active portal.

Parameters:
owner Object which owns the portal (portalized object)
idx Index of the portal in the list of portal planes

void SceneState::setImageRefPoint ( SceneObject obj,
SceneRenderImage image 
) const

Assigns the reference point of the SceneRenderImage.

For use with translucent images.

Parameters:
obj SceneObject that belongs to the SceneRenderImage being manipulated
image SceneRenderImage being manipulated

const Point3F& SceneState::getCameraPosition (  )  const [inline]

Returns the camera position this SceneState is using.

F64 SceneState::getNearPlane (  )  const [inline]

Returns the minimum distance something must be from the camera to not be culled.

F64 SceneState::getFarPlane (  )  const [inline]

Returns the maximum distance something can be from the camera to not be culled.

void SceneState::setFarPlane ( F64  farPlane  )  [inline]

const SceneState::ZoneState & SceneState::getBaseZoneState (  )  const [inline]

Returns the base ZoneState.

See also:
ZoneState

SceneState::ZoneState & SceneState::getBaseZoneStateNC (  )  [inline]

Returns the base ZoneState as a non-const reference.

See also:
getBaseZoneState

const SceneState::ZoneState & SceneState::getZoneState ( const U32  zoneId  )  const [inline]

Returns the ZoneState for a particular zone ID.

Parameters:
zoneId ZoneId

SceneState::ZoneState & SceneState::getZoneStateNC ( const U32  zoneId  )  [inline]

Returns the ZoneState for a particular zone ID as a non-const reference.

See also:
getZoneState
Parameters:
zoneId ZoneId

void SceneState::insertRenderImage ( SceneRenderImage image  ) 

Adds an image to be rendered by this SceneState into the proper category.

Parameters:
image Image to add

void SceneState::insertTransformPortal ( SceneObject owner,
U32  portalIndex,
U32  globalZone,
const Point3F traversalStartPoint,
const bool  flipCull 
)

Adds a new transform portal to the SceneState.

Parameters:
owner SceneObject owner of the portal (portalized object).
portalIndex Index of the portal in the list of portal planes.
globalZone Index of the zone this portal is in in the list of ZoneStates.
traversalStartPoint Start point of the zone traversal.
See also:
SceneGraph::buildSceneTree

SceneGraph::findZone

Parameters:
flipCull If true, the portal plane will be flipped

void SceneState::enableTerrainOverride (  )  [inline]

This enables terrain to be drawn inside interiors.

bool SceneState::isTerrainOverridden (  )  const [inline]

Returns true if terrain is allowed to be drawn inside interiors.

void SceneState::renderCurrentImages (  ) 

Sorts the list of images, builds the translucency BSP tree, sets up the portal, then renders all images in the state.

bool SceneState::isObjectRendered ( const SceneObject obj  ) 

Returns true if the object in question is going to be rendered as opposed to being culled out.

Parameters:
obj Object in question.

void SceneState::setupZoneProjection ( const U32  zone  ) 

Sets the viewport and projection up for the given zone.

Parameters:
zone Zone for which we want to set up a viewport/projection.

void SceneState::setupObjectProjection ( const SceneObject object  ) 

Sets up the projection matrix based on the zone the specified object is in.

Parameters:
object Object to use.

void SceneState::setupBaseProjection (  ) 

Sets up the projection matrix based on the base ZoneState.

F32 SceneState::getFogScale (  )  const [inline]

Returns the scale of the distance based fog [used for haze].

F32 SceneState::getVisibleDistance (  )  const [inline]

Returns the distance at which objects are no longer visible.

F32 SceneState::getFogDistance (  )  const [inline]

Returns how far away fog is (ie, when objects will be fully fogged).

ColorF SceneState::getFogColor (  )  const [inline]

Returns the color of the fog in the scene.

TextureHandle SceneState::getEnvironmentMap (  )  [inline]

Returns a texture handle to the environment map in use.

void SceneState::setupFog (  ) 

Sets up all the fog volumes in the Scene.

bool SceneState::isBoxFogVisible ( F32  dist,
F32  top,
F32  bottom 
)

Returns true if the box specified is visible, taking fog into account.

Parameters:
dist The length of the vector, projected on to the horizontal plane of the world, from the camera to the nearest point on the box
top The maximum z-value of the box
bottom The minimum z-value of the box

F32 SceneState::getHazeAndFog ( float  dist,
float  deltaZ 
) const

Returns a value between 0.0 and 1.0 which indicates how obscured a point is by haze and fog.

Parameters:
dist Length of vector, projected onto horizontal world plane, from camera to the point.
deltaZ Z-offset of the camera.

F32 SceneState::getFog ( float  dist,
float  deltaZ 
)

Returns a value between 0.0 and 1.0 which indicates how obscured a point is by fog only.

Parameters:
dist Length of vector, projected onto horizontal world plane, from camera to the point.
deltaZ Z-offset of the camera.

F32 SceneState::getFog ( float  dist,
float  deltaZ,
S32  volKey 
)

Returns a value between 0.0 and 1.0 which indicates how obscured a point is by fog only.

Parameters:
dist Length of vector, projected onto horizontal world plane, from camera to the point.
deltaZ Z-offset of the camera.
volKey Index of a particular band of volumetric fog.

void SceneState::getFogs ( float  dist,
float  deltaZ,
ColorF array,
U32 numFogs 
)

Returns all fogs at a point.

Parameters:
dist Length of vector, projected onto horizontal world plane, from camera to the point.
deltaZ Z-offset of the camera.
array Array of fog colors at the point.
numFogs Number of fogs in the array.

F32 SceneState::getHaze ( F32  dist  )  const [inline]

Returns a value between 0.0 and 1.0 which indicates how obscured a point is by haze only.

Parameters:
dist Length of vector, projected onto horizontal world plane, from camera to the point.

void SceneState::sortRenderImages (  )  [private]

Sorts the render images.

void SceneState::buildTranslucentBSP (  )  [private]

Builds the BSP tree of translucent images.

void SceneState::insertIntoNode ( RenderBSPNode rNode,
SceneRenderImage image,
bool  rendered = true 
) [private]

Inserts a translucent image into the translucent BSP tree.

Parameters:
rNode Root node.
image Image to insert.
rendered Used in recursion, don't mess with this!

void SceneState::renderNode ( RenderBSPNode rNode  )  [private]

Renders the translucency BSP tree.

Parameters:
rNode Root node.

Vector<FogBand>* SceneState::getPosFogBands (  )  [inline]

Returns the fog bands above the world plane.

const Vector<FogBand>* SceneState::getPosFogBands (  )  const [inline]

Returns the fog bands above the world plane [const].

Vector<FogBand>* SceneState::getNegFogBands (  )  [inline]

Returns the fog bands below the world planes.

const Vector<FogBand>* SceneState::getNegFogBands (  )  const [inline]

Returns the fog bands below the world planes [const].


Friends And Related Function Documentation

friend class SceneGraph [friend]


Field Documentation

The BSP tree for translucent objects.

Collection of ZoneStates in the scene.

Collection of images to render.

Collection of SortType::Plane images.

Collection of SortType::Point images.

Collection of SortType::BeginImage images.

Collection of SortType::EndImage images.

If true, terrain is allowed to render inside interiors.

Transform portals which have been processed by the scene traversal process.

Note:
Closely related. Transform portals are turned into sorted mSubsidiaries by the traversal process...

Collection of TransformPortals.

Fog bands above the world plane.

Fog bands below the world plane.

ZoneState of the base zone of the scene.

Camera position in this state.

Minimum distance an object must be from the camera to get rendered.

Maximum distance an object can be from the camera to get rendered.

Visibility factor of the scene, used to modify fog.

This is used for portals, if this is not NULL, then this SceneState belongs to a portal, and not the main SceneState.

SceneObject which owns the current portal.

Index the current portal is in the list of portals.

Distance based, not volumetric, fog color.

Distance to distance-fog.

Visible distance of the scene.

Fog scale of the distance based fog.

Number of fog volumes in the scene.

Pointer to the array of fog volumes in the scene.

TextureHandle SceneState::mEnvironmentMap [private]

Current environment map.

If true the portal clipping plane will be reversed.

Modelview matrix this scene is based off of.




All Rights Reserved GarageGames.com, Inc. 1999-2005
Auto-magically Generated with Doxygen