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 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 | //-----------------------------------------------------------------------
|
---|
44 | bool 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 | //-----------------------------------------------------------------------
|
---|
80 | bool 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 |
---|