From e585187b248f48b3c6e9247b49fa07c6565d65e5 Mon Sep 17 00:00:00 2001 From: maximius Date: Sat, 17 Oct 2009 15:51:44 -0700 Subject: *Backed out changeset 3be01fb200a5 --HG-- branch : trunk --- src/shared/vmap/SubModel.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/shared/vmap/SubModel.h') diff --git a/src/shared/vmap/SubModel.h b/src/shared/vmap/SubModel.h index d562f36d94e..89ea9b91d7b 100644 --- a/src/shared/vmap/SubModel.h +++ b/src/shared/vmap/SubModel.h @@ -17,15 +17,19 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #ifndef _SUBMODEL_H #define _SUBMODEL_H + // load our modified version first !! #include "AABSPTree.h" + #include "ShortVector.h" #include "ShortBox.h" #include "TreeNode.h" #include "VMapTools.h" #include "BaseModel.h" + namespace VMAP { /** @@ -46,30 +50,44 @@ namespace VMAP #endif public: SubModel() : BaseModel(){ }; + SubModel(unsigned int pNTriangles, TriangleBox *pTriangles, unsigned int pTrianglesPos, unsigned int pNNodes, TreeNode *pTreeNodes, unsigned int pNodesPos); SubModel(G3D::AABSPTree *pTree); ~SubModel(void); //Gets a 50 byte binary block void initFromBinBlock(void *pBinBlock); + void fillRenderArray(G3D::Array &pArray, const TreeNode* pTreeNode); + void countNodesAndTriangles(G3D::AABSPTree::Node& pNode, int &pNNodes, int &pNTriabgles); + void fillContainer(const G3D::AABSPTree::Node& pNode, int &pTreeNodePos, int &pTrianglePos, G3D::Vector3& pLo, G3D::Vector3& pHi); + inline const ShortBox& getReletiveBounds() const { return(iBox); } + inline void setReletiveBounds(const ShortVector& lo, const ShortVector& hi) { iBox.setLo(lo); iBox.setHi(hi); } + inline const G3D::AABox getAABoxBounds() const { return(G3D::AABox(iBox.getLo().getVector3() + getBasePosition(), iBox.getHi().getVector3()+ getBasePosition())); } + // get start pos bases on the global array inline TriangleBox const* getTriangles() const { return &BaseModel::getTriangle(iTrianglesPos); } inline TriangleBox * getTriangles() { return &BaseModel::getTriangle(iTrianglesPos); } + // get start pos bases on the global array inline TreeNode const* getTreeNodes() const { return &BaseModel::getTreeNode(iNodesPos); } inline TreeNode * getTreeNodes() { return &BaseModel::getTreeNode(iNodesPos); } + // internal method usign internal offset inline const TreeNode& getTreeNode(int pPos) const { return(SubModel::getTreeNodes()[pPos]); } + // internal method usign internal offset inline const TriangleBox& getTriangle(int pPos) const { return(SubModel::getTriangles()[pPos]); } + inline unsigned int getNodesPos() const { return(iNodesPos); } inline unsigned int getTrianglesPos() const { return(iTrianglesPos); } + //unsigned int hashCode() { return (getBasePosition() * getNTriangles()).hashCode(); } + void intersect(const G3D::Ray& pRay, float& pMaxDist, bool pStopAtFirstHit, G3D::Vector3& pOutLocation, G3D::Vector3& pOutNormal) const; bool intersect(const G3D::Ray& pRay, float& pMaxDist) const; template @@ -77,6 +95,7 @@ namespace VMAP bool operator==(const SubModel& pSm2) const; unsigned int hashCode() const { return BaseModel::getNTriangles(); } }; + unsigned int hashCode(const SubModel& pSm); void getBounds(const SubModel& pSm, G3D::AABox& pAABox); void getBounds(const SubModel* pSm, G3D::AABox& pAABox); -- cgit v1.2.3