Changeset 74 for trunk/VUT


Ignore:
Timestamp:
05/01/05 23:29:27 (19 years ago)
Author:
mattausch
Message:

added support for release mode

Location:
trunk/VUT
Files:
43 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibility/include/CoherentHierarchicalCullingManager.h

    r59 r74  
    1717{ 
    1818public: 
    19         CoherentHierarchicalCullingManager(HierarchyInterface *hierarchyInterface); 
    2019        void RenderScene(); 
    2120}; 
  • trunk/VUT/GtpVisibility/include/CullingManager.h

    r59 r74  
    1212{ 
    1313public: 
    14         /** Constructor taking a scene traverser for a specific type of hierarchy as argument.  
     14        /** Default constructor.  
     15                @remark an appropriate hierarchy interface must be provided for the algorithms to 
     16                work on specific hierarchy 
    1517        */ 
    16         CullingManager(HierarchyInterface *hierarchyInterface); 
     18        CullingManager(); 
    1719        /** Renders the scene using a specific occlusion culling algorithm, e.g., coherent 
    1820                hierarchical culling or stop and wait. 
     
    2426        */ 
    2527        void SetHierarchyInterface(HierarchyInterface *hierarchyInterface); 
     28        /** Sets the threshold for the visibiliy culling algorithm. 
     29                @param visibilityThreshold number of visible pixels where an object  
     30                is still considered invisible. 
     31        */ 
     32        void SetVisibilityThreshold(unsigned int visibilityThreshold); 
     33 
     34        /** Returns number of frustum culled nodes. 
     35        */ 
     36        unsigned int GetNumFrustumCulledNodes(); 
     37        /** Returns number of occlusion query culled nodes. 
     38        */ 
     39        unsigned int GetNumQueryCulledNodes(); 
    2640 
    2741protected: 
     
    2943        unsigned int mNumQueryCulledNodes; 
    3044        unsigned int mNumFrustumCulledNodes; 
     45        unsigned int mVisibilityThreshold; 
    3146 
    32         unsigned int mVisibilityThreshold; 
    3347        HierarchyInterface *mHierarchyInterface; 
    3448}; 
  • trunk/VUT/GtpVisibility/include/FrustumCullingManager.h

    r59 r74  
    1212{ 
    1313public: 
    14         FrustumCullingManager(HierarchyInterface *hierarchyInterface); 
    1514        void RenderScene(); 
    1615}; 
  • trunk/VUT/GtpVisibility/include/HierarchyInterface.h

    r65 r74  
    1919                @returns true if node is leaf 
    2020        */ 
    21     virtual bool IsLeaf(HierarchyNode *node) = 0; 
     21    virtual bool IsLeaf(HierarchyNode *node) const = 0; 
    2222        /** Traverses the given node.  
    2323                @param node the hierarchy node 
     
    4141        */ 
    4242        void SetSceneRoot(HierarchyNode *root); 
    43   /** Get the root of the scene hierarchy. 
    44       @return the hierarchy root 
    45   */ 
    46   HierarchyNode *GetSceneRoot() const { 
    47     return mSceneRoot; 
    48   } 
     43    /** Get the root of the scene hierarchy. 
     44                @return the hierarchy root 
     45        */ 
     46        HierarchyNode *GetSceneRoot() const; 
    4947        /** Sets the scene root and initialises this scene traverser for a traversal. 
    5048                @param root current scene root 
     
    5250        */ 
    5351        void InitFrame(HierarchyNode *root); 
    54          
    5552        /** Returns current frame id. 
    5653                @returns frame id 
    5754        */ 
    58         int GetFrameId(); 
     55        unsigned int GetFrameId() const; 
    5956        /** Returns the current distance queue. 
    6057                @returns current distance queue 
     
    6663                @param node2 the second node to be compared 
    6764        */                       
    68         virtual bool HasGreaterDistance(HierarchyNode *node1, HierarchyNode *node2) = 0; 
     65        virtual bool HasGreaterDistance(HierarchyNode *node1, HierarchyNode *node2) const = 0; 
    6966        /** Checks if the node is visible from the current view frustum. 
    7067                @param node the current node 
     
    7269        */ 
    7370        virtual bool CheckFrustumVisible(HierarchyNode *node, bool &intersects) = 0; 
     71        /** Checks if the node is visible from the current view frustum. 
     72                @param node the current node 
     73        */ 
     74        bool CheckFrustumVisible(HierarchyNode *node); 
    7475        /** Returns next available occlusion query or creates new one. 
    7576                @return the next occlusion query 
     
    8081                @returns if the node has renderable geometry 
    8182        */ 
    82     virtual bool HasGeometry(HierarchyNode *node) = 0; 
     83    virtual bool HasGeometry(HierarchyNode *node) const = 0; 
    8384        /** Sets the visible flag for this node. 
    8485                @param node the current node 
     
    8889        /** Returns true if node has the visible flag set. See set 
    8990        */ 
    90         virtual bool IsNodeVisible(HierarchyNode *node) = 0; 
     91        virtual bool IsNodeVisible(HierarchyNode *node) const = 0; 
    9192        /** Sets the last visited frame id for this node. 
    9293                @param node the current node 
    9394                @param frameId the current frame id 
    9495        */ 
    95         virtual void SetLastVisited(HierarchyNode *node, const int frameId) = 0; 
     96        virtual void SetLastVisited(HierarchyNode *node,  
     97                                                                const unsigned int frameId) = 0; 
    9698        /** Returns frame id when this node was last visited by the traverser. See set 
    9799        */ 
    98         virtual int LastVisited(HierarchyNode *node) = 0; 
     100        virtual unsigned int LastVisited(HierarchyNode *node) const = 0; 
     101        /** Returns number of traversed nodes. 
     102        */ 
     103        unsigned int GetNumTraversedNodes(); 
     104        /** Returns number of rendered nodes. 
     105        */ 
     106        unsigned int GetNumRenderedNodes(); 
    99107 
    100108protected: 
     
    105113         
    106114        //--- statistics 
    107         unsigned int mNumSceneNodes; 
    108115        unsigned int mNumTraversedNodes; 
    109         unsigned int mNumRenderedGeometry; 
    110116        unsigned int mNumRenderedNodes; 
    111117 
  • trunk/VUT/GtpVisibility/include/StopAndWaitCullingManager.h

    r59 r74  
    1111{ 
    1212public: 
    13         StopAndWaitCullingManager(HierarchyInterface *hierarchyInterface); 
    1413        void RenderScene(); 
    1514}; 
  • trunk/VUT/GtpVisibility/include/VisibilityEnvironment.h

    r71 r74  
    1313        /** Different types of occlusion culling algorithms  
    1414        */ 
    15         enum CullingManagerType {FRUSTUM_CULLING, STOP_AND_WAIT, COHERENT_HIERARCHICAL_CULLING}; 
     15        enum CullingManagerType {FRUSTUM_CULLING,  
     16                                                         STOP_AND_WAIT_CULLING,  
     17                                                         COHERENT_HIERARCHICAL_CULLING,  
     18                                                         NUM_CULLING_MANAGERS}; 
    1619 
    1720        /** Loads an environment from disk. 
     
    2124} // namespace GtpVisibility 
    2225 
    23 /** @}*/ // end of group Visibility 
    24  
    2526#endif // VisibilityEnvironment_H 
  • trunk/VUT/GtpVisibility/include/VisibilityManager.h

    r71 r74  
    4141        void ApplyVisibilityCulling(); 
    4242 
     43        /** Sets the threshold for the visibiliy culling algorithm. 
     44                @param visibilityThreshold number of visible pixels where an object  
     45                is still considered invisible. 
     46                @remark automatically sets the threshold of the current and of  
     47                new culling managers to this value. 
     48        */ 
     49        void SetVisibilityCullingThreshold(unsigned int threshold); 
     50 
    4351protected: 
    4452         
     
    4856  VisibilityEnvironment *mVisibilityEnvironment; 
    4957  VisibilityEnvironment::CullingManagerType mCullingManagerType; 
     58 
     59  unsigned int mVisibilityThreshold; 
     60 
    5061}; 
    5162} // namespace GtpVisibility 
  • trunk/VUT/GtpVisibility/scripts/GtpVisibility.vcproj

    r71 r74  
    2020                                Name="VCCLCompilerTool" 
    2121                                Optimization="0" 
    22                                 AdditionalIncludeDirectories=""$(OGRE_PATH)/OgreMain/include";..\include" 
     22                                AdditionalIncludeDirectories=""$(OGRE_PATH)\OgreMain\include";..\include" 
    2323                                PreprocessorDefinitions="WIN32;_DEBUG;_LIB" 
    2424                                MinimalRebuild="TRUE" 
     
    5555                <Configuration 
    5656                        Name="Release|Win32" 
    57                         OutputDirectory="..\bin\$(ConfigurationName)" 
     57                        OutputDirectory="..\lib\$(ConfigurationName)" 
    5858                        IntermediateDirectory="..\obj\$(ConfigurationName)" 
    5959                        ConfigurationType="4" 
     
    6161                        <Tool 
    6262                                Name="VCCLCompilerTool" 
     63                                AdditionalIncludeDirectories="..\include;&quot;$(OGRE_PATH)\OgreMain\include&quot;" 
    6364                                PreprocessorDefinitions="WIN32;NDEBUG;_LIB" 
    6465                                RuntimeLibrary="2" 
    65                                 UsePrecompiledHeader="3" 
     66                                UsePrecompiledHeader="0" 
    6667                                WarningLevel="3" 
    6768                                Detect64BitPortabilityProblems="TRUE" 
  • trunk/VUT/GtpVisibility/src/CoherentHierarchicalCullingManager.cpp

    r59 r74  
    33namespace GtpVisibility { 
    44 
    5 //----------------------------------------------------------------------- 
    6 CoherentHierarchicalCullingManager::CoherentHierarchicalCullingManager(HierarchyInterface *hierarchyInterface): 
    7 CullingManager(hierarchyInterface) 
    8 { 
    9 } 
    105//----------------------------------------------------------------------- 
    116void CoherentHierarchicalCullingManager::RenderScene() 
     
    4641                        bool intersects = false; 
    4742 
    48                         if(!mHierarchyInterface->CheckFrustumVisible(node, intersects)) 
     43                        if (!mHierarchyInterface->CheckFrustumVisible(node, intersects)) 
    4944                        { 
    5045                                mNumFrustumCulledNodes ++; 
    51                                 continue; 
    5246                        } 
     47                        else 
     48                        { 
     49                                // if intersects near plane => skip occlusion query because wrong results possible 
     50                                if (intersects) 
     51                                { 
     52                                        // update octant's visited flag 
     53                                        mHierarchyInterface->SetLastVisited(node, mHierarchyInterface->GetFrameId()); 
    5354 
    54                         // if intersects near plane => skip occlusion query because wrong results possible 
    55                         if (intersects) 
    56                         { 
    57                                 // update octant's visited flag 
     55                                        mHierarchyInterface->PullUpVisibility(node);                     
     56                                        mHierarchyInterface->TraverseNode(node); 
     57 
     58                                        continue; 
     59                                } 
     60 
     61                                // identify previously visible nodes 
     62                                bool wasVisible = mHierarchyInterface->IsNodeVisible(node) &&  
     63                                        (mHierarchyInterface->LastVisited(node) == mHierarchyInterface->GetFrameId() - 1); 
     64                                 
     65                                // identify nodes that we cannot skip queries for 
     66                                bool mustQuery = !wasVisible || mHierarchyInterface->HasGeometry(node) || mHierarchyInterface->IsLeaf(node); 
     67 
     68                                // reset node's visibility classification  
     69                                mHierarchyInterface->SetNodeVisible(node, false); 
     70 
     71                                // update node's visited flag 
    5872                                mHierarchyInterface->SetLastVisited(node, mHierarchyInterface->GetFrameId()); 
    59  
    60                                 mHierarchyInterface->PullUpVisibility(node);                     
    61                                 mHierarchyInterface->TraverseNode(node); 
    62  
    63                                 continue; 
    64                         } 
    65  
    66                         // identify previously visible nodes 
    67                         bool wasVisible = mHierarchyInterface->IsNodeVisible(node) &&  
    68                                 (mHierarchyInterface->LastVisited(node) == mHierarchyInterface->GetFrameId() - 1); 
    69                                  
    70                         // identify nodes that we cannot skip queries for 
    71                         bool mustQuery = !wasVisible || mHierarchyInterface->HasGeometry(node) || mHierarchyInterface->IsLeaf(node); 
    72  
    73                         // reset node's visibility classification  
    74                         mHierarchyInterface->SetNodeVisible(node, false); 
    75  
    76                         // update node's visited flag 
    77                         mHierarchyInterface->SetLastVisited(node, mHierarchyInterface->GetFrameId()); 
    7873                         
    79                         // skip testing previously visible interior nodes 
    80                         if (mustQuery) 
    81                         { 
    82                                 queryQueue.push(QueryPair(node, mHierarchyInterface->IssueOcclusionQuery(node))); 
    83                         } 
     74                                // skip testing previously visible interior nodes 
     75                                if (mustQuery) 
     76                                { 
     77                                        queryQueue.push(QueryPair(node, mHierarchyInterface->IssueOcclusionQuery(node))); 
     78                                } 
    8479                                         
    85                         // always traverse a node if it was visible 
    86                         if (wasVisible) 
    87                         { 
    88                                 mHierarchyInterface->TraverseNode(node); 
     80                                // always traverse a node if it was visible 
     81                                if (wasVisible) 
     82                                { 
     83                                        mHierarchyInterface->TraverseNode(node); 
     84                                } 
    8985                        } 
    9086                } 
  • trunk/VUT/GtpVisibility/src/CullingManager.cpp

    r59 r74  
    44 
    55//----------------------------------------------------------------------- 
    6 CullingManager::CullingManager(HierarchyInterface *hierarchyInterface): 
    7 mHierarchyInterface(hierarchyInterface), mVisibilityThreshold(0), mNumQueryCulledNodes(0),  
     6CullingManager::CullingManager(): 
     7mHierarchyInterface(NULL), mVisibilityThreshold(0), mNumQueryCulledNodes(0),  
    88mNumFrustumCulledNodes(0) 
    99{ 
     
    1414        mHierarchyInterface = hierarchyInterface; 
    1515} 
     16//----------------------------------------------------------------------- 
     17void CullingManager::SetVisibilityThreshold(unsigned int visibilityThreshold) 
     18{ 
     19        mVisibilityThreshold = visibilityThreshold; 
     20} 
     21//----------------------------------------------------------------------- 
     22unsigned int CullingManager::GetNumFrustumCulledNodes() 
     23{ 
     24        return mNumFrustumCulledNodes; 
     25} 
     26//----------------------------------------------------------------------- 
     27unsigned int CullingManager::GetNumQueryCulledNodes() 
     28{ 
     29        return mNumQueryCulledNodes; 
     30} 
    1631} // namespace GtpVisibility 
  • trunk/VUT/GtpVisibility/src/DummyPreprocessingManager.cpp

    r65 r74  
    33namespace GtpVisibility { 
    44 
    5 DummyPreprocessingManager::DummyPreprocessingManager( HierarchyInterface *hierarchyInterface ) 
     5DummyPreprocessingManager::DummyPreprocessingManager(HierarchyInterface *hierarchyInterface) 
    66  :PreprocessingManager(hierarchyInterface) 
    77{ 
     
    99   
    1010 
    11 bool 
    12 DummyPreprocessingManager::ExportScene(const string filename) 
     11bool DummyPreprocessingManager::ExportScene(const string filename) 
    1312{ 
    1413  ofstream s(filename.c_str()); 
     
    1918   
    2019 
    21 bool 
    22 DummyPreprocessingManager::LoadPreprocessedData(const string filename) 
     20bool DummyPreprocessingManager::LoadPreprocessedData(const string filename) 
    2321{ 
    2422  // do nothing 
     
    3129      Returns false if no viewcell was found. 
    3230    */ 
    33 bool 
    34 DummyPreprocessingManager::LocateViewCellIds(const Vector3 &center, 
    35                                              const float radius, 
    36                                              vector<int> *viewCellIds 
    37                                              ) 
     31bool DummyPreprocessingManager::LocateViewCellIds(const Vector3 &center, 
     32                                                                                                  const float radius, 
     33                                                                                                  vector<int> *viewCellIds) 
    3834{ 
    3935  return false; 
     
    4339    Uses the specified viewcell to find its PVS 
    4440*/ 
    45 int 
    46 DummyPreprocessingManager::AddViewCellPVS(const int cellID, 
     41int DummyPreprocessingManager::AddViewCellPVS(const int cellID, 
    4742                                          InfoContainer<NodeInfo> *visibleNodes, 
    4843                                          InfoContainer<MeshInfo> *visibleMeshes ) 
  • trunk/VUT/GtpVisibility/src/FrustumCullingManager.cpp

    r59 r74  
    11#include "FrustumCullingManager.h" 
     2 
     3#include <windows.h> 
    24 
    35namespace GtpVisibility { 
    46 
    57//----------------------------------------------------------------------- 
    6 FrustumCullingManager::FrustumCullingManager(HierarchyInterface *hierarchyInterface): 
    7 CullingManager(hierarchyInterface) 
    8 { 
    9 } 
    10 //----------------------------------------------------------------------- 
    118void FrustumCullingManager::RenderScene() 
    129{ 
    1310        mNumFrustumCulledNodes = mNumQueryCulledNodes = 0; 
    14  
    15         while(!mHierarchyInterface->GetQueue()->empty()) 
     11         
     12        while (!mHierarchyInterface->GetQueue()->empty()) 
    1613        { 
    1714                HierarchyNode *node = mHierarchyInterface->GetQueue()->top(); 
     
    2219                mHierarchyInterface->SetLastVisited(node, mHierarchyInterface->GetFrameId()); 
    2320 
    24                 bool intersects = false; 
    25  
    26                 if(mHierarchyInterface->CheckFrustumVisible(node, intersects)) 
     21                if (!mHierarchyInterface->CheckFrustumVisible(node)) 
    2722                { 
    2823                        mNumFrustumCulledNodes ++; 
    29                         continue; 
    3024                } 
    31                  
    32                 //if intersects near plane => skip occlusion query because wrong results possible 
    33                 if(intersects) 
    34                 { 
    35             mHierarchyInterface->SetNodeVisible(node, true); 
     25                else 
     26                {                
     27                        mHierarchyInterface->SetNodeVisible(node, true); 
    3628                        mHierarchyInterface->TraverseNode(node); 
    37                         continue; 
    3829                } 
    39  
    40                 mHierarchyInterface->TraverseNode(node); 
    4130        } 
    4231} 
  • trunk/VUT/GtpVisibility/src/HierarchyInterface.cpp

    r59 r74  
    11#include "HierarchyInterface.h" 
    22 
    3 //#include <windows.h> 
     3#include <windows.h> 
    44 
    55namespace GtpVisibility { 
     
    77//----------------------------------------------------------------------- 
    88HierarchyInterface::HierarchyInterface():  
    9 mFrameId(1), mNumSceneNodes(0), mNumTraversedNodes(0),  
    10 mNumRenderedNodes(0), mSceneRoot(0), mCurrentTestIdx(0) 
     9mFrameId(0), mNumTraversedNodes(0), mNumRenderedNodes(0),  
     10mSceneRoot(0), mCurrentTestIdx(0) 
    1111{        
    1212        mDistanceQueue = new DistanceQueue(GreaterDistance<HierarchyNode *>(this)); 
     
    2525void HierarchyInterface::InitFrame(HierarchyNode *root) 
    2626{ 
    27         mFrameId = 0; 
     27        mFrameId ++; 
    2828        mNumTraversedNodes = 0; 
    2929        mNumRenderedNodes = 0; 
     
    3333} 
    3434//----------------------------------------------------------------------- 
    35 int HierarchyInterface::GetFrameId() 
     35unsigned int HierarchyInterface::GetFrameId() const 
    3636{ 
    3737        return mFrameId; 
     
    4242        return mDistanceQueue; 
    4343} 
     44//----------------------------------------------------------------------- 
     45bool HierarchyInterface::CheckFrustumVisible(HierarchyNode *node) 
     46{ 
     47        bool intersects = false; 
     48        return CheckFrustumVisible(node, intersects); 
     49} 
     50//----------------------------------------------------------------------- 
     51HierarchyNode *HierarchyInterface::GetSceneRoot() const  
     52{ 
     53        return mSceneRoot; 
     54} 
     55//----------------------------------------------------------------------- 
     56unsigned int HierarchyInterface::GetNumTraversedNodes() 
     57{ 
     58        return mNumTraversedNodes; 
     59} 
     60//----------------------------------------------------------------------- 
     61unsigned int HierarchyInterface::GetNumRenderedNodes() 
     62{ 
     63        return mNumRenderedNodes; 
     64} 
    4465} // namespace GtpVisibility 
  • trunk/VUT/GtpVisibility/src/StopAndWaitCullingManager.cpp

    r59 r74  
    33namespace GtpVisibility { 
    44 
    5 //----------------------------------------------------------------------- 
    6 StopAndWaitCullingManager::StopAndWaitCullingManager(HierarchyInterface *HierarchyInterface): 
    7 CullingManager(HierarchyInterface) 
    8 { 
    9 } 
    105//----------------------------------------------------------------------- 
    116void StopAndWaitCullingManager::RenderScene() 
     
    2419                bool intersects = false; 
    2520 
    26                 if (mHierarchyInterface->CheckFrustumVisible(node, intersects)) 
     21                if (!mHierarchyInterface->CheckFrustumVisible(node, intersects)) 
    2722                { 
    2823                        mNumFrustumCulledNodes ++; 
    29                         continue; 
    30                 } 
    31                  
    32                 //if intersects near plane => skip occlusion query because wrong results possible 
    33                 if (intersects) 
    34                 { 
    35             mHierarchyInterface->SetNodeVisible(node, true); 
    36                         mHierarchyInterface->TraverseNode(node); 
    37                         continue; 
    38                 } 
    39  
    40                 // node visible 
    41                 if (mHierarchyInterface->IssueOcclusionQuery(node)->GetQueryResult() >  
    42                         mVisibilityThreshold) 
    43                 { 
    44                         mHierarchyInterface->TraverseNode(node); 
    4524                } 
    4625                else 
    4726                { 
    48                         mNumQueryCulledNodes ++; 
     27                        //if intersects near plane => skip occlusion query because wrong results possible 
     28                        if (intersects) 
     29                        { 
     30                    mHierarchyInterface->SetNodeVisible(node, true); 
     31                                mHierarchyInterface->TraverseNode(node); 
     32                                continue; 
     33                        } 
     34 
     35                        // node visible 
     36                        if (mHierarchyInterface->IssueOcclusionQuery(node)->GetQueryResult() >  
     37                                mVisibilityThreshold) 
     38                        { 
     39                                mHierarchyInterface->TraverseNode(node); 
     40                        } 
     41                        else 
     42                        { 
     43                                mNumQueryCulledNodes ++; 
     44                        } 
    4945                } 
    5046        } 
  • trunk/VUT/GtpVisibility/src/VisibilityEnvironment.cpp

    r59 r74  
    22 
    33namespace GtpVisibility { 
    4  
     4//----------------------------------------------------------------------- 
    55VisibilityEnvironment::VisibilityEnvironment() 
    66{ 
    77} 
    8          
     8//----------------------------------------------------------------------- 
    99void VisibilityEnvironment::LoadEnvironment() 
    1010{ 
  • trunk/VUT/GtpVisibility/src/VisibilityManager.cpp

    r65 r74  
    77 
    88namespace GtpVisibility { 
    9  
    10 VisibilityManager::VisibilityManager(VisibilityEnvironment *visEnvironment) 
     9//----------------------------------------------------------------------- 
     10VisibilityManager::VisibilityManager(VisibilityEnvironment *visEnvironment): 
     11mVisibilityThreshold(0) 
    1112{ 
    1213        mVisibilityEnvironment = visEnvironment; 
    13         //mVisibilityManagerType = VisibilityEnvironment::STOP_AND_WAIT; 
    14         //mVisibilityManager = new StopAndWaitCullingManager(NULL); 
    15         mCullingManagerType = VisibilityEnvironment::FRUSTUM_CULLING; 
    16         mCullingManager = new FrustumCullingManager(0); 
     14         
     15        mCullingManagerType = VisibilityEnvironment::STOP_AND_WAIT_CULLING; 
     16        mCullingManager = new StopAndWaitCullingManager(); 
    1717 
    1818        mQueryManager = new DummyQueryManager(0); 
    1919        mPreprocessingManager = new DummyPreprocessingManager(0); 
    20  
    2120} 
    22  
     21//----------------------------------------------------------------------- 
    2322VisibilityManager::~VisibilityManager() 
    2423{ 
    2524        delete mCullingManager; 
    2625} 
    27  
    28 void VisibilityManager::SetCullingManager(VisibilityEnvironment::CullingManagerType ocmType) 
     26//----------------------------------------------------------------------- 
     27void VisibilityManager::SetCullingManager( 
     28        VisibilityEnvironment::CullingManagerType ocmType) 
    2929{ 
    3030        if (mCullingManagerType != ocmType) 
     
    3535                switch (ocmType) 
    3636                { 
    37                 case VisibilityEnvironment::STOP_AND_WAIT: 
    38                         mCullingManager = new StopAndWaitCullingManager(NULL); 
     37                case VisibilityEnvironment::STOP_AND_WAIT_CULLING: 
     38                        mCullingManager = new StopAndWaitCullingManager(); 
    3939                        break; 
    4040 
    4141                case VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING: 
    42                         mCullingManager = new CoherentHierarchicalCullingManager(NULL); 
     42                        mCullingManager = new CoherentHierarchicalCullingManager(); 
    4343                        break; 
    4444 
    4545                case VisibilityEnvironment::FRUSTUM_CULLING: 
    46                         mCullingManager = new FrustumCullingManager(NULL); 
     46                        mCullingManager = new FrustumCullingManager(); 
    4747                        break; 
    4848                default: 
    49                         mCullingManager = new StopAndWaitCullingManager(NULL); 
     49                        mCullingManager = new StopAndWaitCullingManager(); 
    5050                        break; 
    5151                } 
    5252        } 
    5353} 
    54  
     54//----------------------------------------------------------------------- 
     55void VisibilityManager::SetVisibilityCullingThreshold(unsigned int visibilityThreshold) 
     56{ 
     57        mVisibilityThreshold = visibilityThreshold; 
     58        mCullingManager->SetVisibilityThreshold(mVisibilityThreshold); 
     59} 
     60//----------------------------------------------------------------------- 
    5561CullingManager *VisibilityManager::GetCullingManager() 
    5662{ 
    5763        return mCullingManager; 
    5864} 
    59  
     65//----------------------------------------------------------------------- 
    6066void VisibilityManager::ApplyVisibilityCulling() 
    6167{ 
    6268        mCullingManager->RenderScene(); 
    6369} 
    64  
     70//----------------------------------------------------------------------- 
    6571} // namespace GtpVisibility 
  • trunk/VUT/GtpVisibilityPreprocessor/include/Preprocessor.h

    r68 r74  
    77#include "ViewCellBsp.h" 
    88#include "SceneGraph.h" 
     9#include <string> 
    910 
    1011/** Namespace for the external visibility preprocessor 
  • trunk/VUT/GtpVisibilityPreprocessor/scripts/Preprocessor.vcproj

    r71 r74  
    6161                        <Tool 
    6262                                Name="VCCLCompilerTool" 
     63                                AdditionalIncludeDirectories="..\include" 
    6364                                PreprocessorDefinitions="WIN32;NDEBUG;_LIB" 
    6465                                RuntimeLibrary="2" 
    65                                 UsePrecompiledHeader="3" 
     66                                UsePrecompiledHeader="0" 
    6667                                WarningLevel="3" 
    6768                                Detect64BitPortabilityProblems="TRUE" 
  • trunk/VUT/Ogre/include/OgreBspHierarchyInterface.h

    r59 r74  
    2626        void TraverseNode(GtpVisibility::HierarchyNode *node); 
    2727        void RenderNode(GtpVisibility::HierarchyNode *node); 
    28         bool IsLeaf(GtpVisibility::HierarchyNode *node); 
    29         bool HasGeometry(GtpVisibility::HierarchyNode *node); 
     28        bool IsLeaf(GtpVisibility::HierarchyNode *node) const; 
     29        bool HasGeometry(GtpVisibility::HierarchyNode *node) const; 
    3030        bool HasGreaterDistance(GtpVisibility::HierarchyNode *node1,  
    31                                                     GtpVisibility::HierarchyNode *node2); 
     31                                                    GtpVisibility::HierarchyNode *node2) const; 
    3232         
    3333        void SetNodeVisible(GtpVisibility::HierarchyNode *node, const bool visible); 
    34         void SetLastVisited(GtpVisibility::HierarchyNode *node, const int frameId); 
     34        void SetLastVisited(GtpVisibility::HierarchyNode *node,  
     35                                                const unsigned int frameId); 
    3536 
    36         bool IsNodeVisible(GtpVisibility::HierarchyNode *node); 
    37         int LastVisited(GtpVisibility::HierarchyNode *node); 
     37        bool IsNodeVisible(GtpVisibility::HierarchyNode *node) const; 
     38        unsigned int LastVisited(GtpVisibility::HierarchyNode *node) const; 
    3839 
    3940protected: 
  • trunk/VUT/Ogre/include/OgreOctreeHierarchyInterface.h

    r59 r74  
    3333        void TraverseNode(GtpVisibility::HierarchyNode *node); 
    3434        void RenderNode(GtpVisibility::HierarchyNode *node); 
    35         bool IsLeaf(GtpVisibility::HierarchyNode *node); 
    36         bool HasGeometry(GtpVisibility::HierarchyNode *node); 
     35        bool IsLeaf(GtpVisibility::HierarchyNode *node) const; 
     36        bool HasGeometry(GtpVisibility::HierarchyNode *node) const; 
    3737        bool HasGreaterDistance(GtpVisibility::HierarchyNode *node1,  
    38                                                     GtpVisibility::HierarchyNode *node2); 
     38                                                    GtpVisibility::HierarchyNode *node2) const; 
    3939         
    4040        void SetNodeVisible(GtpVisibility::HierarchyNode *node, const bool visible); 
    41         void SetLastVisited(GtpVisibility::HierarchyNode *node, const int frameId); 
     41        void SetLastVisited(GtpVisibility::HierarchyNode *node, const unsigned int frameId); 
    4242 
    43         bool IsNodeVisible(GtpVisibility::HierarchyNode *node); 
    44         int LastVisited(GtpVisibility::HierarchyNode *node); 
     43        bool IsNodeVisible(GtpVisibility::HierarchyNode *node) const; 
     44        unsigned int LastVisited(GtpVisibility::HierarchyNode *node) const; 
    4545 
    4646protected: 
  • trunk/VUT/Ogre/include/OgreSceneNodeHierarchyInterface.h

    r59 r74  
    1919        SceneNodeHierarchyInterface(SceneManager *sm, RenderSystem *rsys); 
    2020         
    21         bool IsLeaf(GtpVisibility::HierarchyNode *node); 
     21        bool IsLeaf(GtpVisibility::HierarchyNode *node) const; 
    2222         
    2323        void TraverseNode(GtpVisibility::HierarchyNode *node); 
    2424        void RenderNode(GtpVisibility::HierarchyNode *node); 
    2525        void PullUpVisibility(GtpVisibility::HierarchyNode *node); 
    26         bool HasGeometry(GtpVisibility::HierarchyNode *node); 
     26        bool HasGeometry(GtpVisibility::HierarchyNode *node) const; 
    2727        bool HasGreaterDistance(GtpVisibility::HierarchyNode *node1,  
    28                                                     GtpVisibility::HierarchyNode *node2); 
     28                                                    GtpVisibility::HierarchyNode *node2) const; 
    2929 
    3030        void SetNodeVisible(GtpVisibility::HierarchyNode *node, const bool visible); 
    31         void SetLastVisited(GtpVisibility::HierarchyNode *node, const int frameId); 
     31        void SetLastVisited(GtpVisibility::HierarchyNode *node,  
     32                                                const unsigned int frameId); 
    3233 
    33         bool IsNodeVisible(GtpVisibility::HierarchyNode *node); 
    34         int LastVisited(GtpVisibility::HierarchyNode *node); 
     34        bool IsNodeVisible(GtpVisibility::HierarchyNode *node) const; 
     35        unsigned int LastVisited(GtpVisibility::HierarchyNode *node) const; 
    3536 
    3637        AxisAlignedBox *GetBoundingBox(GtpVisibility::HierarchyNode *node); 
  • trunk/VUT/Ogre/misc/OgreVisibilitySceneManager.def

    r59 r74  
    1 LIBRARY Plugin_OcclusionCullingSceneManager 
     1LIBRARY Plugin_VisibilitySceneManager 
    22EXPORTS  
    33        dllStartPlugin 
  • trunk/VUT/Ogre/resources/VisibilityDemo.overlay

    r59 r74  
    1 Example/OcclusionCullingDemoOverlay 
     1Example/VisibilityDemoOverlay 
    22{ 
    33        zorder 500 
    44        // Stats block 
    5         container BorderPanel(Example/Occlusion/OcclusionPanel) 
     5        container BorderPanel(Example/Visibility/VisibilityPanel) 
    66        { 
    77                metrics_mode pixels 
     
    2424 
    2525 
    26                 element TextArea(Example/Occlusion/Algorithm) 
     26                element TextArea(Example/Visibility/Algorithm) 
    2727                { 
    2828                        metrics_mode pixels 
     
    3737                        colour_bottom 0.3 0.5 0.3 
    3838                } 
    39                 element TextArea(Example/Occlusion/AlgorithmInfo) 
     39                element TextArea(Example/Visibility/AlgorithmInfo) 
    4040                { 
    4141                        metrics_mode pixels 
     
    5151                } 
    5252 
    53                 element TextArea(Example/Occlusion/Threshold) 
     53                element TextArea(Example/Visibility/Threshold) 
    5454                { 
    5555                        metrics_mode pixels 
     
    6464                        colour_bottom 0.3 0.5 0.3 
    6565                } 
    66                 element TextArea(Example/Occlusion/ThresholdInfo) 
     66                element TextArea(Example/Visibility/ThresholdInfo) 
    6767                { 
    6868                        metrics_mode pixels 
     
    7979        } 
    8080 
    81         container BorderPanel(Example/Occlusion/OcclusionStatsPanel) 
     81        container BorderPanel(Example/Visibility/VisibilityStatsPanel) 
    8282        { 
    8383                metrics_mode pixels 
     
    8787                top 5 
    8888                width 450 
    89                 height 105 
     89                height 90 
    9090                material Core/StatsBlockCenter 
    9191                border_size 1 1 1 1 
     
    100100                border_bottomright_uv 0.9961 0.0039 1.0000 0.0000 
    101101 
    102                 element TextArea(Example/Occlusion/FrustumCulledNodes) 
     102                element TextArea(Example/Visibility/FrustumCulledNodes) 
    103103                { 
    104104                        metrics_mode pixels 
     
    113113                        colour_bottom 0.3 0.5 0.3 
    114114                } 
    115                 element TextArea(Example/Occlusion/FrustumCulledNodesInfo) 
    116                 { 
    117                         metrics_mode pixels 
    118                         left 180 
    119                         top 5 
    120                         width 90 
    121                         height 30 
    122                         font_name TrebuchetMSBold 
    123                         char_height 16 
    124                         caption : 
    125                         colour_top 0.5 0.7 0.5 
    126                         colour_bottom 0.3 0.5 0.3 
    127                 } 
    128                 element TextArea(Example/Occlusion/QueryCulledNodes) 
     115                element TextArea(Example/Visibility/FrustumCulledNodesInfo) 
     116                { 
     117                        metrics_mode pixels 
     118                        left 180 
     119                        top 5 
     120                        width 90 
     121                        height 30 
     122                        font_name TrebuchetMSBold 
     123                        char_height 16 
     124                        caption : 
     125                        colour_top 0.5 0.7 0.5 
     126                        colour_bottom 0.3 0.5 0.3 
     127                } 
     128                element TextArea(Example/Visibility/QueryCulledNodes) 
    129129                { 
    130130                        metrics_mode pixels 
     
    139139                        colour_bottom 0.3 0.5 0.3 
    140140                }        
    141                 element TextArea(Example/Occlusion/QueryCulledNodesInfo) 
    142                 { 
    143                         metrics_mode pixels 
    144                         left 180 
    145                         top 20 
    146                         width 90 
    147                         height 30 
    148                         font_name TrebuchetMSBold 
    149                         char_height 16 
    150                         caption : 
    151                         colour_top 0.5 0.7 0.5 
    152                         colour_bottom 0.3 0.5 0.3 
    153                 } 
    154                 element TextArea(Example/Occlusion/TraversedNodes) 
     141                element TextArea(Example/Visibility/QueryCulledNodesInfo) 
     142                { 
     143                        metrics_mode pixels 
     144                        left 180 
     145                        top 20 
     146                        width 90 
     147                        height 30 
     148                        font_name TrebuchetMSBold 
     149                        char_height 16 
     150                        caption : 
     151                        colour_top 0.5 0.7 0.5 
     152                        colour_bottom 0.3 0.5 0.3 
     153                } 
     154                element TextArea(Example/Visibility/TraversedNodes) 
    155155                { 
    156156                        metrics_mode pixels 
     
    165165                        colour_bottom 0.3 0.5 0.3 
    166166                }        
    167                 element TextArea(Example/Occlusion/TraversedNodesInfo) 
     167                element TextArea(Example/Visibility/TraversedNodesInfo) 
    168168                { 
    169169                        metrics_mode pixels 
     
    178178                        colour_bottom 0.3 0.5 0.3 
    179179                } 
    180                 element TextArea(Example/Occlusion/SceneNodes) 
     180                element TextArea(Example/Visibility/HierarchyNodes) 
    181181                { 
    182182                        metrics_mode pixels 
     
    187187                        font_name TrebuchetMSBold 
    188188                        char_height 16 
    189                         caption Scene Nodes 
    190                         colour_top 0.5 0.7 0.5 
    191                         colour_bottom 0.3 0.5 0.3 
    192                 }        
    193                 element TextArea(Example/Occlusion/SceneNodesInfo) 
     189                        caption Hierarchy Nodes 
     190                        colour_top 0.5 0.7 0.5 
     191                        colour_bottom 0.3 0.5 0.3 
     192                }        
     193                element TextArea(Example/Visibility/HierarchyNodesInfo) 
    194194                { 
    195195                        metrics_mode pixels 
     
    204204                        colour_bottom 0.3 0.5 0.3 
    205205                } 
    206                 element TextArea(Example/Occlusion/HierarchyNodes) 
     206                element TextArea(Example/Visibility/RenderedNodes) 
    207207                { 
    208208                        metrics_mode pixels 
     
    213213                        font_name TrebuchetMSBold 
    214214                        char_height 16 
    215                         caption Hierarchy Nodes 
    216                         colour_top 0.5 0.7 0.5 
    217                         colour_bottom 0.3 0.5 0.3 
    218                 }        
    219                 element TextArea(Example/Occlusion/HierarchyNodesInfo) 
     215                        caption Rendered Nodes 
     216                        colour_top 0.5 0.7 0.5 
     217                        colour_bottom 0.3 0.5 0.3 
     218                }        
     219                element TextArea(Example/Visibility/RenderedNodesInfo) 
    220220                { 
    221221                        metrics_mode pixels 
    222222                        left 180 
    223223                        top 65 
    224                         width 90 
    225                         height 30 
    226                         font_name TrebuchetMSBold 
    227                         char_height 16 
    228                         caption : 
    229                         colour_top 0.5 0.7 0.5 
    230                         colour_bottom 0.3 0.5 0.3 
    231                 } 
    232                 element TextArea(Example/Occlusion/RenderedNodes) 
    233                 { 
    234                         metrics_mode pixels 
    235                         left 5 
    236                         top 80 
    237                         width 180 
    238                         height 30 
    239                         font_name TrebuchetMSBold 
    240                         char_height 16 
    241                         caption Rendered Nodes 
    242                         colour_top 0.5 0.7 0.5 
    243                         colour_bottom 0.3 0.5 0.3 
    244                 }        
    245                 element TextArea(Example/Occlusion/RenderedNodesInfo) 
    246                 { 
    247                         metrics_mode pixels 
    248                         left 180 
    249                         top 80 
    250224                        width 90 
    251225                        height 30 
  • trunk/VUT/Ogre/scripts/Plugin_VisibilitySceneManager.vcproj

    r64 r74  
    4040                                LinkIncremental="2" 
    4141                                SuppressStartupBanner="TRUE" 
    42                                 AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\debug&quot;;..\lib\debug;..\..\lib\debug;..\..\GtpVisibility\lib\debug" 
     42                                AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\$(ConfigurationName)&quot;;&quot;..\lib\$(ConfigurationName)&quot;;&quot;..\..\lib\$(ConfigurationName)&quot;;&quot;..\..\GtpVisibility\lib\$(ConfigurationName)&quot;" 
    4343                                ModuleDefinitionFile="..\misc\OgreVisibilitySceneManager.def" 
    4444                                GenerateDebugInformation="TRUE" 
     
    8787                                EnableFiberSafeOptimizations="TRUE" 
    8888                                OptimizeForProcessor="2" 
    89                                 AdditionalIncludeDirectories="..\include;$(OGRE_PATH)\OgreMain\include" 
    90                                 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGIN_OCCLUSIONCULLINGSCENEMANAGER_EXPORTS" 
     89                                AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\include&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include\CEGUI&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include&quot;;..\include;..\..\GtpVisibility\include" 
     90                                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGIN_OCCLUSIONCULLINGSCENEMANAGER_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE" 
    9191                                StringPooling="TRUE" 
    9292                                RuntimeLibrary="2" 
     
    102102                                Name="VCLinkerTool" 
    103103                                IgnoreImportLibrary="TRUE" 
    104                                 AdditionalDependencies="OgreMain.lib" 
     104                                AdditionalDependencies="OgreMain.lib CEGUIBase.lib OgreGUIRenderer.lib Plugin_OctreeSceneManager.lib GtpVisibility.lib" 
    105105                                OutputFile="$(OutDir)/Plugin_VisibilitySceneManager.dll" 
    106106                                Version="0.99" 
    107107                                LinkIncremental="1" 
    108108                                SuppressStartupBanner="TRUE" 
    109                                 AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)&quot;;&quot;..\..\..\Dependencies\lib\$(ConfigurationName)&quot;" 
     109                                AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;;&quot;..\..\GtpVisibility\lib\$(ConfigurationName)&quot;;&quot;..\..\lib\$(ConfigurationName)&quot;;&quot;..\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)&quot;" 
    110110                                ModuleDefinitionFile="..\misc\OgreVisibilitySceneManager.def" 
    111111                                GenerateDebugInformation="TRUE" 
     
    144144                        Name="SceneManager_Plugins" 
    145145                        Filter=""> 
     146                        <File 
     147                                RelativePath="..\..\GtpVisibility\include\VisibilityManager.h"> 
     148                        </File> 
    146149                        <Filter 
    147150                                Name="Header Files" 
     
    154157                                </File> 
    155158                                <File 
    156                                         RelativePath="..\include\OgreVisibilityDotSceneManager.h"> 
    157                                 </File> 
    158                                 <File 
    159159                                        RelativePath="..\include\OgreVisibilityOctreeSceneManager.h"> 
    160160                                </File> 
     
    171171                                <File 
    172172                                        RelativePath="..\src\OgreOctreeHierarchyInterface.cpp"> 
    173                                 </File> 
    174                                 <File 
    175                                         RelativePath="..\src\OgreVisibilityDotSceneManager.cpp"> 
    176173                                </File> 
    177174                                <File 
     
    202199                                </File> 
    203200                                <File 
     201                                        RelativePath="..\include\OgreVisibilityOptionsManager.h"> 
     202                                </File> 
     203                                <File 
    204204                                        RelativePath="..\include\OgreVisibilitySceneManager.h"> 
    205205                                </File> 
     
    221221                                </File> 
    222222                                <File 
     223                                        RelativePath="..\src\OgreVisibilityOptionsManager.cpp"> 
     224                                </File> 
     225                                <File 
    223226                                        RelativePath="..\src\OgreVisibilitySceneManager.cpp"> 
     227                                </File> 
     228                                <File 
     229                                        RelativePath="..\src\OgreVisibilitySceneManagerDll.cpp"> 
    224230                                </File> 
    225231                        </Filter> 
  • trunk/VUT/Ogre/src/OgreBspHierarchyInterface.cpp

    r59 r74  
    1616} 
    1717//----------------------------------------------------------------------- 
    18 bool BspHierarchyInterface::IsLeaf(GtpVisibility::HierarchyNode *node) 
     18bool BspHierarchyInterface::IsLeaf(GtpVisibility::HierarchyNode *node) const 
    1919{ 
    2020        return true; 
    2121} 
    2222//----------------------------------------------------------------------- 
    23 bool BspHierarchyInterface::HasGeometry(GtpVisibility::HierarchyNode *node) 
     23bool BspHierarchyInterface::HasGeometry(GtpVisibility::HierarchyNode *node) const 
    2424{ 
    2525        return true; 
     
    2727//----------------------------------------------------------------------- 
    2828bool BspHierarchyInterface::HasGreaterDistance(GtpVisibility::HierarchyNode *node1,  
    29                                                                                            GtpVisibility::HierarchyNode *node2) 
     29                                                                                           GtpVisibility::HierarchyNode *node2) const 
    3030{ 
    3131        return true; 
     
    3737} 
    3838//----------------------------------------------------------------------- 
    39 void BspHierarchyInterface::SetNodeVisible(GtpVisibility::HierarchyNode *node, const bool visible) 
     39void BspHierarchyInterface::SetNodeVisible(GtpVisibility::HierarchyNode *node,  
     40                                                                                   const bool visible) 
    4041{ 
    4142} 
    4243//----------------------------------------------------------------------- 
    43 void BspHierarchyInterface::SetLastVisited(GtpVisibility::HierarchyNode *node, const int frameId) 
     44void BspHierarchyInterface::SetLastVisited(GtpVisibility::HierarchyNode *node,  
     45                                                                                   const unsigned int frameId) 
    4446{ 
    4547} 
     
    5355} 
    5456//----------------------------------------------------------------------- 
    55 bool BspHierarchyInterface::IsNodeVisible(GtpVisibility::HierarchyNode *node) 
     57bool BspHierarchyInterface::IsNodeVisible(GtpVisibility::HierarchyNode *node) const 
    5658{ 
    5759        return true; 
    5860} 
    5961//----------------------------------------------------------------------- 
    60 int BspHierarchyInterface::LastVisited(GtpVisibility::HierarchyNode *node) 
     62unsigned int BspHierarchyInterface::LastVisited(GtpVisibility::HierarchyNode *node) const 
    6163{ 
    6264        return 0; 
  • trunk/VUT/Ogre/src/OgreOctreeHierarchyInterface.cpp

    r59 r74  
    22#include "OgreVisibilityOctreeSceneManager.h" 
    33#include <OgreOctree.h> 
    4 //#include <windows.h> 
     4#include <windows.h> 
    55 
    66namespace Ogre { 
     
    1919        RenderNode(node); 
    2020         
    21         for(int i=0; i<8; i++) 
     21        for(int i=0; i<8; ++i) 
    2222        { 
    2323                Octree *nextChild =  
    2424                        static_cast<Octree *>(node)->mChildren[(i & 4) >> 2][(i & 2) >> 1][i & 1]; 
    2525 
    26                 if(nextChild) 
     26        if (nextChild) 
    2727                { 
    2828                        mDistanceQueue->push(nextChild); 
     
    3131} 
    3232//----------------------------------------------------------------------- 
    33 bool OctreeHierarchyInterface::IsLeaf(GtpVisibility::HierarchyNode *node) 
     33bool OctreeHierarchyInterface::IsLeaf(GtpVisibility::HierarchyNode *node) const 
    3434{ 
    3535        Octree *octant = static_cast<Octree *>(node); 
     
    3737        for(int i=0; i<8; i++) 
    3838        { 
    39                 if(octant->mChildren[(i & 4) >> 2][(i & 2) >> 1][i & 1]) 
     39                if (octant->mChildren[(i & 4) >> 2][(i & 2) >> 1][i & 1]) 
    4040                        return false; 
    4141        } 
     
    4444} 
    4545//----------------------------------------------------------------------- 
    46 bool OctreeHierarchyInterface::HasGeometry(GtpVisibility::HierarchyNode *node) 
     46bool OctreeHierarchyInterface::HasGeometry(GtpVisibility::HierarchyNode *node) const 
    4747{ 
    4848        return static_cast<Octree *>(node)->numNodes() > 0; 
     
    5555//----------------------------------------------------------------------- 
    5656bool OctreeHierarchyInterface::HasGreaterDistance(GtpVisibility::HierarchyNode *node1,  
    57                                                                                                   GtpVisibility::HierarchyNode *node2) 
     57                                                                                                  GtpVisibility::HierarchyNode *node2) const 
    5858{ 
    5959        // matt: change this (inefficient) 
     
    6666} 
    6767//----------------------------------------------------------------------- 
    68 Real OctreeHierarchyInterface::GetSquaredViewDepth(const Camera* cam, const AxisAlignedBox* box) const 
     68Real OctreeHierarchyInterface::GetSquaredViewDepth(const Camera* cam,  
     69                                                                                                   const AxisAlignedBox* box) const 
    6970{ 
    70         Vector3 mid  = ((box->getMinimum() - box->getMaximum()) * 0.5) + box->getMinimum(); 
     71        Vector3 mid = ((box->getMinimum() - box->getMaximum()) * 0.5) + box->getMinimum(); 
    7172        return (cam->getDerivedPosition() - mid).squaredLength();                                                                    
    7273} 
    7374//----------------------------------------------------------------------- 
    74 void OctreeHierarchyInterface::SetNodeVisible(GtpVisibility::HierarchyNode *node, const bool visible) 
     75void OctreeHierarchyInterface::SetNodeVisible(GtpVisibility::HierarchyNode *node,  
     76                                                                                          const bool visible) 
    7577{ 
    7678#ifdef GTP_VISIBILITY_MODIFIED_OGRE 
     
    7981} 
    8082//----------------------------------------------------------------------- 
    81 void OctreeHierarchyInterface::SetLastVisited(GtpVisibility::HierarchyNode *node, const int frameId) 
     83void OctreeHierarchyInterface::SetLastVisited(GtpVisibility::HierarchyNode *node,  
     84                                                                                          const unsigned int frameId) 
    8285{ 
    8386#ifdef GTP_VISIBILITY_MODIFIED_OGRE 
     
    117120} 
    118121//----------------------------------------------------------------------- 
    119 bool OctreeHierarchyInterface::IsNodeVisible(GtpVisibility::HierarchyNode *node) 
     122bool OctreeHierarchyInterface::IsNodeVisible(GtpVisibility::HierarchyNode *node) const 
    120123{ 
    121124#ifdef GTP_VISIBILITY_MODIFIED_OGRE 
     
    126129} 
    127130//----------------------------------------------------------------------- 
    128 int OctreeHierarchyInterface::LastVisited(GtpVisibility::HierarchyNode *node) 
     131unsigned int OctreeHierarchyInterface::LastVisited(GtpVisibility::HierarchyNode *node) const 
    129132{ 
    130133#ifdef GTP_VISIBILITY_MODIFIED_OGRE 
  • trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp

    r59 r74  
    1010 
    1111//----------------------------------------------------------------------- 
    12 PlatformHierarchyInterface::PlatformHierarchyInterface(SceneManager *sm, RenderSystem *rsys) 
     12PlatformHierarchyInterface::PlatformHierarchyInterface(SceneManager *sm, RenderSystem *rsys): 
     13mSceneManager(sm), mRenderSystem(rsys) 
    1314{                
    1415        mHalfBoundingBox[0] = mHalfBoundingBox[1] = NULL; 
     
    4546                 
    4647                mRenderSystem->_setWorldMatrix(Ogre::Matrix4::IDENTITY); 
    47  
     48                 
    4849                static RenderOperation ro; 
    4950 
    50                 mSceneManager->useRenderableViewProjMode(halfbox); 
     51        mSceneManager->useRenderableViewProjMode(halfbox); 
     52                mSceneManager->setPass(halfbox->getTechnique()->getPass(0)); 
    5153                halfbox->getRenderOperation(ro); 
    5254                ro.srcRenderable = halfbox;  
     
    6668        return mHalfBoundingBox[half];   
    6769} 
    68 //----------------------------------------------------------------------- 
    69 /*void OcclusionHierarchyInterface::setNumHierarchyNodes(int num) 
    70 { 
    71         mNumSceneNodes = num; 
    72 }*/ 
    7370//----------------------------------------------------------------------- 
    7471void PlatformHierarchyInterface::SetCamera(Ogre::Camera *cam) 
  • trunk/VUT/Ogre/src/OgreSceneNodeHierarchyInterface.cpp

    r59 r74  
    4949} 
    5050//----------------------------------------------------------------------- 
    51 bool SceneNodeHierarchyInterface::IsLeaf(GtpVisibility::HierarchyNode *node) 
     51bool SceneNodeHierarchyInterface::IsLeaf(GtpVisibility::HierarchyNode *node) const 
    5252{ 
    5353        return (static_cast<SceneNode *>(node)->numChildren() == 0); 
    5454} 
    5555//----------------------------------------------------------------------- 
    56 bool SceneNodeHierarchyInterface::HasGeometry(GtpVisibility::HierarchyNode *node) 
     56bool SceneNodeHierarchyInterface::HasGeometry(GtpVisibility::HierarchyNode *node) const 
    5757{ 
    5858        SceneNode *sceneNode = static_cast<SceneNode *>(node); 
     
    7575//----------------------------------------------------------------------- 
    7676bool SceneNodeHierarchyInterface::HasGreaterDistance(GtpVisibility::HierarchyNode *node1,  
    77                                                                                                          GtpVisibility::HierarchyNode *node2) 
     77                                                                                                         GtpVisibility::HierarchyNode *node2) const 
    7878{ 
    7979        SceneNode *sceneNode1 = static_cast<SceneNode *>(node1); 
     
    9292} 
    9393//----------------------------------------------------------------------- 
    94 void SceneNodeHierarchyInterface::SetLastVisited(GtpVisibility::HierarchyNode *node, const int frameId) 
     94void SceneNodeHierarchyInterface::SetLastVisited(GtpVisibility::HierarchyNode *node,  
     95                                                                                                 const unsigned int frameId) 
    9596{ 
    9697#ifdef GTP_VISIBILITY_MODIFIED_OGRE 
     
    100101} 
    101102//----------------------------------------------------------------------- 
    102 bool SceneNodeHierarchyInterface::IsNodeVisible(GtpVisibility::HierarchyNode *node) 
     103bool SceneNodeHierarchyInterface::IsNodeVisible(GtpVisibility::HierarchyNode *node) const 
    103104{ 
    104105#ifdef GTP_VISIBILITY_MODIFIED_OGRE 
     
    110111} 
    111112//----------------------------------------------------------------------- 
    112 int SceneNodeHierarchyInterface::LastVisited(GtpVisibility::HierarchyNode *node) 
     113unsigned int SceneNodeHierarchyInterface::LastVisited(GtpVisibility::HierarchyNode *node) const 
    113114{ 
    114115#ifdef GTP_VISIBILITY_MODIFIED_OGRE 
  • trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp

    r59 r74  
    11#include "OgreVisibilityOctreeSceneManager.h" 
     2#include "OgreVisibilityOptionsManager.h" 
    23#include <OgreMath.h> 
    34#include <OgreIteratorWrappers.h> 
     
    1718 
    1819        //mDisplayNodes = true; 
    19         //mShowBoundingBoxes = true; 
    20         //mShowBoxes = true; 
     20        mShowBoundingBoxes = true; 
     21        mShowBoxes = true; 
    2122        //mMaxDepth = 20; 
    2223} 
     
    4546        setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE); 
    4647 
    47         mHierarchyInterface->InitFrame(mSceneRoot, mCameraInProgress); 
     48        mHierarchyInterface->InitFrame(mOctree, mCameraInProgress); 
    4849        mVisibilityManager->ApplyVisibilityCulling(); 
    4950 
     
    6667void VisibilityOctreeSceneManager::_updateSceneGraph(Camera* cam) 
    6768{ 
    68         //mOcclusionOctreeHierarchyInterface->setNumSceneNodes((int)mSceneNodes.size()); 
    6969        mVisibilityManager->GetCullingManager()->SetHierarchyInterface(mHierarchyInterface); 
    7070        mHierarchyInterface->SetRenderSystem(mDestRenderSystem); 
     
    7878bool VisibilityOctreeSceneManager::setOption(const String & key, const void * val) 
    7979{ 
    80         return /*mVisibilitySceneTraverser->setOption( key, val) || */OctreeSceneManager::setOption( key, val ); 
     80        return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). 
     81                setOption(key, val) || OctreeSceneManager::setOption(key, val); 
    8182} 
    8283//----------------------------------------------------------------------- 
    8384bool VisibilityOctreeSceneManager::getOption(const String & key, void *val) 
    8485{ 
    85         return /*mVisibilitySceneTraverser->getOption( key, val) || */OctreeSceneManager::getOption(key, val); 
     86        if (key == "NumHierarchyNodes") 
     87        { 
     88                * static_cast<unsigned int *>(val) = (unsigned int)mNumOctreeNodes; 
     89                return true; 
     90        } 
     91 
     92        return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). 
     93                getOption(key, val) && OctreeSceneManager::getOption(key, val); 
    8694} 
    8795//----------------------------------------------------------------------- 
     
    93101bool VisibilityOctreeSceneManager::getOptionKeys(StringVector & refKeys) 
    94102{ 
    95         return /*mVisibilitySceneTraverser->getOptionKeys ( refKeys ) || */OctreeSceneManager::getOptionKeys(refKeys); 
     103        return  VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). 
     104                getOptionKeys ( refKeys ) || OctreeSceneManager::getOptionKeys(refKeys); 
    96105} 
    97106//----------------------------------------------------------------------- 
  • trunk/VUT/Ogre/src/OgreVisibilitySceneManager.cpp

    r59 r74  
    55#include "OgreVisibilitySceneManager.h" 
    66#include "OgreSceneNodeHierarchyInterface.h" 
     7#include "OgreVisibilityOptionsManager.h" 
    78 
    89//#include <windows.h> 
     
    4546 
    4647        mHierarchyInterface->InitFrame(mSceneRoot, mCameraInProgress); 
    47  
    4848        mVisibilityManager->ApplyVisibilityCulling(); 
    4949 
     
    6161void VisibilitySceneManager::_updateSceneGraph(Camera* cam) 
    6262{ 
    63         //mVisibilitySceneTraverser->setNumSceneNodes((int)mSceneNodes.size()); 
    6463        mVisibilityManager->GetCullingManager()->SetHierarchyInterface(mHierarchyInterface); 
    6564        mHierarchyInterface->SetRenderSystem(mDestRenderSystem); 
    6665         
    67         //mVisibilitySceneTraverser->setNumQueries((int)mSceneNodes.size()); 
    68          
    6966        SceneManager::_updateSceneGraph(cam); 
    7067} 
     
    7269bool VisibilitySceneManager::setOption(const String & key, const void * val) 
    7370{ 
    74         //mVisibilitySceneTraverser->setOption(key, val);        
    75         return SceneManager::setOption(key, val); 
     71        return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). 
     72                setOption(key, val) || SceneManager::setOption(key, val); 
    7673} 
    7774//----------------------------------------------------------------------- 
    7875bool VisibilitySceneManager::getOption(const String & key, void *val) 
    7976{ 
    80         //mVisibilitySceneTraverser->getOption(key, val); 
     77        if (key == "NumHierarchyNodes") 
     78        { 
     79                * static_cast<unsigned int *>(val) = (unsigned int)mSceneNodes.size(); 
     80                return true; 
     81        } 
    8182         
    82         return SceneManager::getOption(key, val); 
     83        return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). 
     84                getOption(key, val) && SceneManager::getOption(key, val); 
    8385} 
    8486//----------------------------------------------------------------------- 
     
    9092bool VisibilitySceneManager::getOptionKeys(StringVector & refKeys) 
    9193{ 
    92         SceneManager::getOptionKeys(refKeys); 
    93         //mVisibilitySceneTraverser->getOptionKeys( refKeys ); 
    94  
    95         return true; 
     94        return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). 
     95                getOptionKeys(refKeys) || SceneManager::getOptionKeys(refKeys); 
    9696} 
    9797//----------------------------------------------------------------------- 
  • trunk/VUT/Ogre/src/OgreVisibilitySceneManagerDll.cpp

    r59 r74  
    2424*/ 
    2525 
    26 #include <OgreOcclusionCullingTerrainSceneManager.h> 
    27 #include <OgreOcclusionCullingOctreeSceneManager.h> 
    28 //#include <OgreOcclusionCullingDotSceneManager.h> 
     26#include <OgreVisibilityTerrainSceneManager.h> 
     27#include <OgreVisibilityOctreeSceneManager.h> 
     28//#include <OgreVisibilityDotSceneManager.h> 
    2929#include <OgreHeightmapTerrainPageSource.h> 
    30 #include "GtpVisibilityManager.h" 
    31 #include "GtpVisibilityStopAndWaitManager.h" 
    32 #include "GtpVisibilityEnvironment.h" 
     30#include "VisibilityManager.h" 
     31#include "StopAndWaitCullingManager.h" 
     32#include "VisibilityEnvironment.h" 
    3333 
    3434#include <OgreRoot.h> 
    3535 
    3636//#include <windows.h> 
    37 GtpVisibility::Environment *visEnv; 
    38 GtpVisibility::Manager *visManager; 
     37GtpVisibility::VisibilityEnvironment *visEnv; 
     38GtpVisibility::VisibilityManager *visManager; 
    3939 
    4040namespace Ogre { 
    4141 
    42 // OcclusionCullingDotSceneManager *occlusionDotPlugin; 
    43 OcclusionCullingOctreeSceneManager *cullingOctreePlugin; 
    44 OcclusionCullingTerrainSceneManager *cullingTerrainPlugin; 
     42// VisibilityDotSceneManager *occlusionDotPlugin; 
     43VisibilityOctreeSceneManager *cullingOctreePlugin; 
     44VisibilityTerrainSceneManager *cullingTerrainPlugin; 
    4545 
    4646HeightmapTerrainPageSource *heightmapTerrainPageSource; 
     
    4949extern "C" void dllStartPlugin(void) 
    5050{ 
    51         visManager = new GtpVisibility::Manager(visEnv); 
     51        visManager = new GtpVisibility::VisibilityManager(visEnv); 
    5252        // Create new scene manager 
    53         //occlusionDotPlugin = new OcclusionCullingDotSceneManager(); 
    54         cullingOctreePlugin = new OcclusionCullingOctreeSceneManager(visManager); 
    55         cullingTerrainPlugin = new OcclusionCullingTerrainSceneManager(visManager); 
     53        //occlusionDotPlugin = new VisibilityDotSceneManager(); 
     54        cullingOctreePlugin = new VisibilityOctreeSceneManager(visManager); 
     55        cullingTerrainPlugin = new VisibilityTerrainSceneManager(visManager); 
    5656        heightmapTerrainPageSource = new HeightmapTerrainPageSource(); 
    5757 
  • trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp

    r59 r74  
    11#include "OgreVisibilityTerrainSceneManager.h" 
    22#include "OgreOctreeHierarchyInterface.h" 
     3#include "OgreVisibilityOptionsManager.h" 
    34#include <OgreMath.h> 
    45#include <OgreIteratorWrappers.h> 
     
    1819 
    1920        setVisibilityManager(visManager); 
    20         //mShowBoxes = true; 
     21        mShowBoxes = true; 
    2122        //mDisplayNodes = true; 
    22         //mShowBoundingBoxes = true; 
     23        mShowBoundingBoxes = true; 
    2324        mMaxDepth = 20; 
    2425} 
     
    4748        setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE); 
    4849 
    49         mHierarchyInterface->InitFrame(mSceneRoot, mCameraInProgress); 
     50        mHierarchyInterface->InitFrame(mOctree, mCameraInProgress); 
     51        mVisibilityManager->ApplyVisibilityCulling(); 
    5052 
    51         mVisibilityManager->ApplyVisibilityCulling(); 
    5253#ifdef GTP_VISIBILITY_MODIFIED_OGRE 
    5354        _deleteRenderedQueueGroups(); 
     
    7071        mVisibilityManager->GetCullingManager()->SetHierarchyInterface(mHierarchyInterface); 
    7172        mHierarchyInterface->SetRenderSystem(mDestRenderSystem); 
     73 
    7274#ifdef GTP_VISIBILITY_MODIFIED_OGRE 
    7375    mHierarchyInterface->SetNumOctreeNodes(mNumOctreeNodes); 
     
    7880bool VisibilityTerrainSceneManager::setOption(const String & key, const void * val) 
    7981{ 
    80         return /*mOcclusionOctreeHierarchyInterface->setOption( key, val) || */TerrainSceneManager::setOption( key, val ); 
     82        return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). 
     83                setOption(key, val) || TerrainSceneManager::setOption(key, val); 
    8184} 
    8285//----------------------------------------------------------------------- 
    8386bool VisibilityTerrainSceneManager::getOption(const String & key, void *val) 
    8487{ 
    85         return /*mOcclusionOctreeHierarchyInterface->getOption( key, val) || */TerrainSceneManager::getOption( key, val ) ; 
     88        if (key == "NumHierarchyNodes") 
     89        { 
     90                * static_cast<unsigned int *>(val) = (unsigned int)mNumOctreeNodes; 
     91                return true; 
     92        } 
     93         
     94        return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). 
     95                getOption(key, val) && TerrainSceneManager::getOption(key, val); 
    8696} 
    8797//----------------------------------------------------------------------- 
    8898bool VisibilityTerrainSceneManager::getOptionValues(const String & key, StringVector  &refValueList) 
    8999{ 
    90         return TerrainSceneManager::getOptionValues( key, refValueList ); 
     100        return TerrainSceneManager::getOptionValues( key, refValueList); 
    91101} 
    92102//----------------------------------------------------------------------- 
    93103bool VisibilityTerrainSceneManager::getOptionKeys(StringVector & refKeys) 
    94104{ 
    95         return /*mOcclusionOctreeHierarchyInterface->getOptionKeys ( refKeys ) ||*/ TerrainSceneManager::getOptionKeys( refKeys ); 
     105        return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). 
     106                getOptionKeys(refKeys) || TerrainSceneManager::getOptionKeys(refKeys); 
    96107} 
    97108//----------------------------------------------------------------------- 
  • trunk/VUT/chcdemo/HierarchyNode.cpp

    r10 r74  
    151151} 
    152152 
    153 int HierarchyNode::LastVisited() 
     153unsigned int HierarchyNode::LastVisited() 
    154154{ 
    155155        return mLastVisited; 
    156156} 
    157157 
    158 void HierarchyNode::SetLastVisited(int lastVisited) 
     158void HierarchyNode::SetLastVisited(unsigned int lastVisited) 
    159159{ 
    160160        mLastVisited = lastVisited; 
  • trunk/VUT/scripts/GtpVisibility.sln

    r71 r74  
    1111        EndProjectSection 
    1212EndProject 
    13 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestCullingDotScene", "..\work\TestCullingDotScene\TestCullingDotScene.vcproj", "{BE13944C-D05E-467F-B0AC-8A65A3B5FE60}" 
     13Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestCullingTerrain", "..\work\TestCullingTerrain\TestCullingTerrain.vcproj", "{248F19A6-2FE0-4F5D-8928-E0EA10609887}" 
    1414        ProjectSection(ProjectDependencies) = postProject 
    1515                {80DECC17-BDDD-4412-8CF8-F7C1C17A7436} = {80DECC17-BDDD-4412-8CF8-F7C1C17A7436} 
    1616                {101A7691-74F3-48B4-96A3-CF35578F5900} = {101A7691-74F3-48B4-96A3-CF35578F5900} 
    17         EndProjectSection 
    18 EndProject 
    19 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestCullingTerrain", "..\work\TestCullingTerrain\TestCullingTerrain.vcproj", "{248F19A6-2FE0-4F5D-8928-E0EA10609887}" 
    20         ProjectSection(ProjectDependencies) = postProject 
    21                 {80DECC17-BDDD-4412-8CF8-F7C1C17A7436} = {80DECC17-BDDD-4412-8CF8-F7C1C17A7436} 
    2217                {101A7691-74F3-48B4-96A3-CF35578F5900} = {101A7691-74F3-48B4-96A3-CF35578F5900} 
    2318        EndProjectSection 
     
    4540                {248F19A6-2FE0-4F5D-8928-E0EA10609887}.Release.ActiveCfg = Release|Win32 
    4641                {248F19A6-2FE0-4F5D-8928-E0EA10609887}.Release.Build.0 = Release|Win32 
    47                 {BE13944C-D05E-467F-B0AC-8A65A3B5FE60}.Debug.ActiveCfg = Debug|Win32 
    48                 {BE13944C-D05E-467F-B0AC-8A65A3B5FE60}.Debug.Build.0 = Debug|Win32 
    49                 {BE13944C-D05E-467F-B0AC-8A65A3B5FE60}.Release.ActiveCfg = Release|Win32 
    50                 {BE13944C-D05E-467F-B0AC-8A65A3B5FE60}.Release.Build.0 = Release|Win32 
    5142                {248F19A6-2FE0-4F5D-8928-E0EA10609887}.Debug.ActiveCfg = Debug|Win32 
    5243                {248F19A6-2FE0-4F5D-8928-E0EA10609887}.Debug.Build.0 = Debug|Win32 
  • trunk/VUT/work/TestCulling/TestCulling.vcproj

    r64 r74  
    2121                                Name="VCCLCompilerTool" 
    2222                                Optimization="0" 
    23                                 AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\Dependencies\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include\CEGUI&quot;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\include&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include&quot;;../include" 
    24                                 PreprocessorDefinitions="_WINDOWS;_STLP_USE_DYNAMIC_LIB;OGRE_LIBRARY_IMPORTS;_DEBUG;WIN32;_STLP_DEBUG;PLUGIN_TERRAIN_IMPORTS" 
     23                                AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\Dependencies\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include\CEGUI&quot;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\include&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include&quot;;../include;../../GtpVisibility/include" 
     24                                PreprocessorDefinitions="_WINDOWS;_STLP_USE_DYNAMIC_LIB;OGRE_LIBRARY_IMPORTS;_DEBUG;WIN32;_STLP_DEBUG;PLUGIN_TERRAIN_IMPORTS;GTP_VISIBILITY_MODIFIED_OGRE" 
    2525                                MinimalRebuild="TRUE" 
    2626                                BasicRuntimeChecks="3" 
     
    3737                                OutputFile="$(OGRE_PATH)/Samples/Common/bin/Debug/TestCulling.exe" 
    3838                                LinkIncremental="2" 
    39                                 AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\Dependencies\Lib\Debug&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\debug&quot;;&quot;$(OGRE_PATH)\OgreMain\Lib\Debug&quot;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\debug&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;" 
     39                                AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\Dependencies\Lib\$(ConfigurationName)&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\OgreMain\Lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;" 
    4040                                GenerateDebugInformation="TRUE" 
    4141                                ProgramDatabaseFile="$(OutDir)/TestCulling.pdb" 
     
    6666                <Configuration 
    6767                        Name="Release|Win32" 
    68                         OutputDirectory="Release" 
    69                         IntermediateDirectory="Release" 
     68                        OutputDirectory=".\bin\$(ConfigurationName)" 
     69                        IntermediateDirectory=".\obj\$(ConfigurationName)" 
    7070                        ConfigurationType="1" 
    7171                        CharacterSet="2"> 
    7272                        <Tool 
    7373                                Name="VCCLCompilerTool" 
    74                                 AdditionalIncludeDirectories="..\..\..\Samples\Common\Include, ..\..\..\OgreMain\include" 
    75                                 PreprocessorDefinitions="_WINDOWS,_STLP_USE_DYNAMIC_LIB,OGRE_LIBRARY_IMPORTS,_RELEASE,WIN32,_STLP_RELEASE" 
     74                                AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\Dependencies\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include\CEGUI&quot;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\include&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include&quot;;../include;../../GtpVisibility/include" 
     75                                PreprocessorDefinitions="_WINDOWS;_STLP_USE_DYNAMIC_LIB;OGRE_LIBRARY_IMPORTS;_RELEASE;WIN32;_STLP_RELEASE;GTP_VISIBILITY_MODIFIED_OGRE" 
    7676                                RuntimeLibrary="2" 
    7777                                UsePrecompiledHeader="0" 
     
    8383                        <Tool 
    8484                                Name="VCLinkerTool" 
    85                                 AdditionalDependencies="OGREMain.LIB" 
    86                                 OutputFile="..\..\..\Samples\Common\Bin\Release\TestCulling.exe" 
     85                                AdditionalDependencies="OGREMain.LIB Plugin_OctreeSceneManager.lib CEGUIBase.lib OgreGUIRenderer.lib" 
     86                                OutputFile="$(OGRE_PATH)/Samples/Common/bin/Release/TestCulling.exe" 
    8787                                LinkIncremental="1" 
    88                                 AdditionalLibraryDirectories="..\..\..\OgreMain\Lib\Release" 
     88                                AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\Dependencies\Lib\$(ConfigurationName)&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\OgreMain\Lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;" 
    8989                                GenerateDebugInformation="TRUE" 
    9090                                SubSystem="2" 
  • trunk/VUT/work/TestCulling/TestCullingApplication.cpp

    r61 r74  
    33        TestCullingApplication.cpp 
    44    \brief 
    5         Tests the occlusion culling algorithm 
     5        Tests the visibility culling algorithm 
    66*/ 
    77 
     
    1515#include "Ogre.h" 
    1616#include "TestCullingApplication.h" 
    17 //#include "OgreVisibilitySceneTraverser.h" 
    1817 
    1918#define WIN32_LEAN_AND_MEAN 
     
    9392//----------------------------------------------------------------------- 
    9493void TestCullingApplication::generateSceneObject(const Vector3 &translationRatio,  
    95                                                                                                  const Vector3 &rotationRatio, const int idx, const String& entName) 
     94                                                                                                 const Vector3 &rotationRatio,  
     95                                                                                                 const int idx,  
     96                                                                                                 const String& entName) 
    9697{ 
    9798        Vector3 rotation = mMinAngle + rotationRatio * (mMaxAngle - mMinAngle); 
    98         Vector3 translation = mMinTranslation + translationRatio * (mMaxTranslation - mMinTranslation); 
     99        Vector3 translation = mMinTranslation +  
     100                translationRatio * (mMaxTranslation - mMinTranslation); 
    99101 
    100102        char name[16]; 
    101103    sprintf( name, "object%d", idx ); 
    102104 
    103     Entity *ent = mSceneMgr->createEntity( name, entName ); 
    104         SceneNode *node = mSceneMgr->getRootSceneNode()->createChildSceneNode( String(name) + "Node", translation); 
     105    Entity *ent = mSceneMgr->createEntity(name, entName); 
     106        SceneNode *node = mSceneMgr->getRootSceneNode()-> 
     107                createChildSceneNode(String(name) + "Node", translation); 
    105108        node->attachObject(ent); 
    106109        node->scale(0.1,0.1,0.1); 
     
    150153        mRotateSpeed *= 2; 
    151154 
    152         mCurrentAlgorithm = 0;//VisibilitySceneTraverser::RENDER_COHERENT; 
     155        mCurrentAlgorithm = GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING; 
    153156        mThreshold = 0; 
    154157     
     
    161164        Overlay* pOver = OverlayManager::getSingleton().getByName("Example/VisibilityDemoOverlay");  
    162165 
    163         mAlgorithmInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/AlgorithmInfo"); 
    164         mThresholdInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/ThresholdInfo"); 
    165         mFrustumCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/FrustumCulledNodesInfo"); 
    166         mQueryCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/QueryCulledNodesInfo"); 
    167     mTraversedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/TraversedNodesInfo"); 
    168         mSceneNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/SceneNodesInfo"); 
    169         mHierarchyNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/HierarchyNodesInfo"); 
    170         mRenderedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/RenderedNodesInfo"); 
     166        mAlgorithmInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/AlgorithmInfo"); 
     167        mThresholdInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/ThresholdInfo"); 
     168        mFrustumCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/FrustumCulledNodesInfo"); 
     169        mQueryCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/QueryCulledNodesInfo"); 
     170    mTraversedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/TraversedNodesInfo"); 
     171        mHierarchyNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/HierarchyNodesInfo"); 
     172        mRenderedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/RenderedNodesInfo"); 
    171173 
    172174        mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]); 
     
    175177        mQueryCulledNodesInfo->setCaption(": 0"); 
    176178        mTraversedNodesInfo->setCaption(": 0"); 
    177         mSceneNodesInfo->setCaption(": 0"); 
    178179        mHierarchyNodesInfo->setCaption(": 0"); 
    179180        mRenderedNodesInfo->setCaption(": 0"); 
     
    275276void MouseQueryListener::changeAlgorithm() 
    276277{ 
    277     //mCurrentAlgorithm = ++mCurrentAlgorithm % VisibilitySceneTraverser::NUM_RENDERMODES; 
     278    mCurrentAlgorithm = ++mCurrentAlgorithm % GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS, 
    278279 
    279280        mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]); 
     
    295296        mTraversedNodesInfo->setCaption(str); 
    296297 
    297         mSceneMgr->getOption("NumSceneNodes", &opt); sprintf(str,": %d", opt);  
    298         mSceneNodesInfo->setCaption(str); 
    299  
    300         mSceneMgr->getOption("NumOctreeNodes", &opt); sprintf(str,": %d", opt);  
     298        mSceneMgr->getOption("NumHierarchyNodes", &opt); sprintf(str,": %d", opt);  
    301299        mHierarchyNodesInfo->setCaption(str); 
    302300 
  • trunk/VUT/work/TestCulling/TestCullingApplication.h

    r61 r74  
    55#include "CEGUIForwardRefs.h" 
    66#include "ExampleApplication.h" 
    7 //#include "OgreVisibilitySceneTraverser.h" 
     7#include "VisibilityEnvironment.h" 
    88 
    99 
     
    1818} 
    1919 
    20 String mCurrentAlgorithmCaptions[3] =  
     20String mCurrentAlgorithmCaptions[GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS] =  
    2121{ 
    22     "Cull Frustum",  
    23         "Stop and Wait",  
    24         "Coherent Occlusion Culling" 
     22    "View Frustum Culling",  
     23        "Stop and Wait Culling",  
     24        "Coherent Hierarchical Culling" 
    2525}; 
    2626 
     
    8080    OverlayElement *mTraversedNodesInfo; 
    8181        OverlayElement *mHierarchyNodesInfo; 
    82         OverlayElement *mSceneNodesInfo; 
    8382        OverlayElement *mRenderedNodesInfo; 
    8483}; 
  • trunk/VUT/work/TestCullingTerrain/TerrainContentGenerator.cpp

    r61 r74  
    33        TerrainContentGenerator.cpp 
    44    \brief 
    5         Creates content for the terrain, 
     5        Creates content for the terrain. 
    66*/ 
    77#include "TerrainContentGenerator.h" 
    88 
     9/********************************************/ 
     10/*  TerrainContentGenerator implementation  */ 
     11/********************************************/ 
    912//----------------------------------------------------------------------- 
    1013TerrainContentGenerator::TerrainContentGenerator( SceneManager *sm, RayQueryExecutor *rayQueryEx ) 
     
    1316        mRayQueryExecutor = rayQueryEx; 
    1417 
    15         mMinTranslation = Vector3(-70.0f, -70.0f, 0.0f); 
    16         mMaxTranslation = Vector3(70.0f, 70.0f, 600.0f); 
     18        mMinPos = Vector3(-200.0f, -70.0f, 200.0f); 
     19        mMaxPos = Vector3(200.0f, 70.0f, 200.0f); 
    1720 
    1821        mMinAngle = 0; 
     
    4851        // Setup the ray scene query 
    4952        Real rotation = mMinAngle + rotationRatio.x * (mMaxAngle - mMinAngle); 
    50         Vector3 translation = mMinTranslation + translationRatio * (mMaxTranslation - mMinTranslation); 
     53        Vector3 position = mMinPos + translationRatio * (mMaxPos - mMinPos); 
    5154 
    52         translation.y = 5000; 
     55        position.y = 5000; 
    5356     
    5457        Vector3 queryResult; 
    5558 
    56         if(mRayQueryExecutor->executeRayQuery(&queryResult, translation, Vector3::NEGATIVE_UNIT_Y)) 
     59        if(mRayQueryExecutor->executeRayQuery(&queryResult, position, Vector3::NEGATIVE_UNIT_Y)) 
    5760        { 
    5861                char name[16]; 
     
    6063 
    6164                Entity *ent = mSceneMgr->createEntity(name, entName); 
    62                 SceneNode *currentObject = mSceneMgr->getRootSceneNode( )->createChildSceneNode( String(name) + "Node", queryResult); 
     65                SceneNode *currentObject = mSceneMgr->getRootSceneNode()-> 
     66                        createChildSceneNode(String(name) + "Node", queryResult); 
    6367                currentObject->attachObject(ent); 
    6468                currentObject->setScale(0.1f, 0.1f, 0.1f); 
    6569        } 
    6670} 
     71/****************************************/ 
     72/*  RayQueryExecutor implementation     */ 
     73/****************************************/ 
    6774//----------------------------------------------------------------------- 
    68 RayQueryExecutor::RayQueryExecutor( SceneManager *sm ) 
     75RayQueryExecutor::RayQueryExecutor(SceneManager *sm) 
    6976{ 
    7077        mRaySceneQuery = sm->createRayQuery(Ray()); 
     
    7683} 
    7784//----------------------------------------------------------------------- 
    78 bool RayQueryExecutor::executeRayQuery( Vector3 *result, const Vector3 &pos, const Vector3 &dir ) 
     85bool RayQueryExecutor::executeRayQuery(Vector3 *result, const Vector3 &pos, const Vector3 &dir) 
    7986{ 
    80         Ray ray(pos, dir); 
     87        return executeRayQuery(result, Ray(pos, dir)); 
     88} 
     89 
     90bool RayQueryExecutor::executeRayQuery(Vector3 *result, const Ray &ray) 
     91{ 
    8192    mRaySceneQuery->setRay(ray); 
    8293 
    8394    // Perform the scene query 
    8495    RaySceneQueryResult &queryResult = mRaySceneQuery->execute(); 
    85     RaySceneQueryResult::iterator it = queryResult.begin( ); 
     96    RaySceneQueryResult::iterator it = queryResult.begin(); 
    8697 
    8798        if (it != queryResult.end() && it->worldFragment) 
  • trunk/VUT/work/TestCullingTerrain/TerrainContentGenerator.h

    r61 r74  
    55#include "ExampleApplication.h" 
    66 
     7/** Class which executes a simple ray query. 
     8*/ 
    79class RayQueryExecutor 
    810{ 
    911public: 
    10         RayQueryExecutor( SceneManager *sm ); 
    11         ~RayQueryExecutor( ); 
    12         bool executeRayQuery( Vector3 *result, const Vector3 &pos, const Vector3 &dir ); 
     12        RayQueryExecutor(SceneManager *sm); 
     13        ~RayQueryExecutor(); 
     14         
     15        bool executeRayQuery(Vector3 *result, const Vector3 &pos, const Vector3 &dir); 
     16        bool RayQueryExecutor::executeRayQuery( Vector3 *result, const Ray &ray); 
     17 
    1318protected: 
    1419        RaySceneQuery *mRaySceneQuery; 
    1520}; 
    16  
     21/** Class which fills a terrain with content in a random way. 
     22*/ 
    1723class TerrainContentGenerator 
    1824{ 
    1925public: 
    20         TerrainContentGenerator(  SceneManager *sm, RayQueryExecutor *rayQueryEx ); 
     26        TerrainContentGenerator(SceneManager *sm, RayQueryExecutor *rayQueryEx); 
    2127        /** Generates a the scene hierarchy with random values . 
    22         @param number of objects to generate 
     28                @param number of objects to generate 
    2329        */ 
    24         void generateScene( int numObjects ); 
    25         /**  
    26                 generates a new scene object  
     30        void generateScene(int numObjects); 
     31        /** Generates a new scene object  
    2732                @param tranlationRatio ratio between minimal and maximal possible translation 
    2833                @param rotationRatio ratio between minimal and maximal possible rotation 
     
    3035                @entName the name of the object entity 
    3136        */ 
    32         void generateSceneObject( const Vector3 &translationRatio, const Vector3 &rotationRatio,  
    33                                                           const int idx, const String &entName ); 
     37        void generateSceneObject(const Vector3 &translationRatio, const Vector3 &rotationRatio,  
     38                                                         const int idx, const String &entName); 
    3439 
    3540protected: 
     
    3742        Real mMinAngle; 
    3843        Real mMaxAngle; 
    39         Vector3 mMaxTranslation; 
    40         Vector3 mMinTranslation; 
     44        Vector3 mMaxPos; 
     45        Vector3 mMinPos; 
    4146 
    4247        RayQueryExecutor *mRayQueryExecutor; 
  • trunk/VUT/work/TestCullingTerrain/TestCullingTerrain.vcproj

    r64 r74  
    2121                                Name="VCCLCompilerTool" 
    2222                                Optimization="0" 
    23                                 AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\Dependencies\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include\CEGUI&quot;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\include&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include&quot;;../include" 
    24                                 PreprocessorDefinitions="_WINDOWS;_STLP_USE_DYNAMIC_LIB;OGRE_LIBRARY_IMPORTS;_DEBUG;WIN32;_STLP_DEBUG;PLUGIN_TERRAIN_IMPORTS" 
     23                                AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\Dependencies\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include\CEGUI&quot;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\include&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include&quot;;../../GtpVisibility/include;../include" 
     24                                PreprocessorDefinitions="_WINDOWS;_STLP_USE_DYNAMIC_LIB;OGRE_LIBRARY_IMPORTS;_DEBUG;WIN32;_STLP_DEBUG;PLUGIN_TERRAIN_IMPORTS;GTP_VISIBILITY_MODIFIED_OGRE" 
    2525                                MinimalRebuild="TRUE" 
    2626                                BasicRuntimeChecks="3" 
     
    3737                                OutputFile="$(OGRE_PATH)/Samples/Common/bin/Debug/TestCullingTerrain.exe" 
    3838                                LinkIncremental="2" 
    39                                 AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\Dependencies\Lib\Debug&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\debug&quot;;&quot;$(OGRE_PATH)\OgreMain\Lib\Debug&quot;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\debug&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;" 
     39                                AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\Dependencies\Lib\$(ConfigurationName)&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\OgreMain\Lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;" 
    4040                                GenerateDebugInformation="TRUE" 
    4141                                ProgramDatabaseFile="$(OutDir)/TestCullingTerrain.pdb" 
     
    6666                <Configuration 
    6767                        Name="Release|Win32" 
    68                         OutputDirectory="Release" 
    69                         IntermediateDirectory="Release" 
     68                        OutputDirectory=".\bin\$(ConfigurationName)" 
     69                        IntermediateDirectory=".\obj\$(ConfigurationName)" 
    7070                        ConfigurationType="1" 
    7171                        CharacterSet="2"> 
    7272                        <Tool 
    7373                                Name="VCCLCompilerTool" 
    74                                 AdditionalIncludeDirectories="..\..\..\Samples\Common\Include, ..\..\..\OgreMain\include" 
    75                                 PreprocessorDefinitions="_WINDOWS,_STLP_USE_DYNAMIC_LIB,OGRE_LIBRARY_IMPORTS,_RELEASE,WIN32,_STLP_RELEASE" 
     74                                AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\Dependencies\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include\CEGUI&quot;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\include&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include&quot;;../../GtpVisibility/include;../include" 
     75                                PreprocessorDefinitions="_WINDOWS;_STLP_USE_DYNAMIC_LIB;OGRE_LIBRARY_IMPORTS;_RELEASE;WIN32;_STLP_RELEASE;GTP_VISIBILITY_MODIFIED_OGRE" 
    7676                                RuntimeLibrary="2" 
    7777                                UsePrecompiledHeader="0" 
     
    8383                        <Tool 
    8484                                Name="VCLinkerTool" 
    85                                 AdditionalDependencies="OGREMain.LIB" 
    86                                 OutputFile="..\..\..\Samples\Common\Bin\Release\TestCullingTerrain.exe" 
     85                                AdditionalDependencies="OGREMain.LIB Plugin_OctreeSceneManager.lib CEGUIBase.lib OgreGUIRenderer.lib" 
     86                                OutputFile="$(OGRE_PATH)/Samples/Common/bin/Release/TestCullingTerrain.exe" 
    8787                                LinkIncremental="1" 
    88                                 AdditionalLibraryDirectories="..\..\..\OgreMain\Lib\Release" 
     88                                AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\Dependencies\Lib\$(ConfigurationName)&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\OgreMain\Lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;" 
    8989                                GenerateDebugInformation="TRUE" 
    9090                                SubSystem="2" 
  • trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp

    r61 r74  
    33        TestCullingTerrainApplication.cpp 
    44    \brief 
    5         Tests the occlusion culling algorithm 
     5        Tests the visibility culling algorithm 
    66*/ 
    77 
     
    4444} 
    4545//----------------------------------------------------------------------- 
    46 void TestCullingTerrainApplication::generateSceneObject(const Vector3 &translationRatio,  
    47                                          const Vector3 &rotationRatio, const int idx, const String& entName) 
    48 { 
    49         // Setup the ray scene query 
    50         /*Vector3 rotation = mMinAngle + rotationRatio * (mMaxAngle - mMinAngle); 
    51         Vector3 translation = mMinTranslation + translationRatio * (mMaxTranslation - mMinTranslation); 
    52  
    53         translation.y = 5000; 
    54     Ray ray(translation, Vector3::NEGATIVE_UNIT_Y); 
    55     mRaySceneQuery->setRay(ray); 
    56  
    57     // Execute query 
    58         RaySceneQueryResult &result = mRaySceneQuery->execute(); 
    59         RaySceneQueryResult::iterator itr = result.begin( ); 
    60  
    61         // Get results, create a node/entity on the position 
    62         if ( itr != result.end() && itr->worldFragment ) 
    63         { 
    64                 char name[16]; 
    65                 sprintf( name, "%s%d", entName.c_str(), mCount++ ); 
    66  
    67                 Entity *ent = mSceneMgr->createEntity( name, entName ); 
    68                 SceneNode currentObject = mSceneMgr->getRootSceneNode( )->createChildSceneNode( String(name) + "Node", itr->worldFragment->singleIntersection ); 
    69                 currentObject->attachObject( ent ); 
    70                 currentObject->setScale( 0.1f, 0.1f, 0.1f ); 
    71         }*/ 
    72 } 
    73  
    74 //----------------------------------------------------------------------- 
    7546void TestCullingTerrainApplication::createScene( void ) 
    7647{ 
    7748        mRayQueryExecutor = new RayQueryExecutor(mSceneMgr); 
    7849        mTerrainContentGenerator = new TerrainContentGenerator(mSceneMgr, mRayQueryExecutor); 
     50 
    7951        // Set ambient light 
    8052        mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5)); 
     
    11183        terrain_cfg = mResourcePath + terrain_cfg; 
    11284#endif 
    113         mSceneMgr -> setWorldGeometry( terrain_cfg ); 
     85        mSceneMgr->setWorldGeometry(terrain_cfg); 
    11486        // Infinite far plane? 
    11587        if (mRoot->getRenderSystem()->getCapabilities()->hasCapability(RSC_INFINITE_FAR_PLANE)) 
     
    12496        // CEGUI setup 
    12597        setupGui(); 
     98 
     99        mTerrainContentGenerator->generateScene(100); 
    126100} 
    127101//----------------------------------------------------------------------- 
     
    149123void TestCullingTerrainApplication::chooseSceneManager(void) 
    150124{ 
    151     //mSceneMgr = mRoot->getSceneManager(ST_GENERIC); 
    152125        mSceneMgr = mRoot->getSceneManager(ST_EXTERIOR_CLOSE); 
    153126} 
     
    171144        mRotateSpeed *= 2; 
    172145 
    173         mCurrentAlgorithm = 0;//VisibilitySceneTraverser::RENDER_COHERENT; 
     146        mCurrentAlgorithm = GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING, 
    174147        mThreshold = 0; 
    175148     
     
    179152        mEventProcessor->addKeyListener(this); 
    180153 
    181         mRaySceneQuery = mSceneMgr->createRayQuery(Ray()); 
     154        mRayQueryExecutor = new RayQueryExecutor(mSceneMgr); 
    182155 
    183156        // show overlay 
    184157        Overlay* pOver = OverlayManager::getSingleton().getByName("Example/VisibilityDemoOverlay");  
    185158 
    186         mAlgorithmInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/AlgorithmInfo"); 
    187         mThresholdInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/ThresholdInfo"); 
    188         mFrustumCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/FrustumCulledNodesInfo"); 
    189         mQueryCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/QueryCulledNodesInfo"); 
    190     mTraversedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/TraversedNodesInfo"); 
    191         mSceneNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/SceneNodesInfo"); 
    192         mHierarchyNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/HierarchyNodesInfo"); 
    193         mRenderedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/RenderedNodesInfo"); 
     159        mAlgorithmInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/AlgorithmInfo"); 
     160        mThresholdInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/ThresholdInfo"); 
     161        mFrustumCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/FrustumCulledNodesInfo"); 
     162        mQueryCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/QueryCulledNodesInfo"); 
     163    mTraversedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/TraversedNodesInfo"); 
     164        mHierarchyNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/HierarchyNodesInfo"); 
     165        mRenderedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/RenderedNodesInfo"); 
    194166 
    195167        mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]); 
     
    198170        mQueryCulledNodesInfo->setCaption(": 0"); 
    199171        mTraversedNodesInfo->setCaption(": 0"); 
    200         mSceneNodesInfo->setCaption(": 0"); 
    201172        mHierarchyNodesInfo->setCaption(": 0"); 
    202173        mRenderedNodesInfo->setCaption(": 0"); 
     
    207178MouseQueryListener::~MouseQueryListener( ) 
    208179{ 
    209         delete mRaySceneQuery; 
     180        delete mRayQueryExecutor; 
    210181} 
    211182//----------------------------------------------------------------------- 
     
    225196                 // Setup the ray scene query 
    226197         Ray mouseRay = mCamera->getCameraToViewportRay( e->getX(), e->getY() ); 
    227          mRaySceneQuery->setRay( mouseRay ); 
    228  
    229          // Execute query 
    230          RaySceneQueryResult &result = mRaySceneQuery->execute(); 
    231          RaySceneQueryResult::iterator itr = result.begin( ); 
    232  
     198    
     199                 Vector3 queryResult; 
    233200         // Get results, create a node/entity on the position 
    234          if ( itr != result.end() && itr->worldFragment ) 
     201                 if(mRayQueryExecutor->executeRayQuery(&queryResult, mouseRay)) 
    235202         { 
    236203                         char name[16]; 
    237204             sprintf( name, "Robot%d", mCount++ ); 
    238205 
    239              Entity *ent = mSceneMgr->createEntity( name, "robot.mesh" ); 
    240              mCurrentObject = mSceneMgr->getRootSceneNode( )->createChildSceneNode( String(name) + "Node", itr->worldFragment->singleIntersection ); 
     206             Entity *ent = mSceneMgr->createEntity(name, "robot.mesh"); 
     207             mCurrentObject = mSceneMgr->getRootSceneNode()-> 
     208                                 createChildSceneNode( String(name) + "Node", queryResult); 
    241209             mCurrentObject->attachObject( ent ); 
    242210             mCurrentObject->setScale( 0.1f, 0.1f, 0.1f ); 
     
    275243         if ( mLMouseDown ) 
    276244     { 
    277                  Ray mouseRay = mCamera->getCameraToViewportRay( e->getX(), e->getY() ); 
    278                  mRaySceneQuery->setRay( mouseRay ); 
    279  
    280                  RaySceneQueryResult &result = mRaySceneQuery->execute(); 
    281                  RaySceneQueryResult::iterator itr = result.begin( ); 
    282  
    283                  if ( itr != result.end() && itr->worldFragment ) 
     245                 Vector3 queryResult; 
     246                 Ray mouseRay = mCamera->getCameraToViewportRay(e->getX(), e->getY()); 
     247 
     248                 if(mRayQueryExecutor->executeRayQuery(&queryResult, mouseRay)) 
    284249                 { 
    285                          mCurrentObject->setPosition( itr->worldFragment->singleIntersection ); 
    286                  }  
     250                         mCurrentObject->setPosition(queryResult); 
     251                 } 
    287252     } 
    288253         // If we are dragging the right mouse button. 
     
    297262{ 
    298263        // clamp to terrain 
    299         Vector3 camPos = mCamera->getPosition( ); 
    300     Ray cameraRay( Vector3(camPos.x, 5000.0f, camPos.z), Vector3::NEGATIVE_UNIT_Y ); 
    301     mRaySceneQuery->setRay( cameraRay ); 
    302  
    303     // Perform the scene query 
    304     RaySceneQueryResult &queryResult = mRaySceneQuery->execute(); 
    305     RaySceneQueryResult::iterator it = queryResult.begin( ); 
    306  
    307         if (it != queryResult.end() && it->worldFragment) 
     264        Vector3 camPos = mCamera->getPosition(); 
     265        Vector3 queryResult; 
     266 
     267    if(mRayQueryExecutor->executeRayQuery(&queryResult,  
     268                Vector3(camPos.x, 5000.0f, camPos.z), Vector3::NEGATIVE_UNIT_Y)) 
    308269        { 
    309                 SceneQuery::WorldFragment* wf = it->worldFragment; 
    310  
    311                 mCamera->setPosition(mCamera->getPosition().x, wf->singleIntersection.y + 10,  
     270                mCamera->setPosition(mCamera->getPosition().x, queryResult.y + 10,  
    312271                        mCamera->getPosition().z); 
    313272        } 
     
    347306void MouseQueryListener::changeAlgorithm() 
    348307{ 
    349     //mCurrentAlgorithm = ++mCurrentAlgorithm % VisibilitySceneTraverser::NUM_RENDERMODES; 
     308        mCurrentAlgorithm = ++mCurrentAlgorithm %  
     309                GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS, 
    350310 
    351311        mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]); 
     
    367327        mTraversedNodesInfo->setCaption(str); 
    368328 
    369         mSceneMgr->getOption("NumSceneNodes", &opt); sprintf(str,": %d", opt);  
    370         mSceneNodesInfo->setCaption(str); 
    371  
    372         mSceneMgr->getOption("NumOctreeNodes", &opt); sprintf(str,": %d", opt);  
     329        mSceneMgr->getOption("NumHierarchyNodes", &opt); sprintf(str,": %d", opt);  
    373330        mHierarchyNodesInfo->setCaption(str); 
    374331 
  • trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h

    r61 r74  
    66#include "ExampleApplication.h" 
    77#include "TerrainContentGenerator.h" 
     8#include "VisibilityEnvironment.h" 
    89 
    910Real timeDelay = 0; 
     
    1718} 
    1819 
    19 String mCurrentAlgorithmCaptions[3/*VisibilitySceneTraverser::NUM_RENDERMODES*/] =  
     20String mCurrentAlgorithmCaptions[GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS] =  
    2021{ 
    21     "Cull Frustum",  
    22         "Stop and Wait",  
    23         "Coherent Occlusion Culling" 
     22    "View Frustum Culling",  
     23        "Stop and Wait Culling",  
     24        "Coherent Hierarchical Culling" 
    2425}; 
    2526 
     
    8384 
    8485        SceneNode *mCurrentObject;         // The newly created object 
    85         RaySceneQuery *mRaySceneQuery;     // The ray scene query pointer 
    8686        int mCount;                        // The number of robots on the screen 
    8787 
     
    101101        virtual void createCamera(void); 
    102102 
    103         /**  
    104                 generates a new scene object  
    105                 @param tranlationRatio ratio between minimal and maximal possible translation 
    106                 @param rotationRatio ratio between minimal and maximal possible rotation 
    107                 @idx the index of the new object 
    108                 @entName the name of the object entity 
    109         */ 
    110         void generateSceneObject(const Vector3 &translationRatio, const Vector3 &rotationRatio,  
    111                                                          const int idx, const String &entName); 
    112  
    113103        CEGUI::OgreCEGUIRenderer *mGUIRenderer; 
    114104        CEGUI::System *mGUISystem; 
  • trunk/VUT/work/ogre_changes/OgreMain/include/OgreSceneManager.h

    r61 r74  
    130130                */ 
    131131                void _renderSceneNode( Camera *cam, SceneNode *node ); 
    132                  
    133132                /** deletes all queues which we were currently processing 
    134133                        @remark clears renderqueue after rendering scene node 
    135134                */ 
    136135                void _deleteRenderedQueueGroups(); 
    137          
    138                  
    139                 void myrenderSingleObject(Renderable* rend, Pass* pass, bool doLightIteration,  
    140             const LightList* manualLightList = 0) 
    141                 { 
    142                         setPass(pass); 
    143                         renderSingleObject(rend, pass, doLightIteration, manualLightList);} 
    144  
     136                /** Internal method used by _renderVisibleObjects to deal with renderables 
     137            which override the camera's own view / projection materices.  
     138                        @remark made public by matt  
     139                */ 
     140        void useRenderableViewProjMode(Renderable* pRend); 
     141                /** Method for setting up the renderstate for a rendering pass. 
     142            @param 
     143                pass The Pass details to set. 
     144            @returns 
     145                A Pass object that was used instead of the one passed in, can 
     146                happen when rendering shadow passes 
     147                        @remark made public by matt 
     148        */ 
     149        virtual Pass* setPass(Pass* pass); 
    145150#endif // GTP_VISIBILITY_MODIFIED_OGRE 
    146                 /** Internal method used by _renderVisibleObjects to deal with renderables 
    147             which override the camera's own view / projection materices. made 
    148                         public by matt */ 
    149         void useRenderableViewProjMode(Renderable* pRend); 
    150                  
     151 
    151152    protected: 
    152153 
     
    250251        /** Retrieves the internal render queue. */ 
    251252        virtual RenderQueue* getRenderQueue(void); 
     253#ifndef GTP_VISIBILITY_MODIFIED_OGRE // made public, is found in the modfified section 
    252254        /** Internal method for setting up the renderstate for a rendering pass. 
    253255            @param 
     
    258260        */ 
    259261        virtual Pass* setPass(Pass* pass); 
     262#endif 
    260263        /// A pass designed to let us render shadow colour on white for texture shadows 
    261264        Pass* mShadowCasterPlainBlackPass; 
     
    332335        AnimationList mAnimationsList; 
    333336        AnimationStateSet mAnimationStates; 
    334  
     337#ifndef GTP_VISIBILITY_MODIFIED_OGRE // made public, is found in the modfified section 
     338        /** Internal method used by _renderVisibleObjects to deal with renderables 
     339            which override the camera's own view / projection materices. */ 
     340        void useRenderableViewProjMode(Renderable* pRend); 
     341#endif 
    335342        /// Controller flag for determining if we need to set view/proj matrices 
    336343        bool mCamChanged; 
Note: See TracChangeset for help on using the changeset viewer.