My Project
ZoneNode.h
1 #pragma once
2 #include "BaseObject.h"
3 #include <list>
4 #include <map>
5 
6 namespace ParaEngine
7 {
8  class CBaseObject;
9  class CPortalNode;
10  struct SceneState;
11 
17  class CZoneNode : public CBaseObject
18  {
19  public:
20  CZoneNode(void);
21  virtual ~CZoneNode(void);
22  virtual CBaseObject::_SceneObjectType GetType(){return CBaseObject::ZoneNode;};
23 
24  virtual string ToString(DWORD nMethod);
25 
26  virtual DVector3 GetPosition();
27  virtual void SetPosition(const DVector3 & v);
28 
32  virtual bool TestCollisionSphere(CBaseCamera* pCamera, float fFarPlaneDistance);
35  virtual bool TestCollision(CBaseCamera* pCamera);
36 
38  // implementation of IAttributeFields
39 
41  virtual int GetAttributeClassID(){return ATTRIBUTE_CLASSID_CZoneNode;}
43  virtual const char* GetAttributeClassName(){static const char name[] = "CZoneNode"; return name;}
45  virtual const char* GetAttributeClassDescription(){static const char desc[] = ""; return desc;}
47  virtual int InstallFields(CAttributeClass* pClass, bool bOverride);
48 
49  ATTRIBUTE_METHOD1(CZoneNode, GetZonePlanes_s, const char**) {*p1 = cls->GetZonePlanes(); return S_OK;}
50  ATTRIBUTE_METHOD1(CZoneNode, SetZonePlanes_s, const char*) {cls->SetZonePlanes(p1); return S_OK;}
51 
52  ATTRIBUTE_METHOD(CZoneNode, AutoGenZonePlanes_s) {cls->AutoGenZonePlanes(); return S_OK;}
53  ATTRIBUTE_METHOD(CZoneNode, AutoFillZone_s) {cls->AutoFillZone(); return S_OK;}
54 
55  public:
57  void AutoGenZonePlanes();
58 
60  void AutoFillZone();
61 
67  void SetZonePlanes(const char* sPlanes);
68 
70  const char* GetZonePlanes();
71 
72 
76  void addNode( CBaseObject * pNode);
77 
80  void removeNode( CBaseObject * pNode );
81 
82  /* Add a portal to the zone
83  */
84  void addPortal( CPortalNode * );
85 
86  /* Remove a portal from the zone
87  */
88  void removePortal( CPortalNode * );
89 
95  bool Contains(CBaseObject * pNode, bool bStrict);
96 
100  bool Contains(const Vector3& vPos);
101 
103  vector<Plane>& GetPlanes() {return m_planes;};
104 
106  virtual HRESULT Draw( SceneState * sceneState);
107  private:
109  vector<Plane> m_planes;
110 
112  DVector3 m_vPos;
113  };
114 }
void AutoFillZone()
automatically fill the zone with static mesh objects that are within the zone&#39;s convex space...
Definition: ZoneNode.cpp:224
virtual const char * GetAttributeClassDescription()
a static string, describing the attribute class object
Definition: ZoneNode.h:45
virtual string ToString(DWORD nMethod)
convert the object to an NPL string by which this object may be created or deleted.
Definition: ZoneNode.cpp:30
3-dimensional vector with double precision.
Definition: ParaDVector3.h:17
an attribute class is a collection of attribute fields.
Definition: AttributeClass.h:10
It&#39;s used as parameter to Draw method of each scene object.
Definition: SceneState.h:284
virtual bool TestCollision(CBaseCamera *pCamera)
check if the object&#39;s original shape can be seen via a camera.
Definition: ZoneNode.cpp:305
Definition: combase.h:159
void AutoGenZonePlanes()
automatically generate 6 zone planes according to the bounding box of the zone node.
Definition: ZoneNode.cpp:192
const char * GetZonePlanes()
set or get zone planes as a string
Definition: ZoneNode.cpp:270
different physics engine has different winding order.
Definition: EventBinding.h:32
virtual void SetPosition(const DVector3 &v)
always bottom center of the bounding shape
Definition: ZoneNode.cpp:187
virtual DVector3 GetPosition()
always bottom center of the bounding shape
Definition: ZoneNode.cpp:182
virtual bool TestCollisionSphere(CBaseCamera *pCamera, float fFarPlaneDistance)
assume that the object is a sphere, it will return false if the sphere is completely out of the 6 fru...
Definition: ZoneNode.cpp:286
virtual int GetAttributeClassID()
attribute class ID should be identical, unless one knows how overriding rules work.
Definition: ZoneNode.h:41
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
Definition: BaseCamera.h:70
bool Contains(CBaseObject *pNode, bool bStrict)
check whether the zone contains a given object.
Definition: ZoneNode.cpp:88
void SetZonePlanes(const char *sPlanes)
set or get zone planes as a string
Definition: ZoneNode.cpp:229
a zone in portal rendering.
Definition: ZoneNode.h:17
vector< Plane > & GetPlanes()
return planes of the zone.
Definition: ZoneNode.h:103
virtual HRESULT Draw(SceneState *sceneState)
it only draws an arrow, when the scene&#39;s show local light parameter is true.
Definition: ZoneNode.cpp:129
Portal rendering: portal class a portal can be connected to one or two zones.
Definition: PortalNode.h:15
Defines the base class of all scene elements:CBaseObject for Parallel World Engine.
Definition: BaseObject.h:230
void addNode(CBaseObject *pNode)
Adds an Scene Node to this Zone.
Definition: ZoneNode.cpp:55
virtual int InstallFields(CAttributeClass *pClass, bool bOverride)
this class should be implemented if one wants to add new attribute.
Definition: ZoneNode.cpp:347
virtual const char * GetAttributeClassName()
a static string, describing the attribute class object&#39;s name
Definition: ZoneNode.h:43
void removeNode(CBaseObject *pNode)
Removes all references to a SceneNode from this Zone.
Definition: ZoneNode.cpp:63