Changeset 1175


Ignore:
Timestamp:
08/01/06 16:55:06 (18 years ago)
Author:
szydlowski
Message:

slow but steady progress on kdtree scene manager

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

Legend:

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

    r1173 r1175  
    1313#include <OgreKdTreeHierarchyInterface.h> 
    1414#include <OgreSceneManager.h> 
     15#include <VisibilityManager.h> 
    1516#include "OgreKdTree.h" 
    16 #include "VisibilityManager.h" 
    1717 
    1818#define KDTREE_MAX_DEPTH 20 
     
    2222        class KdTreeSceneNode; 
    2323        class WireBoundingBox; 
    24         typedef std::list < WireBoundingBox * > WBBList; 
     24        //typedef std::list < WireBoundingBox * > WBBList; 
    2525 
    2626        class KdTreeSceneManager : public SceneManager 
     
    3131 
    3232                virtual const String& getTypeName(void) const; 
     33 
    3334                virtual SceneNode* createSceneNode(void); 
    3435                virtual SceneNode* createSceneNode(const String& name); 
     36                /** Override from SceneManager so that sub entities can be assigned an id for item buffer. 
     37                */ 
     38                Entity* createEntity(const String& entityName, const String& meshName); 
    3539 
     40                /** Update the KdTree with the node (more or less disabled now) 
     41                */ 
     42                virtual void _updateNode(KdTreeSceneNode *node); // TODO:  
     43 
     44                //virtual void _updateSceneGraph(Camera* cam); 
    3645                virtual void _findVisibleObjects(Camera *cam, bool onlyShadowCasters); 
     46                //virtual void _renderVisibleObjects(); 
    3747 
    3848                virtual void _renderNodes(const KdRenderableList& nodelist, Camera * cam, 
     
    4252                virtual bool getShowBoxes(void) const; 
    4353 
    44                 virtual void _updateNode(KdTreeSceneNode *node); // TODO:  
    45  
    4654                virtual bool setOption(const String& strKey, const void* pValue); 
    4755                virtual bool getOption(const String& strKey, void* pDestValue); 
     56 
     57                bool getOptionValues(const String & key, StringVector &refValueList); 
     58                bool getOptionKeys(StringVector &refKeys); 
     59 
     60                /** Sets the visibility manager. 
     61                @param visManager the visibility manager 
     62                */ 
     63                void setVisibilityManager(GtpVisibility::VisibilityManager *visManager); 
     64                /** See set. 
     65                */ 
     66                GtpVisibility::VisibilityManager *getVisibilityManager(); 
     67 
     68                /** Returns pointer to visibility manager. 
     69                */ 
     70                GtpVisibility::VisibilityManager *GetVisibilityManager(); 
     71 
     72                /** Returns hierarchy interface. 
     73                */ 
     74                KdTreeHierarchyInterface *GetHierarchyInterface(); 
     75 
     76 
     77                ///** Render a queue group.  
     78                //Override so we can handle delayed rendering of transparent objects 
     79                //*/ 
     80                //void renderBasicQueueGroupObjects(RenderQueueGroup* pGroup,  
     81                //      QueuedRenderableCollection::OrganisationMode om); 
     82 
     83                ///** Writes out stats into the Ogre log file. 
     84                //*/ 
     85                //void WriteLog(); 
     86 
     87                ///** Override pass so we can do the z-fail pass.  
     88                //*/ 
     89                //const Pass* _setPass(Pass* pass); 
     90 
     91                ///** Override from SceneManager so we can skip all but first pass for depth pass.  
     92                //*/ 
     93                //bool validatePassForRendering(Pass* pass); 
    4894 
    4995                virtual void clearScene() 
     
    64110                KdTreeHierarchyInterface *mHierarchyInterface; 
    65111 
     112                /// consecutive number for sub-entities 
     113                int mCurrentEntityId; 
     114 
     115                /// flag for passes which should not be deleted from queue during first traversal 
     116                int mLeavePassesInQueue; 
     117                 
    66118                int mMaxDepth; 
    67119 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeSceneManager.cpp

    r1173 r1175  
    99 
    1010#include <OgreCamera.h> 
     11#include <OgreSubEntity.h> 
    1112#include "OgreKdTreeSceneManager.h" 
    1213#include "OgreKdTreeSceneNode.h" 
    1314#include "OgreKdTree.h" 
     15#include "OgreVisibilityOptionsManager.h" 
    1416 
    1517#include <OgreLogManager.h> 
     
    1921{ 
    2022        KdTreeSceneManager::KdTreeSceneManager(const String& name, GtpVisibility::VisibilityManager *vm): 
    21                 SceneManager(name), mKdTree(0), mVisibilityManager(vm) 
     23                SceneManager(name),  
     24                mVisibilityManager(vm),  
     25                mKdTree(0),  
     26                mMaxDepth(KDTREE_MAX_DEPTH), 
     27                mShowBoxes(false), 
     28#ifdef KDTREE_DEBUG 
     29                mHighlighLevel(0), 
     30                mShowAllBoxes(false), 
     31#endif 
     32                mBuildMethod(KdTree::KDBM_PRIORITYQUEUE), 
     33                mRenderMethod(KdTree::KDRM_RECURSE), 
     34                mLeavePassesInQueue(0), 
     35                mCurrentEntityId(1) 
    2236        { 
    2337                // Replace root node with my node 
     
    2640                mSceneRoot = new KdTreeSceneNode(this, "root node"); 
    2741                mSceneRoot->_notifyRootNode(); 
    28  
    29                 mMaxDepth = KDTREE_MAX_DEPTH; 
    30                 mShowBoxes = false; 
    31  
    32                 // kill the old kd-tree if exists  
    33                 OGRE_DELETE(mKdTree); 
    34  
    35                 mRenderMethod = KdTree::KDRM_RECURSE; 
    36  
    37                 //mBuildMethod = KdTree::KDBM_RECURSIVE; 
    38                 mBuildMethod = KdTree::KDBM_PRIORITYQUEUE; 
    39 #ifdef KDTREE_DEBUG 
    40                 mHighlighLevel = 0; 
    41                 mShowAllBoxes = false; 
    42 #endif 
    4342 
    4443                mHierarchyInterface = new KdTreeHierarchyInterface(this, mDestRenderSystem); 
     
    197196                } 
    198197 
    199                 return SceneManager::setOption(strKey, pValue); 
     198                return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface) 
     199                        .setOption(strKey, pValue) || SceneManager::setOption(strKey, pValue); 
    200200        } 
    201201 
     
    269269                } 
    270270 
    271                 return SceneManager::getOption(strKey, pDestValue); 
     271                return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface) 
     272                        .getOption(strKey, pDestValue) || SceneManager::getOption(strKey, pDestValue); 
     273        } 
     274 
     275        bool KdTreeSceneManager::getOptionKeys(StringVector &refKeys) 
     276        { 
     277                refKeys.push_back("BuildMethod"); 
     278                refKeys.push_back("KI"); 
     279                refKeys.push_back("KT"); 
     280                refKeys.push_back("KdTreeMaxDepth"); 
     281                refKeys.push_back("RebuildKdTree"); 
     282                refKeys.push_back("RenderMethod"); 
     283                refKeys.push_back("ShowKdTree"); 
     284                refKeys.push_back("TreeBox"); 
     285#ifdef KDTREE_DEBUG 
     286                refKeys.push_back("HighlightLevel"); 
     287                refKeys.push_back("ShowAllBoxes"); 
     288#endif 
     289                return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface) 
     290                        .getOptionKeys(refKeys); 
     291        } 
     292 
     293        bool KdTreeSceneManager::getOptionValues(const String & key, StringVector &refValueList) 
     294        { 
     295                return SceneManager::getOptionValues(key, refValueList); 
     296        } 
     297 
     298        void KdTreeSceneManager::setVisibilityManager(GtpVisibility::VisibilityManager *visManager) 
     299        { 
     300                mVisibilityManager = visManager; 
     301        } 
     302 
     303        GtpVisibility::VisibilityManager * KdTreeSceneManager::getVisibilityManager() 
     304        { 
     305                return mVisibilityManager; 
     306        } 
     307 
     308        GtpVisibility::VisibilityManager * KdTreeSceneManager::GetVisibilityManager() 
     309        { 
     310                return mVisibilityManager; 
     311        } 
     312 
     313        KdTreeHierarchyInterface * KdTreeSceneManager::GetHierarchyInterface() 
     314        { 
     315                return mHierarchyInterface; 
    272316        } 
    273317 
     
    294338                mSceneNodes[sn->getName()] = sn; 
    295339                return sn; 
     340        } 
     341 
     342        Entity * KdTreeSceneManager::createEntity(const String& entityName, const String& meshName) 
     343        { 
     344                Entity *ent = SceneManager::createEntity(entityName, meshName); 
     345 
     346                for (int i = 0; i < (int)ent->getNumSubEntities(); ++i) 
     347                { 
     348                        ent->getSubEntity(i)->setId(mCurrentEntityId); 
     349                } 
     350 
     351                // increase counter of entity id values 
     352                ++ mCurrentEntityId; 
     353 
     354                return ent; 
    296355        } 
    297356 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreVisibilityOptionsManager.cpp

    r903 r1175  
    8282        refKeys.push_back("NumQueryCulledNodes"); 
    8383        refKeys.push_back("NumFrustumCulledNodes"); 
     84        refKeys.push_back("NumQueriesIssued"); 
    8485         
    8586        return true; 
Note: See TracChangeset for help on using the changeset viewer.