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

Legend:

Unmodified
Added
Removed
  • 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        } 
Note: See TracChangeset for help on using the changeset viewer.