My Project
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
ParaEngine::SceneState Struct Reference

It's used as parameter to Draw method of each scene object. More...

#include <SceneState.h>

Inheritance diagram for ParaEngine::SceneState:
ParaEngine::IAttributeFields ParaEngine::IObject ParaEngine::CRefCounted

Classes

class  List_PostRenderObject_TrackRef_Type
 Same as IRefObject except that it tracks references of the object. More...
 

Public Types

enum  TOUCH_METHOD { LButton, RButton, None }
 
enum  ProcessingStage {
  stage_framemove = 0, stage_UserInputHandling = 1, stage_EnvironmentSim = 2, stage_AISimulator = 3,
  stage_RootSceneAnimate = 4, stage_RootGUIAnimate = 5, stage_SetCamera = 101, stage_AdvanceScene = 102,
  stage_AdvanceGUI = 103
}
 At what stage is the scene currently being processed, ascending order.
 
typedef std::vector< PostRenderObjectList_PostRenderObject_Type
 
typedef std::vector< CSpriteObject * > List_CSpriteObjectPtr_Type
 
typedef unordered_array< ParticleSystemRefList_ParticleSystemPtr_Type
 
typedef std::vector< AlphaPostRenderObjectList_AlphaPostRenderObject_Type
 
typedef std::vector< PostRenderObjectWeakPtrList_HeadOnRenderObject_Type
 
typedef std::vector< CLightObject * > List_LightObject_Type
 
- Public Types inherited from ParaEngine::IAttributeFields
typedef ParaEngine::weak_ptr< IObject, IAttributeFieldsWeakPtr_type
 
- Public Types inherited from ParaEngine::IObject
typedef ParaEngine::weak_ptr< IObjectWeakPtr_type
 

Public Member Functions

 SceneState (IScene *pScene=NULL)
 
 ATTRIBUTE_DEFINE_CLASS (SceneState)
 
virtual int InstallFields (CAttributeClass *pClass, bool bOverride)
 this class should be implemented if one wants to add new attribute. More...
 
 ATTRIBUTE_METHOD1 (SceneState, GetCurrentRenderPipeline_s, int *)
 
 ATTRIBUTE_METHOD1 (SceneState, SetCurrentRenderPipeline_s, int)
 
 ATTRIBUTE_METHOD1 (SceneState, GetRenderState_s, int *)
 
 ATTRIBUTE_METHOD1 (SceneState, SetRenderState_s, int)
 
 ATTRIBUTE_METHOD1 (SceneState, GetCameraToCurObjectDistance_s, float *)
 
 ATTRIBUTE_METHOD1 (SceneState, SetCameraToCurObjectDistance_s, float)
 
 ATTRIBUTE_METHOD1 (SceneState, GetGlobalTime_s, int *)
 
 ATTRIBUTE_METHOD1 (SceneState, SetGlobalTime_s, int)
 
CBaseObjectGetCurrentSceneObject ()
 get the current scene object that is being processed. More...
 
void SetCurrentSceneObject (CBaseObject *pObj)
 set the current scene object. More...
 
void SetCameraToCurObjectDistance (float fDist)
 set camera to current object distance. More...
 
float GetCameraToCurObjectDistance ()
 get camera to current object distance. More...
 
bool IsLODEnabled ()
 is lod enabled
 
void SetShadowMapCameraToCurObjectDistance (float fDist)
 set shadow map camera to current object distance. More...
 
float GetShadowMapCameraToCurObjectDistance ()
 get shadow map camera to current object distance. More...
 
SceneStateRenderState GetRenderState () const
 
void SetRenderState (SceneStateRenderState val)
 
void SetShadowPass (bool bShadowPass)
 true if it is a shadow pass. More...
 
bool IsShadowPass ()
 true if it is a shadow pass. More...
 
void SetBatchedElementDrawer (IBatchedElementDraw *pDebugDraw)
 set the debug drawing object. More...
 
IBatchedElementDrawGetBatchedElementDrawer ()
 get the debug drawing object. More...
 
int GetGlobalTime ()
 get the global time. More...
 
void SetGlobalTime (int nGlobalTime)
 
bool IsIgnoreTransparent ()
 ignore all globally transparent and particle object
 
void SetIgnoreTransparent (bool bIgnore)
 
ParaMaterialGetGlobalMaterial ()
 this is the usually the global sun light material. More...
 
ParaMaterialGetLocalMaterial ()
 this is the usually the material local to a given 3d position. More...
 
ParaMaterialGetCurrentMaterial ()
 this is the main function used by effect file to apply material to shaders. More...
 
void EnableLocalMaterial (bool bEnable=true)
 Whether to use local material as current material. More...
 
bool HasLocalMaterial ()
 Whether to use local material. More...
 
Vector3GetCurrentLightStrength ()
 x is the sun light strength, y is local light strength. More...
 
RenderDevicePtr GetRenderDevice ()
 
BillBoardViewInfoBillBoardInfo ()
 
bool IsDeferredShading () const
 whether we are currently using deferred shading
 
void SetDeferredShading (bool val)
 whether we are currently using deferred shading
 
CBaseCameraGetCamera ()
 get current camera
 
int GetCurrentRenderPipeline () const
 one of the enum RENDER_PIPELINE_ORDER
 
void SetCurrentRenderPipeline (int val)
 one of the enum RENDER_PIPELINE_ORDER
 
void AddToDeferredLightPool (CLightObject *lightObject)
 
bool IsGlobalLODEnabled () const
 
void EnableGlobalLOD (bool val)
 
ISceneGetScene ()
 
void SetMaxRenderCount (int nRenderImportance, int nCount)
 the max number of objects to be rendered of a given render importance. More...
 
bool CheckAddRenderCount (int nRenderImportance)
 Add one to the render count of a given render importance. More...
 
int GetRenderFrameCount ()
 get the current frame render number
 
template<class T >
T::value_type * FindObject (T &renderlist, CBaseObject *pObject)
 
void CleanupSceneState ()
 clean up all objects in post rendering lists. call this when you finished rendering one framework. More...
 
void Cleanup ()
 this function must be called, when the entire scene is reset or cleaned up. More...
 
void AddParticleSystem (ParticleSystem *ps)
 add a particle system to the scene state. More...
 
CSortedFaceGroupsGetFaceGroups ()
 get sorted face groups. More...
 
HRESULT InitDeviceObjects ()
 
HRESULT RestoreDeviceObjects ()
 
HRESULT InvalidateDeviceObjects ()
 
HRESULT DeleteDeviceObjects ()
 
- Public Member Functions inherited from ParaEngine::IAttributeFields
virtual int GetAttributeClassID ()
 attribute class ID should be identical, unless one knows how overriding rules work. More...
 
virtual const char * GetAttributeClassName ()
 a static string, describing the attribute class object's name
 
virtual const char * GetAttributeClassDescription ()
 a static string, describing the attribute class object
 
virtual int GetChildAttributeColumnCount ()
 we support multi-dimensional child object. More...
 
virtual int GetChildAttributeObjectCount (int nColumnIndex=0)
 get the number of child objects (row count) in the given column. More...
 
virtual IAttributeFieldsGetChildAttributeObject (int nRowIndex, int nColumnIndex=0)
 
virtual IAttributeFieldsGetChildAttributeObject (const std::string &sName)
 get attribute by child object. More...
 
 ATTRIBUTE_METHOD1 (IAttributeFields, GetName_s, const char **)
 
 ATTRIBUTE_METHOD1 (IAttributeFields, SetName_s, const char *)
 
 ATTRIBUTE_METHOD (IAttributeFields, PrintObject_s)
 
 ATTRIBUTE_METHOD (IAttributeFields, AddRef_s)
 
 ATTRIBUTE_METHOD1 (IAttributeFields, GetRefCount_s, int *)
 
 ATTRIBUTE_METHOD1 (IAttributeFields, SetTime_s, int)
 
 ATTRIBUTE_METHOD1 (IAttributeFields, GetTime_s, int *)
 
 ATTRIBUTE_METHOD (IAttributeFields, Release_s)
 
virtual const std::string & GetIdentifier ()
 
virtual void SetIdentifier (const std::string &sID)
 
virtual bool IsModified ()
 whether some of the fields are modified.It is up to the implementation class to provide this functionality if necessary. More...
 
virtual void SetModified (bool bModified)
 set whether any field has been modified. More...
 
virtual bool ValidateFields ()
 validate all fields and return true if validation passed. More...
 
virtual string GetValidationMessage ()
 get the recent validation message due to the most recent call to ValidateFields()
 
virtual bool ResetField (int nFieldID)
 Reset the field to its initial or default value. More...
 
virtual bool InvokeEditor (int nFieldID, const std::string &sParameters)
 Invoke an (external) editor for a given field. More...
 
virtual bool AddChildAttributeObject (IAttributeFields *pChild, int nRowIndex=-1, int nColumnIndex=0)
 add child object. More...
 
virtual void * QueryObjectByName (const std::string &sObjectType)
 convert to object of a given type. More...
 
virtual void * QueryObject (int nObjectType)
 convert to object of a given type. More...
 
virtual int GetTime ()
 get the current local time in case it is animated in milli seconds frames. More...
 
virtual void SetTime (int nTime)
 
virtual CDynamicAttributeFieldGetDynamicField (const std::string &sName)
 Get a dynamic field with a given name. More...
 
virtual CDynamicAttributeFieldGetDynamicField (int nIndex)
 Get a dynamic field with a given index. More...
 
virtual const char * GetDynamicFieldNameByIndex (int nIndex)
 get field name by index
 
virtual int GetDynamicFieldCount ()
 how many dynamic field this object currently have. More...
 
virtual int SetDynamicField (const std::string &sName, const CVariable &value)
 set a dynamic field with a given name. More...
 
virtual int AddDynamicField (const std::string &sName, ATTRIBUTE_FIELDTYPE dwType)
 add dynamic field and return field index
 
virtual void RemoveAllDynamicFields ()
 remove all dynamic fields
 
virtual int SaveDynamicFieldsToString (std::string &output)
 save only text dynamic fields to fieldname = value text strings. More...
 
virtual int LoadDynamicFieldsFromString (const std::string &input)
 load only text dynamic fields from string More...
 
CAttributeClassGetAttributeClass ()
 get the main attribute class object. More...
 
void PrintObject ()
 print the content of this object to a text file at temp/doc/[ClassName].txt. More...
 
- Public Member Functions inherited from ParaEngine::IObject
virtual void Clone (IObject *obj) const
 Clone the object's contains to a pointer. More...
 
virtual IObjectClone () const
 Clone the object's contains and return a pointer to the newly created object. More...
 
virtual bool Equals (const IObject *obj) const
 Compare the object with another object. More...
 
virtual const ITypeGetType () const
 
virtual std::string ToString () const
 
WeakPtr_typeGetWeakReference ()
 get weak reference object. More...
 
virtual int ProcessObjectEvent (const ObjectEvent &event)
 this function is only used to backward compatibility of ParaObject:AddEvent() function. More...
 
- Public Member Functions inherited from ParaEngine::CRefCounted
void addref () const
 add reference count of the object. More...
 
bool delref () const
 decrease reference count of the object. More...
 
int GetRefCount () const
 get the reference count
 
virtual int Release ()
 
CRefCountedAddToAutoReleasePool ()
 addref and releases the ownership sometime soon automatically (usually at the end of the current frame). More...
 

Public Attributes

RenderDevicePtr m_pd3dDevice
 
IScenem_pScene
 rendering device pointer
 
GUIStatepGUIState
 the GUI rendering state
 
CParaWorldAssetpAssetManager
 pointer to the asset manager
 
int m_nCurrentRenderPipeline
 one of the enum RENDER_PIPELINE_ORDER
 
double dTimeDelta
 time advance delta
 
ParaMaterial m_matGlobalMaterial
 default material
 
ParaMaterial m_matLocalMaterial
 
bool m_bUseLocalMaterial: 1
 
bool bIsBatchRender: 1
 true if the it's currently performing batch rendering
 
bool m_bCameraMoved: 1
 
bool m_bGlobalLOD: 1
 
bool m_bEnableTranslucentFaceSorting
 translucent face sorting is enabled.
 
int m_nRenderCount
 how many times the scene has been rendered since its creation. More...
 
float fAlphaFactor
 the frame number that this object is last accessed. More...
 
DWORD m_dwD3D_CULLMODE
 the material alpha should be multiplied by this factor. More...
 
int m_nOccluded
 the default value of Occluded property when new objects are added to it.
 
Matrix4 mxView
 
Matrix4 mxProj
 view transform of the current camera
 
Vector3 vEye
 projection transform of the current camera
 
Vector3 vLookAt
 camera position
 
BillBoardViewInfo m_BillBoardInfo
 camera look at position
 
FLOAT fViewCullingRadius
 
CBaseObjectpTouchedObject
 the radius of the circle with the center at vEye: More...
 
CEffectFilem_pCurrentEffect
 the object that has been touched by the mouse ray. More...
 
Vector3 m_curLightStrength
 x is the sun light strength, y is local light strength. More...
 
enum ParaEngine::SceneState::TOUCH_METHOD touchMethod
 
enum ParaEngine::SceneState::ProcessingStage CurrentStage
 
DWORD m_nCurRenderGroup
 bitwise fields of RENDER_GROUP
 
SceneState::List_PostRenderObject_TrackRef_Type listPostRenderingObjects
 listPostRenderingObjects: this is the general post rendering list. More...
 
SceneState::List_PostRenderObject_TrackRef_Type listPRBiped
 list of general post rendering object
 
SceneState::List_PostRenderObject_TrackRef_Type listPRTransparentBiped
 list of Post Rendering object: biped
 
SceneState::List_PostRenderObject_Type listPRSolidObject
 list of Post Rendering object: biped with alpha blending More...
 
SceneState::List_PostRenderObject_Type listShadowCasters
 
SceneState::List_PostRenderObject_Type listShadowReceivers
 
SceneState::List_AlphaPostRenderObject_Type listPRSmallObject
 smaller objects are rendered after bigger objects are drawn for better occlusion.They are rendered from back to front.
 
SceneState::List_HeadOnRenderObject_Type listHeadonDisplayObject
 
SceneState::List_AlphaPostRenderObject_Type listPRTransparentObject
 transparent meshes (object) are usually rendered from back to front(far to near). More...
 
SceneState::List_AlphaPostRenderObject_Type listPRMissiles
 
SceneState::List_ParticleSystemPtr_Type listParticleSystems
 
SceneState::List_PostRenderObject_Type listZones
 
SceneState::List_PostRenderObject_Type listPortals
 
SceneState::List_PostRenderObject_Type listBoundingBox
 
SceneState::List_PostRenderObject_Type listSelections
 
SceneState::List_LightObject_Type listDeferredLightObjects
 
unordered_array< WeakPtrlistOwnerDrawObjs
 
bool m_bSkipOcean
 
bool m_bSkipTerrain
 
bool m_bSkipSky
 
bool m_bOuterWorldZoneVisible
 
bool m_bDeferredShading
 whether we are currently using deferred shading
 
vector< int > m_MaxRenderCount
 m_MaxRenderCount[RenderImportance] is the max number of objects to be rendered of a given render importance
 
vector< int > m_RenderCount
 m_RenderCount[RenderImportance] is the max number of objects that has already been rendered of a given render importance
 
CSortedFaceGroups m_SortedFaceGroups
 face groups.
 

Additional Inherited Members

- Static Public Member Functions inherited from ParaEngine::IAttributeFields
static HRESULT GetAttributeClassID_s (IAttributeFields *cls, int *p1)
 
static HRESULT GetAttributeClassName_s (IAttributeFields *cls, const char **p1)
 
static bool OpenWithDefaultEditor (const char *sFilename, bool bWaitOnReturn=false)
 Open a given file with the default registered editor in the game engine. More...
 
- Protected Member Functions inherited from ParaEngine::IAttributeFields
virtual CAttributeClassCreateAttributeClass ()
 initialize fields
 
virtual CDynamicAttributesSetGetDynamicAttributes (bool bCreateIfNotExist=false)
 
- Protected Attributes inherited from ParaEngine::IObject
WeakPtr_type m_weak_reference
 
- Protected Attributes inherited from ParaEngine::CRefCounted
int m_refcount
 

Detailed Description

It's used as parameter to Draw method of each scene object.

Its only instance is in the RootScene object. It keeps track of all the intermediate results generated during game rendering. It might be used by game interface, environment simulator or AI, since most of the time we are only interested of computing object that is in the view.

Member Function Documentation

§ AddParticleSystem()

void ParaEngine::SceneState::AddParticleSystem ( ParticleSystem ps)

add a particle system to the scene state.

during each frame, the scene manager will render all absolute instances in the particle system list.

§ CheckAddRenderCount()

bool ParaEngine::SceneState::CheckAddRenderCount ( int  nRenderImportance)

Add one to the render count of a given render importance.

return true if it has not reached MAX rendered count.

§ Cleanup()

void ParaEngine::SceneState::Cleanup ( )

this function must be called, when the entire scene is reset or cleaned up.

§ CleanupSceneState()

void ParaEngine::SceneState::CleanupSceneState ( )

clean up all objects in post rendering lists. call this when you finished rendering one framework.

clean up all objects in post rendering lists. call this when you finished rendering one render frame.

§ EnableLocalMaterial()

void ParaEngine::SceneState::EnableLocalMaterial ( bool  bEnable = true)

Whether to use local material as current material.

§ GetBatchedElementDrawer()

IBatchedElementDraw * ParaEngine::SceneState::GetBatchedElementDrawer ( )

get the debug drawing object.

§ GetCameraToCurObjectDistance()

float ParaEngine::SceneState::GetCameraToCurObjectDistance ( )

get camera to current object distance.

this is automatically set by the pipeline before drawing a certain object.

§ GetCurrentLightStrength()

Vector3 & ParaEngine::SceneState::GetCurrentLightStrength ( )

x is the sun light strength, y is local light strength.

z is reserved.

§ GetCurrentMaterial()

ParaMaterial & ParaEngine::SceneState::GetCurrentMaterial ( )

this is the main function used by effect file to apply material to shaders.

§ GetCurrentSceneObject()

CBaseObject * ParaEngine::SceneState::GetCurrentSceneObject ( )

get the current scene object that is being processed.

the object may not be a valid scene object, unless one understands well when it is being assigned. the current scene object is assigned by the scene object itself in its animate or draw method.

§ GetFaceGroups()

CSortedFaceGroups * ParaEngine::SceneState::GetFaceGroups ( )

get sorted face groups.

§ GetGlobalMaterial()

ParaMaterial & ParaEngine::SceneState::GetGlobalMaterial ( )

this is the usually the global sun light material.

§ GetGlobalTime()

int ParaEngine::SceneState::GetGlobalTime ( )

get the global time.

§ GetLocalMaterial()

ParaMaterial & ParaEngine::SceneState::GetLocalMaterial ( )

this is the usually the material local to a given 3d position.

§ GetShadowMapCameraToCurObjectDistance()

float ParaEngine::SceneState::GetShadowMapCameraToCurObjectDistance ( )

get shadow map camera to current object distance.

This is usually a fixed value for all shadow casters, such as 500 meters

§ HasLocalMaterial()

bool ParaEngine::SceneState::HasLocalMaterial ( )

Whether to use local material.

§ InstallFields()

int ParaEngine::SceneState::InstallFields ( CAttributeClass pClass,
bool  bOverride 
)
virtual

this class should be implemented if one wants to add new attribute.

This function is always called internally.

Reimplemented from ParaEngine::IAttributeFields.

§ IsShadowPass()

bool ParaEngine::SceneState::IsShadowPass ( )

true if it is a shadow pass.

Currently it only affects the GetCameraToCurObjectDistance() for auto LOD mesh picking.

§ SetBatchedElementDrawer()

void ParaEngine::SceneState::SetBatchedElementDrawer ( IBatchedElementDraw pDebugDraw)

set the debug drawing object.

§ SetCameraToCurObjectDistance()

void ParaEngine::SceneState::SetCameraToCurObjectDistance ( float  fDist)

set camera to current object distance.

this is automatically set by the pipeline before drawing a certain object.

§ SetCurrentSceneObject()

void ParaEngine::SceneState::SetCurrentSceneObject ( CBaseObject pObj)

set the current scene object.

see GetCurrentSceneObject()

§ SetMaxRenderCount()

void ParaEngine::SceneState::SetMaxRenderCount ( int  nRenderImportance,
int  nCount 
)

the max number of objects to be rendered of a given render importance.

This is usually called at the beginning of a frame.

§ SetShadowMapCameraToCurObjectDistance()

void ParaEngine::SceneState::SetShadowMapCameraToCurObjectDistance ( float  fDist)

set shadow map camera to current object distance.

This is usually a fixed value for all shadow casters, such as 500 meters

§ SetShadowPass()

void ParaEngine::SceneState::SetShadowPass ( bool  bShadowPass)

true if it is a shadow pass.

Currently it only affects the GetCameraToCurObjectDistance() for auto LOD mesh picking.

Member Data Documentation

§ fAlphaFactor

float ParaEngine::SceneState::fAlphaFactor

the frame number that this object is last accessed.

§ listPostRenderingObjects

SceneState::List_PostRenderObject_TrackRef_Type ParaEngine::SceneState::listPostRenderingObjects

listPostRenderingObjects: this is the general post rendering list.

Objects in this list are sorted only by primary asset entity name. Texture entity is usually considered as the primary asset entity, since texture switch is most slow on GPU. The process goes like this: scan the list. For each items with the same texture as the first element in the list, render and remove it from the list. This goes on until the list is blank. When inserting items into the list, you can also sort while inserting. listPRSprite: Not only sorted by texture, but also use transparent key | alpha channel for all objects in the list. listPRBiped: biped, sorted by primary asset entity, this is always the MA asset. Note: post rendering are performed in the order listed above.

§ listPRSolidObject

SceneState::List_PostRenderObject_Type ParaEngine::SceneState::listPRSolidObject

list of Post Rendering object: biped with alpha blending

solid meshes (object) are usually rendered from front to back(near to far).

§ listPRTransparentObject

SceneState::List_AlphaPostRenderObject_Type ParaEngine::SceneState::listPRTransparentObject

transparent meshes (object) are usually rendered from back to front(far to near).

and they are rendered after all solid meshes have already been rendered. with "z-buffer write" disabled.

§ m_curLightStrength

Vector3 ParaEngine::SceneState::m_curLightStrength

x is the sun light strength, y is local light strength.

z is reserved.

§ m_dwD3D_CULLMODE

DWORD ParaEngine::SceneState::m_dwD3D_CULLMODE

the material alpha should be multiplied by this factor.

For opaque object, this is 1.0f. the pipeline required cull mode, mostly for reflection rendering during fixed function pipeline, where the cull mode is reversed. objects who will be rendered as reflections, should set the cull mode, according to this setting, rather then use what they think is correct. CULLNONE is an exception to this rule.

§ m_nRenderCount

int ParaEngine::SceneState::m_nRenderCount

how many times the scene has been rendered since its creation.

If this is 0, we may be pre-render stage or rendering is disabled.

§ m_pCurrentEffect

CEffectFile* ParaEngine::SceneState::m_pCurrentEffect

the object that has been touched by the mouse ray.

current effect object, this may be NULL

§ pTouchedObject

CBaseObject* ParaEngine::SceneState::pTouchedObject

the radius of the circle with the center at vEye:

contents outside are culled out when rendering


The documentation for this struct was generated from the following files: