[75] | 1 | #include "OgreVisibilityOptionsManager.h"
|
---|
| 2 |
|
---|
| 3 | namespace Ogre {
|
---|
| 4 | //-----------------------------------------------------------------------
|
---|
[100] | 5 | VisibilityOptionsManager::VisibilityOptionsManager(
|
---|
[187] | 6 | GtpVisibility::VisibilityManager *visManager,
|
---|
| 7 | PlatformHierarchyInterface *hierarchyInterface):
|
---|
[100] | 8 | mVisibilityManager(visManager),
|
---|
| 9 | mHierarchyInterface(hierarchyInterface)
|
---|
[75] | 10 | {
|
---|
| 11 | }
|
---|
| 12 | //-----------------------------------------------------------------------
|
---|
[187] | 13 | bool VisibilityOptionsManager::setOption(const String & key, const void * val)
|
---|
[75] | 14 | {
|
---|
[100] | 15 | if (key == "Algorithm")
|
---|
[75] | 16 | {
|
---|
[254] | 17 | // delete old queries (not needed for e.g., view frustum culling)
|
---|
[2171] | 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();
|
---|
[75] | 22 | mVisibilityManager->SetCullingManager(*static_cast<const
|
---|
| 23 | GtpVisibility::VisibilityEnvironment::CullingManagerType *>(val));
|
---|
| 24 | return true;
|
---|
| 25 | }
|
---|
[2455] | 26 |
|
---|
[100] | 27 | if (key == "Threshold")
|
---|
[75] | 28 | {
|
---|
| 29 | mVisibilityManager->SetVisibilityCullingThreshold(*static_cast<const int *>(val));
|
---|
| 30 | return true;
|
---|
| 31 | }
|
---|
[146] | 32 | if (key == "AssumedVisibility")
|
---|
| 33 | {
|
---|
[155] | 34 | mVisibilityManager->SetAssumedVisibilityForChc(*static_cast<const int *>(val));
|
---|
[146] | 35 | return true;
|
---|
| 36 | }
|
---|
[155] | 37 | if (key == "TestGeometryForVisibleLeaves")
|
---|
[86] | 38 | {
|
---|
[2455] | 39 | mVisibilityManager->SetTestGeometryForVisibleLeaves(*static_cast<const bool *>(val));
|
---|
[86] | 40 | return true;
|
---|
| 41 | }
|
---|
[75] | 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 | }
|
---|
[87] | 72 | if (key == "NumQueriesIssued")
|
---|
| 73 | {
|
---|
| 74 | * static_cast<unsigned int *>(val) =
|
---|
| 75 | mVisibilityManager->GetCullingManager()->GetNumQueriesIssued();
|
---|
| 76 | return true;
|
---|
| 77 | }
|
---|
[2455] | 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 | }
|
---|
[86] | 96 |
|
---|
[75] | 97 | return false;
|
---|
| 98 | }
|
---|
| 99 | //-----------------------------------------------------------------------
|
---|
[100] | 100 | bool VisibilityOptionsManager::getOptionKeys(StringVector & refKeys)
|
---|
[75] | 101 | {
|
---|
[155] | 102 | refKeys.push_back("NumRenderedNodes");
|
---|
| 103 | refKeys.push_back("NumTraversedNodes");
|
---|
| 104 | refKeys.push_back("NumQueryCulledNodes");
|
---|
| 105 | refKeys.push_back("NumFrustumCulledNodes");
|
---|
[1175] | 106 | refKeys.push_back("NumQueriesIssued");
|
---|
[75] | 107 |
|
---|
| 108 | return true;
|
---|
| 109 | }
|
---|
| 110 | } // namespace Ogre |
---|