My Project
|
Pure interface for CBaseObject (3D scene object) It defines basic shapes and collision detection. More...
#include <IViewClippingObject.h>
Public Member Functions | |
virtual ObjectShape | GetObjectShape () |
get the object shape | |
virtual void | SetObjectShape (ObjectShape shape) |
set the object shape | |
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 bounding box (AABB). More... | |
virtual void | GetBoundingBox (float *fOBB_X, float *fOBB_Y, float *fOBB_Z, float *fFacing) |
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 bounding box (AABB). More... | |
virtual void | GetBoundRect (float *fWidth, float *fHeight, float *fFacing) |
virtual void | SetRadius (float fRadius) |
Set the object shape to Sphere and sphere parameters. More... | |
virtual float | GetRadius () |
virtual void | GetVertices (Vector3 *pVertices, int *nNumber) |
get all the vertices which can represent the object's shape. More... | |
virtual void | GetRenderVertices (Vector3 *pVertices, int *nNumber) |
same as GetVertices(). More... | |
virtual void | GetVerticesWithOrigin (const Vector3 *vOrigin, Vector3 *pVertices, int *nNumber) |
virtual DVector3 | GetPosition () |
get object position in the world space. More... | |
virtual void | SetPosition (const DVector3 &v) |
set the object position. More... | |
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 physics mesh. More... | |
virtual void | SetRotation (const Quaternion &quat) |
set rotation using a quaternion. More... | |
virtual void | GetRotation (Quaternion *quat) |
get rotation using a quaternion | |
virtual void | SetScaling (float s) |
set the scale of the object. More... | |
virtual float | GetScaling () |
get the scaling. More... | |
virtual Vector3 | GetRenderOffset () |
get the offset(translation) of the object used for rendering. More... | |
virtual DVector3 | GetObjectCenter () |
get the center of the object in world space | |
virtual void | SetObjectCenter (const DVector3 &v) |
set the center of the object in world space | |
virtual void | GetFacing3D (Vector3 *pV) |
get object facing: only for object that has a facing property like biped, not bound facing | |
float | GetFacing () |
same as GetYaw and SetYaw get object facing: only for object that has a facing property like biped, not bound facing The object is facing the positive x axis, if facing is 0. | |
void | SetFacing (float fFacing) |
virtual float | GetYaw () |
get object Yaw: is facing the positive x axis, if yaw is 0. | |
virtual void | SetYaw (float fFacing) |
virtual float | GetPitch () |
get object pitch: is facing the positive x axis, if yaw is 0. | |
virtual void | SetPitch (float fFacing) |
virtual float | GetRoll () |
get object roll: is facing the positive x axis, if yaw is 0. | |
virtual void | SetRoll (float fFacing) |
virtual float | GetHeight () |
get object height y axis: only for object that has a Height property, usually is height of the bounding box | |
virtual void | SetHeight (float fHeight) |
virtual float | GetWidth () |
get object width: x axis | |
virtual void | SetWidth (float fWidth) |
virtual float | GetDepth () |
get object depth: z axis | |
virtual void | SetDepth (float fDepth) |
virtual Vector3 | GetNormal () |
virtual void | SetNormal (const Vector3 &pNorm) |
virtual void | GetOBB (CShapeOBB *obb) |
get the oriented bounding box in world space. More... | |
virtual void | GetAABB (CShapeAABB *aabb) |
virtual void | SetAABB (const Vector3 *vMin, const Vector3 *vMax) |
Set local AABB information. More... | |
virtual Vector3 | GetLocalAABBCenter () |
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 will be transformed on demand, so that the transformed object can be used for efficient object-level view culling in ParaEngine. More... | |
virtual void | SetTransform (Matrix4 *pWorldTransform) |
virtual Matrix4 * | GetRenderMatrix (Matrix4 &out, int nRenderNumber=0) |
return the world matrix of the object for rendering More... | |
virtual Matrix4 * | GetWorldTransform (Matrix4 &pOut, int nRenderNumber=0) |
get world transform | |
virtual bool | TestCollisionSphere (const Vector3 *pvCenter, float radius, BYTE nMethod=1) |
– collision detection More... | |
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 frustum planes of the camera More... | |
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 direction is completely out of the 6 frustum planes of the camera this function is usually used to test whether we need to render this object as shadow caster, where pvDirection is the current sun direction. | |
virtual bool | TestCollision (CBaseCamera *pCamera) |
check if the object's original shape can be seen via a camera. More... | |
virtual bool | TestCollisionObject (IViewClippingObject *pObj) |
desc: test if the object collide with this object in the world view. More... | |
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 output: fDistance: the distance between the eye and the intersection point. More... | |
virtual float | GetSphereCollisionDepth (Vector3 *pvCenter, float radius, bool bSolveDepth=false) |
desc: this is similar to TestCollisionSphere, but does more than that. More... | |
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 be zero. More... | |
virtual float | GetObjectToPointDistance (const Vector3 *pPoint) |
get the distance from the object's surface to a given point. More... | |
virtual void | DrawBoundingBox (SceneState *sceneState, DWORD color) |
debugging only: draw bounding box | |
virtual void | DrawOcclusionObject (SceneState *sceneState) |
draw the occlusion object More... | |
virtual void | DebugDraw (IBatchedElementDraw *pDebugDraw) |
this function is called whenever debugging drawing is enabled. More... | |
![]() | |
virtual const std::string & | GetIdentifier () |
get the name or identifier. More... | |
virtual void | SetIdentifier (const std::string &sID) |
int | GetNameW (std::u16string &out) |
gets the unicode name | |
const std::string & | GetName () |
alias name for GetIdentifier | |
IRefObject * | GetRefObjectByName (const char *sName) |
RefListItem * | GetRefObjectByTag (int nTag) |
get the first reference object by its tag | |
bool | HasReferences () |
RefResult | AddReference (IRefObject *maker, int nTag=0) |
add a new reference. More... | |
RefResult | DeleteReference (IRefObject *ref) |
delete a reference. More... | |
RefResult | DeleteAllRefs () |
Deletes all references of this object. More... | |
int | DeleteAllRefsByTag (int nTag=0) |
Deletes all references whose tag is nTag of this object. More... | |
RefList & | GetRefList () |
get the ref list | |
int | GetRefObjNum () |
get the total number of references | |
RefListItem * | GetRefObject (int nIndex) |
get the referenced object at the given index. More... | |
virtual void | OnRefAdded (IRefObject *rm, int nTag=0) |
This is called after another object added this object to its reference list. More... | |
virtual void | OnRefDeleted (IRefObject *rm) |
This is called after another object deleted this object from its reference list. More... | |
![]() | |
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 | InstallFields (CAttributeClass *pClass, bool bOverride) |
this class should be implemented if one wants to add new attribute. More... | |
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 IAttributeFields * | GetChildAttributeObject (int nRowIndex, int nColumnIndex=0) |
virtual IAttributeFields * | GetChildAttributeObject (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 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 CDynamicAttributeField * | GetDynamicField (const std::string &sName) |
Get a dynamic field with a given name. More... | |
virtual CDynamicAttributeField * | GetDynamicField (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... | |
CAttributeClass * | GetAttributeClass () |
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... | |
![]() | |
virtual void | Clone (IObject *obj) const |
Clone the object's contains to a pointer. More... | |
virtual IObject * | Clone () 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 IType * | GetType () const |
virtual std::string | ToString () const |
WeakPtr_type & | GetWeakReference () |
get weak reference object. More... | |
virtual int | ProcessObjectEvent (const ObjectEvent &event) |
this function is only used to backward compatibility of ParaObject:AddEvent() function. More... | |
![]() | |
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 () |
CRefCounted * | AddToAutoReleasePool () |
addref and releases the ownership sometime soon automatically (usually at the end of the current frame). More... | |
Additional Inherited Members | |
![]() | |
typedef ParaEngine::weak_ptr< IObject, IAttributeFields > | WeakPtr_type |
![]() | |
typedef ParaEngine::weak_ptr< IObject > | WeakPtr_type |
![]() | |
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... | |
![]() | |
virtual CAttributeClass * | CreateAttributeClass () |
initialize fields | |
virtual CDynamicAttributesSet * | GetDynamicAttributes (bool bCreateIfNotExist=false) |
![]() | |
RefList | m_references |
This is the list of active references that refer to us. | |
std::string | m_sIdentifer |
unit name used in the scripting language | |
![]() | |
WeakPtr_type | m_weak_reference |
![]() | |
int | m_refcount |
Pure interface for CBaseObject (3D scene object) It defines basic shapes and collision detection.
|
virtual |
this function is called whenever debugging drawing is enabled.
|
virtual |
draw the occlusion object
the occlusion object is defined in CBaseObject.
However, I may use more simplified model to draw the object. Currently I used the line primitive of the bounding box. Maybe Point primitive is enough(I tested it. it is not working well with point primitive even with fixed screen point size set.)
|
virtual |
Reimplemented in ParaEngine::CBaseObject, and ParaEngine::CTileObject.
|
virtual |
Reimplemented in ParaEngine::CBaseObject, and ParaEngine::CTileObject.
|
virtual |
get the oriented bounding box in world space.
One may need to shift by the rendering origin if used on that purposes.
obb | [out] |
Reimplemented in ParaEngine::CBipedObject, ParaEngine::CTileObject, and ParaEngine::CViewCullingObject.
|
virtual |
desc: test if the circle in the y=0 plane collide with this object in the world view Note: radius can be zero.
We assume that test is done in the y=0 plane only
|
virtual |
get the distance from the object's surface to a given point.
the object is always treated as a sphere. If the point is not inside the object, a positive value is always returned. otherwise, a negative value will be returned.
|
virtual |
get object position in the world space.
The position of an object is the bottom center of the object. most scene object will return the position using the following rules project the center of the shape to the bottom plane of the shape, the projection point at the bottom is returned as the object's world position. so it is different from the center of the object.
this is perhaps only for root scene
Reimplemented in ParaEngine::CBaseObject, ParaEngine::CSkyMesh, ParaEngine::CSphereObject, ParaEngine::CViewCullingObject, ParaEngine::CZoneNode, and ParaEngine::CTileObject.
|
inlinevirtual |
Reimplemented in ParaEngine::CBaseObject, ParaEngine::CSphereObject, ParaEngine::CTileObject, and ParaEngine::CViewCullingObject.
|
virtual |
return the world matrix of the object for rendering
out | the output. |
nRenderNumber | if it is bigger than current calculated render number, the value will be recalculated. If 0, it will not recalculate |
set facing and rotate local matrix round y axis
Reimplemented in ParaEngine::CBipedObject, ParaEngine::CMeshPhysicsObject, ParaEngine::CMeshObject, ParaEngine::CLightObject, ParaEngine::BMaxObject, and ParaEngine::CadModelNode.
|
virtual |
get the offset(translation) of the object used for rendering.
the rendering offset will translate the object from the world coordinate system to the scene's rendering coordinate system.This will make the components of world transform matrix consistent.(i.e. of the same magnitude.) hence it will correct floating point calculation imprecisions, due to large object coordinates, such as (20000.01). Notes: both the render function and the camera will use the render offset, instead of GetPosition() to get the position of the render object. This function will internally call the virtual function GetPosition().
|
virtual |
same as GetVertices().
Except that the vertices returned are for rendering, not for physics.
Reimplemented in ParaEngine::CViewCullingObject.
|
virtual |
get the scaling.
Reimplemented in ParaEngine::CBipedObject, ParaEngine::CMeshPhysicsObject, ParaEngine::BMaxObject, ParaEngine::CMeshObject, ParaEngine::CadModelNode, and ParaEngine::CVoxelMesh.
|
virtual |
desc: this is similar to TestCollisionSphere, but does more than that.
a depth value is returned test if the object collide with this object in the world view. Currently the pObj is regarded as a spherical/circular object. mostly it's a biped object. And this object can have shape of any type.
pvCenter[in/out]: bSolveDepth: true, the pvCenter will be changed to align to the nearest edge, if the original depth value is greater than 0. after alignment the value will be 0.
return the depth of collision, the large this value, the deeper the two object run into each other if this value is smaller than or equal to 0, then no collision is detected
|
virtual |
get all the vertices which can represent the object's shape.
This is used for view clipping. for sphere shaped object: 8 vertices of a axis aligned bounding box of the sphere is returned for box shaped object: The eight points of the bounding box is returned. for rect shaped object: The 4 points of the bounding box is returned. for circle shaped object: The 4 points of the bounding box of the circle is returned. pVertices: out parameter for storing the vertices, must be at least Vector3[8] nNumber: out parameter storing the number of vertices returned
Reimplemented in ParaEngine::CPortalNode.
|
virtual |
Rotate the object.This only takes effects on objects having 3D orientation, such as static mesh and physics mesh.
The orientation is computed in the following way: first rotate around x axis, then around y, finally z axis.
x | rotation around the x axis. |
y | rotation around the y axis. |
z | rotation around the z axis. |
Reimplemented in ParaEngine::CBipedObject, ParaEngine::CMeshPhysicsObject, ParaEngine::C3DCanvas, ParaEngine::CLightObject, ParaEngine::CCanvasCamera, ParaEngine::CMeshObject, and ParaEngine::CadModelNode.
|
virtual |
Set local AABB information.
It is possibly attained from a mesh entity.
Reimplemented in ParaEngine::CTileObject, and ParaEngine::CViewCullingObject.
|
virtual |
Set the object shape to box and bounding box parameters if fFacing is 0, it is a axis aligned bounding box (AABB).
The bounding sphere is set to radius of bounding box's the smallest spherical container
fOBB_X | object bounding box.x |
fOBB_Y | object bounding box.y |
fOBB_Z | object bounding box.z |
fFacing | rotation of the bounding box around the y axis. |
Reimplemented in ParaEngine::CBaseObject, ParaEngine::CMeshPhysicsObject, and ParaEngine::CTileObject.
|
inlinevirtual |
Set the object shape to rect (a plane) and rect parameters if fFacing is 0, it is a axis aligned bounding box (AABB).
fWidth | plane width or x |
fHeight | plane height or y. |
fFacing | rotation of the plane around the y axis. |
Reimplemented in ParaEngine::CBaseObject, ParaEngine::CMeshPhysicsObject, and ParaEngine::CTileObject.
|
virtual |
set the object position.
Reimplemented in ParaEngine::CBaseObject, ParaEngine::CBipedObject, ParaEngine::CMeshPhysicsObject, ParaEngine::CSkyMesh, ParaEngine::CMissileObject, ParaEngine::CSphereObject, ParaEngine::CBlockDynamicObject, ParaEngine::CZoneNode, ParaEngine::CTileObject, ParaEngine::CMeshObject, and ParaEngine::CadModelNode.
|
inlinevirtual |
Set the object shape to Sphere and sphere parameters.
fRadius | radius |
Reimplemented in ParaEngine::CBaseObject, ParaEngine::CMeshPhysicsObject, ParaEngine::CSphereObject, ParaEngine::CTileObject, and ParaEngine::CViewCullingObject.
|
virtual |
set rotation using a quaternion.
Reimplemented in ParaEngine::CMeshPhysicsObject, ParaEngine::CMeshObject, and ParaEngine::CadModelNode.
|
virtual |
set the scale of the object.
This function takes effects on both character object and mesh object.
s | scaling applied to all axis.1.0 means original size. |
Reimplemented in ParaEngine::CBipedObject, ParaEngine::CMeshPhysicsObject, ParaEngine::CLightObject, ParaEngine::BMaxObject, ParaEngine::CMeshObject, ParaEngine::CadModelNode, and ParaEngine::CVoxelMesh.
|
virtual |
Set a local transform matrix, a global position and a facing value, according to which the object will be transformed on demand, so that the transformed object can be used for efficient object-level view culling in ParaEngine.
Please note, that the input pointers must be valid until the ClearTransform is called
Reimplemented in ParaEngine::CViewCullingObject.
|
virtual |
check if the object's original shape can be seen via a camera.
it will return false if the object is completely out of the 6 frustum planes of the camera
Reimplemented in ParaEngine::CBlockDynamicObject, ParaEngine::CZoneNode, and ParaEngine::CPortalNode.
|
virtual |
desc: test if the object collide with this object in the world view.
Currently the pObj is regarded as a spherical/circular object. mostly it's a biped object. And this object can have shape of any type.
|
virtual |
Desc: Check the ray intersection with the object input:vPickRayOrig,vPickRayDir: mouse ray params output: fDistance: the distance between the eye and the intersection point.
this is only set when it's intersection in the first place return: true if they collide. note: TODO: currently the caller should always be the biped class
Let:a = Dx2 + Dy2 + Dz2; (for normalized rays, a=1) b = 2[ Dx(x0 每cx) + Dy(y0 每cy) + Dz(z0 每cz)] c = (x0 每cx)2 +(y0 每cy)2 +(z0 每cz)2-r2 Then: t = (-b ㊣ sqrt(b2 每 4ac))/2a if (b2 每 4ac) < 0, the ray does not intersect the sphere; if (b2 每 4ac) = 0, the ray grazes the sphere; if (b2 每 4ac) > 0, the ray enters and passes through the sphere, exiting on the other side. Use the smallest positive t to find the closest visible ray/sphere intersection point x(t), y(t), z(t),
|
virtual |
– collision detection
test if the sphere collides with this object in the world coordinate. this function is called by the game engine for object level clipping. The more accurate method will be slower. We assume that the view culling object is a box transformed from the AABB with the temporary transform information.
pvCenter | center of the sphere to test against |
radius | the radius of the sphere. It can be zero. |
nMethod | whether this object will be treated as a 2D cylinder, a 3D sphere or the original shape.
|
only test in the y=0 plane
we will first do a sphere based rough test
nMethod | = 1 |
|
virtual |
assume that the object is a sphere, it will return false if the sphere is completely out of the 6 frustum planes of the camera
fFarPlaneDistance | this value will replace the far plane. |
Reimplemented in ParaEngine::CZoneNode, and ParaEngine::CPortalNode.