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 | //mHierarchyInterface->ResetQueries();
|
---|
19 | mVisibilityManager->SetCullingManager(*static_cast<const
|
---|
20 | GtpVisibility::VisibilityEnvironment::CullingManagerType *>(val));
|
---|
21 | return true;
|
---|
22 | }
|
---|
23 | if (key == "Threshold")
|
---|
24 | {
|
---|
25 | mVisibilityManager->SetVisibilityCullingThreshold(*static_cast<const int *>(val));
|
---|
26 | return true;
|
---|
27 | }
|
---|
28 | if (key == "AssumedVisibility")
|
---|
29 | {
|
---|
30 | mVisibilityManager->SetAssumedVisibilityForChc(*static_cast<const int *>(val));
|
---|
31 | return true;
|
---|
32 | }
|
---|
33 | if (key == "TestGeometryForVisibleLeaves")
|
---|
34 | {
|
---|
35 | mHierarchyInterface->TestGeometryForVisibleLeaves(*static_cast<const bool *>(val));
|
---|
36 | return true;
|
---|
37 | }
|
---|
38 |
|
---|
39 | return false;
|
---|
40 | }
|
---|
41 | //-----------------------------------------------------------------------
|
---|
42 | bool VisibilityOptionsManager::getOption( const String & key, void *val )
|
---|
43 | {
|
---|
44 | if (key == "NumTraversedNodes")
|
---|
45 | {
|
---|
46 | * static_cast <unsigned int *>(val) =
|
---|
47 | mHierarchyInterface->GetNumTraversedNodes();
|
---|
48 | return true;
|
---|
49 | }
|
---|
50 | if (key == "NumRenderedNodes")
|
---|
51 | {
|
---|
52 | * static_cast <unsigned int *>(val) =
|
---|
53 | mHierarchyInterface->GetNumRenderedNodes();
|
---|
54 | return true;
|
---|
55 | }
|
---|
56 | if (key == "NumQueryCulledNodes")
|
---|
57 | {
|
---|
58 | * static_cast <unsigned int *>(val) =
|
---|
59 | mVisibilityManager->GetCullingManager()->GetNumQueryCulledNodes();
|
---|
60 | return true;
|
---|
61 | }
|
---|
62 | if (key == "NumFrustumCulledNodes")
|
---|
63 | {
|
---|
64 | * static_cast<unsigned int *>(val) =
|
---|
65 | mVisibilityManager->GetCullingManager()->GetNumFrustumCulledNodes();
|
---|
66 | return true;
|
---|
67 | }
|
---|
68 | if (key == "NumQueriesIssued")
|
---|
69 | {
|
---|
70 | * static_cast<unsigned int *>(val) =
|
---|
71 | mVisibilityManager->GetCullingManager()->GetNumQueriesIssued();
|
---|
72 | return true;
|
---|
73 | }
|
---|
74 |
|
---|
75 | return false;
|
---|
76 | }
|
---|
77 | //-----------------------------------------------------------------------
|
---|
78 | bool VisibilityOptionsManager::getOptionKeys(StringVector & refKeys)
|
---|
79 | {
|
---|
80 | refKeys.push_back("NumRenderedNodes");
|
---|
81 | refKeys.push_back("NumTraversedNodes");
|
---|
82 | refKeys.push_back("NumQueryCulledNodes");
|
---|
83 | refKeys.push_back("NumFrustumCulledNodes");
|
---|
84 | refKeys.push_back("NumQueriesIssued");
|
---|
85 |
|
---|
86 | return true;
|
---|
87 | }
|
---|
88 | } // namespace Ogre |
---|