#ifndef CCOLLISIONMESH_H #define CCOLLISIONMESH_H #include #include #include #include "CResource.h" class CCollisionMesh : public CResource { friend class CCollisionLoader; class CCollisionOctree { friend class CCollisionLoader; struct SOctreeNode {}; struct SLeaf : public SOctreeNode { CAABox AABox; std::vector FaceIndices; }; struct SBranch : public SOctreeNode { u16 Flags; SOctreeNode *pChildren[8]; }; SOctreeNode* Root; }; struct SCollisionProperties { // todo: figure out what the other properties are bool Invert; }; class CCollisionVertex { public: SCollisionProperties Properties; CVector3f Pos; }; class CCollisionLine { public: SCollisionProperties Properties; u16 Vertices[2]; }; class CCollisionFace { public: SCollisionProperties Properties; u16 Lines[3]; }; CVertexBuffer mVBO; CIndexBuffer mIBO; u32 mVertexCount; u32 mLineCount; u32 mFaceCount; bool mBuffered; CAABox mAABox; CCollisionOctree *mOctree; std::vector mFlags; std::vector mCollisionVertices; std::vector mCollisionLines; std::vector mCollisionFaces; bool mOctreeLoaded; CCollisionVertex *GetVertex(u16 index); CCollisionLine *GetLine(u16 index); CCollisionFace *GetFace(u16 index); public: CCollisionMesh(); ~CCollisionMesh(); EResType Type(); void BufferGL(); void Draw(); void DrawLines(); }; #endif // CCOLLISIONMESH_H