1 | #include "OgreVisibilityOptionsManager.h"
|
---|
2 |
|
---|
3 | namespace Ogre {
|
---|
4 | //-----------------------------------------------------------------------
|
---|
5 | VisibilityOptionsManager::VisibilityOptionsManager(
|
---|
6 | GtpVisibility::VisibilityManager *visManager,
|
---|
7 | PlatformHierarchyInterface *hierarchyInterface):
|
---|
8 | mVisibilityManager(visManager),
|
---|
9 | mHierarchyInterface(hierarchyInterface)
|
---|
10 | {
|
---|
11 | }
|
---|
12 | //-----------------------------------------------------------------------
|
---|
13 | bool 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
|
---|
19 | // implementation there we cannot just delete the queries, so
|
---|
20 | // they would stay!
|
---|
21 | // mHierarchyInterface->ResetQueries();
|
---|
22 | mVisibilityManager->SetCullingManager(*static_cast<const
|
---|
23 | GtpVisibility::VisibilityEnvironment::CullingManagerType *>(val));
|
---|
24 | return true;
|
---|
25 | }
|
---|
26 |
|
---|
27 | if (key == "Threshold")
|
---|
28 | {
|
---|
29 | mVisibilityManager->SetVisibilityCullingThreshold(*static_cast<const int *>(val));
|
---|
30 | return true;
|
---|
31 | }
|
---|
32 | if (key == "AssumedVisibility")
|
---|
33 | {
|
---|
34 | mVisibilityManager->SetAssumedVisibilityForChc(*static_cast<const int *>(val));
|
---|
35 | return true;
|
---|
36 | }
|
---|
37 | if (key == "TestGeometryForVisibleLeaves")
|
---|
38 | {
|
---|
39 | mVisibilityManager->SetTestGeometryForVisibleLeaves(*static_cast<const bool *>(val));
|
---|
40 | return true;
|
---|
41 | }
|
---|
42 |
|
---|
43 | return false;
|
---|
44 | }
|
---|
45 | //-----------------------------------------------------------------------
|
---|
46 | bool VisibilityOptionsManager::getOption( const String & key, void *val )
|
---|
47 | {
|
---|
48 | if (key == "NumTraversedNodes")
|
---|
49 | {
|
---|
50 | * static_cast <unsigned int *>(val) =
|
---|
51 | mHierarchyInterface->GetNumTraversedNodes();
|
---|
52 | return true;
|
---|
53 | }
|
---|
54 | if (key == "NumRenderedNodes")
|
---|
55 | {
|
---|
56 | * static_cast <unsigned int *>(val) =
|
---|
57 | mHierarchyInterface->GetNumRenderedNodes();
|
---|
58 | return true;
|
---|
59 | }
|
---|
60 | if (key == "NumQueryCulledNodes")
|
---|
61 | {
|
---|
62 | * static_cast <unsigned int *>(val) =
|
---|
63 | mVisibilityManager->GetCullingManager()->GetNumQueryCulledNodes();
|
---|
64 | return true;
|
---|
65 | }
|
---|
66 | if (key == "NumFrustumCulledNodes")
|
---|
67 | {
|
---|
68 | * static_cast<unsigned int *>(val) =
|
---|
69 | mVisibilityManager->GetCullingManager()->GetNumFrustumCulledNodes();
|
---|
70 | return true;
|
---|
71 | }
|
---|
72 | if (key == "NumQueriesIssued")
|
---|
73 | {
|
---|
74 | * static_cast<unsigned int *>(val) =
|
---|
75 | mVisibilityManager->GetCullingManager()->GetNumQueriesIssued();
|
---|
76 | return true;
|
---|
77 | }
|
---|
78 | if (key == "TestGeometryForVisibleLeaves")
|
---|
79 | {
|
---|
80 | * static_cast<bool *>(val) =
|
---|
81 | mVisibilityManager->GetTestGeometryForVisibleLeaves();
|
---|
82 | return true;
|
---|
83 | }
|
---|
84 | if (key == "AssumedVisibility")
|
---|
85 | {
|
---|
86 | * static_cast<unsigned int *>(val) =
|
---|
87 | mVisibilityManager->GetAssumedVisibilityForChc();
|
---|
88 | return true;
|
---|
89 | }
|
---|
90 | if (key == "TestGeometryForVisibleLeaves")
|
---|
91 | {
|
---|
92 | * static_cast<unsigned int *>(val) =
|
---|
93 | mVisibilityManager->GetRandomUpdateCandidatesForRuc();
|
---|
94 | return true;
|
---|
95 | }
|
---|
96 |
|
---|
97 | return false;
|
---|
98 | }
|
---|
99 | //-----------------------------------------------------------------------
|
---|
100 | bool VisibilityOptionsManager::getOptionKeys(StringVector & refKeys)
|
---|
101 | {
|
---|
102 | refKeys.push_back("NumRenderedNodes");
|
---|
103 | refKeys.push_back("NumTraversedNodes");
|
---|
104 | refKeys.push_back("NumQueryCulledNodes");
|
---|
105 | refKeys.push_back("NumFrustumCulledNodes");
|
---|
106 | refKeys.push_back("NumQueriesIssued");
|
---|
107 |
|
---|
108 | return true;
|
---|
109 | }
|
---|
110 | } // namespace Ogre |
---|