My Project
SceneObject.h
1 #pragma once
2 #include "BaseObject.h"
3 #include "ShadowVolume.h"
4 #include "ShapeRay.h"
5 #include "SceneState.h"
6 #include "ObjScriptPool.h"
7 #include "IScene.h"
8 #include "IObjectDrag.h"
9 #include "util/ParaMemPool.h"
10 #include "util/unordered_array.hpp"
11 #include <list>
12 #include <map>
13 #include <queue>
14 
15 namespace ParaTerrain
16 {
17  class CGlobalTerrain;
18 }
19 
20 namespace ParaEngine
21 {
22  class IParaDebugDraw;
23  class IBatchedElementDraw;
24  class CBatchedElementDraw;
25  class BlockWorldClient;
26  class CTerrainTileRoot;
27  class DropShadowRenderer;
28  class CSunLight;
29  typedef ObjectScriptPool<CBaseObject> CSceneScripts;
30 
31  typedef CTerrainTile* CTerrainTilePtr;
32  typedef FixedSizedAllocator<CTerrainTilePtr> DL_Allocator_CTerrainTilePtr;
33  typedef std::deque<CTerrainTilePtr, DL_Allocator_CTerrainTilePtr > deque_CTerrainTilePtr_Type;
34  typedef std::queue<CTerrainTilePtr, deque_CTerrainTilePtr_Type > queue_CTerrainTilePtr_Type;
35 
36  typedef CBaseObject* CBaseObjectPtr;
37  typedef FixedSizedAllocator<CBaseObjectPtr> DL_Allocator_CBaseObjectPtr;
38  typedef std::deque<CBaseObjectPtr, DL_Allocator_CBaseObjectPtr > deque_CBaseObjectPtr_Type;
39  typedef std::queue<CBaseObjectPtr, deque_CBaseObjectPtr_Type > queue_CBaseObjectPtr_Type;
40 
41  typedef unordered_array<WeakPtr> list_IObjectWeakPtr_Type;
42 
44  typedef bool (*OBJECT_FILTER_CALLBACK)(CBaseObject* obj);
45 
58  class CSceneObject :
59  public CBaseObject,public IObjectDrag, public IScene
60  {
61  public:
65  typedef std::list <ShadowVolume*> ShadowVolumePool_Type;
67 #ifdef PARAENGINE_CLIENT
68  typedef std::vector <CMirrorSurface*> MirrorSufacePool_Type;
69 #endif
70  CSceneObject();
71  virtual ~CSceneObject(void);
72 
73  virtual CBaseObject::_SceneObjectType GetType(){return CBaseObject::SceneRoot;};
74  static CSceneObject* g_pRootscene;
76  static CSceneObject* GetInstance();
77 
78  /************************************************************************/
79  /* Object-level culling method */
80  /************************************************************************/
92  {
96  CENTER_ON_PLAYER = 0x1<<1,
100  VIEW_RADIUS_FOG = 0x1<<3,
103  };
104  public:
105 
107  // implementation of IAttributeFields
108 
110  virtual int GetAttributeClassID(){return ATTRIBUTE_CLASSID_CSceneObject;}
112  virtual const char* GetAttributeClassName(){static const char name[] = "CSceneObject"; return name;}
114  virtual const char* GetAttributeClassDescription(){static const char desc[] = ""; return desc;}
116  virtual int InstallFields(CAttributeClass* pClass, bool bOverride);
117 
119  virtual IAttributeFields* GetChildAttributeObject(const std::string& sName);
121  virtual int GetChildAttributeObjectCount(int nColumnIndex = 0);
123  virtual int GetChildAttributeColumnCount();
124  virtual IAttributeFields* GetChildAttributeObject(int nRowIndex, int nColumnIndex = 0);
125 
126  ATTRIBUTE_METHOD1(CSceneObject, IsModified_s, bool*) {*p1 = cls->IsModified(); return S_OK;}
127  ATTRIBUTE_METHOD1(CSceneObject, SetModified_s, bool) {cls->SetModified(p1); return S_OK;}
128 
129  ATTRIBUTE_METHOD1(CSceneObject, IsUsingFullScreenGlow_s, bool*) {*p1 = cls->IsUsingFullScreenGlow(); return S_OK;}
130  ATTRIBUTE_METHOD1(CSceneObject, EnableFullScreenGlow_s, bool) {cls->EnableFullScreenGlow(p1); return S_OK;}
131 
132 
133  ATTRIBUTE_METHOD1(CSceneObject, GetFullscreenGlowIntensity_s, float*) {*p1 = cls->GetFullscreenGlowIntensity(); return S_OK;}
134  ATTRIBUTE_METHOD1(CSceneObject, SetFullscreenGlowIntensity_s, float) {cls->SetFullscreenGlowIntensity(p1); return S_OK;}
135 
136  ATTRIBUTE_METHOD1(CSceneObject, GetFullscreenGlowBlendingFactor_s, float*) {*p1 = cls->GetFullscreenGlowBlendingFactor(); return S_OK;}
137  ATTRIBUTE_METHOD1(CSceneObject, SetFullscreenGlowBlendingFactor_s, float) {cls->SetFullscreenGlowBlendingFactor(p1); return S_OK;}
138 
139  ATTRIBUTE_METHOD1(CSceneObject, GetGlowness_s, Vector4*) {*p1 = *(Vector4*)(&cls->GetGlowness()); return S_OK;}
140  //ATTRIBUTE_METHOD1(CSceneObject, SetGlowness_s, Vector4) {LinearColor c(p1.x, p1.y,p1.z,1); cls->SetGlowness(c); return S_OK;}
141  //change glowness type to Vector4 --clayman 2011.7.19
142  ATTRIBUTE_METHOD1(CSceneObject, SetGlowness_s, Vector4) { cls->SetGlowness(p1); return S_OK;}
143 
144  ATTRIBUTE_METHOD1(CSceneObject, IsSunLightEnabled_s, bool*) {*p1 = cls->IsSunLightEnabled(); return S_OK;}
145  ATTRIBUTE_METHOD1(CSceneObject, EnableSunLight_s, bool) {cls->EnableSunLight(p1); return S_OK;}
146 
147  ATTRIBUTE_METHOD1(CSceneObject, IsLightEnabled_s, bool*) {*p1 = cls->IsLightEnabled(); return S_OK;}
148  ATTRIBUTE_METHOD1(CSceneObject, EnableLight_s, bool) {cls->EnableLight(p1); return S_OK;}
149 
150  ATTRIBUTE_METHOD1(CSceneObject, IsShowLocalLightMesh_s, bool*) {*p1 = cls->IsShowLocalLightMesh(); return S_OK;}
151  ATTRIBUTE_METHOD1(CSceneObject, ShowLocalLightMesh_s, bool) {cls->ShowLocalLightMesh(p1); return S_OK;}
152 
153  ATTRIBUTE_METHOD1(CSceneObject, GetMaxLocalLightsNum_s, int*) {*p1 = cls->GetMaxLocalLightsNum(); return S_OK;}
154  ATTRIBUTE_METHOD1(CSceneObject, SetMaxLocalLightsNum_s, int) {cls->SetMaxLocalLightsNum(p1); return S_OK;}
155 
156  ATTRIBUTE_METHOD1(CSceneObject, IsShadowMapEnabled_s, bool*) {*p1 = cls->IsShadowMapEnabled(); return S_OK;}
157  ATTRIBUTE_METHOD1(CSceneObject, SetShadow_s, bool) {cls->SetShadow(p1); return S_OK;}
158 
159  ATTRIBUTE_METHOD1(CSceneObject, GetMaximumNumShadowCasters_s, int*) {*p1 = cls->GetMaximumNumShadowCasters(); return S_OK;}
160  ATTRIBUTE_METHOD1(CSceneObject, SetMaximumNumShadowCasters_s, int) {cls->SetMaximumNumShadowCasters(p1); return S_OK;}
161 
162  ATTRIBUTE_METHOD1(CSceneObject, GetMaximumNumShadowReceivers_s, int*) {*p1 = cls->GetMaximumNumShadowReceivers(); return S_OK;}
163  ATTRIBUTE_METHOD1(CSceneObject, SetMaximumNumShadowReceivers_s, int) {cls->SetMaximumNumShadowReceivers(p1); return S_OK;}
164 
165  ATTRIBUTE_METHOD1(CSceneObject, GetMaxCharTriangles_s, int*) {*p1 = cls->GetMaxCharTriangles(); return S_OK;}
166  ATTRIBUTE_METHOD1(CSceneObject, SetMaxCharTriangles_s, int) {cls->SetMaxCharTriangles(p1); return S_OK;}
167 
168  ATTRIBUTE_METHOD1(CSceneObject, GetBackGroundColor_s, Vector3*) { *p1 = cls->GetBackGroundColor().ToVector3(); return S_OK;}
169  ATTRIBUTE_METHOD1(CSceneObject, SetBackGroundColor_s, Vector3) {LinearColor c(p1.x, p1.y,p1.z,1); cls->SetBackGroundColor(c); return S_OK;}
170 
171  ATTRIBUTE_METHOD1(CSceneObject, IsFogEnabled_s, bool*) {*p1 = cls->IsFogEnabled(); return S_OK;}
172  ATTRIBUTE_METHOD1(CSceneObject, EnableFog_s, bool) {cls->EnableFog(p1); return S_OK;}
173 
174  ATTRIBUTE_METHOD1(CSceneObject, GetFogColor_s, Vector3*) { *p1 = cls->GetFogColorFactor().ToVector3(); return S_OK; }
175  ATTRIBUTE_METHOD1(CSceneObject, SetFogColor_s, Vector3) {LinearColor c(p1.x, p1.y,p1.z,1); cls->SetFogColorFactor(c); return S_OK;}
176 
177  ATTRIBUTE_METHOD1(CSceneObject, GetFogStart_s, float*) {*p1 = cls->GetFogStart(); return S_OK;}
178  ATTRIBUTE_METHOD1(CSceneObject, SetFogStart_s, float) {cls->SetFogStart(p1); return S_OK;}
179 
180  ATTRIBUTE_METHOD1(CSceneObject, GetFogEnd_s, float*) {*p1 = cls->GetFogEnd(); return S_OK;}
181  ATTRIBUTE_METHOD1(CSceneObject, SetFogEnd_s, float) {cls->SetFogEnd(p1); return S_OK;}
182 
183  ATTRIBUTE_METHOD1(CSceneObject, GetFogDensity_s, float*) {*p1 = cls->GetFogDensity(); return S_OK;}
184  ATTRIBUTE_METHOD1(CSceneObject, SetFogDensity_s, float) {cls->SetFogDensity(p1); return S_OK;}
185 
186  ATTRIBUTE_METHOD1(CSceneObject, GetMinPopUpDistance_s, float*) {*p1 = cls->GetMinPopUpDistance(); return S_OK;}
187  ATTRIBUTE_METHOD1(CSceneObject, SetMinPopUpDistance_s, float) {cls->SetMinPopUpDistance(p1); return S_OK;}
188 
189  ATTRIBUTE_METHOD1(CSceneObject, GetOnClickDistance_s, float*) {*p1 = cls->GetOnClickDistance(); return S_OK;}
190  ATTRIBUTE_METHOD1(CSceneObject, SetOnClickDistance_s, float) {cls->SetOnClickDistance(p1); return S_OK;}
191 
192  ATTRIBUTE_METHOD1(CSceneObject, IsRenderSky_s, bool*) {*p1 = cls->IsRenderSky(); return S_OK;}
193  ATTRIBUTE_METHOD1(CSceneObject, EnableSkyRendering_s, bool) {cls->EnableSkyRendering(p1); return S_OK;}
194 
195  ATTRIBUTE_METHOD1(CSceneObject, IsScenePaused_s, bool*) {*p1 = cls->IsScenePaused(); return S_OK;}
196  ATTRIBUTE_METHOD1(CSceneObject, PauseScene_s, bool) {cls->PauseScene(p1); return S_OK;}
197 
198  ATTRIBUTE_METHOD1(CSceneObject, IsSceneEnabled_s, bool*) {*p1 = cls->IsSceneEnabled(); return S_OK;}
199  ATTRIBUTE_METHOD1(CSceneObject, EnableScene_s, bool) {cls->EnableScene(p1); return S_OK;}
200 
201  ATTRIBUTE_METHOD1(CSceneObject, IsShowBoundingBox_s, bool*) {*p1 = cls->IsShowBoundingBox(); return S_OK;}
202  ATTRIBUTE_METHOD1(CSceneObject, ShowBoundingBox_s, bool) {cls->ShowBoundingBox(p1); return S_OK;}
203 
204  ATTRIBUTE_METHOD1(CSceneObject, IsGenerateReport_s, bool*) {*p1 = cls->IsGenerateReport(); return S_OK;}
205  ATTRIBUTE_METHOD1(CSceneObject, SetGenerateReport_s, bool) {cls->SetGenerateReport(p1); return S_OK;}
206 
207  ATTRIBUTE_METHOD1(CSceneObject, IsPortalSystemShown_s, bool*) {*p1 = cls->IsPortalSystemShown(); return S_OK;}
208  ATTRIBUTE_METHOD1(CSceneObject, ShowPortalSystem_s, bool) {cls->ShowPortalSystem(p1); return S_OK;}
209 
210  ATTRIBUTE_METHOD1(CSceneObject, IsAutoPlayerRippleEnabled_s, bool*) {*p1 = cls->IsAutoPlayerRippleEnabled(); return S_OK;}
211  ATTRIBUTE_METHOD1(CSceneObject, EnableAutoPlayerRipple_s, bool) {cls->EnableAutoPlayerRipple(p1); return S_OK;}
212 
213  ATTRIBUTE_METHOD1(CSceneObject, IsHeadOnDisplayShown_s, bool*) {*p1 = cls->IsHeadOnDisplayShown(); return S_OK;}
214  ATTRIBUTE_METHOD1(CSceneObject, ShowHeadOnDisplay_s, bool) {cls->ShowHeadOnDisplay(p1); return S_OK;}
215 
216  ATTRIBUTE_METHOD1(CSceneObject, IsPortalZoneEnabled_s, bool*) {*p1 = cls->IsPortalZoneEnabled(); return S_OK;}
217  ATTRIBUTE_METHOD1(CSceneObject, EnablePortalZone_s, bool) {cls->EnablePortalZone(p1); return S_OK;}
218 
219  ATTRIBUTE_METHOD1(CSceneObject, IsUseWireFrame_s, bool*) {*p1 = cls->IsUseWireFrame(); return S_OK;}
220  ATTRIBUTE_METHOD1(CSceneObject, SetUseWireFrame_s, bool) {cls->SetUseWireFrame(p1); return S_OK;}
221 
222  ATTRIBUTE_METHOD1(CSceneObject, IsForceExportPhysics_s, bool*) {*p1 = cls->IsForceExportPhysics(); return S_OK;}
223  ATTRIBUTE_METHOD1(CSceneObject, SetForceExportPhysics_s, bool) {cls->SetForceExportPhysics(p1); return S_OK;}
224 
225  ATTRIBUTE_METHOD1(CSceneObject, IsInstancingEnabled_s, bool*) {*p1 = cls->IsInstancingEnabled(); return S_OK;}
226  ATTRIBUTE_METHOD1(CSceneObject, EnableInstancing_s, bool) {cls->EnableInstancing(p1); return S_OK;}
227 
228  ATTRIBUTE_METHOD1(CSceneObject, GetMaxHeadOnDisplayDistance_s, float*) {*p1 = cls->GetMaxHeadOnDisplayDistance(); return S_OK;}
229  ATTRIBUTE_METHOD1(CSceneObject, SetMaxHeadOnDisplayDistance_s, float) {cls->SetMaxHeadOnDisplayDistance(p1); return S_OK;}
230 
231  ATTRIBUTE_METHOD1(CSceneObject, IsPersistent_s, bool*) {*p1 = cls->IsPersistent(); return S_OK;}
232  ATTRIBUTE_METHOD1(CSceneObject, SetPersistent_s, bool) {cls->SetPersistent(p1); return S_OK;}
233 
234  ATTRIBUTE_METHOD(CSceneObject, ScreenShotReflection_s) {return cls->ScreenShotReflection() ? S_OK:E_FAIL;}
235  ATTRIBUTE_METHOD(CSceneObject, ScreenShotShadowMap_s) {return cls->ScreenShotShadowMap() ? S_OK:E_FAIL;}
236  ATTRIBUTE_METHOD(CSceneObject, ScreenShotGlowMap_s) {return cls->ScreenShotGlowMap() ? S_OK:E_FAIL;}
237  ATTRIBUTE_METHOD(CSceneObject, ClearParticles_s) {cls->ClearParticles(); return S_OK;}
238  ATTRIBUTE_METHOD(CSceneObject, UnLoadFlashTextures_s) {return cls->UnLoadFlashTextures() ? S_OK:E_FAIL;}
239 
240  ATTRIBUTE_METHOD1(CSceneObject, GetPhysicsDebugDrawMode_s, int*) {*p1 = cls->GetPhysicsDebugDrawMode(); return S_OK;}
241  ATTRIBUTE_METHOD1(CSceneObject, SetPhysicsDebugDrawMode_s, int) {cls->SetPhysicsDebugDrawMode(p1); return S_OK;}
242 
243  ATTRIBUTE_METHOD1(CSceneObject, IsBlockInput_s, bool*) {*p1 = cls->IsBlockInput(); return S_OK;}
244  ATTRIBUTE_METHOD1(CSceneObject, SetBlockInput_s, bool) {cls->SetBlockInput(p1); return S_OK;}
245 
246  ATTRIBUTE_METHOD1(CSceneObject, GetAllMiniSceneGraphNames_s, const char**) {*p1 = cls->GetAllMiniSceneGraphNames().c_str(); return S_OK;}
247 
248  ATTRIBUTE_METHOD1(CSceneObject, GetShadowRadius_s, float*) {*p1 = cls->GetShadowRadius(); return S_OK;}
249  ATTRIBUTE_METHOD1(CSceneObject, SetShadowRadius_s, float) {cls->SetShadowRadius(p1); return S_OK;}
250 
251  ATTRIBUTE_METHOD1(CSceneObject, IsDropShadow_s, bool*) {*p1 = cls->IsDropShadow(); return S_OK;}
252  ATTRIBUTE_METHOD1(CSceneObject, SetDropShadow_s, bool) {cls->SetDropShadow(p1); return S_OK;}
253 
254  ATTRIBUTE_METHOD1(CSceneObject, IsUsingScreenWaveEffect_s, bool*) {*p1 = cls->IsUsingScreenWaveEffect(); return S_OK;}
255  ATTRIBUTE_METHOD1(CSceneObject, SetEnableScreenWaveEffect_s, bool) {cls->EnableScreenWaveEffect(p1); return S_OK;}
256 
257  ATTRIBUTE_METHOD1(CSceneObject, IsShowMainPlayer_s, bool*) {*p1 = cls->IsShowMainPlayer(); return S_OK;}
258  ATTRIBUTE_METHOD1(CSceneObject, ShowMainPlayer_s, bool) {cls->ShowMainPlayer(p1); return S_OK;}
259 
260  ATTRIBUTE_METHOD1(CSceneObject, SetShadowMapTexelSize_s, int) { cls->SetShadowMapTexelSize(p1, p1); return S_OK; }
261  public:
263  void ShowHeadOnDisplay(bool bShow){m_bShowHeadOnDisplay = bShow;};
264 
266  bool IsHeadOnDisplayShown(){return m_bShowHeadOnDisplay;};
267 
269  void SetMaxHeadOnDisplayDistance(float fDist){m_fMaxHeadOnDisplayDistance = fDist;};
270 
272  float GetMaxHeadOnDisplayDistance(){return m_fMaxHeadOnDisplayDistance;};
273 
275  bool ScreenShotReflection();
277  bool ScreenShotShadowMap();
279  bool ScreenShotGlowMap();
280 
282  bool UnLoadFlashTextures();
283 
285  void ClearParticles();
286 
288  void SetForceExportPhysics(bool bWhetherPhysicsAreAlwaysExported);
289 
291  bool IsForceExportPhysics();
292 
294  float GetMinPopUpDistance(){return m_fMinPopUpDistance;};
295  void SetMinPopUpDistance(float fDist){m_fMinPopUpDistance = fDist;}
296 
298  bool IsSnapToTerrain(){return m_bSnapToTerrain;};
299 
301  bool IsShowBoundingBox(){return m_bShowBoundingBox;};
302  void ShowBoundingBox(bool bEnable){m_bShowBoundingBox = bEnable;}
303 
305  bool IsGenerateReport(){return m_bGenerateReport;};
306  void SetGenerateReport(bool bEnable){m_bGenerateReport = bEnable;}
307 
309  bool IsOcclusionQueryEnabled(){return m_bEnableOcclusionQuery;};
310  void EnableOcclusionQuery(bool bEnable){m_bEnableOcclusionQuery = bEnable;}
311 
314  void EnableInstancing(bool bEnable){m_bUseInstancing = bEnable;}
315 
317  bool IsShowMainPlayer();
318  void ShowMainPlayer(bool bEnable);
319 
321  bool CanShowMainPlayer() const;
322  void SetCanShowMainPlayer(bool val);
323 
325  bool IsScenePaused(){return m_bGamePaused;};
326  void PauseScene(bool bEnable);
327 
329  bool IsSceneEnabled(){return m_bGameEnabled;};
330  void EnableScene(bool bEnable);
331 
333  void SetModified(bool bModified);
335  bool IsModified();
336 
338  bool IsSunLightEnabled();
340  void EnableSunLight(bool bEnable);
341 
343  bool IsLightEnabled();
345  void EnableLight(bool bEnable);
346 
351  void SetMaxLocalLightsNum(int nNum);
352 
357  int GetMaxLocalLightsNum();
358 
360  bool IsShowLocalLightMesh();
362  void ShowLocalLightMesh(bool bShow);
363 
365  bool IsRenderSky(){ return m_bRenderSky; }
366  void EnableSkyRendering(bool bEnable){m_bRenderSky = bEnable;};
367 
369  void SetBackGroundColor(const LinearColor& bgColor);
372 
375 
377  void SetFogColorFactor(const LinearColor& fogColorFactor){m_FogColorFactor = fogColorFactor;};
378  const LinearColor& GetFogColorFactor(){return m_FogColorFactor;};
379  void SetFogColor(const LinearColor& fogColor);
380  LinearColor GetFogColor();
381  void SetFogStart(float fFogStart);
382  float GetFogStart();
383  void SetFogEnd(float fFogEnd);
384  float GetFogEnd();
385  void SetFogDensity(float fFogDensity);
386  float GetFogDensity();
387  void EnableFog(bool bEnableFog);
388  bool IsFogEnabled();
389  void ResetCameraAndFog();
390  void SetAndRestoreFog(bool bEnableFog, DWORD dwFogColor, FLOAT fFogStart, FLOAT fFogEnd, FLOAT fFogDensity);
391 
393  void SetShadow(bool bRenderShadow);
395  bool IsShadowMapEnabled();
396 
399 
401  void SetMaximumNumShadowCasters(int nNum);
402 
405 
407  void SetMaximumNumShadowReceivers(int nNum);
408 
411  void SetMaxCharTriangles(int nNum);
412 
415  int GetMaxCharTriangles();
416 
422  void SetMaxRenderCount(int nRenderImportance, int nCount);
428  int GetMaxRenderCount(int nRenderImportance);
429 
431  bool IsUsingFullScreenGlow();
432 
434  void EnableFullScreenGlow( bool bEnable);
435 
436  bool IsUsingScreenWaveEffect();
437  void EnableScreenWaveEffect(bool value);
438 
442  void SetCursor(const char* szCursorFile, int nHotSpotX = -1, int nHotSpotY = -1);
443  const std::string& GetCursor(int* pnHotSpotX = 0, int* pnHotSpotY = 0) const;
444 
445  //now glowness contains 4 control value
446  //glowness.x : glow saturate
447  //glowness.y : glow brightness/intensity
448  //glowness.z : original scene saturate
449  //glowness.w : original scene brightness/intensity --clayman 2011.7.19
450 
451  void SetGlowness(const Vector4& Glowness);
452  const Vector4& GetGlowness();
453 
454 
457  void SetShadowMapTexelSizeLevel(int nLevel);
459  void SetShadowMapTexelSize(int nWidth, int nHeight);
460 
461  public:
467  bool CheckObjectCullingMethod(DWORD dwMethod){
468  return ((dwMethod & m_dwObjCullingMethod)==dwMethod);
469  };
472  CManagedLoader* GetManagedLoader(string sName);
474  bool DeleteManagedLoader(string sName);
477  CManagedLoader* CreateManagedLoader(string sName);
478 
479  void AddConsoleStr(const char * pStr);
480  void ClearConsoleStr();
481 
483  bool IsInitialized();
484 
491  void OnTerrainChanged(const Vector3& vCenter, float fRadius);
492 
496  void ResetScene();
517  void RegenerateRenderOrigin(const Vector3& vPos);
518 
521  // void CleanDeleteList();
522 
525 
527  bool DeleteSentientObject(IGameObject* pObj);
530  void AddSentientObject(IGameObject* pObj, bool bCheckDuplicate = false);
531 
533  inline CTerrainTileRoot* GetRootTile() {return m_pTileRoot.get();};
534 
536  inline CBaseCamera* GetCurrentCamera(){ return m_pCurrentCamera;};
537 
545  bool CreateSkyBox(const string& strObjectName, AssetEntity& MeshAsset, float fScaleX, float fScaleY,float fScaleZ, float fHeightOffset);
548  bool DeleteSkyBox(const string& strObjectName);
549 
551 
552  /*
553  * @absolete: this function is no longer used.
554  * detach a specified object from the scene and destroy it. A destroyed object can no longer be used.
555  * @param id: if id == "\\", the entire scene is deleted and game is put into unloaded state and paused.
556  * asset is not released by this call.
557  */
558  void DestroyObjectByName(const char * id);
573  IObject* AttachObject(CBaseObject * pObject);
574 
586  bool DetachObject(CBaseObject * pObject);
587 
592  virtual CBaseObject* GetGlobalObject(const string& sName);
593 
599  CBaseObject* GetLocalObject(const string& sName, const Vector3& vPos);
600 
608  CBaseObject* GetLocalObject(const Vector3& vPos, float fEpsilon=0.01f);
609  CBaseObject* GetLocalObject(const Vector3& vPos, const std::string& sName, float fEpsilon=0.01f);
610 
618  CBaseObject* GetObject(const string& sName, const Vector3& vPos, bool bGlobal);
619 
623  CBaseObject* FindObjectByNameAndType(const std::string& sName, const std::string& sClassName);
624 
630  CBaseObject* GetObjectByViewBox(const CShapeAABB& viewbox);
631 
641  int GetObjectsBySphere(list<CBaseObject*>& output, const CShapeSphere& sphere, OBJECT_FILTER_CALLBACK pFnctFilter=NULL, int nMethod=0);
642 
653  int GetObjectsByScreenRect(list<CBaseObject*>& output, const RECT& rect,OBJECT_FILTER_CALLBACK pFnctFilter=NULL, float fMaxDistance = -1.f);
654 
658 
664  void EnablePostProcessing(bool bEnable, const char* sCallbackScript);
665 
668 
670  CMiniSceneGraph* GetMiniSceneGraph(const string& name);
671 
675  int DeleteMiniSceneGraph(const string& name);
676 
678  void EnableMiniSceneGraph(bool bEnable);
679 
682 
684  const std::string& GetAllMiniSceneGraphNames();
685 
694  bool DeleteObject(CBaseObject * pObject);
695 
698  void ShowPortalSystem(bool bEnable);
699 
701  bool IsPortalSystemShown();
702 
706  void UnloadObjectResources(CBaseObject * pObject);
707 
709  virtual HRESULT InitDeviceObjects();
710  virtual HRESULT DeleteDeviceObjects();
711  virtual HRESULT RestoreDeviceObjects();
712  virtual HRESULT InvalidateDeviceObjects();
713  virtual HRESULT RendererRecreated();
714  virtual void Cleanup();
715 
736  float PickClosest(const Vector3& vPickRayOrig, const Vector3& vPickRayDir , CBaseObject** pTouchedObject, Vector3* vIntersectPos, Vector3* vImpactNormal = NULL, bool bTestObject=false, float fMaxDistance = 0, DWORD dwGroupMask=0xffffffff);
737 
739  float PickClosest(int nScreenX, int nScreenY, CBaseObject** pPickedObject, Vector3* vIntersectPos, Vector3* vImpactNormal = NULL, bool bTestObject=false, float fMaxDistance=0, DWORD dwGroupMask=0xffffffff);
761  bool PickObject(const CShapeRay& ray, CBaseObject** pTouchedObject, float fMaxDistance=0, OBJECT_FILTER_CALLBACK pFnctFilter=NULL);
763  bool PickObject(int nScreenX, int nScreenY, CBaseObject** pTouchedObject, float fMaxDistance=0, OBJECT_FILTER_CALLBACK pFnctFilter=NULL);
764 
772  int SelectObject(int nGroupIndex, const CShapeOBB& box, OBJECT_FILTER_CALLBACK pFnctFilter=NULL);
773  int SelectObject(int nGroupIndex, const CShapeSphere& circle, OBJECT_FILTER_CALLBACK pFnctFilter=NULL);
774 
776  void PauseGame(){PauseScene(true);};
778  void DisableGame(){ EnableScene(false);};
779 
780 
781  // -- For rendering and frame move --
782  virtual void Animate( double dTimeDelta, int nRenderNumber=0);
783 
789  HRESULT AdvanceScene( double dTimeDelta, int nPipelineOrder = PIPELINE_3D_SCENE);
790 
791  void UpdateFogColor();
793  Vector3 GetFogColor(float fAngle);
794 
801  int RenderSelection(DWORD dwSelection=0xffffffff, double dTimeDelta=0);
802 
805 
809  int RenderHeadOnDisplay(int nPass = 0);
810 
816  CMirrorSurface* GetMirrorSurface(int nIndex);
817 
818  // -- Used mostly internally
819  virtual HRESULT Draw(SceneState * sceneState);
820  void RenderShadows();
821  void RenderShadowMap();
823 
826 
827  //render screen wave effect
828  void RenderScreenWaveEffect();
829 
830  void ApplyWaterFogParam();
831  void RestoreSceneFogParam();
832 
834  void SetCurrentPlayer(CBipedObject* pPlayer);
835 
844 
848  bool HandleUserInput();
849 
851  CSceneScripts& GetScripts();
852 
856  void EnableMouseEvent(bool bEnable, DWORD dwEvents=0xffff);
857 
859  const CEventBinding * GetEventBinding();
860 
863 
867  void SetCurrentActor(CBaseObject* pActor);
868 
871  void UpdateOcean();
872 
878  int SaveLocalCharacters();
879 
885  int SaveAllCharacters();
886 
890  int SaveCharacterToDB(IGameObject* pObj);
897 
899  bool IsPersistent();
900 
902  void SetPersistent(bool bPersistent);
903 
905  virtual void SetCandrag(bool bCandrag){m_bCandrag=bCandrag;}
906  virtual bool GetCandrag()const{return m_bCandrag;}
907  virtual void BeginDrag(int nEvent, int x, int y, int z){}
908  virtual void EndDrag(int nEvent, int x, int y, int z){}
909  virtual BOOL IsOnObject(int x,int y, int z);
910  bool IsPickingObject(){return m_bPickFlag;};
911 
919 
927  bool LoadNPCByNPCDbItem(CNpcDbItem& npc,CRpgCharacter** pOut, bool bReload = false);
928 
936  bool DB_LoadNPCByID(int nNPCID, CRpgCharacter** pOut, bool bReload = false);
944  bool DB_LoadNPCByName(const string& sName, CRpgCharacter** pOut, bool bReload = false);
945 
954  int DB_LoadNPCsByRegion(const Vector3& vMin, const Vector3& vMax, bool bReload = false);
955 
962  void SetFullscreenGlowIntensity(float fGlowIntensity);
963  float GetFullscreenGlowIntensity();
964 
971  void SetFullscreenGlowBlendingFactor(float fGlowFactor);
972  float GetFullscreenGlowBlendingFactor();
973 
975  bool IsAutoPlayerRippleEnabled(){return m_bAutoPlayerRipple;};
977  void EnableAutoPlayerRipple(bool bEnable){m_bAutoPlayerRipple = bEnable;};
978 
980  bool IsPortalZoneEnabled(){return m_bEnablePortalZone;};
981 
983  void EnablePortalZone(bool bEnable){m_bEnablePortalZone = bEnable;};
984 
986  bool IsUseWireFrame(){return m_bUseWireFrame;};
987 
989  void SetUseWireFrame(bool UseWireFrame );
990 
991 
993  inline list_IObjectWeakPtr_Type& GetSentientObjects(){ return m_sentientGameObjects; };
994 
997  inline MissileObjectPool_Type& GetMissiles(){return m_missiles;};
998 
1000  void SetEnvironmentSim(IEnvironmentSim* pSim);
1001 
1004  SceneState* GetSceneState(){return m_sceneState.get();};
1005  inline CPhysicsWorld* GetPhysicsWorld() {return m_pPhysicsWorld.get();} ;
1006  inline IEnvironmentSim* GetEnvSim() {return m_pEnvironmentSim;};
1007 
1010 
1011  IBatchedElementDraw* GetBatchedElementDrawer();
1012 
1015  void SetPhysicsDebugDrawMode(int nMode);
1016 
1020 
1022  void SetOnClickDistance(float fDist){ m_fOnClickDistance = fDist;}
1023  float GetOnClickDistance(){ return m_fOnClickDistance;}
1024 
1026  CZoneNode * CreateGetZoneNode(const char* sName);
1028  CZoneNode * GetZoneNode(const char* sName);
1030  CPortalNode * CreateGetPortalNode(const char* sName);
1032  CPortalNode * GetPortalNode(const char* sName);
1033 
1036  virtual float GetShadowRadius() { return m_fShadowRadius; }
1037  void SetShadowRadius(float fShadowRadius);
1038 
1040  bool IsBlockInput(){return m_bBlockInput;}
1041  void SetBlockInput(bool bBlockInput){m_bBlockInput = bBlockInput;}
1042 
1044  virtual void SetPhysicsGroupMask(DWORD dwValue);
1045 
1047  virtual DWORD GetPhysicsGroupMask();
1048 
1049  bool IsDropShadow(){return m_renderDropShadow;}
1050  void SetDropShadow(bool useDropShadow){m_renderDropShadow = useDropShadow;}
1051 
1054  void AddToDeadObjectPool(CBaseObject* pObject);
1055  void RemoveDeadObjects();
1056  private:
1057 
1059  bool m_bBlockInput;
1060 
1062  bool m_bEnablePostProcessing;
1065  string m_sPostPorcessorCallbackScript;
1066 
1068  bool m_bShowHeadOnDisplay;
1069 
1071  float m_fMaxHeadOnDisplayDistance;
1072 
1074  bool m_bEnableMiniScenegraph;
1075 
1077  bool m_bAutoPlayerRipple;
1082  DWORD m_dwObjCullingMethod;
1086  float m_fCullingPixelsHeight;
1090  float m_fMinPopUpDistance;
1091 
1093  map <string, CManagedLoader*> m_managedloader;
1094 
1095  bool m_bRenderFog;
1097  DWORD m_dwFogColor;
1098  LinearColor m_FogColorFactor;
1099  FLOAT m_fFogStart;
1100  FLOAT m_fFogEnd;
1101  FLOAT m_fFogDensity;
1102 
1104  float m_fShadowRadius;
1105 
1107  DWORD m_dwBackGroundColor;
1108  bool m_bSnapToTerrain;
1109  bool m_bShowBoundingBox;
1110  bool m_bGenerateReport;
1111 
1113  bool m_bEnableOcclusionQuery;
1114 
1116  bool m_bGamePaused;
1118  bool m_bGameEnabled;
1119 
1121  ShadowVolumePool_Type m_ShadowVolumes;
1122  bool m_bRenderMeshShadow;
1123 
1125  CameraPool_type m_cameras;
1126  CBaseCamera* m_pCurrentCamera;
1127  SkyMeshPool_type m_skymeshes;
1128  MiniSceneGraphPool_type m_miniSceneGraphs;
1129 
1131  bool m_bRenderSky;
1132 
1134  bool m_bModified;
1135 
1137  CGUIEvent *m_event;
1138 
1140  Vector3 m_vRenderOrigin;
1141 
1144  ref_ptr<SceneState> m_sceneState;
1145 
1147  int m_nMaxNumShadowCasters;
1148  int m_nMaxNumShadowReceivers;
1149 
1152  int m_nMaxCharTriangles;
1153 
1154 
1157  float m_fFullscreenGlowIntensity;
1158  float m_fFullscreenGlowBlendingFactor;
1159 
1161  ref_ptr<ParaTerrain::CGlobalTerrain> m_globalTerrain;
1162 
1164  CSceneScripts m_scripts;
1166  bool m_bInitialized;
1167 
1170  DWORD m_dwEnableMouseEvent;
1172  CBipedObject* m_currentplayer;
1173 
1175  bool m_bEnableLighting;
1177  bool m_bEnableSunLight;
1178 
1180  ref_ptr<CSunLight> m_pSunLight;
1181 
1182  CBaseObject* m_pickObj;
1184  CBaseObject* m_pActor;
1185 
1187  bool m_bShowLocalLightMesh;
1188 
1189  bool m_bPickFlag;
1190 
1191 
1193  bool m_bEnablePortalZone;
1194 
1196  bool m_bShowPortalSystem;
1197 
1199  bool m_bUseWireFrame;
1200 
1201 
1203  float m_fCoefF, m_fCoefN, m_fCoefK;
1204 
1210  virtual bool PrepareRenderObject(CBaseObject* pObj, CBaseCamera* pCamera, SceneState& sceneState);
1211 
1214  virtual int PrepareRender(CBaseCamera* pCamera, SceneState * pSceneState);
1215 
1216  void PrepareRenderAllChildren(CBaseCamera* pCamera, SceneState& sceneState);
1217 
1218  void PrepareCameraState(CBaseCamera* pCamera, SceneState &sceneState);
1219 
1221  void PreparePortalsAndZones(CBaseCamera* pCamera, SceneState &sceneState);
1222 
1224  void PrepareMissileObjects(CBaseCamera* pCamera, SceneState &sceneState);
1225 
1228  void PrepareTileObjects(CBaseCamera* pCamera, SceneState &sceneState);
1229 
1230  void UpdateMovableObjectZone(SceneState &sceneState, SceneState::List_PostRenderObject_Type& listPRBiped);
1231 
1233  void AutoGenPlayerRipple(float fTimeDelta);
1234 
1238  void CreateAttributeModels();
1239 
1240 #ifdef USE_DIRECTX_RENDERER
1241  std::unique_ptr<DropShadowRenderer> m_dropShadowRenderer;
1242 #endif
1243  bool m_renderDropShadow;
1244 
1245  LinearColor m_defaultAmbColor;
1246  LinearColor m_defaultFogColor;
1247  float m_defaultFogStart;
1248  float m_defaultFogEnd;
1249 
1250 
1251  //
1252  ref_ptr<BlockWorldClient> m_pBlockWorldClient;
1253 
1254  protected:
1255  IEnvironmentSim* m_pEnvironmentSim;
1257 
1259 
1261  list_IObjectWeakPtr_Type m_sentientGameObjects;
1264  MissileObjectPool_Type m_missiles;
1265 #ifdef PARAENGINE_CLIENT
1266 
1267  MirrorSufacePool_Type m_mirrorSurfaces;
1268 #endif
1269 
1270  map <string, CZoneNode*> m_zones;
1272  map <string, CPortalNode*> m_portals;
1273 
1278 
1281  char m_sConsoleString[200];
1282 
1285 
1288 
1291 
1294 
1297 
1299  vector<int> m_MaxRenderCount;
1300 
1303 
1305  std::string m_sCursorFile;
1310 
1313 
1318  friend class CParaEngineApp;
1319  };
1320 
1321 }
bool IsGenerateReport()
whether to use generate scene report.
Definition: SceneObject.h:305
float GetMinPopUpDistance()
all objects must be drawn when they are within this radius.
Definition: SceneObject.h:294
void SetForceExportPhysics(bool bWhetherPhysicsAreAlwaysExported)
set whether physics of MeshPhysicsObject is always exported regardless of per object settings...
Definition: SceneObject.cpp:4668
bool DetachObject(CBaseObject *pObject)
detach an object from the scene graph.
Definition: SceneObject.cpp:665
void UpdateOcean()
call this function, when the ocean has changed or the environment has changed.
Definition: SceneObject.cpp:2060
virtual void EndDrag(int nEvent, int x, int y, int z)
Default EndDrag handle function.
Definition: SceneObject.h:908
bool m_bIsPersistent
whether the scene can be automatically marked as modified
Definition: SceneObject.h:1290
void SetUseWireFrame(bool UseWireFrame)
set whether to use wire frame
Definition: SceneObject.cpp:4341
virtual void SetPhysicsGroupMask(DWORD dwValue)
set groups Mask used to filter physics objects, default to 0xffffffff
Definition: SceneObject.cpp:551
void SetMaxCharTriangles(int nNum)
set max number of character triangles allowed.
Definition: SceneObject.cpp:362
CBaseObject * GetObject(const string &sName, const Vector3 &vPos, bool bGlobal)
this function is just a short cut for (bGlobal ? GetGlobalObject():GetLocalObject()) ...
Definition: SceneObject.cpp:717
a flying missile in the global space.
Definition: MissileObject.h:11
Definition: SceneObject.h:15
void EnableMouseEvent(bool bEnable, DWORD dwEvents=0xffff)
Whether to generate mouse events for the scene objects.
Definition: SceneObject.cpp:3669
int RenderCharacters(SceneState &sceneState, SceneState::List_PostRenderObject_TrackRef_Type &listPRBiped)
render characters
Definition: SceneObject.cpp:3160
void SetPhysicsDebugDrawMode(int nMode)
set the physics debug draw mode.
Definition: SceneObject.cpp:4699
CSunLight & GetSunLight()
get sun light object
Definition: SceneObject.cpp:2657
void SetMaximumNumShadowCasters(int nNum)
set the maximum number of shadow casters.
Definition: SceneObject.cpp:387
an attribute class is a collection of attribute fields.
Definition: AttributeClass.h:10
virtual void Cleanup()
Desc: Called before the app exits, this function gives the app the chance to cleanup after itself...
Definition: SceneObject.cpp:1071
IParaDebugDraw * GetDebugDrawer()
deprecated: use GetBatchedElementDrawer()
Definition: SceneObject.cpp:329
float PickClosest(const Vector3 &vPickRayOrig, const Vector3 &vPickRayDir, CBaseObject **pTouchedObject, Vector3 *vIntersectPos, Vector3 *vImpactNormal=NULL, bool bTestObject=false, float fMaxDistance=0, DWORD dwGroupMask=0xffffffff)
Checks if mouse point hits any physical geometry in the current scene.
Definition: SceneObjectPicking.cpp:242
int SaveAllCharacters()
save all local characters in the scene to the current NPC database regardless of whether they are mod...
Definition: SceneObject.cpp:3892
It&#39;s used as parameter to Draw method of each scene object.
Definition: SceneState.h:284
CBaseObject * TogglePlayer()
It changes the current player to the next player in the scene.
Definition: SceneObject.cpp:4269
bool IsUseWireFrame()
whether to use wire frame
Definition: SceneObject.h:986
void RenderFullScreenGlowEffect()
render the full screen glow effect
Definition: SceneObject.cpp:4153
bool IsLightEnabled()
get light enable state
Definition: SceneObject.cpp:509
CZoneNode * GetZoneNode(const char *sName)
get a zone node by its name.
Definition: SceneObject.cpp:416
4-dimensional homogeneous vector.
Definition: ParaVector4.h:10
Definition: combase.h:159
const std::string & GetAllMiniSceneGraphNames()
get commar separated list of mini scene graph names, such as "name1,name2,"
Definition: SceneObject.cpp:4614
A typical character in role playing game.
Definition: RpgCharacter.h:73
char m_sConsoleString[200]
console string the console panel string
Definition: SceneObject.h:1281
virtual const char * GetAttributeClassDescription()
a static string, describing the attribute class object
Definition: SceneObject.h:114
int GetMaximumNumShadowCasters()
get the maximum number of shadow casters.
Definition: SceneObject.cpp:382
bool IsModified()
Get whether scene is modified.
Definition: SceneObject.cpp:3985
virtual void SetCandrag(bool bCandrag)
implementing IObjectDrag Interface
Definition: SceneObject.h:905
bool IsForceExportPhysics()
get whether physics of MeshPhysicsObject is always exported regardless of per object settings...
Definition: SceneObject.cpp:4673
a managed loader is a kind of global scene object for dynamic scene object loading and unloading...
Definition: ManagedLoader.h:28
Basic scene interface: implemented by the CSceneObject and CMiniScenegraph class. ...
Definition: IScene.h:12
bool CreateSkyBox(const string &strObjectName, AssetEntity &MeshAsset, float fScaleX, float fScaleY, float fScaleZ, float fHeightOffset)
create a sky box and add it to the current list, and select it as the current skybox.
Definition: SceneObject.cpp:2612
bool IsSnapToTerrain()
whether snap to terrain
Definition: SceneObject.h:298
int16 m_nCursorHotSpotY
default to -1, which is using current hardware value.
Definition: SceneObject.h:1309
void SetCurrentActor(CBaseObject *pActor)
Set the actor that is being processed by the AI module or a script call back.
Definition: SceneObject.cpp:344
bool DeleteObject(CBaseObject *pObject)
delete a object from the scene.
Definition: SceneObject.cpp:737
CBipedObject * GetNextPlayer(CBipedObject *pObj)
get the next scene object.
Definition: SceneObject.cpp:2899
void RenderShadows()
Shadow volume rendering.
Definition: SceneObject.cpp:2678
bool IsRenderSky()
whether rendering the sky
Definition: SceneObject.h:365
HRESULT AdvanceScene(double dTimeDelta, int nPipelineOrder=PIPELINE_3D_SCENE)
build the render list, and render the entire scene.
Definition: SceneObject.cpp:2072
SceneState * GetSceneState()
get the scene state information.
Definition: SceneObject.h:1004
Mini scene graph does not use a spatial partitions for its stored objects, instead it just implement ...
Definition: MiniSceneGraph.h:29
different physics engine has different winding order.
Definition: EventBinding.h:32
bool DeleteSkyBox(const string &strObjectName)
delete a name sky box.
Definition: SceneObject.cpp:2648
virtual IAttributeFields * GetChildAttributeObject(const std::string &sName)
get attribute by child object.
Definition: SceneObject.cpp:4857
CBaseObject * FindObjectByNameAndType(const std::string &sName, const std::string &sClassName)
find a named object by its name.
Definition: SceneObject.cpp:565
the root of the quad-tree terrain tiles.
Definition: TerrainTileRoot.h:11
IObject * AttachObject(CBaseObject *pObject)
Automatically attach a scene object to the scene graph according to its type and position.
Definition: SceneObject.cpp:574
CPortalNode * GetPortalNode(const char *sName)
get a portal node by its name.
Definition: SceneObject.cpp:442
bool DB_LoadNPCByID(int nNPCID, CRpgCharacter **pOut, bool bReload=false)
load a character from the database
Definition: SceneObject.cpp:3991
Place of the.
Definition: GUIEvent.h:43
CMiniSceneGraph * GetMiniSceneGraph(const string &name)
If the mini scene graph does not exist, it will be created.
Definition: SceneObject.cpp:4626
void PauseGame()
Definition: SceneObject.h:776
void SetShadow(bool bRenderShadow)
whether render shadow
Definition: SceneObject.cpp:3738
Definition: ManagedDef.h:18
void SetEnvironmentSim(IEnvironmentSim *pSim)
set the environment simulator to be used with this world.
Definition: SceneObject.cpp:320
Modeling the global sun and its directional light, including sun position, direction, color, time of day, etc.
Definition: SunLight.h:26
void ShowLocalLightMesh(bool bShow)
show the arrow mesh associated with the light object
Definition: SceneObject.cpp:540
int RemoveCharacterFromDB(IGameObject *pObj)
remove a character from DB.
Definition: SceneObject.cpp:3821
int GetMaxRenderCount(int nRenderImportance)
Get the max number of objects to be rendered of a given render importance.
Definition: SceneObject.cpp:4690
this is the interface class for managing global terrain used in ParaEngine.
Definition: GlobalTerrain.h:36
std::string m_sMiniSceneGraphNames
comma separated list of mini scene graphs
Definition: SceneObject.h:1302
list_IObjectWeakPtr_Type & GetSentientObjects()
get the list of sentient objects.
Definition: SceneObject.h:993
the sky object in the scene.
Definition: SkyMesh.h:13
bool LoadNPCByNPCDbItem(CNpcDbItem &npc, CRpgCharacter **pOut, bool bReload=false)
load a character from the database.
Definition: SceneObject.cpp:4039
bool HandleUserInput()
handle user input return true if there is a handler
CZoneNode * CreateGetZoneNode(const char *sName)
get a zone node by its name.
Definition: SceneObject.cpp:398
CBaseObject * GetLocalObject(const string &sName, const Vector3 &vPos)
Get an object.
Definition: SceneObject.cpp:712
int RenderHeadOnDisplay(int nPass=0)
render the head on display, return the number of objects rendered
Definition: SceneObject.cpp:2523
ParaTerrain::CGlobalTerrain * GetGlobalTerrain()
clean up all objects in the delete list.
Definition: SceneObject.cpp:560
map< string, CZoneNode * > m_zones
store all zones in a map from zone name to its pointer
Definition: SceneObject.h:1270
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
void SetFogColorFactor(const LinearColor &fogColorFactor)
fog parameters
Definition: SceneObject.h:377
void EnableLight(bool bEnable)
whether use light
Definition: SceneObject.cpp:514
int RenderSelection(DWORD dwSelection=0xffffffff, double dTimeDelta=0)
render objects in the post rendering list.
Definition: SceneObject.cpp:3238
ref_ptr< CTerrainTileRoot > m_pTileRoot
a quad tree object that hold most static (regional mobile) objects according to its spatial parameter...
Definition: SceneObject.h:1275
Definition: BaseCamera.h:70
void EnablePostProcessing(bool bEnable, const char *sCallbackScript)
set whether post processing is enabled.
Definition: SceneObject.cpp:4593
the view frustum&#39;s bounding radius
Definition: SceneObject.h:102
map< string, CPortalNode * > m_portals
store all zones in a map from zone name to its pointer
Definition: SceneObject.h:1272
LinearColor GetClearColor()
Get the color of the scene ground when it is not enabled.When scene is enabled, the background color ...
Definition: SceneObject.cpp:1002
bool IsPostProcessingEnabled()
get whether post processing is enabled.
Definition: SceneObject.cpp:4599
Definition: IObjectDrag.h:66
void ShowHeadOnDisplay(bool bShow)
show or hide all scene&#39;s objects&#39; head on display
Definition: SceneObject.h:263
CManagedLoader * GetManagedLoader(string sName)
get the managed loader by its name
Definition: SceneObject.cpp:799
vector< int > m_MaxRenderCount
m_MaxRenderCount[RenderImportance] is the max number of objects to be rendered of a given render impo...
Definition: SceneObject.h:1299
void SetFullscreenGlowBlendingFactor(float fGlowFactor)
full screen glow effect is parameterized by the blending weight of the source image and the glow imag...
Definition: SceneObject.cpp:4127
bool IsMiniSceneGraphEnabled()
enable to render all mini scene graphs
Definition: SceneObject.cpp:4609
virtual BOOL IsOnObject(int x, int y, int z)
Decide whether the input position is on this object This function is to help other function to decide...
Definition: SceneObject.cpp:3799
virtual int InstallFields(CAttributeClass *pClass, bool bOverride)
this class should be implemented if one wants to add new attribute.
Definition: SceneObject.cpp:4891
IParaDebugDraw draw interface draws line based primitives for debugging purposes. ...
Definition: IBatchedElementDraw.h:12
base class for object, such as CBaseObject, IAttributeObject, GUI object.
Definition: PERef.h:287
void SetMaxRenderCount(int nRenderImportance, int nCount)
set the max number of objects to be rendered of a given render importance.
Definition: SceneObject.cpp:4678
int GetMaxLocalLightsNum()
get maximum number of local lights per object.
Definition: SceneObject.cpp:526
MissileObjectPool_Type & GetMissiles()
return a list of missile objects.
Definition: SceneObject.h:997
bool ScreenShotShadowMap()
take a screen shot of the current shadow map and save it to .
Definition: SceneObject.cpp:4237
bool IsPersistent()
get whether the scene can be automatically marked as modified
Definition: SceneObject.cpp:3811
Definition: ShapeSphere.h:6
bool UnLoadFlashTextures()
unload all flash textures.
Definition: SceneObject.cpp:4758
a zone in portal rendering.
Definition: ZoneNode.h:17
list_IObjectWeakPtr_Type m_sentientGameObjects
it keeps a reference to all active (sentient) game objects in the scene.
Definition: SceneObject.h:1261
AABB-related code.
Definition: ShapeAABB.h:11
ref_ptr< CPhysicsWorld > m_pPhysicsWorld
current physics engine and simulation engine
Definition: SceneObject.h:1256
bool IsAutoPlayerRippleEnabled()
the current player will automatically generate ripples near the water surface
Definition: SceneObject.h:975
CSceneObject()
Definition: SceneObject.cpp:135
void SetMaximumNumShadowReceivers(int nNum)
set the maximum number of shadow receivers.
Definition: SceneObject.cpp:377
void RegenerateRenderOrigin(const Vector3 &vPos)
generate the render origin, so that it is near the given point in the world units this function is ca...
Definition: SceneObject.cpp:2953
bool IsSunLightEnabled()
get light enable state
Definition: SceneObject.cpp:500
virtual float GetShadowRadius()
get the distance from the eye, within which shadow map will be used.
Definition: SceneObject.h:1036
bool IsOcclusionQueryEnabled()
whether to use occlusion query algorithm for rendering.
Definition: SceneObject.h:309
CMissileObject * NewMissile()
Create a new managed missile object.
Definition: SceneObject.cpp:2964
int DeleteMiniSceneGraph(const string &name)
Delete mini scene graphs by name.
Definition: SceneObject.cpp:4652
The ref_ptr class template stores a pointer to a dynamically allocated (AssetEntity|CRefCounted|BaseA...
Definition: PERefPtr.h:13
virtual int GetChildAttributeObjectCount(int nColumnIndex=0)
get the number of child objects (row count) in the given column.
Definition: SceneObject.cpp:4876
bool IsSceneEnabled()
whether 3D scene is enabled or not.
Definition: SceneObject.h:329
this is an interface class for game objects, such as NPC, OPC and players.
Definition: IGameObject.h:15
IParaDebugDraw draw interface draws line based primitives for debugging purposes. ...
Definition: IParaDebugDraw.h:10
virtual CBaseObject * GetGlobalObject(const string &sName)
get the global object by its name.
Definition: SceneObject.cpp:707
void SetShadowMapTexelSize(int nWidth, int nHeight)
Set the size of the shadow map.
Definition: SceneObject.cpp:3726
virtual DWORD GetPhysicsGroupMask()
get groups Mask used to filter physics objects, default to 0xffffffff
Definition: SceneObject.cpp:546
void EnableSunLight(bool bEnable)
whether use light
Definition: SceneObject.cpp:504
bool CheckObjectCullingMethod(DWORD dwMethod)
Definition: SceneObject.h:467
virtual HRESULT InitDeviceObjects()
– For device and input handling –
Definition: SceneObject.cpp:835
void SetShadowMapTexelSizeLevel(int nLevel)
Set the size level of the shadow map.
Definition: SceneObject.cpp:3708
bool IsPortalSystemShown()
get whether portal zone and portals are rendered.
Definition: SceneObject.cpp:456
unordered_ref_array< IAttributeFields * > m_attribute_models
attribute models in the second column
Definition: SceneObject.h:1317
virtual const char * GetAttributeClassName()
a static string, describing the attribute class object&#39;s name
Definition: SceneObject.h:112
CManagedLoader * CreateManagedLoader(string sName)
create a new managed loader.
Definition: SceneObject.cpp:821
the view center is on current player. if no player selected. it is on the current camera eye position...
Definition: SceneObject.h:96
bool ScreenShotReflection()
take a screen shot of the current reflection map and save it to .
Definition: SceneObject.cpp:4225
void UnloadObjectResources(CBaseObject *pObject)
unload the resources used by the specified object.
Definition: SceneObject.cpp:782
NPC database item (complete)
Definition: NpcDatabase.h:8
Definition: enum_maker.hpp:46
void DisableGame()
Definition: SceneObject.h:778
void AddSentientObject(IGameObject *pObj, bool bCheckDuplicate=false)
add a new sentient object to the back of the sentient object list.
Definition: SceneObject.cpp:621
float m_fOnClickDistance
the mouse ray picking distance for onclick event.
Definition: SceneObject.h:1284
bool(* OBJECT_FILTER_CALLBACK)(CBaseObject *obj)
call back function type for ray picking.
Definition: MiniSceneGraph.h:19
bool IsPortalZoneEnabled()
enable portal and zone rendering.
Definition: SceneObject.h:980
bool IsShadowMapEnabled()
whether render using shadow map
Definition: SceneObject.cpp:3759
int GetMaximumNumShadowReceivers()
get the maximum number of shadow receivers.
Definition: SceneObject.cpp:372
A common interface for all classes implementing IAttributeFields By implementing this class&#39;s virtual...
Definition: IAttributeFields.h:59
bool IsBlockInput()
whether to block all user input (both key and mouse).
Definition: SceneObject.h:1040
The top level scene management class.
Definition: SceneObject.h:58
void SetBackGroundColor(const LinearColor &bgColor)
set the color of the scene ground when it is not enabled.When scene is enabled, the background color ...
Definition: SceneObject.cpp:989
void ShowPortalSystem(bool bEnable)
set whether portal zone and portals are rendered.
Definition: SceneObject.cpp:451
bool PickObject(const CShapeRay &ray, CBaseObject **pTouchedObject, float fMaxDistance=0, OBJECT_FILTER_CALLBACK pFnctFilter=NULL)
Pick object using view clipping object.
Definition: SceneObjectPicking.cpp:359
int SaveLocalCharacters()
save all modified and unsaved local characters in the scene to the current NPC database.
Definition: SceneObject.cpp:3925
bool ScreenShotGlowMap()
take a screen shot of the current glow texture and save it to .
Definition: SceneObject.cpp:4252
CSkyMesh * GetCurrentSky()
return NULL if no sky defined.
Definition: SceneObject.cpp:2605
void ResetScene()
reset the scene to blank.
Definition: SceneObject.cpp:281
This class is for maintaining the event binding table and script binding table.
Definition: EventBinding.h:51
bool IsShowLocalLightMesh()
whether show the arrow mesh associated with the light object.
Definition: SceneObject.cpp:535
bool m_bUseInstancing
whether to use instancing during scene rendering.
Definition: SceneObject.h:1287
bool DeleteManagedLoader(string sName)
delete a managed loader
Definition: SceneObject.cpp:809
AABB with orientation by a matrix.
Definition: ShapeOBB.h:11
Use fog far plane distance as the view radius.
Definition: SceneObject.h:100
bool IsUsingFullScreenGlow()
whether full screen glow effect is used.
Definition: SceneObject.cpp:4103
the view center is the 2d center of the view frustum
Definition: SceneObject.h:98
int DB_LoadNPCsByRegion(const Vector3 &vMin, const Vector3 &vMax, bool bReload=false)
return all NPC whose position is within a AABB region
Definition: SceneObject.cpp:4015
CPortalNode * CreateGetPortalNode(const char *sName)
get a portal node by its name.
Definition: SceneObject.cpp:424
bool IsShowMainPlayer()
whether to show main player.
Definition: SceneObject.cpp:480
float m_fPostRenderQueueOrder
this is always 100.f
Definition: SceneObject.h:1315
The global physics scene (NxScene) and physics SDK is encapsulated in a member object of scene manage...
Definition: PhysicsWorld.h:18
int GetObjectsByScreenRect(list< CBaseObject *> &output, const RECT &rect, OBJECT_FILTER_CALLBACK pFnctFilter=NULL, float fMaxDistance=-1.f)
Get objects inside or intersect with a screen rect.
Definition: SceneObject.cpp:4366
void EnableFullScreenGlow(bool bEnable)
whether full screen glow effect is used.
Definition: SceneObject.cpp:4112
CMiniSceneGraph * GetPostProcessingScene()
get the post processing mini scene graph.
Definition: SceneObject.cpp:4588
bool IsInstancingEnabled()
whether to use instancing.
Definition: SceneObject.h:313
void SetPersistent(bool bPersistent)
set whether the scene can be automatically marked as modified
Definition: SceneObject.cpp:3816
CBatchedElementDraw * m_pBatchedElementDraw
physics world
Definition: SceneObject.h:1258
a reflective plane in the scene currently it only supports horizontal surface.Vertical surface and ar...
Definition: MirrorSurface.h:10
bool CanShowMainPlayer() const
whether current camera allows showing the main player
Definition: SceneObject.cpp:490
Portal rendering: portal class a portal can be connected to one or two zones.
Definition: PortalNode.h:15
void SetFullscreenGlowIntensity(float fGlowIntensity)
full screen glow effect is parameterized by the blending weight of the source image and the glow imag...
Definition: SceneObject.cpp:4119
CSceneScripts & GetScripts()
get script interface for reading and writing.
Definition: SceneObject.cpp:3664
void ClearParticles()
clear all particles.
Definition: SceneObject.cpp:4718
Defines the base class of all scene elements:CBaseObject for Parallel World Engine.
Definition: BaseObject.h:230
MissileObjectPool_Type m_missiles
a list of missile objects.
Definition: SceneObject.h:1264
A ray is a half-line P(t) = mOrig + mDir * t, with 0 <= t <= +infinity.
Definition: ShapeRay.h:11
void RenderShadowMap()
render the shadow volume
Definition: SceneObject.cpp:3768
CBaseObject * GetObjectByViewBox(const CShapeAABB &viewbox)
get an object(usually a static mesh object) by a given view box.
Definition: SceneObject.cpp:732
CBipedObject * GetCurrentPlayer()
get the current player
Definition: SceneObject.cpp:2894
std::string m_sCursorFile
the cursor to be displayed when mouse over it.
Definition: SceneObject.h:1305
void EnableMiniSceneGraph(bool bEnable)
enable to render all mini scene graphs
Definition: SceneObject.cpp:4604
OBJECT_LEVEL_CULLING_METHOD
a bit wise field for object level culling parameters.
Definition: SceneObject.h:91
virtual void BeginDrag(int nEvent, int x, int y, int z)
Default BeginDrag handle function.
Definition: SceneObject.h:907
static CSceneObject * GetInstance()
this function may return NULL, if scene object is never created.
Definition: SceneObject.cpp:241
virtual void Animate(double dTimeDelta, int nRenderNumber=0)
Desc: Called once per frame, the call is the entry point for animating the scene. ...
Definition: SceneObject.cpp:1227
unordered_ref_array< CBaseObject * > m_dead_objects
dead objects pool.
Definition: SceneObject.h:1277
int GetMaxCharTriangles()
get max number of character triangles allowed.
Definition: SceneObject.cpp:367
int GetPhysicsDebugDrawMode()
set the physics debug draw mode.
Definition: SceneObject.cpp:4707
Same as IRefObject except that it tracks references of the object.
Definition: SceneState.h:481
void SetModified(bool bModified)
set whether scene is modified
Definition: SceneObject.cpp:3980
virtual void AddToDeadObjectPool()
When a child object wants to remove itself, it is usually not safe to do so immediately, instead the object add itself to dead object pool for the root scene to safely remove it at the end of the frame.
Definition: BaseObject.cpp:957
bool IsShowBoundingBox()
whether to draw bounding box of scene objects.
Definition: SceneObject.h:301
A linear, 32-bit/component floating point RGBA color.
Definition: ParaColor.h:12
bool IsScenePaused()
when a scene is paused, all animation will be frozen.
Definition: SceneObject.h:325
void OnTerrainChanged(const Vector3 &vCenter, float fRadius)
This function is called manually to update characters in a square region.
Definition: SceneObject.cpp:4311
void SetOnClickDistance(float fDist)
the mouse ray picking distance for onclick event.
Definition: SceneObject.h:1022
for drawing special element object(like particles, lines, etc) in the scene.
Definition: BatchedElementDraw.h:15
void SetCurrentPlayer(CBipedObject *pPlayer)
set the current player
Definition: SceneObject.cpp:3677
bool IsInitialized()
when the device used by the scene have been initialized and ready for drawing.
Definition: SceneObject.cpp:1266
int SelectObject(int nGroupIndex, const CShapeOBB &box, OBJECT_FILTER_CALLBACK pFnctFilter=NULL)
select select objects within a given region into a given group.
Definition: SceneObjectPicking.cpp:609
LinearColor GetBackGroundColor()
Get the color of the scene ground when it is not enabled.When scene is enabled, the background color ...
Definition: SceneObject.cpp:994
Vector3 GetRenderOrigin()
get the render origin in the rendering coordinate system.rendering coordinate system is a 3D coordina...
Definition: SceneObject.cpp:2948
CBaseCamera * GetCurrentCamera()
get current camera
Definition: SceneObject.h:536
CBaseObject * GetCurrentActor()
get the actor that is being processed by the AI module or a script call back.
Definition: SceneObject.cpp:339
virtual int GetAttributeClassID()
attribute class ID should be identical, unless one knows how overriding rules work.
Definition: SceneObject.h:110
float GetMaxHeadOnDisplayDistance()
whether all scene&#39;s objects&#39; head on display
Definition: SceneObject.h:272
void EnableAutoPlayerRipple(bool bEnable)
the current player will automatically generate ripples near the water surface
Definition: SceneObject.h:977
const CEventBinding * GetEventBinding()
Get the current event binding object.
Definition: SceneObject.cpp:349
int16 m_nCursorHotSpotX
default to -1, which is using current hardware value.
Definition: SceneObject.h:1307
void SetMaxHeadOnDisplayDistance(float fDist)
show or hide all scene&#39;s objects&#39; head on display
Definition: SceneObject.h:269
bool DB_LoadNPCByName(const string &sName, CRpgCharacter **pOut, bool bReload=false)
load a character from the database
Definition: SceneObject.cpp:4003
This class demonstrate how to initialize, destroy and drive the game loop of ParaEngine through the C...
Definition: ParaEngineApp.h:96
CTerrainTileRoot * GetRootTile()
get the root terrain tile of the quad tree.
Definition: SceneObject.h:533
It can be used to represent biped object(like human, re spawning monsters) in the scene without inher...
Definition: BipedObject.h:60
void EnablePortalZone(bool bEnable)
enable portal and zone rendering.
Definition: SceneObject.h:983
bool IsHeadOnDisplayShown()
whether all scene&#39;s objects&#39; head on display
Definition: SceneObject.h:266
void SetMaxLocalLightsNum(int nNum)
set maximum number of local lights per object.
Definition: SceneObject.cpp:519
CMirrorSurface * GetMirrorSurface(int nIndex)
It will create the mirror surface if not exist.
Definition: SceneObject.cpp:461
bool m_bCanShowMainPlayer
whether current camera allows showing the main player
Definition: SceneObject.h:1296
the view center is always on camera eye position
Definition: SceneObject.h:94
Base class for managed asset entity in ParaEngine.
Definition: AssetEntity.h:25
bool DeleteSentientObject(IGameObject *pObj)
return true if the object is found and deleted.
Definition: SceneObject.cpp:646
virtual int GetChildAttributeColumnCount()
we support multi-dimensional child object.
Definition: SceneObject.cpp:4886
DWORD m_dwPhysicsGroupMask
groups Mask used to filter physics objects, default to 0xffffffff
Definition: SceneObject.h:1312
bool m_bShowMainPlayer
whether to show the main player
Definition: SceneObject.h:1293
void SetCursor(const char *szCursorFile, int nHotSpotX=-1, int nHotSpotY=-1)
Set/Get cursor file when mouse is over it.
Definition: SceneObject.cpp:4735
void LoadDefaultEventBinding()
load the default camera key and mouse event binding.
Definition: SceneObject.cpp:354
environment simulator.
Definition: IEnvironmentSim.h:103
int GetObjectsBySphere(list< CBaseObject *> &output, const CShapeSphere &sphere, OBJECT_FILTER_CALLBACK pFnctFilter=NULL, int nMethod=0)
Get objects inside or intersect with a sphere.
Definition: SceneObject.cpp:4464
virtual HRESULT Draw(SceneState *sceneState)
only for drawable objects
Definition: SceneObject.cpp:1261
int SaveCharacterToDB(IGameObject *pObj)
save the given character to current database no matter it is modified or not.
Definition: SceneObject.cpp:3846