Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 21, 2005, 4:27:06 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: more cleanup, and more cleanup to come

Location:
orxonox/trunk/src/lib/graphics/spatial_separation
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/graphics/spatial_separation/quadtree.cc

    r4922 r4923  
    1717
    1818#include "quadtree.h"
     19
    1920#include "quadtree_node.h"
    2021#include "material.h"
  • orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.cc

    r4922 r4923  
    1717
    1818#include "quadtree_node.h"
     19
    1920#include "quadtree.h"
    2021#include "material.h"
     
    9495
    9596/**
    96  * takes the rest of the initialisation process
     97 *  takes the rest of the initialisation process
    9798 */
    9899void QuadtreeNode::init()
     
    136137
    137138/**
    138 
     139  \brief this functions builds up a hash table containing all leafs of the Quadtree in a sorted array
     140  \param nodeList the nodelist array to add them
     141  \param index the current index in the array
     142
     143  The algorithm used for this purpose is home-brown. its not to fast but and the nodes are not always in the right
     144  order. this is why there will be needed a quicksort later on.
    139145 */
    140146void QuadtreeNode::buildHashTable(QuadtreeNode** nodeList, int* index)
     
    160166 *  gives the signal to separate the model into a quadtree
    161167 * @param treeDepth the max depth, the steps to go if treeDept == 0 leaf reached
    162 */
     168 */
    163169void QuadtreeNode::separateNode(float minLength)
    164170{
     
    361367
    362368
     369 /**
     370  * checks if a point is included in this quadtree
     371  * @param v the vector to be checked
     372  * @returns true if the vector is included
     373  */
    363374bool QuadtreeNode::includesPoint(const Vector& v)
    364375{
     
    377388
    378389/**
    379  *  draws the debug quadtree boxes around the model
     390 *  draws all the debug quadtree squares
    380391 */
    381392void QuadtreeNode::drawTree() const
     
    408419
    409420
     421/**
     422 *  draws only this quadtree square
     423 */
    410424void QuadtreeNode::draw() const
    411425{
  • orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.h

    r4922 r4923  
    11/*!
    2     \file proto_class.h
    3  *  Definition of ...
     2 *  \file proto_class.h
     3 *  Definition of a QuadtreeNode which represents a quad in a Quadtree
    44
     5  This struct is used to partition big land scapes into smaller ones for different reasons:
     6    - for collision detection: only a subset of all triangles need to be tested vs a given body
     7    - for object culling purposes: the quadtrees that are not in the field of view can be ommitted in the draw process
     8    - for LOD (level of Detail). The models can be drawn using different LODs depending on the distance
     9
     10  This struct includes all the triangles, vertices, normal informations needed to make something usefull with
     11  a terrain partition.
    512 */
    613
     
    2330                 const float* pVertices, int numVertices,
    2431                 Quadtree* quadtree, QuadtreeNode* parent,
    25                  Rectangle* rect, int treeDepth, const int maxDepth, int index);
     32                 Rectangle* rect, int treeDepth, const int maxDepth, int index
     33                );
    2634    QuadtreeNode(modelInfo* pModelInfo, Quadtree* quadtree, const int maxDepth);
    2735    virtual ~QuadtreeNode();
    2836
    2937    void buildHashTable(QuadtreeNode** nodeList, int* index);
    30 
     38    bool includesPoint(const Vector& v);
    3139    float getHeight(const Vector& position);
    32     Rectangle* getDimension() { return this->pDimension; }
    33 
    34     bool includesPoint(const Vector& v);
     40    inline Rectangle* getDimension() { return this->pDimension; }
    3541
    3642    void drawTree() const;
     
    4349    void separateNode(float minLength);
    4450    void separateNode();
     51    Rectangle* getDimFromModel();
    4552
    46     Rectangle* getDimFromModel();
    4753
    4854  protected:
     
    5359    QuadtreeNode*                   nodeD;              //!< reference to the node D
    5460    QuadtreeNode**                  nodes;              //!< reference to the quadtree nodes
    55     int                             nodeIter;           //!< temp helping variable for the hashing algorithm
     61
    5662
    5763  private:
     
    6571    int                             maxDepth;           //!< the maximal depth of the tree
    6672    int                             indexNode;          //!< the index number of the node
     73    int                             nodeIter;           //!< temp helping variable for the hashing algorithm
    6774
    6875    sTriangleExt**                  pTriangles;         //!< reference to the triangles of the node
  • orxonox/trunk/src/lib/graphics/spatial_separation/spatial_separation.cc

    r4922 r4923  
    99   any later version.
    1010
    11    ### File Specific:
     11### File Specific:
    1212   main-programmer: Patrick Boenzli
    1313   co-programmer: ...
     
    3030   The boxes are overlaping because this makes collision detection a lot simpler
    3131
    32 */
     32 */
    3333SpatialSeparation::SpatialSeparation (AbstractModel* model, float overlapSize)
    3434{
    35   PRINT(3)("\n");
    3635  PRINT(3)("+---------Debug Information SpatialSeparation----------\n");
    3736  PRINT(3)("+-| (Event) Spatial Separation process kicked on\n");
    3837
    39    this->setClassID(CL_SPATIAL_SEPARATION, "SpatialSeparation");
    40    /* debug vice */
    41    this->createQuadtree(model);
     38  this->setClassID(CL_SPATIAL_SEPARATION, "SpatialSeparation");
     39  /* debug vice */
     40  this->createQuadtree(model);
    4241}
     42
    4343
    4444/**
     
    4848
    4949   The boxes are overlaping because this makes collision detection a lot simpler
    50 
    5150 */
    5251SpatialSeparation::SpatialSeparation (AbstractModel* model, AbstractModel* playerModel)
     
    5958/**
    6059 *  standard deconstructor
    61 
    62 */
     60 */
    6361SpatialSeparation::~SpatialSeparation ()
    6462{
     
    6765
    6866/**
    69   \brief creates a quadtree
    70 * @param model the model to do a quadtree on
    71 * @param minLength the minimal length of a quadtree node
    72   \return the new quadtree
     67 * creates a quadtree
     68 * @param model the model to do a quadtree on
     69 * @param minLength the minimal length of a quadtree node
     70 * @return the new quadtree
    7371 */
    7472Quadtree* SpatialSeparation::createQuadtree(AbstractModel* model, float minLength)
     
    8078
    8179/**
    82   \brief creates a quadtree
    83 * @param model the model to do a quadtree on
    84 * @param minLength the minimal length of a quadtree node
    85   \return the new quadtree
     80 brief creates a quadtree
     81 * @param model the model to do a quadtree on
     82 * @param minLength the minimal length of a quadtree node
     83 * @return the new quadtree
    8684 */
    8785Quadtree* SpatialSeparation::createQuadtree(AbstractModel* model, int treeDepth)
     
    9290
    9391/**
    94   \brief creates a quadtree
    95 * @param model the model to do a quadtree on
    96 * @param minLength the minimal length of a quadtree node
    97   \return the new quadtree
    98 */
     92 * creates a quadtree
     93 * @param model the model to do a quadtree on
     94 * @param minLength the minimal length of a quadtree node
     95 * @return the new quadtree
     96 */
    9997Quadtree* SpatialSeparation::createQuadtree(AbstractModel* model)
    10098{
     
    105103
    106104
    107 
     105/**
     106 *  draws all the quadtrees
     107 */
    108108void SpatialSeparation::drawQuadtree()
    109109{
Note: See TracChangeset for help on using the changeset viewer.