1 | #include "VisibilityManager.h"
|
---|
2 | #include "StopAndWaitCullingManager.h"
|
---|
3 | #include "CoherentHierarchicalCullingManager.h"
|
---|
4 | #include "FrustumCullingManager.h"
|
---|
5 | #include "DummyPreprocessingManager.h"
|
---|
6 | #include "DummyQueryManager.h"
|
---|
7 |
|
---|
8 | namespace GtpVisibility {
|
---|
9 | //-----------------------------------------------------------------------
|
---|
10 | VisibilityManager::VisibilityManager(VisibilityEnvironment *visEnvironment):
|
---|
11 | mVisibilityThreshold(0)
|
---|
12 | {
|
---|
13 | mVisibilityEnvironment = visEnvironment;
|
---|
14 |
|
---|
15 | mCullingManagerType = VisibilityEnvironment::STOP_AND_WAIT_CULLING;
|
---|
16 | mCullingManager = new StopAndWaitCullingManager();
|
---|
17 |
|
---|
18 | mQueryManager = new DummyQueryManager(0);
|
---|
19 | mPreprocessingManager = new DummyPreprocessingManager(0);
|
---|
20 | }
|
---|
21 | //-----------------------------------------------------------------------
|
---|
22 | VisibilityManager::~VisibilityManager()
|
---|
23 | {
|
---|
24 | delete mCullingManager;
|
---|
25 | }
|
---|
26 | //-----------------------------------------------------------------------
|
---|
27 | void VisibilityManager::SetCullingManager(
|
---|
28 | VisibilityEnvironment::CullingManagerType ocmType)
|
---|
29 | {
|
---|
30 | if (mCullingManagerType != ocmType)
|
---|
31 | {
|
---|
32 | mCullingManagerType = ocmType;
|
---|
33 | delete mCullingManager;
|
---|
34 |
|
---|
35 | switch (ocmType)
|
---|
36 | {
|
---|
37 | case VisibilityEnvironment::STOP_AND_WAIT_CULLING:
|
---|
38 | mCullingManager = new StopAndWaitCullingManager();
|
---|
39 | break;
|
---|
40 |
|
---|
41 | case VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING:
|
---|
42 | mCullingManager = new CoherentHierarchicalCullingManager();
|
---|
43 | break;
|
---|
44 |
|
---|
45 | case VisibilityEnvironment::FRUSTUM_CULLING:
|
---|
46 | mCullingManager = new FrustumCullingManager();
|
---|
47 | break;
|
---|
48 | default:
|
---|
49 | mCullingManager = new StopAndWaitCullingManager();
|
---|
50 | break;
|
---|
51 | }
|
---|
52 | }
|
---|
53 | }
|
---|
54 | //-----------------------------------------------------------------------
|
---|
55 | void VisibilityManager::SetVisibilityCullingThreshold(unsigned int visibilityThreshold)
|
---|
56 | {
|
---|
57 | mVisibilityThreshold = visibilityThreshold;
|
---|
58 | mCullingManager->SetVisibilityThreshold(mVisibilityThreshold);
|
---|
59 | }
|
---|
60 | //-----------------------------------------------------------------------
|
---|
61 | CullingManager *VisibilityManager::GetCullingManager()
|
---|
62 | {
|
---|
63 | return mCullingManager;
|
---|
64 | }
|
---|
65 | //-----------------------------------------------------------------------
|
---|
66 | void VisibilityManager::ApplyVisibilityCulling()
|
---|
67 | {
|
---|
68 | mCullingManager->RenderScene();
|
---|
69 | }
|
---|
70 | //-----------------------------------------------------------------------
|
---|
71 | } // namespace GtpVisibility
|
---|