[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)
|
---|
[187] | 18 | mHierarchyInterface->DeleteQueries();
|
---|
[75] | 19 | mVisibilityManager->SetCullingManager(*static_cast<const
|
---|
| 20 | GtpVisibility::VisibilityEnvironment::CullingManagerType *>(val));
|
---|
| 21 | return true;
|
---|
| 22 | }
|
---|
[100] | 23 | if (key == "Threshold")
|
---|
[75] | 24 | {
|
---|
| 25 | mVisibilityManager->SetVisibilityCullingThreshold(*static_cast<const int *>(val));
|
---|
| 26 | return true;
|
---|
| 27 | }
|
---|
[146] | 28 | if (key == "AssumedVisibility")
|
---|
| 29 | {
|
---|
[155] | 30 | mVisibilityManager->SetAssumedVisibilityForChc(*static_cast<const int *>(val));
|
---|
[146] | 31 | return true;
|
---|
| 32 | }
|
---|
[155] | 33 | if (key == "TestGeometryForVisibleLeaves")
|
---|
[86] | 34 | {
|
---|
[155] | 35 | mHierarchyInterface->TestGeometryForVisibleLeaves(*static_cast<const bool *>(val));
|
---|
[86] | 36 | return true;
|
---|
| 37 | }
|
---|
[75] | 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 | }
|
---|
[87] | 68 | if (key == "NumQueriesIssued")
|
---|
| 69 | {
|
---|
| 70 | * static_cast<unsigned int *>(val) =
|
---|
| 71 | mVisibilityManager->GetCullingManager()->GetNumQueriesIssued();
|
---|
| 72 | return true;
|
---|
| 73 | }
|
---|
[86] | 74 |
|
---|
[75] | 75 | return false;
|
---|
| 76 | }
|
---|
| 77 | //-----------------------------------------------------------------------
|
---|
[100] | 78 | bool VisibilityOptionsManager::getOptionKeys(StringVector & refKeys)
|
---|
[75] | 79 | {
|
---|
[155] | 80 | refKeys.push_back("NumRenderedNodes");
|
---|
| 81 | refKeys.push_back("NumTraversedNodes");
|
---|
| 82 | refKeys.push_back("NumQueryCulledNodes");
|
---|
| 83 | refKeys.push_back("NumFrustumCulledNodes");
|
---|
[75] | 84 |
|
---|
| 85 | return true;
|
---|
| 86 | }
|
---|
| 87 | } // namespace Ogre |
---|