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