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