Ignore:
Timestamp:
08/13/06 21:40:58 (18 years ago)
Author:
szydlowski
Message:

certain types of movableobject (camera, frustum, light) now excluded from tree building, list is extensible

Location:
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTree.h

    r1195 r1203  
    1717#define KDBRANCHPTR_CAST(a) (static_cast<KdTree::Branch *>(a)) 
    1818#define KDLEAFPTR_CAST(a) (static_cast<KdTree::Leaf *>(a)) 
     19 
     20#define KDTREE_LOGNAME "KdTreeBuild.log" 
    1921 
    2022#include <OgreAxisAlignedBox.h> 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTreeSceneManager.h

    r1192 r1203  
    2222 
    2323class KdTreeSceneNode; 
    24 //class WireBoundingBox; 
    2524 
    2625class KdTreeSceneManager : public SceneManager 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTreeSceneNode.h

    r1187 r1203  
    2828                ~KdTreeSceneNode() {}; 
    2929 
    30                 // calculate all-enclosing AABB, similar to _updateBounds() 
    31                 void forceComputeAABB(AxisAlignedBox& aabb); // OBSOLETE !! 
    32  
    3330                // gather info for kd-tree creation 
    3431                virtual void computeScene(PlaneEventList& events, AxisAlignedBox& aabb, int& nObjects, bool includeChildren = true); 
     
    4138 
    4239                // return a bounding box enclosing all objects 
    43                 virtual AxisAlignedBox getBoundingBox() const; 
    44  
    45                 // custom render op, show bounding box instead of axes 
    46                 //virtual void getRenderOperation(RenderOperation& op); 
    47  
    48                 //virtual void _findVisibleObjects(Camera* cam, RenderQueue* queue,  
    49                 //      bool includeChildren = true, bool displayNodes = false, bool onlyShadowCasters = false); 
     40                virtual AxisAlignedBox getBoundingBox(void) const; 
    5041 
    5142                // DEBUG 
    52                 String dumpToString(); 
     43                String dumpToString(void); 
    5344        protected: 
    5445                virtual void _updateBounds(void); 
    5546 
    56                 //AxisAlignedBox mLocalAABB; 
     47                typedef std::set<String> StringSet; 
     48 
     49                static StringSet& getExcludedMovables(void); 
    5750        }; 
    5851 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTree.cpp

    r1195 r1203  
    2121#include <OgreMaterialManager.h> 
    2222 
    23 #define KDTREE_LOGNAME "KdTreeBuild.log" 
    2423#define PLT_SIZE 101 
    2524 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeSceneNode.cpp

    r1195 r1203  
    4343                /* TODO: find a generic solution where MOVABLE nodes are NOT INSERTED into the KDTREE */ 
    4444                /**************************************************************************************/ 
    45                 if (mName == "PlayerCamNode") 
    46                         return; 
     45                //if (mName == "PlayerCamNode") 
     46                //      return; 
    4747 
    4848                // first compute nodes AABB 
     
    5252                for (i = mObjectsByName.begin(); i != mObjectsByName.end(); ++i) 
    5353                { 
    54                         // Merge world bounds of each object 
    55                         mWorldAABB.merge(i->second->getWorldBoundingBox(true)); 
     54                        // ignore objects with no actual geometry like frustums & lights 
     55                        if (getExcludedMovables().find(i->second->getMovableType()) == getExcludedMovables().end()) 
     56                        { 
     57                                //LogManager::getSingleton().getLog(KDTREE_LOGNAME)->logMessage("Adding movable type " + i->second->getMovableType() + " to KdTree"); 
     58                                // Merge world bounds of each object 
     59                                mWorldAABB.merge(i->second->getWorldBoundingBox(true)); 
     60                        } 
    5661                } 
    5762 
     63                // create information for KdTree/SAH 
    5864                if (!mWorldAABB.isNull()) 
    5965                { 
    6066                        // merge aabb with global AABB 
    6167                        aabb.merge(mWorldAABB); 
     68 
    6269                        // increase object count 
    6370                        nObjects++; 
     
    6875                        Vector3 min = mWorldAABB.getMinimum(); 
    6976                        Vector3 max = mWorldAABB.getMaximum(); 
    70                         //PlaneEvent * e; 
    7177                        for (int i = 0; i < 3; i++) 
    7278                        { 
     
    148154 
    149155        // recalculate the world aabb 
    150         AxisAlignedBox KdTreeSceneNode::getBoundingBox() const 
     156        AxisAlignedBox KdTreeSceneNode::getBoundingBox(void) const 
    151157        { 
    152 #if 0 
    153                 AxisAlignedBox box; 
     158                return mWorldAABB; 
     159        } 
    154160 
    155                 // Update bounds from own attached objects 
    156                 ObjectMap::const_iterator it = mObjectsByName.begin(); 
    157                 ObjectMap::const_iterator end = mObjectsByName.end(); 
    158                 for ( ; it != end ; ++it) 
     161        KdTreeSceneNode::StringSet& KdTreeSceneNode::getExcludedMovables(void) 
     162        { 
     163                static StringSet sExluded; 
     164 
     165                // initialise once 
     166                if (sExluded.empty()) 
    159167                { 
    160                         // Merge world bounds of each object 
    161                         box.merge(it->second->getWorldBoundingBox(true)); 
     168                        sExluded.insert("Camera"); 
     169                        sExluded.insert("Frustum"); 
     170                        sExluded.insert("Light"); 
    162171                } 
    163172 
    164                 if (box.getMinimum() != mWorldAABB.getMinimum() ||box.getMaximum() != mWorldAABB.getMaximum()) 
    165                 { 
    166                         try 
    167                         { 
    168                                 Log * log = LogManager::getSingleton().getLog("KdTreeBuild.log"); 
    169                                 log->logMessage("mWorldAABB was not up to date"); 
    170                         } 
    171                         catch (Exception) 
    172                         { 
    173                                 // F.U. 
    174                         } 
    175                 } 
    176  
    177                 return box; 
    178 #else 
    179                 return mWorldAABB; 
    180 #endif 
     173                return sExluded; 
    181174        } 
    182175 
    183         //void KdTreeSceneNode::getRenderOperation(RenderOperation& op) 
    184         //{ 
    185         //      if (mWireBoundingBox == NULL)  
    186         //      { 
    187         //              mWireBoundingBox = new WireBoundingBox(); 
    188         //      } 
    189  
    190         //      mWireBoundingBox->setupBoundingBox(mWorldAABB); 
    191         //      mWireBoundingBox->getRenderOperation(op); 
    192         //} 
    193  
    194176        // DEBUG 
    195         String KdTreeSceneNode::dumpToString() 
     177        String KdTreeSceneNode::dumpToString(void) 
    196178        { 
    197179                String objects; 
Note: See TracChangeset for help on using the changeset viewer.