Changeset 1192


Ignore:
Timestamp:
08/09/06 17:08:34 (18 years ago)
Author:
szydlowski
Message:

pre-major-changes-backup (TM)
fixed node vis issues for internal culling

Location:
GTP/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTreeAppListener.cpp

    r1188 r1192  
    208208 
    209209        int hl; 
    210         if (mSceneMgr->getOption("HighlightLevel", &hl)) 
     210        if (mSceneMgr->getOption("HiLiteLevel", &hl)) 
    211211                sHL = ": " + StringConverter::toString(hl); 
    212212        else 
     
    373373                                mKdTreeMaxDepthInfo->setCaption(": " + StringConverter::toString(currdepth)); 
    374374                                int hl; 
    375                                 if (mSceneMgr->getOption("HighlightLevel", &hl)) 
     375                                if (mSceneMgr->getOption("HiLiteLevel", &hl)) 
    376376                                        mHighlightLevelInfo->setCaption(": " + StringConverter::toString(hl)); 
    377377                                else 
     
    394394        { 
    395395                int hl; 
    396                 if (mSceneMgr->getOption("HighlightLevel", &hl)) 
     396                if (mSceneMgr->getOption("HiLiteLevel", &hl)) 
    397397                { 
    398398                        if (mInputDevice->isKeyDown(KC_3)) 
     
    401401                                hl++; 
    402402 
    403                         if (mSceneMgr->setOption("HighlightLevel", &hl)) 
     403                        if (mSceneMgr->setOption("HiLiteLevel", &hl)) 
    404404                                mHighlightLevelInfo->setCaption(": " + StringConverter::toString(hl)); 
    405405                } 
     
    600600                { 
    601601                        int hl; 
    602                         if (mSceneMgr->getOption("HighlightLevel", &hl)) 
     602                        if (mSceneMgr->getOption("HiLiteLevel", &hl)) 
    603603                                mHighlightLevelInfo->setCaption(": " + StringConverter::toString(hl)); 
    604604                        else 
     
    621621        { 
    622622                bool toggleShow; 
    623                 mSceneMgr->getOption("ShowNodeAABB", &toggleShow); 
     623                mSceneMgr->getOption("ShowNodes", &toggleShow); 
    624624                toggleShow = !toggleShow; 
    625                 mSceneMgr->setOption("ShowNodeAABB", &toggleShow); 
     625                mSceneMgr->setOption("ShowNodes", &toggleShow); 
    626626                mTimeUntilNextToggle = 0.2; 
    627627        } 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTree.h

    r1190 r1192  
    192192                { 
    193193                public: 
    194                         Node(int level, AxisAlignedBox& aabb, Branch * parent): 
     194                        Node(KdTree * owner, int level, AxisAlignedBox& aabb, Branch * parent): 
     195                        mOwner(owner), 
    195196                        mLevel(level), 
    196197                        mAABB(aabb), 
     
    208209                        virtual bool hasGeometry() const = 0; 
    209210 
     211                        // Gets this node's parent (NULL if this is the root). 
     212                        Node *getParent(void) const { return mParent; }; 
     213                        // Gets the nodes left & right child nodes, or NULL if not present 
     214                        // or node is leaf 
     215                        virtual Node *getLeftChild(void) const = 0; 
     216                        virtual Node *getRightChild(void) const = 0; 
     217                         
     218                        // returns the level the node is on 
     219                        int getLevel(void) const { return mLevel; }; 
     220 
    210221                        virtual void queueVisibleObjects(unsigned long currentFrame,  
    211222                                Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes) = 0; 
    212223                         
    213                         // consider using typesafe callback functions 
    214                         //virtual void cbInsert(KdTree * caller, KdRenderable * rend) = 0; 
    215  
    216                         WireBoundingBox * getWireBoundingBox(bool node = true) 
     224                        WireBoundingBox * getWireBoundingBox() 
    217225                        { 
    218226                                if (mWBB == 0) 
    219227                                        mWBB = new WireBoundingBox(); 
    220228 
    221                                 if (node) 
     229                                if (mOwner->getShowNodes()) 
    222230                                        mWBB->setupBoundingBox(mAABB); 
    223231                                else 
    224232                                        mWBB->setupBoundingBox(mWorldAABB); 
     233 
     234                                if (mOwner->getHiLiteLevel() == mLevel) 
     235                                        mWBB->setMaterial("KdTree/BoxHiLite"); 
     236                                else 
     237                                        mWBB->setMaterial("BaseWhiteNoLighting"); 
    225238                                 
    226 #ifdef KDTREE_DEBUG 
    227                                 SceneManager * sceneManager = Root::getSingleton()._getCurrentSceneManager(); 
    228                                 int level = -1; 
    229                                 bool boxes = false; 
    230                                 if (sceneManager->getOption("HighlightLevel",&level)) 
    231                                 { 
    232                                         if (mLevel == level) 
    233                                         { 
    234                                                 mWBB->setMaterial("KdTree/BoxHiLite"); 
    235                                                 return mWBB; 
    236                                         } 
    237                                         else 
    238                                         { 
    239                                                 mWBB->setMaterial("BaseWhiteNoLighting"); 
    240                                                 if (sceneManager->getOption("ShowAllBoxes", &boxes)) 
    241                                                 { 
    242                                                         if (boxes) 
    243                                                                 return mWBB; 
    244                                                         else 
    245                                                                 return 0; 
    246                                                 } 
    247                                         } 
    248                                 } 
    249 #else 
    250                                 mWBB->setMaterial("BaseWhiteNoLighting"); 
    251 #endif // KDTREE_DEBUG 
    252239                                return mWBB; 
    253240 
     
    277264                        */ 
    278265                        void setLastRendered(unsigned int frameid) { mLastRendered = frameid; }; 
    279                         /** Gets this node's parent (NULL if this is the root). 
    280                         */       
    281                         KdTree::Branch *getParent(void) { return mParent; }; 
    282266                        /** Returns real extent of the kdtree, i.e., the merged extent of the bounding boxes.  
    283267                        */ 
     
    287271                        virtual void _updateBounds(bool recurse = true) = 0; 
    288272 
    289                         Branch * mParent; 
    290                         int mLevel; 
    291273                        AxisAlignedBox mAABB; 
    292274 
     
    295277                        AxisAlignedBox mWorldAABB; 
    296278                protected: 
     279                        KdTree * mOwner; 
     280                        Branch * mParent; 
     281                        int mLevel; 
     282 
    297283                        WireBoundingBox * mWBB; 
    298284                         
     
    305291                { 
    306292                public: 
    307                         Branch(int level, AxisAlignedBox& aabb, Branch * parent, Plane * splitplane, PlaneEvent::Side side): 
    308                                 Node(level, aabb, parent),  
    309                                 mSplitPlane(splitplane),  
    310                                 mLeft(0),  
    311                                 mRight(0), 
    312                                 mPlaneSide(side) 
     293                        Branch(KdTree * owner, int level, AxisAlignedBox& aabb, Branch * parent,  
     294                                Plane * splitplane, PlaneEvent::Side side): 
     295                        Node(owner, level, aabb, parent),  
     296                        mSplitPlane(splitplane),  
     297                        mLeft(0),  
     298                        mRight(0), 
     299                        mPlaneSide(side) 
    313300                        { }; 
    314301 
     
    329316                        virtual bool hasGeometry() const { return false; }; 
    330317 
     318                        // a branch should have at least one child 
     319                        virtual Node * getLeftChild() const { return mLeft; }; 
     320                        virtual Node * getRightChild() const { return mRight; }; 
     321 
    331322                        virtual void queueVisibleObjects(unsigned long currentFrame,  
    332323                                Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes) 
    333324                        { 
    334325                                if (showBoxes) 
    335                                 { 
    336                                         WireBoundingBox * wbb = getWireBoundingBox(); 
    337                                         if (wbb) 
    338                                                 queue->addRenderable(wbb); 
    339                                 } 
     326                                        if (mLevel == mOwner->getHiLiteLevel() || mOwner->getShowAllBoxes()) 
     327                                                queue->addRenderable(getWireBoundingBox()); 
    340328                        } 
    341329 
     
    365353                { 
    366354                public: 
    367                         Leaf(int level, AxisAlignedBox& aabb, Branch * parent): 
    368                           Node(level, aabb, parent)  
     355                        Leaf(KdTree * owner, int level, AxisAlignedBox& aabb, Branch * parent): 
     356                        Node(owner, level, aabb, parent)  
    369357                        {}; 
    370358 
     
    379367                        // a leaf has geometry when it has renderables 
    380368                        virtual bool hasGeometry() const { return !mKdRenderables.empty(); }; 
     369 
     370                        // a leaf never has children  
     371                        virtual Node * getLeftChild() const { return 0; }; 
     372                        virtual Node * getRightChild() const { return 0; }; 
    381373 
    382374                        virtual void queueVisibleObjects(unsigned long currentFrame,  
     
    478470                        KDBM_PRIORITYQUEUE 
    479471                }; 
     472 
     473                const static int HILITE_OFF  = -1; 
    480474                 
    481                 KdTree(int maxdepth); 
     475                KdTree(int maxdepth, BuildMethod bm); 
     476                KdTree(int maxdepth, BuildMethod bm, int hilite, bool allboxes, bool shownodes); 
    482477                virtual ~KdTree(); 
    483478 
     
    486481                Real calcCost(void); 
    487482 
    488                 /** Switches between displaying the bounding box of the node and 
    489                 the box of the contained scene nodes 
    490                 */ 
    491                 inline void setShowNodeAABB(bool show = true) { mShowNodeAABB = show; }; 
    492                 inline bool getShowNodeAABB(void) { return mShowNodeAABB; }; 
     483                // sets the level to highlight or turns it off (when hilite < 0) 
     484                inline void setHiLiteLevel(int hilite) { mHiLiteLevel = hilite; }; 
     485                inline int  getHiLiteLevel(void) { return mHiLiteLevel; }; 
     486 
     487                // toggles displaying the kdtree boxes 
     488                inline void setShowAllBoxes(bool show) { mShowAllBoxes = show; }; 
     489                inline bool getShowAllBoxes(void) { return mShowAllBoxes; }; 
     490 
     491                // toggles between displaying the bounding box of the node and 
     492                // the box of the contained scene nodes 
     493                inline void setShowNodes(bool show = true) { mShowNodes = show; }; 
     494                inline bool getShowNodes(void) { return mShowNodes; }; 
    493495 
    494496                NodePtr getRoot(void) const { return mKdRoot; }; 
     
    510512                void setBuildMethod(BuildMethod bm) { mBuildMethod = bm; } 
    511513        protected: 
     514                // init materials, logs and stuff 
     515                void init(); 
    512516                // recursive insert funciton 
    513517                void recInsert(KdTree::Node * node, KdRenderable * rend); 
     
    549553                Stats mStats; 
    550554 
    551                 // show node or object aabb 
    552                 bool mShowNodeAABB; 
     555                /** Visualization flags **/ 
     556                // show/highlight selected level in kdtree 
     557                int mHiLiteLevel; 
     558                // show whole kd-tree 
     559                bool mShowAllBoxes; 
     560                // show node or object boxes 
     561                bool mShowNodes; 
    553562 
    554563 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTreeSceneManager.h

    r1187 r1192  
    243243        // if bounding boxes of kdtree nodes are shown 
    244244        bool mShowBoxes; 
     245        // bounding boxes of kd nodes will be highlighted on this level of the kd tree 
     246        int mHiLiteLevel; 
     247        // if all bounding boxes shall be displayed, not only the highlighted level 
     248        bool mShowAllBoxes; 
     249        // visualize kdtree nodes or bounding boxes of objects in nodes 
     250        bool mShowNodes; 
    245251 
    246252        // the method/algorithm used when rendering the scene 
     
    249255        // the method of building the tree 
    250256        KdTree::BuildMethod mBuildMethod; 
    251 #ifdef KDTREE_DEBUG 
    252         // bounding boxes of kd nodes will be highlighted on this level of the kd tree 
    253         int mHighlighLevel; 
    254         // if all bounding boxes shall be displayed, not only the highlighted level 
    255         bool mShowAllBoxes; 
    256 #endif 
    257257}; 
    258258 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTree.cpp

    r1190 r1192  
    304304        //---------------------------------------------------------------------------- 
    305305 
    306         KdTree::KdTree(int maxdepth):  
     306        KdTree::KdTree(int maxdepth, BuildMethod bm):  
    307307        mMaxDepth(maxdepth),  
     308        mBuildMethod(bm),  
     309        mHiLiteLevel(HILITE_OFF), 
     310        mShowAllBoxes(false), 
     311        mShowNodes(true), 
    308312        mKdRoot(0),  
    309         mBuildMethod(KDBM_RECURSIVE),  
    310         mBuildLog(0),  
    311         mShowNodeAABB(true) 
    312         { 
     313        mBuildLog(0) 
     314        { 
     315                init(); 
     316        } 
     317 
     318        KdTree::KdTree(int maxdepth, BuildMethod bm, int hilite, bool allboxes, bool shownodes): 
     319        mMaxDepth(maxdepth),  
     320        mBuildMethod(bm),  
     321        mHiLiteLevel(hilite), 
     322        mShowAllBoxes(allboxes), 
     323        mShowNodes(shownodes), 
     324        mKdRoot(0),  
     325        mBuildLog(0) 
     326        { 
     327                init(); 
     328        } 
     329 
     330        KdTree::~KdTree() 
     331        { 
     332                delete mKdRoot; 
     333        } 
     334 
     335        void KdTree::init() 
     336        { 
     337                // init visualization materials 
    313338                MaterialPtr mphi = MaterialManager::getSingleton().getByName("KdTree/BoxHiLite"); 
    314339                if (mphi.isNull()) 
     
    318343                        mphi->setAmbient(green); 
    319344                        mphi->setDiffuse(green); 
    320                         mphi->setSelfIllumination(ColourValue::Black); 
    321345                        mphi->setLightingEnabled(true); 
    322346                        mphi->getTechnique(0)->getPass(0)->removeAllTextureUnitStates(); 
     
    330354                        mpviz->setAmbient(yellow); 
    331355                        mpviz->setDiffuse(yellow); 
    332                         mpviz->setSelfIllumination(ColourValue::Black); 
    333356                        mpviz->setLightingEnabled(true); 
    334357                        mpviz->getTechnique(0)->getPass(0)->removeAllTextureUnitStates(); 
    335358                } 
    336359 
     360                // retrieve or create build log 
    337361                try 
    338362                { 
     
    343367                        mBuildLog = LogManager::getSingleton().createLog(KDTREE_LOGNAME); 
    344368                } 
    345         } 
    346  
    347         KdTree::~KdTree() 
    348         { 
    349                 delete mKdRoot; 
    350369        } 
    351370 
     
    399418                        else 
    400419                        { 
    401                                 KdTree::Branch * parent = node->mParent; 
     420                                KdTree::Branch * parent = KDBRANCHPTR_CAST(node->getParent()); 
    402421                                if (node == parent->mLeft) 
    403422                                { 
     
    571590                else 
    572591                { 
    573                         KdTree::Branch * parent = KDBRANCHPTR_CAST(node->mParent); 
     592                        KdTree::Branch * parent = KDBRANCHPTR_CAST(node->getParent()); 
    574593 
    575594                        if (node == parent->mLeft) 
     
    738757                if (parent) 
    739758                { 
    740                         level = parent->mLevel + 1; 
     759                        level = parent->getLevel() + 1; 
    741760                } 
    742761 
     
    795814                { 
    796815                        // Terminating condition reached, create leaf and add renderables to list 
    797                         KdTree::Leaf * leaf = new KdTree::Leaf(level, aabb, parent); 
     816                        KdTree::Leaf * leaf = new KdTree::Leaf(this, level, aabb, parent); 
    798817                        KdRenderable *rend; 
    799818                        it = begin; 
     
    879898 
    880899                        // create a new branch node and continue recursion 
    881                         KdTree::Branch * branch = new KdTree::Branch(level, aabb, parent, best.event.getSplitPlane(), best.side); 
     900                        KdTree::Branch * branch = new KdTree::Branch(this, level, aabb, parent,  
     901                                best.event.getSplitPlane(), best.side); 
    882902 
    883903                        // now create the child nodes and continue recursion 
     
    931951                        if (sc.parent) 
    932952                        { 
    933                                 level = sc.parent->mLevel + 1; 
     953                                level = sc.parent->getLevel() + 1; 
    934954                        } 
    935955 
     
    941961                        { 
    942962                                // Terminating condition reached, create leaf and add renderables to list 
    943                                 KdTree::Leaf * leaf = new KdTree::Leaf(level, sc.aabb, sc.parent); 
     963                                KdTree::Leaf * leaf = new KdTree::Leaf(this, level, sc.aabb, sc.parent); 
    944964                                KdRenderable *rend; 
    945965                                PlaneEventList::iterator begin = sc.events->begin(); 
     
    10321052 
    10331053                                // create a new branch node 
    1034                                 KdTree::Branch * branch =  
    1035                                         new KdTree::Branch(level, sc.aabb, sc.parent, sc.best->event.getSplitPlane(), sc.best->side); 
     1054                                KdTree::Branch * branch = new KdTree::Branch(this, level, sc.aabb, sc.parent,  
     1055                                        sc.best->event.getSplitPlane(), sc.best->side); 
    10361056 
    10371057                                globalTreeCost -= sc.decrease; 
     
    11741194                if (cam->isVisible(node->mAABB)) 
    11751195                { 
     1196#if 0 
     1197                        node->queueVisibleObjects(currentFrame, cam, queue, onlyShadowCasters, showBoxes); 
     1198 
     1199                        if (node->getLeftChild()) 
     1200                                recQueueVisibleObjects(node->getLeftChild(), currentFrame, cam, queue, onlyShadowCasters, showBoxes); 
     1201                        if (node->getRightChild()) 
     1202                                recQueueVisibleObjects(node->getRightChild(), currentFrame, cam, queue, onlyShadowCasters, showBoxes); 
     1203#else 
    11761204#ifdef KDTREE_DEBUG 
    11771205                        WireBoundingBox * wbb = 0; 
    11781206                        if (showBoxes) 
    1179                                 wbb = node->getWireBoundingBox(mShowNodeAABB); 
     1207                                wbb = node->getWireBoundingBox(); 
    11801208#endif 
    11811209 
     
    11981226#else 
    11991227                                if (showBoxes) 
    1200                                         queue->addRenderable(leaf->getWireBoundingBox(mShowNodeAABB)); 
     1228                                        queue->addRenderable(leaf->getWireBoundingBox()); 
    12011229#endif 
    12021230                        } 
     
    12091237#else 
    12101238                                if (showBoxes) 
    1211                                         queue->addRenderable(branch->getWireBoundingBox(mShowNodeAABB)); 
     1239                                        queue->addRenderable(branch->getWireBoundingBox()); 
    12121240#endif 
    12131241 
     
    12171245                                        recQueueVisibleObjects(branch->mRight, currentFrame, cam, queue, onlyShadowCasters, showBoxes); 
    12181246                        } 
     1247#endif 
    12191248                } 
    12201249        } 
     
    12411270                 
    12421271                pad = ""; 
    1243                 for (p = 0; p < node->mLevel; p++) 
     1272                for (p = 0; p < node->getLevel(); p++) 
    12441273                { 
    12451274                        pad += " "; 
     
    12551284                                scenenode = dynamic_cast<KdTreeSceneNode *>(*it); 
    12561285                                log->logMessage(pad + "# Leaf   level " +  
    1257                                         StringConverter::toString(node->mLevel) +  
     1286                                        StringConverter::toString(node->getLevel()) +  
    12581287                                        " SceneNode " + scenenode->getName()); 
    12591288                                log->logMessage(pad + "## Objects: " + scenenode->dumpToString()); 
     
    12671296                        { 
    12681297                                log->logMessage(pad + "# Branch level " +  
    1269                                         StringConverter::toString(node->mLevel) + " Left Child"); 
     1298                                        StringConverter::toString(node->getLevel()) + " Left Child"); 
    12701299                                dump(branch->mLeft); 
    12711300                        } 
     
    12731302                        { 
    12741303                                log->logMessage(pad + "# Branch level " +  
    1275                                         StringConverter::toString(node->mLevel) + " Right Child"); 
     1304                                        StringConverter::toString(node->getLevel()) + " Right Child"); 
    12761305                                dump(branch->mRight); 
    12771306                        } 
     
    13421371 
    13431372                if (showBoxes) 
    1344                 { 
    1345                         WireBoundingBox * wbb = getWireBoundingBox(); 
    1346                         if (wbb) 
    1347                                 queue->addRenderable(wbb); 
    1348                 } 
     1373                        if (mLevel == mOwner->getHiLiteLevel() || mOwner->getShowAllBoxes()) 
     1374                                queue->addRenderable(getWireBoundingBox()); 
    13491375        } 
    13501376 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeSceneManager.cpp

    r1190 r1192  
    2929mMaxDepth(KDTREE_MAX_DEPTH), 
    3030mShowBoxes(false), 
    31 #ifdef KDTREE_DEBUG 
    32 mHighlighLevel(0), 
     31mHiLiteLevel(0), 
    3332mShowAllBoxes(false), 
    34 #endif 
    3533mBuildMethod(KdTree::KDBM_PRIORITYQUEUE), 
    3634mRenderMethod(KdTree::KDRM_INTERNAL), 
     
    102100                { 
    103101                        mMaxDepth = maxdepth; 
    104 #ifdef KDTREE_DEBUG 
    105                         if (mHighlighLevel > mMaxDepth) 
    106                                 mHighlighLevel = mMaxDepth; 
    107 #endif 
     102                        if (mHiLiteLevel > mMaxDepth) 
     103                                mHiLiteLevel = mMaxDepth; 
    108104                        return true; 
    109105                } 
     
    139135        { 
    140136                OGRE_DELETE(mKdTree); 
    141                 mKdTree = new KdTree(mMaxDepth); 
    142                 mKdTree->setBuildMethod(mBuildMethod); 
     137                mKdTree = new KdTree(mMaxDepth, mBuildMethod, mHiLiteLevel, mShowAllBoxes, mShowNodes); 
    143138                mKdTree->build(static_cast<KdTreeSceneNode *>(mSceneRoot)); 
    144139                return true; 
    145140        } 
    146 #ifdef KDTREE_DEBUG 
    147         else if (strKey == "HighlightLevel") 
    148         { 
    149                 int hl = *static_cast<const int *>(pValue); 
    150                 if (hl >= 0 && hl <= mMaxDepth) 
    151                 { 
    152                         mHighlighLevel = hl; 
    153                         return true; 
    154                 } 
    155                 else 
    156                 { 
    157                         return false; 
    158                 } 
    159         } 
    160         else if (strKey == "ShowAllBoxes") 
    161         { 
    162                 bool sa = *static_cast<const bool *>(pValue); 
    163                 mShowAllBoxes = sa; 
    164                 return true; 
    165         } 
    166 #endif 
    167141        else if (strKey == "BuildMethod") 
    168142        { 
     
    236210                                mRenderMethod = KdTree::KDRM_INTERNAL; 
    237211                } 
     212                else 
     213                { 
     214                        mRenderMethod = KdTree::KDRM_INTERNAL; 
     215                } 
    238216                return success; 
    239217        } 
     
    244222                return true; 
    245223        } 
    246         else if (strKey == "ShowNodeAABB") 
     224        else if (strKey == "HiLiteLevel") 
     225        { 
     226                int hl = *static_cast<const int *>(pValue); 
     227                if (hl >= 0 && hl <= mMaxDepth) 
     228                { 
     229                        mHiLiteLevel = hl; 
     230                        if (mKdTree) 
     231                                mKdTree->setHiLiteLevel(mHiLiteLevel); 
     232                        return true; 
     233                } 
     234                else 
     235                { 
     236                        return false; 
     237                } 
     238        } 
     239        else if (strKey == "ShowAllBoxes") 
     240        { 
     241                bool sa = *static_cast<const bool *>(pValue); 
     242                mShowAllBoxes = sa; 
     243                if (mKdTree) 
     244                        mKdTree->setShowAllBoxes(mShowAllBoxes); 
     245                return true; 
     246        } 
     247        else if (strKey == "ShowNodes") 
    247248        { 
    248249                bool sn = *static_cast<const bool *>(pValue); 
     250                mShowNodes = sn; 
    249251                if (mKdTree) 
    250                         mKdTree->setShowNodeAABB(sn); 
     252                        mKdTree->setShowNodes(mShowNodes); 
    251253                return true; 
    252254        } 
     
    341343                return true; 
    342344        } 
    343 #ifdef KDTREE_DEBUG 
    344         else if (strKey == "HighlightLevel") 
    345         { 
    346                 *static_cast<int *>(pDestValue) = mHighlighLevel; 
     345        else if (strKey == "BuildMethod") 
     346        { 
     347                if (mBuildMethod == KdTree::KDBM_PRIORITYQUEUE) 
     348                { 
     349                        *static_cast<String *>(pDestValue) = "PriorityQueue"; 
     350                } 
     351                else if (mBuildMethod == KdTree::KDBM_RECURSIVE) 
     352                { 
     353                        *static_cast<String *>(pDestValue) = "Recursive"; 
     354                } 
     355                return true; 
     356        } 
     357        else if (strKey == "RenderMethod") 
     358        { 
     359                if (mRenderMethod == KdTree::KDRM_INTERNAL) 
     360                { 
     361                        *static_cast<String *>(pDestValue) = "INT"; 
     362                } 
     363                else if (mRenderMethod == KdTree::KDRM_GTP_VFC) 
     364                { 
     365                                *static_cast<String *>(pDestValue) = "VFC"; 
     366                } 
     367                else if (mRenderMethod == KdTree::KDRM_GTP_SWC) 
     368                { 
     369                                *static_cast<String *>(pDestValue) = "SWC"; 
     370                } 
     371                else if (mRenderMethod == KdTree::KDRM_GTP_CHC) 
     372                { 
     373                                *static_cast<String *>(pDestValue) = "CHC"; 
     374                } 
     375                else 
     376                { 
     377                        return false; 
     378                } 
     379                return true; 
     380        } 
     381        else if (strKey == "ShowKdTree") 
     382        { 
     383                *static_cast<bool *>(pDestValue) = mShowBoxes; 
     384                return true; 
     385        }        
     386        else if (strKey == "HiLiteLevel") 
     387        { 
     388                *static_cast<int *>(pDestValue) = mHiLiteLevel; 
    347389                return true; 
    348390        } 
    349391        else if (strKey == "ShowAllBoxes") 
    350392        { 
    351                 if (mRenderMethod == KdTree::KDRM_INTERNAL) 
    352                         *static_cast<bool *>(pDestValue) = mShowAllBoxes; 
    353                 else 
    354                         *static_cast<bool *>(pDestValue) = mVisualizeCulledNodes; 
    355                 return true; 
    356         } 
    357 #endif 
    358         else if (strKey == "BuildMethod") 
    359         { 
    360                 if (mBuildMethod == KdTree::KDBM_PRIORITYQUEUE) 
    361                 { 
    362                         *static_cast<String *>(pDestValue) = "PriorityQueue"; 
    363                 } 
    364                 else if (mBuildMethod == KdTree::KDBM_RECURSIVE) 
    365                 { 
    366                         *static_cast<String *>(pDestValue) = "Recursive"; 
    367                 } 
    368                 return true; 
    369         } 
    370         else if (strKey == "RenderMethod") 
    371         { 
    372                 if (mRenderMethod == KdTree::KDRM_INTERNAL) 
    373                 { 
    374                         *static_cast<String *>(pDestValue) = "INT"; 
    375                 } 
    376                 else if (mRenderMethod == KdTree::KDRM_GTP_VFC) 
    377                 { 
    378                                 *static_cast<String *>(pDestValue) = "VFC"; 
    379                 } 
    380                 else if (mRenderMethod == KdTree::KDRM_GTP_SWC) 
    381                 { 
    382                                 *static_cast<String *>(pDestValue) = "SWC"; 
    383                 } 
    384                 else if (mRenderMethod == KdTree::KDRM_GTP_CHC) 
    385                 { 
    386                                 *static_cast<String *>(pDestValue) = "CHC"; 
    387                 } 
    388                 else 
    389                 { 
    390                         return false; 
    391                 } 
    392                 return true; 
    393         } 
    394         else if (strKey == "ShowKdTree") 
    395         { 
    396                 *static_cast<bool *>(pDestValue) = mShowBoxes; 
    397                 return true; 
    398         } 
    399         else if (strKey == "ShowNodeAABB") 
    400         { 
    401                 if (mKdTree) 
    402                         *static_cast<bool *>(pDestValue) = mKdTree->getShowNodeAABB(); 
    403                 else 
    404                         *static_cast<bool *>(pDestValue) = false; 
    405                 return true; 
    406         } 
    407         else if (strKey == "TreeBox") 
    408         { 
    409                 if (mKdTree) 
    410                         *static_cast<AxisAlignedBox *>(pDestValue) = mKdTree->getBox(); 
    411                 else 
    412                         *static_cast<AxisAlignedBox *>(pDestValue) = AxisAlignedBox(); 
     393                *static_cast<bool *>(pDestValue) = mShowAllBoxes; 
     394                return true; 
     395        } 
     396        else if (strKey == "ShowNodes") 
     397        { 
     398                *static_cast<bool *>(pDestValue) = mShowNodes; 
     399                return true; 
    413400        } 
    414401 
     
    426413        refKeys.push_back("RenderMethod"); 
    427414        refKeys.push_back("ShowKdTree"); 
    428         refKeys.push_back("ShowNodeAABB"); 
    429         refKeys.push_back("TreeBox"); 
    430 #ifdef KDTREE_DEBUG 
    431         refKeys.push_back("HighlightLevel"); 
     415        refKeys.push_back("ShowNodes"); 
     416        refKeys.push_back("HiLiteLevel"); 
    432417        refKeys.push_back("ShowAllBoxes"); 
    433 #endif 
    434418        return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface) 
    435419                .getOptionKeys(refKeys); 
     
    515499        if (!mKdTree) 
    516500        { 
    517                 mKdTree = new KdTree(mMaxDepth); 
    518                 mKdTree->setBuildMethod(mBuildMethod); 
     501                mKdTree = new KdTree(mMaxDepth, mBuildMethod); 
    519502                mKdTree->build(static_cast<KdTreeSceneNode *>(mSceneRoot)); 
    520503        } 
     
    724707 
    725708                getRenderQueue()->clear(); // finally clear render queue 
    726                 if (0) OGRE_DELETE(mRenderQueue); // HACK: should rather only be cleared ... 
     709                if (1) OGRE_DELETE(mRenderQueue); // HACK: should rather only be cleared ... 
    727710 
    728711                if (0) WriteLog(); // write out stats 
Note: See TracChangeset for help on using the changeset viewer.