Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8508 in orxonox.OLD for branches/bsp_model/src


Ignore:
Timestamp:
Jun 15, 2006, 11:59:56 PM (19 years ago)
Author:
patrick
Message:

bsp: added the bounding box for each model on WE level

Location:
branches/bsp_model/src
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • branches/bsp_model/src/defs/class_id.h

    r8507 r8508  
    278278  CL_OBB                        =    0x00720000,
    279279  CL_BOUNDING_SPHERE            =    0x00740000,
    280   CL_AABB_TREE_NODE             =    0x00000724,                //FIXME: is this correct? AABB_TREE_NODE isA BOUNDING_VOLUME
     280  CL_AABB_TREE_NODE             =    0x00000724,                //FIXME: is this correct? AABB_TREE_NODE isA BV_TREE_NODE
     281  CL_AABB                       =    0x00780000,                //FIXME: is this correct? AABB isA BOUNDING_VOLUME
    281282
    282283
  • branches/bsp_model/src/lib/collision_detection/Makefile.am

    r8507 r8508  
    1212                     bounding_volume.cc \
    1313                     bounding_sphere.cc \
    14                      aabb_tree_node.cc
     14                     aabb_tree_node.cc \
     15                     aabb.cc
    1516
    1617
     
    2425                     bounding_volume.h \
    2526                     bounding_sphere.h \
    26                      aabb_tree_node.h
     27                     aabb_tree_node.h \
     28                     aabb.h
    2729
  • branches/bsp_model/src/lib/collision_detection/aabb_tree_node.cc

    r8507 r8508  
    1616
    1717#include "aabb_tree_node.h"
    18 #include "obb_tree.h"
    19 #include "obb.h"
     18#include "aabb.h"
     19
     20#include "bv_tree.h"
    2021
    2122#include "matrix.h"
     
    133134void AABBTreeNode::spawnBVTree(const modelInfo& modelInf, const int* triangleIndexes, int length)
    134135{
    135   PRINTF(4)("\n==============================Creating OBB Tree Node==================\n");
    136   PRINT(4)(" OBB Tree Infos: \n");
     136  PRINTF(4)("\n==============================Creating AABB Tree Node==================\n");
     137  PRINT(4)(" AABB Tree Infos: \n");
    137138  PRINT(4)("\tDepth: %i \n\tTree Index: %i \n\tNumber of Triangles: %i\n", depth, this->treeIndex, length);
    138139  this->depth = depth;
    139140
    140   this->bvElement = new OBB();
     141  this->bvElement = new AABB();
    141142  this->bvElement->modelInf = &modelInf;
    142143  this->bvElement->triangleIndexes = triangleIndexes;
     
    175176 * @param length: the length of the indexes array
    176177 */
    177 void AABBTreeNode::calculateBoxCovariance(OBB& box, const modelInfo& modelInf, const int* triangleIndexes, int length)
     178void AABBTreeNode::calculateBoxCovariance(AABB& box, const modelInfo& modelInf, const int* triangleIndexes, int length)
    178179{
    179180  float     facelet[length];                         //!< surface area of the i'th triangle of the convex hull
     
    246247    PRINT(4)("\n");
    247248  }
    248   PRINTF(4)("\nWeighteed OBB Center:\n\t\t%11.4f\t %11.4f\t %11.4f\n", center.x, center.y, center.z);
     249  PRINTF(4)("\nWeighteed AABB Center:\n\t\t%11.4f\t %11.4f\t %11.4f\n", center.x, center.y, center.z);
    249250}
    250251
     
    258259 * @param length: the length of the indexes array
    259260 */
    260 void AABBTreeNode::calculateBoxEigenvectors(OBB& box, const modelInfo& modelInf,
     261void AABBTreeNode::calculateBoxEigenvectors(AABB& box, const modelInfo& modelInf,
    261262    const int* triangleIndexes, int length)
    262263{
     
    295296 * @param length: the length of the indexes array
    296297 */
    297 void AABBTreeNode::calculateBoxAxis(OBB& box, const modelInfo& modelInf, const int* triangleIndexes, int length)
     298void AABBTreeNode::calculateBoxAxis(AABB& box, const modelInfo& modelInf, const int* triangleIndexes, int length)
    298299{
    299300
     
    371372 * this will separate the box into to smaller boxes. the separation is done along the middle of the longest axis
    372373 */
    373 void AABBTreeNode::forkBox(OBB& box)
     374void AABBTreeNode::forkBox(AABB& box)
    374375{
    375376
     
    481482
    482483  PRINTF(4)("collideWith\n");
    483   PRINTF(5)("Checking OBB %i vs %i: ", this->getIndex(), treeNode->getIndex());
     484  PRINTF(5)("Checking AABB %i vs %i: ", this->getIndex(), treeNode->getIndex());
    484485
    485486  // for now only collide with AABBTreeNodes
     
    556557 * @param nodeB the node itself
    557558 */
    558 bool AABBTreeNode::overlapTest(OBB* boxA, OBB* boxB, WorldEntity* nodeA, WorldEntity* nodeB)
     559bool AABBTreeNode::overlapTest(AABB* boxA, AABB* boxB, WorldEntity* nodeA, WorldEntity* nodeB)
    559560{
    560561  //HACK remove this again
     
    776777        glColor4f(color.x, color.y, color.z, .5);
    777778      }
    778 
    779       // debug out
    780       if( this->obbTree->getOwner() != NULL)
    781       {
    782         PRINTF(4)("debug poly draw: depth: %i, mode: %i, entity-name: %s, class: %s\n", depth, drawMode, this->obbTree->getOwner()->getName(), this->obbTree->getOwner()->getClassName());
    783       }
    784       else
    785         PRINTF(4)("debug poly draw: depth: %i, mode: %i\n", depth, drawMode);
    786779
    787780
  • branches/bsp_model/src/lib/collision_detection/aabb_tree_node.h

    r8507 r8508  
    1212
    1313class BoundingVolume;
    14 class OBB;
     14class AABB;
    1515class OBBTree;
    1616class Plane;
     
    4141    /**  gets the id of the current child @return id of the child */
    4242    inline const int getID() { return this->nextID++; }
    43 
     43    inline AABB* getAABB() { return this->bvElement; }
    4444
    4545  private:
    46     void calculateBoxAxis(OBB& box, const sVec3D* verticesList, unsigned int length);
     46    void calculateBoxAxis(AABB& box, const sVec3D* verticesList, unsigned int length);
    4747
    48     void calculateBoxCovariance(OBB& box, const modelInfo& modelInf, const int* triangleIndexes, int length);
    49     void calculateBoxEigenvectors(OBB& box, const modelInfo& modelInf, const int* triangleIndexes, int length);
    50     void calculateBoxAxis(OBB& box, const modelInfo& modelInf, const int* triangleIndexes, int length);
    51     void forkBox(OBB& box);
     48    void calculateBoxCovariance(AABB& box, const modelInfo& modelInf, const int* triangleIndexes, int length);
     49    void calculateBoxEigenvectors(AABB& box, const modelInfo& modelInf, const int* triangleIndexes, int length);
     50    void calculateBoxAxis(AABB& box, const modelInfo& modelInf, const int* triangleIndexes, int length);
     51    void forkBox(AABB& box);
    5252
    5353    void collideWithOBB(AABBTreeNode* treeNode, WorldEntity* nodeA, WorldEntity* nodeB);
    54     bool overlapTest(OBB* boxA, OBB* boxB, WorldEntity* nodeA, WorldEntity* nodeB);
     54    bool overlapTest(AABB* boxA, AABB* boxB, WorldEntity* nodeA, WorldEntity* nodeB);
    5555
    5656
    5757  protected:
    58     OBB*                bvElement;                  //!< the obb element
     58    AABB*                bvElement;                  //!< the obb element
    5959    AABBTreeNode*        nodePrev;                   //!< ref to the previous (parent) tree node = NULL if first
    6060    AABBTreeNode*        nodeLeft;                   //!< ref to the left tree node
  • branches/bsp_model/src/world_entities/world_entity.h

    r8507 r8508  
    1515#include "glincl.h"
    1616#include <vector>
     17
     18#include "aabb_tree_node.h"
    1719
    1820#include "physics_interface.h"
     
    7476  inline BVTree* getOBBTree() const { return this->obbTree; };
    7577  void drawBVTree(int depth, int drawMode) const;
     78  inline AABB* getModelAABB() { return (this->aabbNode)?this->aabbNode->getAABB():NULL;}
    7679
    7780  /* --- Collision Reaction Block --- */
Note: See TracChangeset for help on using the changeset viewer.