Changeset 1220


Ignore:
Timestamp:
08/18/06 17:25:57 (18 years ago)
Author:
szydlowski
Message:
 
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/include/TestKdTree.h

    r1204 r1220  
    5757        // scene options 
    5858        String  mSceneFiles; 
    59         String  mSelectedSceneManager; 
    6059        Real    mRotationRadius; 
    6160        int             mModelSpacing; 
     
    6766 
    6867        KdTreeAppListener::Options mOptions; 
    69  
    7068 
    7169        virtual void setupResources(void); 
  • GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/include/TestKdTreeAppListener.h

    r1215 r1220  
    3636#define __KdTreeAppListener_H__ 
    3737 
    38 #include "Ogre.h" 
    39 #include "OgreKeyEvent.h" 
    40 #include "OgreEventListeners.h" 
    41 #include "OgreStringConverter.h" 
    42 #include "OgreException.h" 
    43  
     38#include <Ogre.h> 
     39#include <OgreKeyEvent.h> 
     40#include <OgreEventListeners.h> 
     41#include <OgreStringConverter.h> 
     42#include <OgreException.h> 
     43 
     44#include <OgreKdTree.h> 
     45 
     46#define CONV_OCM_TO_KDT_ALG(i) (i == 0 ? 3 : i) 
     47#define CONV_KDT_TO_OCM_ALG(i) (i % 3) 
    4448#define VIZ_VIEWPORT_Z_ORDER 10 
    4549 
     
    7276        }; 
    7377 
     78        enum SceneMgr 
     79        { 
     80                SM_KDT, 
     81                SM_OCM, 
     82                SM_OCT, 
     83                SM_GEN, 
     84                SM_SIZE, 
     85                SM_NOTSET 
     86        }; 
     87 
    7488        enum ShowTree 
    7589        { 
     
    90104        { 
    91105                Options(): 
    92                 mDemoMode(false), 
    93                 mEnhancedVisibility(false), 
    94106                mRotateSpeed(36.0f), 
    95107                mMoveSpeed(100.0f), 
    96108                mRotationPeriod(30.0f), 
    97                 mMaxDepth(12), 
    98109                mKT(2.0f), 
    99110                mKI(1.0f), 
    100                 mRenderMethod("CHC") 
     111                mMaxDepth(12), 
     112                mSceneManager(SM_KDT), 
     113                mRenderMethod(KdTree::KDRM_GTP_CHC), 
     114                mBuildMethod(KdTree::KDBM_PRIORITYQUEUE), 
     115                mDemoMode(false), 
     116                mEnhancedVisibility(false) 
    101117                { 
    102118 
    103119                } 
    104120 
    105                 String mSceneManager; 
    106121                String mDemoInfileName; 
    107122                String mDemoOutfileName; 
    108123                String mDemoLogfileName; 
    109                 bool mDemoMode; 
    110                 bool mEnhancedVisibility; 
     124                String mComment; 
    111125                Degree mRotateSpeed; 
    112126                Real mMoveSpeed; 
    113127                Real mRotationPeriod; 
    114                 int mMaxDepth; 
    115128                Real mKT; 
    116129                Real mKI; 
    117                 String mRenderMethod; 
    118                 String mComment; 
     130                int mMaxDepth; 
     131                int mSceneManager; 
     132                int mRenderMethod; 
     133                int mBuildMethod; 
     134                bool mDemoMode; 
     135                bool mEnhancedVisibility; 
    119136        }; 
    120137 
     
    164181        void keyReleased(KeyEvent* e) {}; 
    165182 
     183        const static Real       DEMO_WAIT; 
    166184        const static String NA; 
    167         const static Real DEMO_WAIT; 
     185        const static String RENDERMETHOD[]; 
     186        const static String RENDERMETHODCAPTION[]; 
     187        const static String BUILDMETHOD[]; 
     188        const static String BUILDMETHODCAPTION[]; 
     189        const static String SCENEMANAGER[]; 
     190        const static String SCENEMANAGERNAME[]; 
    168191protected: 
    169192        // basic 
  • GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/scripts/TestKdTree.vcproj

    r1203 r1220  
    2121                                Optimization="0" 
    2222                                ImproveFloatingPointConsistency="TRUE" 
    23                                 AdditionalIncludeDirectories="..\include;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;..\..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\include" 
     23                                AdditionalIncludeDirectories="..\include;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;..\..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\include;..\..\..\..\..\..\Lib\Vis\OnlineCullingCHC\OGRE\include;..\..\..\..\..\..\Lib\Vis\OnlineCullingCHC\include" 
    2424                                PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;GTP_VISIBILITY_MODIFIED_OGRE" 
    2525                                MinimalRebuild="TRUE" 
     
    8484                                OptimizeForProcessor="2" 
    8585                                OptimizeForWindowsApplication="TRUE" 
    86                                 AdditionalIncludeDirectories="..\include;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;..\..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\include" 
     86                                AdditionalIncludeDirectories="..\include;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;..\..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\include;..\..\..\..\..\..\Lib\Vis\OnlineCullingCHC\OGRE\include;..\..\..\..\..\..\Lib\Vis\OnlineCullingCHC\include" 
    8787                                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;GTP_VISIBILITY_MODIFIED_OGRE" 
    8888                                StringPooling="TRUE" 
  • GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTree.cpp

    r1215 r1220  
    3030                                .addOpt("l","logfile", ARGUMENT_REQUIRED) 
    3131                                .addOpt("d","demomode", ARGUMENT_NONE) 
     32                                .addOpt("","buildmode", ARGUMENT_REQUIRED) 
    3233                                .addOpt("","maxdepth", ARGUMENT_REQUIRED) 
    3334                                .addOpt("","kt", ARGUMENT_REQUIRED) 
     
    4950                        std::stringstream s; 
    5051 
     52                        if (cmdparser.getOpt("buildmode", tmp)) 
     53                        { 
     54                                int bm = KdTree::KDBM_NOTSET; 
     55                                for (int i = 0; i < KdTree::KDBM_SIZE; i ++) 
     56                                { 
     57                                        if (tmp == KdTreeAppListener::BUILDMETHOD[i]) 
     58                                                bm = i; 
     59                                } 
     60                                if (bm != KdTree::KDBM_NOTSET) 
     61                                { 
     62                                        options.mBuildMethod = bm; 
     63                                } 
     64                                else 
     65                                { 
     66                                        MessageBox(NULL, ("Invalid argument for option --buildmode: " + tmp).c_str(), "Error", MB_OK | MB_ICONERROR ); 
     67                                        return -1; 
     68                                } 
     69                        } 
     70 
    5171                        if (cmdparser.getOpt("maxdepth", tmp)) 
    5272                        { 
     
    7292                        if (cmdparser.getOpt("r",tmp)) 
    7393                        { 
    74                                 if (tmp == "INT" || tmp == "VFC" || tmp == "SWC" || tmp == "CHC") 
    75                                 { 
    76                                         options.mRenderMethod = tmp; 
     94                                int rm = KdTree::KDRM_NOTSET; 
     95                                for (int i = 0; i < KdTree::KDRM_SIZE; i ++) 
     96                                { 
     97                                        if (tmp == KdTreeAppListener::RENDERMETHOD[i]) 
     98                                                rm = i; 
     99                                } 
     100                                if (rm != KdTree::KDRM_NOTSET) 
     101                                { 
     102                                        options.mRenderMethod = rm; 
    77103                                } 
    78104                                else 
    79105                                { 
    80                                         MessageBox(NULL, ("Invalid argument for option --rendermethod: " + tmp).c_str(), "Error", MB_OK | MB_ICONERROR ); 
     106                                        MessageBox(NULL, ("Invalid argument for option --rendermode: " + tmp).c_str(), "Error", MB_OK | MB_ICONERROR ); 
    81107                                        return -1; 
    82108                                } 
     
    85111                        if (cmdparser.getOpt("s",tmp)) 
    86112                        { 
    87                                 if (tmp == "KDT" || tmp == "OCT" || tmp == "OCM" || tmp == "GEN") 
    88                                 { 
    89                                         options.mSceneManager = tmp; 
     113                                int sm = KdTreeAppListener::SM_NOTSET; 
     114                                for (int i = 0; i < KdTreeAppListener::SM_SIZE; i ++) 
     115                                { 
     116                                        if (tmp == KdTreeAppListener::SCENEMANAGER[i]) 
     117                                                sm = i; 
     118                                } 
     119                                if (sm != KdTreeAppListener::SM_NOTSET) 
     120                                { 
     121                                        options.mSceneManager = sm; 
    90122                                } 
    91123                                else 
     
    149181        cfDeath.load("testKdTree.cfg"); 
    150182 
    151         mSelectedSceneManager = cfDeath.getSetting("scenemanager"); 
    152183        mSceneFiles = cfDeath.getSetting("scene"); 
    153184 
     
    194225                mOptions.mDemoOutfileName = cfDeath.getSetting("demooutfile"); 
    195226 
    196         // set default demo output name to avoid SNAFUs 
    197         //if (mOptions.mDemoOutfileName.empty()) 
    198         //      mOptions.mDemoOutfileName = "demo.bin"; 
    199  
    200227        if (mOptions.mDemoLogfileName.empty()) 
    201228                mOptions.mDemoLogfileName = cfDeath.getSetting("demologfile"); 
    202  
    203         // set default demo logfile name to avoid SNAFUs 
    204         //if (mOptions.mDemoLogfileName.empty()) 
    205         //      mOptions.mDemoLogfileName = "demo.csv"; 
    206  
    207         // override scene manager set in config file 
    208         if (!mOptions.mSceneManager.empty()) 
    209         { 
    210                 if (mOptions.mSceneManager == "KDT") 
    211                         mSelectedSceneManager = "KdTreeSceneManager"; 
    212                 else if (mOptions.mSceneManager == "OCT") 
    213                         mSelectedSceneManager = "OctreeSceneManager"; 
    214                 else if (mOptions.mSceneManager == "OCM") 
    215                         mSelectedSceneManager = "OcclusionCullingSceneManager"; 
    216                 else if (mOptions.mSceneManager == "GEN") 
    217                         mSelectedSceneManager = "DefaultSceneManager"; 
    218         } 
    219         // the other way round for log 
    220         else 
    221         { 
    222                 if (mSelectedSceneManager == "KdTreeSceneManager") 
    223                         mOptions.mSceneManager = "KDT"; 
    224                 else if (mSelectedSceneManager == "OctreeSceneManager") 
    225                         mOptions.mSceneManager = "OCT"; 
    226                 else if (mSelectedSceneManager == "OcclusionCullingSceneManager") 
    227                         mOptions.mSceneManager = "OCM"; 
    228                 else if (mSelectedSceneManager == "DefaultSceneManager") 
    229                         mOptions.mSceneManager = "GEN"; 
    230         } 
    231229 
    232230        ExampleApplication::setupResources(); 
     
    416414{ 
    417415        // Get the SceneManager 
    418         mSceneMgr = mRoot->createSceneManager(mSelectedSceneManager,"MySceneManager"); 
    419         // set params 
    420         mSceneMgr->setOption("KdTreeMaxDepth", &mOptions.mMaxDepth); 
    421         mSceneMgr->setOption("KT", &mOptions.mKT); 
    422         mSceneMgr->setOption("KI", &mOptions.mKI); 
    423         mSceneMgr->setOption("RenderMethod", &mOptions.mRenderMethod); 
    424         mSceneMgr->setOption("EnhancedVisibility", &mOptions.mEnhancedVisibility); 
     416        mSceneMgr = mRoot->createSceneManager( 
     417                KdTreeAppListener::SCENEMANAGERNAME[mOptions.mSceneManager], 
     418                "MySceneManager"); 
     419        // set params depending on scene manager 
     420        if (mOptions.mSceneManager == KdTreeAppListener::SM_KDT) 
     421        { 
     422                mSceneMgr->setOption("BuildMethod", &mOptions.mBuildMethod); 
     423                mSceneMgr->setOption("KdTreeMaxDepth", &mOptions.mMaxDepth); 
     424                mSceneMgr->setOption("KT", &mOptions.mKT); 
     425                mSceneMgr->setOption("KI", &mOptions.mKI); 
     426                mSceneMgr->setOption("RenderMethod", &mOptions.mRenderMethod); 
     427                mSceneMgr->setOption("EnhancedVisibility", &mOptions.mEnhancedVisibility); 
     428        } 
     429        // set algorithm when scene manager is OCM - numbering is different though 
     430        if (mOptions.mSceneManager == KdTreeAppListener::SM_OCM) 
     431        { 
     432                int alg = CONV_KDT_TO_OCM_ALG(mOptions.mRenderMethod); 
     433                mSceneMgr->setOption("Algorithm", &alg); 
     434        } 
    425435} 
    426436 
     
    452462        mTopCam->setDirection(0,0,-1); 
    453463        mTopCam->pitch(Radian(-Math::HALF_PI)); 
    454         //mTopCam->setCullingFrustum(mCamera); 
     464        mTopCam->setCullingFrustum(mCamera); 
    455465        mTopCam->setNearClipDistance(1); 
    456466 
  • GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTreeAppListener.cpp

    r1215 r1220  
    66#include <windows.h> 
    77 
     8const Real       KdTreeAppListener::DEMO_WAIT = 5.0; 
    89const String KdTreeAppListener::NA = ": N/A"; 
    9 const Real KdTreeAppListener::DEMO_WAIT = 5.0; 
     10const String KdTreeAppListener::RENDERMETHOD[] = { "INT", "VFC", "SWC", "CHC" }; 
     11const String KdTreeAppListener::RENDERMETHODCAPTION[] = 
     12{ 
     13        "Internal Frustum Culling", 
     14        "View Frustum Culling",  
     15        "Stop and Wait Culling", 
     16        "Coherent Hierarchical Culling" 
     17}; 
     18const String KdTreeAppListener::BUILDMETHOD[] = { "RE", "PQ" }; 
     19const String KdTreeAppListener::BUILDMETHODCAPTION[] = { "Recursive", "Priority Queue" }; 
     20const String KdTreeAppListener::SCENEMANAGER[] = { "KDT", "OCM", "OCT", "GEN" }; 
     21const String KdTreeAppListener::SCENEMANAGERNAME[] = 
     22{ 
     23        "KdTreeSceneManager", 
     24        "OcclusionCullingSceneManager", 
     25        "OctreeSceneManager", 
     26        "DefaultSceneManager" 
     27}; 
    1028 
    1129void KdTreeAppListener::updateStats(void) 
     
    220238        const int border_height = 10; 
    221239        const int vert_space = 15; 
     240        int top = border_height; 
     241 
     242        String ext = "KdTree/"; 
    222243        String sMD, sKT, sKI, sHL, sBM, sRM, sFM, sTC, sEV; 
    223  
    224         int top = border_height; 
    225  
    226         String ext = "KdTree/"; 
    227244 
    228245        int maxd; 
     
    252269                sHL = ": off"; 
    253270 
    254         String bm; 
     271        int bm; 
    255272        if (mSceneMgr->getOption("BuildMethod", &bm)) 
    256                 sBM = ": " + bm; 
     273                sBM = ": " + BUILDMETHODCAPTION[bm]; 
    257274        else 
    258275                sBM = NA; 
    259276 
    260         String rm; 
     277        int rm; 
    261278        if (mSceneMgr->getOption("RenderMethod", &rm)) 
    262         { 
    263                 if (rm == "INT") 
    264                         sRM = ": Internal Frustum Culling"; 
    265                 else if (rm == "VFC") 
    266                         sRM = ": View Frustum Culling"; 
    267                 else if (rm == "SWC") 
    268                         sRM = ": Stop and Wait Culling"; 
    269                 else if (rm == "CHC") 
    270                         sRM = ": Coherent Hierarchical Culling"; 
    271                 else 
    272                         sRM = NA; 
    273         } 
     279                sRM = ": " + RENDERMETHODCAPTION[rm]; 
    274280        else 
    275281                sRM = NA; 
     282 
     283        // hack to allow mode switching in OCM 
     284        if (mOptions.mSceneManager == SM_OCM) 
     285        { 
     286                rm = CONV_KDT_TO_OCM_ALG(mOptions.mRenderMethod); 
     287                sRM = ": " + RENDERMETHODCAPTION[CONV_OCM_TO_KDT_ALG(rm)]; 
     288        } 
    276289 
    277290        bool enh; 
     
    430443void KdTreeAppListener::toggleBuildMethod() 
    431444{ 
    432         static String bmOptions[] = { "Recursive", "PriorityQueue" }; 
    433         static String bmOptionCaptions[] = { ": Recursive", ": PriorityQueue" }; 
    434         static int bmOptionsSize = sizeof(bmOptions) / sizeof(String); 
    435         static int bmCurrent = 0; 
    436  
    437         String bm; 
     445        int bm; 
     446 
    438447        if (mSceneMgr->getOption("BuildMethod", &bm)) 
    439448        { 
    440                 for (int idx = 0; idx < bmOptionsSize; idx++) 
    441                         if (bmOptions[idx] == bm) 
    442                                 bmCurrent = idx; 
    443                 bmCurrent = (bmCurrent + 1) % bmOptionsSize; 
    444                 if (mSceneMgr->setOption("BuildMethod", &bmOptions[bmCurrent])) 
    445                         mBuildMethodInfo->setCaption(bmOptionCaptions[bmCurrent]); 
     449                bm = (bm + 1) % KdTree::KDBM_SIZE; 
     450                if (mSceneMgr->setOption("BuildMethod", &bm)) 
     451                        mBuildMethodInfo->setCaption(": " + BUILDMETHODCAPTION[bm]); 
    446452        } 
    447453        else 
     
    453459void KdTreeAppListener::toggleRenderMethod() 
    454460{ 
    455         static String rmOptions[] = { "INT", "VFC", "SWC", "CHC" }; 
    456         static String rmOptionCaptions[] = 
    457         { 
    458                 ": Internal Frustum Culling", 
    459                 ": View Frustum Culling",  
    460                 ": Stop and Wait Culling", 
    461                 ": Coherent Hierarchical Culling" 
    462         }; 
    463         static int rmOptionsSize = sizeof(rmOptions) / sizeof (String); 
    464         static int rmCurrent = 0; 
    465  
    466         String rm; 
     461        int rm; 
     462 
    467463        if (mSceneMgr->getOption("RenderMethod", &rm)) 
    468464        { 
    469                 for (int idx = 0; idx < rmOptionsSize; idx++) 
    470                         if (rmOptions[idx] == rm) 
    471                                 rmCurrent = idx; 
    472                 rmCurrent = (rmCurrent + 1) % rmOptionsSize; 
    473                 if (mSceneMgr->setOption("RenderMethod", &rmOptions[rmCurrent])) 
    474                         mRenderMethodInfo->setCaption(rmOptionCaptions[rmCurrent]); 
     465                rm = (rm + 1) % KdTree::KDRM_SIZE; 
     466                if (mSceneMgr->setOption("RenderMethod", &rm)) 
     467                        mRenderMethodInfo->setCaption(": " + RENDERMETHODCAPTION[rm]); 
    475468        } 
    476469        else 
    477470        { 
    478471                mRenderMethodInfo->setCaption(NA); 
     472        } 
     473 
     474        // hack to allow mode switching in OCM, cannot extract setting from sm 
     475        if (mOptions.mSceneManager == SM_OCM) 
     476        { 
     477                static int alg = CONV_KDT_TO_OCM_ALG(mOptions.mRenderMethod); 
     478                alg = (alg + 1) % 3; 
     479                if (mSceneMgr->setOption("Algorithm", &alg)) 
     480                        mRenderMethodInfo->setCaption(": " + RENDERMETHODCAPTION[CONV_OCM_TO_KDT_ALG(alg)]); 
    479481        } 
    480482} 
     
    539541        } 
    540542 
    541         if (mInputDevice->isKeyDown(KC_F11) && mTimeUntilNextToggle <= 0) 
     543        if (mInputDevice->isKeyDown(KC_0) && mTimeUntilNextToggle <= 0) 
    542544        { 
    543545                toggleBuildMethod(); 
     
    15001502        { 
    15011503                // demo settings 
    1502                 logwrite << mOptions.mSceneManager; 
    1503                 if (mOptions.mSceneManager == "KDT") 
    1504                 { 
    1505                         logwrite << ds << mOptions.mRenderMethod << ds << mOptions.mMaxDepth << ds  
     1504                logwrite << SCENEMANAGER[mOptions.mSceneManager]; 
     1505                if (mOptions.mSceneManager == SM_KDT) 
     1506                { 
     1507                        logwrite << ds << RENDERMETHOD[mOptions.mRenderMethod] << ds << mOptions.mMaxDepth << ds  
    15061508                                << mOptions.mKT << ds << mOptions.mKI; 
    15071509                } 
    1508                 //else if (mOptions.mSceneManager == "OCM" && mOptions.mRenderMethod != "INT") 
    1509                 //{ 
    1510                 //      logwrite << ds << mOptions.mRenderMethod; 
    1511                 //} 
     1510                else if (mOptions.mSceneManager == SM_OCM && mOptions.mRenderMethod != KdTree::KDRM_INTERNAL) 
     1511                { 
     1512                        logwrite << ds << RENDERMETHOD[(mOptions.mRenderMethod+3)%3]; 
     1513                } 
    15121514                logwrite << fs; 
    15131515                // per second stats 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTree.h

    r1211 r1220  
    478478                        KDRM_GTP_VFC, 
    479479                        KDRM_GTP_SWC, 
    480                         KDRM_GTP_CHC 
    481  
     480                        KDRM_GTP_CHC, 
     481                        // invalid modes, just for convenience 
     482                        KDRM_SIZE, 
     483                        KDRM_NOTSET 
    482484                }; 
    483485 
     
    485487                { 
    486488                        KDBM_RECURSIVE, 
    487                         KDBM_PRIORITYQUEUE 
    488                 }; 
     489                        KDBM_PRIORITYQUEUE, 
     490                        // invalid modes, just for convenience 
     491                        KDBM_SIZE, 
     492                        KDBM_NOTSET 
     493                }; 
     494 
    489495 
    490496                const static int HILITE_OFF  = -1; 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeSceneManager.cpp

    r1214 r1220  
    5151mIsHierarchicalCulling(false) 
    5252{ 
    53 // Replace root node with my node 
    54 OGRE_DELETE(mSceneRoot); 
    55  
    56 mSceneRoot = new KdTreeSceneNode(this, "root node"); 
    57 mSceneRoot->_notifyRootNode(); 
    58  
    59 mHierarchyInterface = new KdTreeHierarchyInterface(this, mDestRenderSystem); 
     53        // Replace root node with my node 
     54        OGRE_DELETE(mSceneRoot); 
     55        mSceneRoot = new KdTreeSceneNode(this, "root node"); 
     56        mSceneRoot->_notifyRootNode(); 
     57 
     58        // init heirarchy interface 
     59        mHierarchyInterface = new KdTreeHierarchyInterface(this, mDestRenderSystem); 
    6060} 
    6161 
     
    8080        return mShowBoxes; 
    8181} 
    82  
    83 //void KdTreeSceneManager::setEnhancedVis(bool enhanced) 
    84 //{ 
    85 //      for (CameraList::iterator it = mCameras.begin(); it != mCameras.end(); it ++) 
    86 //      { 
    87 //              KDCAMPTR_CAST(it->second)->setEnhancedVisMode(enhanced); 
    88 //      } 
    89 //} 
    9082 
    9183bool KdTreeSceneManager::setOption(const String& strKey, const void* pValue) 
     
    156148        else if (strKey == "BuildMethod") 
    157149        { 
    158                 String bm = *static_cast<const String *>(pValue); 
    159                 if (bm == "PriorityQueue") 
    160                 { 
    161                         mBuildMethod = KdTree::KDBM_PRIORITYQUEUE; 
     150                KdTree::BuildMethod bm = *static_cast<const KdTree::BuildMethod *>(pValue); 
     151                if (bm == KdTree::KDBM_RECURSIVE || bm == KdTree::KDBM_PRIORITYQUEUE) 
     152                { 
     153                        mBuildMethod = bm; 
    162154                        return true; 
    163155                } 
    164                 else if (bm == "Recursive") 
    165                 { 
    166                         mBuildMethod = KdTree::KDBM_RECURSIVE; 
     156                else 
     157                { 
     158                        return false; 
     159                } 
     160        } 
     161        else if (strKey == "RenderMethod") 
     162        { 
     163                KdTree::RenderMethod rm = *static_cast<const KdTree::RenderMethod *>(pValue); 
     164                if (rm == KdTree::KDRM_INTERNAL) 
     165                { 
     166                        mRenderMethod = rm; 
    167167                        return true; 
    168168                } 
    169                 else 
    170                 { 
    171                         return false; 
    172                 } 
    173         } 
    174         else if (strKey == "RenderMethod") 
    175         { 
    176                 String rm = *static_cast<const String *>(pValue); 
    177                 if (rm == "INT") 
    178                 { 
    179                         mRenderMethod = KdTree::KDRM_INTERNAL; 
    180                         return true; 
    181                 } 
    182                 else if (rm == "VFC") 
    183                 { 
    184                         mRenderMethod = KdTree::KDRM_GTP_VFC; 
     169                else if (rm == KdTree::KDRM_GTP_VFC) 
     170                { 
     171                        mRenderMethod = rm; 
    185172                        int cmt = GtpVisibility::VisibilityEnvironment::FRUSTUM_CULLING; 
    186173                        return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface) 
    187174                                .setOption("Algorithm", &cmt); 
    188175                } 
    189                 else if (rm == "SWC") 
    190                 { 
    191                         mRenderMethod = KdTree::KDRM_GTP_SWC; 
     176                else if (rm == KdTree::KDRM_GTP_SWC) 
     177                { 
     178                        mRenderMethod = rm; 
    192179                        int cmt = GtpVisibility::VisibilityEnvironment::STOP_AND_WAIT_CULLING; 
    193180                        return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface) 
    194181                                .setOption("Algorithm", &cmt); 
    195182                } 
    196                 else if (rm == "CHC") 
    197                 { 
    198                         mRenderMethod = KdTree::KDRM_GTP_CHC; 
     183                else if (rm == KdTree::KDRM_GTP_CHC) 
     184                { 
     185                        mRenderMethod = rm; 
    199186                        int cmt = GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING; 
    200187                        return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface) 
     
    205192                        return false; 
    206193                } 
     194                //String rm = *static_cast<const String *>(pValue); 
     195                //if (rm == "INT") 
     196                //{ 
     197                //      mRenderMethod = KdTree::KDRM_INTERNAL; 
     198                //      return true; 
     199                //} 
     200                //else if (rm == "VFC") 
     201                //{ 
     202                //      mRenderMethod = KdTree::KDRM_GTP_VFC; 
     203                //      int cmt = GtpVisibility::VisibilityEnvironment::FRUSTUM_CULLING; 
     204                //      return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface) 
     205                //              .setOption("Algorithm", &cmt); 
     206                //} 
     207                //else if (rm == "SWC") 
     208                //{ 
     209                //      mRenderMethod = KdTree::KDRM_GTP_SWC; 
     210                //      int cmt = GtpVisibility::VisibilityEnvironment::STOP_AND_WAIT_CULLING; 
     211                //      return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface) 
     212                //              .setOption("Algorithm", &cmt); 
     213                //} 
     214                //else if (rm == "CHC") 
     215                //{ 
     216                //      mRenderMethod = KdTree::KDRM_GTP_CHC; 
     217                //      int cmt = GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING; 
     218                //      return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface) 
     219                //              .setOption("Algorithm", &cmt); 
     220                //} 
     221                //else 
     222                //{ 
     223                //      return false; 
     224                //} 
    207225        } 
    208226        // little hack in case someone uses "Algorithm" option from VisOptMan directly 
     
    362380                if (mKdTree) 
    363381                        *static_cast<bool *>(pDestValue) = mKdTree->getEnhancedVis(); 
    364                         //KDCAMPTR_CAST(mCameras.begin()->second)->getEnhancedVisMode(); 
    365382                else 
    366383                        *static_cast<bool *>(pDestValue) = mEnhancedVisiblity; 
     
    369386        else if (strKey == "BuildMethod") 
    370387        { 
    371                 if (mBuildMethod == KdTree::KDBM_PRIORITYQUEUE) 
    372                 { 
    373                         *static_cast<String *>(pDestValue) = "PriorityQueue"; 
    374                 } 
    375                 else if (mBuildMethod == KdTree::KDBM_RECURSIVE) 
    376                 { 
    377                         *static_cast<String *>(pDestValue) = "Recursive"; 
    378                 } 
     388                //if (mBuildMethod == KdTree::KDBM_PRIORITYQUEUE) 
     389                //{ 
     390                //      *static_cast<String *>(pDestValue) = "PriorityQueue"; 
     391                //} 
     392                //else if (mBuildMethod == KdTree::KDBM_RECURSIVE) 
     393                //{ 
     394                //      *static_cast<String *>(pDestValue) = "Recursive"; 
     395                //} 
     396                *static_cast<KdTree::BuildMethod *>(pDestValue) = mBuildMethod; 
    379397                return true; 
    380398        } 
    381399        else if (strKey == "RenderMethod") 
    382400        { 
    383                 if (mRenderMethod == KdTree::KDRM_INTERNAL) 
    384                 { 
    385                         *static_cast<String *>(pDestValue) = "INT"; 
    386                 } 
    387                 else if (mRenderMethod == KdTree::KDRM_GTP_VFC) 
    388                 { 
    389                                 *static_cast<String *>(pDestValue) = "VFC"; 
    390                 } 
    391                 else if (mRenderMethod == KdTree::KDRM_GTP_SWC) 
    392                 { 
    393                                 *static_cast<String *>(pDestValue) = "SWC"; 
    394                 } 
    395                 else if (mRenderMethod == KdTree::KDRM_GTP_CHC) 
    396                 { 
    397                                 *static_cast<String *>(pDestValue) = "CHC"; 
    398                 } 
    399                 else 
    400                 { 
    401                         return false; 
    402                 } 
     401                //if (mRenderMethod == KdTree::KDRM_INTERNAL) 
     402                //{ 
     403                //      *static_cast<String *>(pDestValue) = "INT"; 
     404                //} 
     405                //else if (mRenderMethod == KdTree::KDRM_GTP_VFC) 
     406                //{ 
     407                //              *static_cast<String *>(pDestValue) = "VFC"; 
     408                //} 
     409                //else if (mRenderMethod == KdTree::KDRM_GTP_SWC) 
     410                //{ 
     411                //              *static_cast<String *>(pDestValue) = "SWC"; 
     412                //} 
     413                //else if (mRenderMethod == KdTree::KDRM_GTP_CHC) 
     414                //{ 
     415                //              *static_cast<String *>(pDestValue) = "CHC"; 
     416                //} 
     417                //else 
     418                //{ 
     419                //      return false; 
     420                //} 
     421                *static_cast<KdTree::RenderMethod *>(pDestValue) = mRenderMethod; 
    403422                return true; 
    404423        } 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp

    r1193 r1220  
    454454 
    455455        getRenderQueue()->clear(); // finally clear render queue 
    456         if (0) OGRE_DELETE(mRenderQueue); // HACK: should rather only be cleared ... 
     456        if (1) OGRE_DELETE(mRenderQueue); // HACK: should rather only be cleared ... 
    457457        if (0) WriteLog(); // write out stats 
    458458} 
  • OGRE/trunk/resources/overlays/TestKdTree.overlay

    r1211 r1220  
    7070                        width 120 
    7171                        height 30 
    72                         caption [F11] Build Method 
     72                        caption [0] Build Method 
    7373                } 
    7474                element TextArea(KdTree/BuildMethodInfo): KdTree/Templates/BasicText 
Note: See TracChangeset for help on using the changeset viewer.