00001
00002
00003
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef TA_COLLISIONOBJECT_H
00015 #define TA_COLLISIONOBJECT_H
00016
00017 #ifndef TA_AABB_H
00018 #include "../Common/AABB.h"
00019 #endif // TA_AABB_H
00020
00021 #ifndef TA_REFCOUNT_H
00022 #include "../Common/RefCount.h"
00023 #endif // TA_REFCOUNT_H
00024
00025 #ifndef TA_PHYSICSCOMMON_H
00026 #include "PhysicsCommon.h"
00027 #endif // TA_PHYSICSCOMMON_H
00028
00029 TA_OBFUSCATION_SKIP_PASS_2
00030
00031 namespace TA
00032 {
00033
00034 struct MFrame;
00035 class Serialiser;
00036 struct Version;
00037 class FileHeader;
00038 class Collision;
00039
00040 class TAPHYSICS_CLASS CollisionObject : public RefCount
00041 {
00042 public:
00043 TA_OBFUSCATION_RESERVED_ON
00044 enum Type
00045 {
00046
00047
00048
00049 TYPE_CONVEX = 0,
00050 TYPE_LINE_LIST,
00051 TYPE_CAPSULE,
00052 TYPE_SPHERE,
00053 TYPE_CYLINDER,
00054
00055
00056 TYPE_COMPLEX,
00057
00058
00059 TYPE_CACHED_POLY_DATA,
00060 TYPE_COMBO,
00061
00062 NUM_TYPES
00063 };
00064
00065 virtual ~CollisionObject() {}
00066
00067 bool InitialiseFromFile(const Char* szFileName);
00068 bool SaveToFile(const Char* szFileName);
00069 bool InitialiseFromFileInMemory(void* pFileData, int nSizeInBytes);
00070 bool SaveToFileInMemory(void* pFileData, int nSizeInBytes);
00071 int CalculateFileSize();
00072
00074
00075 TA_OBFUSCATION_RESERVED_OFF
00076 virtual void Serialise(Serialiser& serialiser, const Version& version) { TA_ASSERT(0); }
00077 TA_OBFUSCATION_RESERVED_ON
00079 virtual bool Serialisable() const { return false; }
00080
00081 virtual void Render(const MFrame& mFrame) {};
00082
00083 virtual const AABB& GetAABB() const = 0;
00084
00085 virtual bool TestLineForCollision(
00086 const Vec3& v3Start,
00087 const Vec3& v3Normal,
00088 float fLength,
00089 Collision& collision) const = 0;
00090
00091 int GetCollisionObjectType() const;
00092 void SetUserData(u32 nUserData);
00093 u32 GetUserData() const;
00094 TA_OBFUSCATION_RESERVED_OFF
00095
00096 protected:
00097 AABB s_NullAABB;
00098
00099 CollisionObject(int nType) : m_nType(nType), m_nUserData(0) {}
00100 const AABB& NoGetAABB() const { TA_ASSERT_MSG(0, "GetAABB Not Implemented on this class"); return s_NullAABB; }
00101
00102 private:
00103 const int m_nType;
00104 int m_nUserData;
00105
00106 virtual const Char* GetFileHeaderString() const { return 0; }
00107 };
00108
00109 inline int CollisionObject::GetCollisionObjectType() const { return m_nType; }
00110 inline void CollisionObject::SetUserData(u32 nUserData) { m_nUserData = nUserData; }
00111 inline u32 CollisionObject::GetUserData() const { return m_nUserData; }
00112
00113 }
00114
00115 #endif // TA_COLLISIONOBJECT_H
© Copyright 2004-2006 TRUE AXIS PTY LTD Australia. All rights reserved.