My Project
SphereObject.h
1 #pragma once
2 #include "BaseObject.h"
3 
4 namespace ParaEngine
5 {
12  class CSphereObject : public CBaseObject
13  {
14  public:
15  CSphereObject(void);
16  virtual ~CSphereObject(void);
17 
18  public:
19 
21  // implementation of IAttributeFields
22 
24  virtual int GetAttributeClassID(){return ATTRIBUTE_CLASSID_CSphereObject;}
26  virtual const char* GetAttributeClassName(){static const char name[] = "CSphereObject"; return name;}
28  virtual const char* GetAttributeClassDescription(){static const char desc[] = ""; return desc;}
30  virtual int InstallFields(CAttributeClass* pClass, bool bOverride);
31 
33  //
34  // Note: I have secretly changed position to center. the position attribute of the
35  // the sphere object is not consistent with the position methods
36  //
38  ATTRIBUTE_METHOD1(CSphereObject, GetPosition_s, DVector3*) { *p1 = cls->GetObjectCenter(); return S_OK;}
39  ATTRIBUTE_METHOD1(CSphereObject, SetPosition_s, DVector3) {cls->SetObjectCenter(p1); return S_OK;}
40 
41  public:
43  virtual ObjectShape GetObjectShape();
44 
48  virtual DVector3 GetObjectCenter();
49 
53  virtual void SetObjectCenter(const Vector3 & v);
54 
59  virtual void SetRadius(float fRadius);
60 
64  virtual float GetRadius();
65 
74  virtual DVector3 GetPosition();
76  virtual void SetPosition(const DVector3& v);
77 
78  protected:
81  float m_fRadius;
82  };
83 
84 }
DVector3 m_vCenter
center of the object.
Definition: SphereObject.h:80
a CBaseObject whose position is at the center, instead of at the bottom.
Definition: SphereObject.h:12
3-dimensional vector with double precision.
Definition: ParaDVector3.h:17
an attribute class is a collection of attribute fields.
Definition: AttributeClass.h:10
virtual int InstallFields(CAttributeClass *pClass, bool bOverride)
this class should be implemented if one wants to add new attribute.
Definition: SphereObject.cpp:61
different physics engine has different winding order.
Definition: EventBinding.h:32
virtual void SetPosition(const DVector3 &v)
set the object position.
Definition: SphereObject.cpp:39
virtual float GetRadius()
Definition: SphereObject.cpp:51
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
virtual const char * GetAttributeClassName()
a static string, describing the attribute class object's name
Definition: SphereObject.h:26
ObjectShape
object shape
Definition: IViewClippingObject.h:13
virtual DVector3 GetObjectCenter()
get the center of the object in world space
Definition: SphereObject.cpp:24
virtual int GetAttributeClassID()
attribute class ID should be identical, unless one knows how overriding rules work.
Definition: SphereObject.h:24
virtual ObjectShape GetObjectShape()
get the object shape
Definition: SphereObject.cpp:56
virtual DVector3 GetPosition()
get object position in the world space.
Definition: SphereObject.cpp:34
Defines the base class of all scene elements:CBaseObject for Parallel World Engine.
Definition: BaseObject.h:230
virtual const char * GetAttributeClassDescription()
a static string, describing the attribute class object
Definition: SphereObject.h:28
virtual void SetObjectCenter(const Vector3 &v)
set the center of the object in world space
Definition: SphereObject.cpp:29
virtual void SetRadius(float fRadius)
Set the object shape to Sphere and sphere parameters.
Definition: SphereObject.cpp:46