1 | #include "HierarchyInterface.h"
|
---|
2 |
|
---|
3 | #include <windows.h>
|
---|
4 |
|
---|
5 | namespace GtpVisibility {
|
---|
6 |
|
---|
7 | //-----------------------------------------------------------------------
|
---|
8 | HierarchyInterface::HierarchyInterface():
|
---|
9 | mFrameId(0), mNumTraversedNodes(0), mNumRenderedNodes(0),
|
---|
10 | mSceneRoot(0), mPreviousNode(0), mCurrentTestIdx(0), mUseOptimization(true)
|
---|
11 | {
|
---|
12 | mDistanceQueue = new DistanceQueue(GreaterDistance<HierarchyNode *>(this));
|
---|
13 | }
|
---|
14 | //-----------------------------------------------------------------------
|
---|
15 | HierarchyInterface::~HierarchyInterface()
|
---|
16 | {
|
---|
17 | delete mDistanceQueue;
|
---|
18 | }
|
---|
19 | //-----------------------------------------------------------------------
|
---|
20 | void HierarchyInterface::SetSceneRoot(HierarchyNode *root)
|
---|
21 | {
|
---|
22 | mSceneRoot = root;
|
---|
23 | }
|
---|
24 | //-----------------------------------------------------------------------
|
---|
25 | void HierarchyInterface::InitFrame(HierarchyNode *root)
|
---|
26 | {
|
---|
27 | mFrameId ++;
|
---|
28 | mCurrentTestIdx = 0;
|
---|
29 | mNumTraversedNodes = 0;
|
---|
30 | mNumRenderedNodes = 0;
|
---|
31 |
|
---|
32 | SetSceneRoot(root);
|
---|
33 | mDistanceQueue->push(mSceneRoot);
|
---|
34 | }
|
---|
35 | //-----------------------------------------------------------------------
|
---|
36 | unsigned int HierarchyInterface::GetFrameId() const
|
---|
37 | {
|
---|
38 | return mFrameId;
|
---|
39 | }
|
---|
40 | //-----------------------------------------------------------------------
|
---|
41 | DistanceQueue *HierarchyInterface::GetQueue()
|
---|
42 | {
|
---|
43 | return mDistanceQueue;
|
---|
44 | }
|
---|
45 | //-----------------------------------------------------------------------
|
---|
46 | bool HierarchyInterface::CheckFrustumVisible(HierarchyNode *node)
|
---|
47 | {
|
---|
48 | bool intersects = false;
|
---|
49 | return CheckFrustumVisible(node, intersects);
|
---|
50 | }
|
---|
51 | //-----------------------------------------------------------------------
|
---|
52 | HierarchyNode *HierarchyInterface::GetSceneRoot() const
|
---|
53 | {
|
---|
54 | return mSceneRoot;
|
---|
55 | }
|
---|
56 | //-----------------------------------------------------------------------
|
---|
57 | unsigned int HierarchyInterface::GetNumTraversedNodes()
|
---|
58 | {
|
---|
59 | return mNumTraversedNodes;
|
---|
60 | }
|
---|
61 | //-----------------------------------------------------------------------
|
---|
62 | unsigned int HierarchyInterface::GetNumRenderedNodes()
|
---|
63 | {
|
---|
64 | return mNumRenderedNodes;
|
---|
65 | }
|
---|
66 |
|
---|
67 | void HierarchyInterface::SetUseOptimization(bool useOptimization)
|
---|
68 | {
|
---|
69 | mUseOptimization = useOptimization;
|
---|
70 | }
|
---|
71 |
|
---|
72 | } // namespace GtpVisibility
|
---|