source: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreVisibilityOptionsManager.cpp @ 1486

Revision 1486, 2.8 KB checked in by mattausch, 18 years ago (diff)

worked on guided visibility sampling

Line 
1#include "OgreVisibilityOptionsManager.h"
2
3namespace Ogre {
4//-----------------------------------------------------------------------
5VisibilityOptionsManager::VisibilityOptionsManager(
6                                                        GtpVisibility::VisibilityManager *visManager,
7                                                        PlatformHierarchyInterface *hierarchyInterface):
8mVisibilityManager(visManager),
9mHierarchyInterface(hierarchyInterface)
10{
11}
12//-----------------------------------------------------------------------
13bool VisibilityOptionsManager::setOption(const String & key, const void * val)
14{
15        if (key == "Algorithm")
16        {
17                // delete old queries (not needed for e.g., view frustum culling)
18                // note cannot be deleted because of new ogre occlusion query implementation
19                // there we cannot just delete the queries, so they would stay!
20                //mHierarchyInterface->ResetQueries();
21                mVisibilityManager->SetCullingManager(*static_cast<const
22                        GtpVisibility::VisibilityEnvironment::CullingManagerType *>(val));
23                return true;
24        }
25        if (key == "Threshold")
26        {
27                mVisibilityManager->SetVisibilityCullingThreshold(*static_cast<const int *>(val));
28                return true;
29        }
30        if (key == "AssumedVisibility")
31        {
32                mVisibilityManager->SetAssumedVisibilityForChc(*static_cast<const int *>(val));
33                return true;
34        }
35        if (key == "TestGeometryForVisibleLeaves")
36        {
37                mHierarchyInterface->TestGeometryForVisibleLeaves(*static_cast<const bool *>(val));
38                return true;
39        }
40       
41        return false;
42}
43//-----------------------------------------------------------------------
44bool VisibilityOptionsManager::getOption( const String & key, void *val )
45{
46        if (key == "NumTraversedNodes")
47        {
48                * static_cast <unsigned int *>(val) =
49                        mHierarchyInterface->GetNumTraversedNodes();
50                return true;
51        }
52        if (key == "NumRenderedNodes")
53        {
54                * static_cast <unsigned int *>(val) =
55                        mHierarchyInterface->GetNumRenderedNodes();
56                return true;
57        }
58        if (key == "NumQueryCulledNodes")
59        {
60                * static_cast <unsigned int *>(val) =
61                        mVisibilityManager->GetCullingManager()->GetNumQueryCulledNodes();
62                return true;
63        }
64        if (key == "NumFrustumCulledNodes")
65        {
66                * static_cast<unsigned int *>(val) =
67                        mVisibilityManager->GetCullingManager()->GetNumFrustumCulledNodes();
68                return true;
69        }
70        if (key == "NumQueriesIssued")
71        {
72                * static_cast<unsigned int *>(val) =
73                        mVisibilityManager->GetCullingManager()->GetNumQueriesIssued();
74                return true;
75        }
76       
77        return false;
78}
79//-----------------------------------------------------------------------
80bool VisibilityOptionsManager::getOptionKeys(StringVector & refKeys)
81{
82        refKeys.push_back("NumRenderedNodes");
83        refKeys.push_back("NumTraversedNodes");
84        refKeys.push_back("NumQueryCulledNodes");
85        refKeys.push_back("NumFrustumCulledNodes");
86        refKeys.push_back("NumQueriesIssued");
87       
88        return true;
89}
90} // namespace Ogre
Note: See TracBrowser for help on using the repository browser.