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