1 | #include "HierarchyInterface.h"
|
---|
2 |
|
---|
3 | #include <windows.h>
|
---|
4 |
|
---|
5 | namespace GtpVisibility {
|
---|
6 |
|
---|
7 | //-----------------------------------------------------------------------
|
---|
8 | HierarchyInterface::HierarchyInterface():
|
---|
9 | mFrameId(0), mNumTraversedNodes(0), mHierarchyRoot(NULL),
|
---|
10 | mSavedNode(NULL), mCurrentTestIdx(0), mTestGeometryForVisibleLeaves(false)
|
---|
11 | {
|
---|
12 | mDistanceQueue = new DistanceQueue(GreaterDistance<HierarchyNode *>(this));
|
---|
13 | }
|
---|
14 | //-----------------------------------------------------------------------
|
---|
15 | HierarchyInterface::~HierarchyInterface()
|
---|
16 | {
|
---|
17 | delete mDistanceQueue;
|
---|
18 | }
|
---|
19 | //-----------------------------------------------------------------------
|
---|
20 | void HierarchyInterface::SetHierarchyRoot(HierarchyNode *root)
|
---|
21 | {
|
---|
22 | mHierarchyRoot = root;
|
---|
23 | }
|
---|
24 | //-----------------------------------------------------------------------
|
---|
25 | void HierarchyInterface::InitTraversal()
|
---|
26 | {
|
---|
27 | // initialise for front-to-back rendering
|
---|
28 |
|
---|
29 | ++ mFrameId;
|
---|
30 | mCurrentTestIdx = 0;
|
---|
31 | mNumTraversedNodes = 0;
|
---|
32 | mRenderedNodes.clear();
|
---|
33 |
|
---|
34 | mDistanceQueue->push(mHierarchyRoot);
|
---|
35 | }
|
---|
36 | //-----------------------------------------------------------------------
|
---|
37 | unsigned int HierarchyInterface::GetFrameId() const
|
---|
38 | {
|
---|
39 | return mFrameId;
|
---|
40 | }
|
---|
41 | //-----------------------------------------------------------------------
|
---|
42 | DistanceQueue *HierarchyInterface::GetQueue()
|
---|
43 | {
|
---|
44 | return mDistanceQueue;
|
---|
45 | }
|
---|
46 | //-----------------------------------------------------------------------
|
---|
47 | bool HierarchyInterface::CheckFrustumVisible(HierarchyNode *node)
|
---|
48 | {
|
---|
49 | bool intersects = false;
|
---|
50 | return CheckFrustumVisible(node, intersects);
|
---|
51 | }
|
---|
52 | //-----------------------------------------------------------------------
|
---|
53 | HierarchyNode *HierarchyInterface::GetHierarchyRoot() const
|
---|
54 | {
|
---|
55 | return mHierarchyRoot;
|
---|
56 | }
|
---|
57 | //-----------------------------------------------------------------------
|
---|
58 | unsigned int HierarchyInterface::GetNumTraversedNodes()
|
---|
59 | {
|
---|
60 | return mNumTraversedNodes;
|
---|
61 | }
|
---|
62 | //-----------------------------------------------------------------------
|
---|
63 | unsigned int HierarchyInterface::GetNumRenderedNodes()
|
---|
64 | {
|
---|
65 | return (unsigned int)mRenderedNodes.size();
|
---|
66 | }
|
---|
67 | //-----------------------------------------------------------------------
|
---|
68 | void HierarchyInterface::TestGeometryForVisibleLeaves(bool testGeometry)
|
---|
69 | {
|
---|
70 | mTestGeometryForVisibleLeaves = testGeometry;
|
---|
71 | }
|
---|
72 | //-----------------------------------------------------------------------
|
---|
73 | std::vector<HierarchyNode *> *HierarchyInterface::GetRenderedNodes()
|
---|
74 | {
|
---|
75 | return &mRenderedNodes;
|
---|
76 | }
|
---|
77 | } // namespace GtpVisibility
|
---|