My Project
IViewClippingObject.h
1 #pragma once
2 #include "IRefObject.h"
3 
4 namespace ParaEngine
5 {
6  class IBatchedElementDraw;
7  class CShapeOBB;
8  class CShapeAABB;
9  class CBaseCamera;
10  struct SceneState;
11 
14  {
15  _ObjectShape_Circle = 0,
16  _ObjectShape_Sphere,
17  _ObjectShape_Rectangular,
18  _ObjectShape_Box,
19  _ObjectShape_NX_dynamic,
22  };
23 
24  struct AssetEntity;
25 
30  {
31  public:
32  virtual ~IViewClippingObject(){};
33 
35  virtual ObjectShape GetObjectShape(){return _ObjectShape_Box;};
36 
38  virtual void SetObjectShape(ObjectShape shape){};
39 
49  virtual void SetBoundingBox(float fOBB_X, float fOBB_Y, float fOBB_Z, float fFacing);
50 
54  virtual void GetBoundingBox(float* fOBB_X, float* fOBB_Y, float* fOBB_Z, float* fFacing);
55 
63  virtual void SetBoundRect(float fWidth ,float fHeight, float fFacing){};
67  virtual void GetBoundRect(float* fWidth ,float* fHeight, float* fFacing);
68 
73  virtual void SetRadius(float fRadius){};
74 
78  virtual float GetRadius(){return 0.f;};
79 
93  virtual void GetVertices(Vector3 * pVertices, int* nNumber);
94 
96  virtual void GetRenderVertices(Vector3 * pVertices, int* nNumber);
97 
98  virtual void GetVerticesWithOrigin( const Vector3* vOrigin, Vector3 * pVertices, int* nNumber);
107  virtual DVector3 GetPosition();
108 
110  virtual void SetPosition(const DVector3& v);
111 
119  virtual void Rotate(float x, float y, float z);
120 
122  virtual void SetRotation(const Quaternion& quat);
124  virtual void GetRotation(Quaternion* quat);
125 
128  virtual void SetScaling(float s);
129 
131  virtual float GetScaling();
132 
143  virtual Vector3 GetRenderOffset();
144 
148  virtual DVector3 GetObjectCenter();
152  virtual void SetObjectCenter(const DVector3 & v);
153 
155  virtual void GetFacing3D( Vector3 *pV );
156 
161  inline float GetFacing() { return GetYaw(); };
162  inline void SetFacing(float fFacing) { SetYaw(fFacing); };
163 
166  virtual float GetYaw(){ return 0.f; };
167  virtual void SetYaw(float fFacing){};
168 
171  virtual float GetPitch(){ return 0.f; };
172  virtual void SetPitch(float fFacing){};
173 
176  virtual float GetRoll(){ return 0.f; };
177  virtual void SetRoll(float fFacing){};
178 
179 
181  virtual float GetHeight(){return 0.f;};
182  virtual void SetHeight(float fHeight){};
183 
185  virtual float GetWidth(){return 0.f;};
186  virtual void SetWidth(float fWidth){};
187 
189  virtual float GetDepth(){return 0.f;};
190  virtual void SetDepth(float fDepth){};
191 
192  /* return the normal at the terrain position where the object is situated at its x,z plane.*/
193  virtual Vector3 GetNormal(){return Vector3(0,1.f,0);};
194  virtual void SetNormal(const Vector3 & pNorm){};
195 
199  virtual void GetOBB(CShapeOBB* obb);
200  virtual void GetAABB(CShapeAABB* aabb);
201 
202 
204  virtual void SetAABB(const Vector3 *vMin, const Vector3 *vMax);
205 
206  virtual Vector3 GetLocalAABBCenter();
207 
213  virtual void SetTransform(Matrix4* pLocalTransform, const DVector3& pGlobalPos, float* pRotation);
214  virtual void SetTransform(Matrix4* pWorldTransform);
215 
222  virtual Matrix4* GetRenderMatrix(Matrix4& out, int nRenderNumber = 0);
223 
225  virtual Matrix4* GetWorldTransform(Matrix4& pOut, int nRenderNumber = 0);
226 
228 
242  virtual bool TestCollisionSphere(const Vector3* pvCenter, float radius, BYTE nMethod = 1);
246  virtual bool TestCollisionSphere(CBaseCamera* pCamera, float fFarPlaneDistance);
247 
251  virtual bool TestShadowSweptSphere(CBaseCamera* pCamera, const Vector3* pvDirection);
252 
255  virtual bool TestCollision(CBaseCamera* pCamera);
256 
257  virtual bool TestCollisionObject(IViewClippingObject* pObj);
258  virtual bool TestCollisionRay(const Vector3& vPickRayOrig, const Vector3& vPickRayDir, float* fDistance);
259  virtual float GetSphereCollisionDepth(Vector3* pvCenter, float radius, bool bSolveDepth = false);
260  virtual float GetObjectCollisionDepth(IViewClippingObject* pObj);
261 
265  virtual float GetObjectToPointDistance(const Vector3* pPoint);
266 
268  virtual void DrawBoundingBox(SceneState * sceneState, DWORD color);
269 
271  virtual void DrawOcclusionObject(SceneState * sceneState);
272 
274  virtual void DebugDraw(IBatchedElementDraw* pDebugDraw);
275  };
276 }
the shape of the object is associated with a dynamic actor defined in Novodex physics engine ...
Definition: IViewClippingObject.h:20
virtual void SetBoundingBox(float fOBB_X, float fOBB_Y, float fOBB_Z, float fFacing)
Set the object shape to box and bounding box parameters if fFacing is 0, it is a axis aligned boundin...
Definition: IViewClippingObject.cpp:783
virtual float GetYaw()
get object Yaw: is facing the positive x axis, if yaw is 0.
Definition: IViewClippingObject.h:166
float GetFacing()
same as GetYaw and SetYaw get object facing: only for object that has a facing property like biped...
Definition: IViewClippingObject.h:161
virtual float GetRadius()
Definition: IViewClippingObject.h:78
virtual bool TestShadowSweptSphere(CBaseCamera *pCamera, const Vector3 *pvDirection)
assume that the object is a sphere, it will return false if the swept sphere along the given directio...
Definition: IViewClippingObject.cpp:319
3-dimensional vector with double precision.
Definition: ParaDVector3.h:17
virtual bool TestCollisionSphere(const Vector3 *pvCenter, float radius, BYTE nMethod=1)
– collision detection
Definition: IViewClippingObject.cpp:363
It's used as parameter to Draw method of each scene object.
Definition: SceneState.h:284
virtual bool TestCollisionRay(const Vector3 &vPickRayOrig, const Vector3 &vPickRayDir, float *fDistance)
Desc: Check the ray intersection with the object input:vPickRayOrig,vPickRayDir: mouse ray params out...
Definition: IViewClippingObject.cpp:611
Pure interface for CBaseObject (3D scene object) It defines basic shapes and collision detection...
Definition: IViewClippingObject.h:29
virtual void SetRadius(float fRadius)
Set the object shape to Sphere and sphere parameters.
Definition: IViewClippingObject.h:73
different physics engine has different winding order.
Definition: EventBinding.h:32
virtual float GetPitch()
get object pitch: is facing the positive x axis, if yaw is 0.
Definition: IViewClippingObject.h:171
the shape of the object is associated with a static actor defined in Novodex physics engine ...
Definition: IViewClippingObject.h:21
virtual void SetObjectCenter(const DVector3 &v)
set the center of the object in world space
Definition: IViewClippingObject.cpp:42
Implementation of a Quaternion, i.e.
Definition: ParaQuaternion.h:10
virtual bool TestCollisionObject(IViewClippingObject *pObj)
desc: test if the object collide with this object in the world view.
Definition: IViewClippingObject.cpp:456
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
virtual float GetRoll()
get object roll: is facing the positive x axis, if yaw is 0.
Definition: IViewClippingObject.h:176
virtual void SetAABB(const Vector3 *vMin, const Vector3 *vMax)
Set local AABB information.
Definition: IViewClippingObject.cpp:773
ObjectShape
object shape
Definition: IViewClippingObject.h:13
Definition: BaseCamera.h:70
virtual void GetVertices(Vector3 *pVertices, int *nNumber)
get all the vertices which can represent the object's shape.
Definition: IViewClippingObject.cpp:168
virtual void SetTransform(Matrix4 *pLocalTransform, const DVector3 &pGlobalPos, float *pRotation)
Set a local transform matrix, a global position and a facing value, according to which the object wil...
Definition: IViewClippingObject.cpp:686
IParaDebugDraw draw interface draws line based primitives for debugging purposes. ...
Definition: IBatchedElementDraw.h:12
virtual void SetBoundRect(float fWidth, float fHeight, float fFacing)
Set the object shape to rect (a plane) and rect parameters if fFacing is 0, it is a axis aligned boun...
Definition: IViewClippingObject.h:63
virtual void Rotate(float x, float y, float z)
Rotate the object.This only takes effects on objects having 3D orientation, such as static mesh and p...
Definition: IViewClippingObject.cpp:730
virtual bool TestCollision(CBaseCamera *pCamera)
check if the object's original shape can be seen via a camera.
Definition: IViewClippingObject.cpp:346
virtual float GetObjectCollisionDepth(IViewClippingObject *pObj)
desc: test if the circle in the y=0 plane collide with this object in the world view Note: radius can...
Definition: IViewClippingObject.cpp:588
AABB-related code.
Definition: ShapeAABB.h:11
virtual float GetWidth()
get object width: x axis
Definition: IViewClippingObject.h:185
virtual void SetRotation(const Quaternion &quat)
set rotation using a quaternion.
Definition: IViewClippingObject.cpp:735
virtual float GetSphereCollisionDepth(Vector3 *pvCenter, float radius, bool bSolveDepth=false)
desc: this is similar to TestCollisionSphere, but does more than that.
Definition: IViewClippingObject.cpp:476
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: ParaMatrix4.h:23
virtual float GetDepth()
get object depth: z axis
Definition: IViewClippingObject.h:189
virtual Matrix4 * GetRenderMatrix(Matrix4 &out, int nRenderNumber=0)
return the world matrix of the object for rendering
Definition: IViewClippingObject.cpp:662
virtual void GetRenderVertices(Vector3 *pVertices, int *nNumber)
same as GetVertices().
Definition: IViewClippingObject.cpp:162
virtual void DrawBoundingBox(SceneState *sceneState, DWORD color)
debugging only: draw bounding box
Definition: IViewClippingObject.cpp:131
virtual void GetFacing3D(Vector3 *pV)
get object facing: only for object that has a facing property like biped, not bound facing ...
Definition: IViewClippingObject.cpp:696
virtual void SetScaling(float s)
set the scale of the object.
Definition: IViewClippingObject.cpp:676
virtual void GetRotation(Quaternion *quat)
get rotation using a quaternion
Definition: IViewClippingObject.cpp:740
AABB with orientation by a matrix.
Definition: ShapeOBB.h:11
virtual float GetObjectToPointDistance(const Vector3 *pPoint)
get the distance from the object's surface to a given point.
Definition: IViewClippingObject.cpp:594
virtual float GetScaling()
get the scaling.
Definition: IViewClippingObject.cpp:681
virtual void GetBoundRect(float *fWidth, float *fHeight, float *fFacing)
Definition: IViewClippingObject.cpp:710
virtual void DebugDraw(IBatchedElementDraw *pDebugDraw)
this function is called whenever debugging drawing is enabled.
Definition: IViewClippingObject.cpp:105
virtual Vector3 GetRenderOffset()
get the offset(translation) of the object used for rendering.
Definition: IViewClippingObject.cpp:748
virtual DVector3 GetPosition()
get object position in the world space.
Definition: IViewClippingObject.cpp:27
virtual void DrawOcclusionObject(SceneState *sceneState)
draw the occlusion object
Definition: IViewClippingObject.cpp:54
virtual void SetPosition(const DVector3 &v)
set the object position.
Definition: IViewClippingObject.cpp:725
virtual void GetBoundingBox(float *fOBB_X, float *fOBB_Y, float *fOBB_Z, float *fFacing)
Definition: IViewClippingObject.cpp:717
virtual ObjectShape GetObjectShape()
get the object shape
Definition: IViewClippingObject.h:35
Base class for managed asset entity in ParaEngine.
Definition: AssetEntity.h:25
virtual void SetObjectShape(ObjectShape shape)
set the object shape
Definition: IViewClippingObject.h:38
virtual void GetOBB(CShapeOBB *obb)
get the oriented bounding box in world space.
Definition: IViewClippingObject.cpp:754
virtual float GetHeight()
get object height y axis: only for object that has a Height property, usually is height of the boundi...
Definition: IViewClippingObject.h:181
virtual Matrix4 * GetWorldTransform(Matrix4 &pOut, int nRenderNumber=0)
get world transform
Definition: IViewClippingObject.cpp:652
virtual DVector3 GetObjectCenter()
get the center of the object in world space
Definition: IViewClippingObject.cpp:35
anything that makes references to other objects.
Definition: IRefObject.h:65