[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)
|
---|
[1486] | 18 | // note cannot be deleted because of new ogre occlusion query implementation
|
---|
| 19 | // there we cannot just delete the queries, so they would stay!
|
---|
[903] | 20 | //mHierarchyInterface->ResetQueries();
|
---|
[75] | 21 | mVisibilityManager->SetCullingManager(*static_cast<const
|
---|
| 22 | GtpVisibility::VisibilityEnvironment::CullingManagerType *>(val));
|
---|
| 23 | return true;
|
---|
| 24 | }
|
---|
[100] | 25 | if (key == "Threshold")
|
---|
[75] | 26 | {
|
---|
| 27 | mVisibilityManager->SetVisibilityCullingThreshold(*static_cast<const int *>(val));
|
---|
| 28 | return true;
|
---|
| 29 | }
|
---|
[146] | 30 | if (key == "AssumedVisibility")
|
---|
| 31 | {
|
---|
[155] | 32 | mVisibilityManager->SetAssumedVisibilityForChc(*static_cast<const int *>(val));
|
---|
[146] | 33 | return true;
|
---|
| 34 | }
|
---|
[155] | 35 | if (key == "TestGeometryForVisibleLeaves")
|
---|
[86] | 36 | {
|
---|
[155] | 37 | mHierarchyInterface->TestGeometryForVisibleLeaves(*static_cast<const bool *>(val));
|
---|
[86] | 38 | return true;
|
---|
| 39 | }
|
---|
[75] | 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 | }
|
---|
[87] | 70 | if (key == "NumQueriesIssued")
|
---|
| 71 | {
|
---|
| 72 | * static_cast<unsigned int *>(val) =
|
---|
| 73 | mVisibilityManager->GetCullingManager()->GetNumQueriesIssued();
|
---|
| 74 | return true;
|
---|
| 75 | }
|
---|
[86] | 76 |
|
---|
[75] | 77 | return false;
|
---|
| 78 | }
|
---|
| 79 | //-----------------------------------------------------------------------
|
---|
[100] | 80 | bool VisibilityOptionsManager::getOptionKeys(StringVector & refKeys)
|
---|
[75] | 81 | {
|
---|
[155] | 82 | refKeys.push_back("NumRenderedNodes");
|
---|
| 83 | refKeys.push_back("NumTraversedNodes");
|
---|
| 84 | refKeys.push_back("NumQueryCulledNodes");
|
---|
| 85 | refKeys.push_back("NumFrustumCulledNodes");
|
---|
[1175] | 86 | refKeys.push_back("NumQueriesIssued");
|
---|
[75] | 87 |
|
---|
| 88 | return true;
|
---|
| 89 | }
|
---|
| 90 | } // namespace Ogre |
---|