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