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