SceneState Class Reference

#include <sceneState.h>

List of all members.


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, SceneGraph *mgr, 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, F32 visFactor)
 Constructor.
 ~SceneState ()
void setPortal (SceneObject *owner, const U32 idx)
 Sets the active portal.
SceneGraphgetSceneManager () const
LightManagergetLightManager () const
const Point3FgetCameraPosition () const
 Returns the camera position this SceneState is using.
const MatrixFgetCameraTransform () const
 Returns the camera transform 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.
const FrustumgetFrustum () const
 Returns the frustum.
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 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.
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.
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 (F32 dist, F32 deltaZ) const
 Returns a value between 0.0 and 1.0 which indicates how obscured a point is by haze and fog.
F32 getFog (F32 dist, F32 deltaZ) const
 Returns a value between 0.0 and 1.0 which indicates how obscured a point is by fog only.
F32 getFog (F32 dist, F32 deltaZ, S32 volKey) const
 Returns a value between 0.0 and 1.0 which indicates how obscured a point is by fog only.
void getFogs (F32 dist, F32 deltaZ, ColorF *array, U32 &numFogs) const
 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.
Vector< FogBand > * getNegFogBands ()
 Returns the fog bands below the world planes.
void insertInterior (InteriorListElem &elem)

Public Attributes

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 buildTranslucentBSP ()
 Builds the BSP tree of translucent images.

Private Attributes

Vector< ZoneStatemZoneStates
 Collection of ZoneStates in the scene.
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.
Frustum mFrustum
 The camera frustum used in culling.
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
SceneGraphmSceneManager
LightManagermLightManager
 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.
Vector< InteriorListElemmInteriorList

Friends

class SceneGraph

Classes

struct  FogBand
struct  InteriorListElem
struct  TransformPortal
 Used to represent a portal which inserts a transformation into the scene. More...
struct  ZoneState


Constructor & Destructor Documentation

SceneState::SceneState ( SceneState parent,
SceneGraph mgr,
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,
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

SceneGraph* SceneState::getSceneManager (  )  const [inline]

LightManager* SceneState::getLightManager (  )  const [inline]

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

Returns the camera position this SceneState is using.

const MatrixF& SceneState::getCameraTransform (  )  const [inline]

Returns the camera transform 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.

const Frustum& SceneState::getFrustum (  )  const [inline]

Returns the frustum.

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::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.

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.

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 ( F32  dist,
F32  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 ( F32  dist,
F32  deltaZ 
) const

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 ( F32  dist,
F32  deltaZ,
S32  volKey 
) const

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 ( F32  dist,
F32  deltaZ,
ColorF array,
U32 numFogs 
) const

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::buildTranslucentBSP (  )  [private]

Builds the BSP tree of translucent images.

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

Returns the fog bands above the world plane.

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

Returns the fog bands below the world planes.

void SceneState::insertInterior ( InteriorListElem elem  )  [inline]


Friends And Related Function Documentation

friend class SceneGraph [friend]


Member Data Documentation

Collection of ZoneStates in the scene.

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.

The camera frustum used in culling.

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.

If true the portal clipping plane will be reversed.

Modelview matrix this scene is based off of.