1 | #include "HierarchyInterface.h"
|
---|
2 |
|
---|
3 | #include <windows.h>
|
---|
4 |
|
---|
5 | namespace GtpVisibility {
|
---|
6 |
|
---|
7 | //-----------------------------------------------------------------------
|
---|
8 | HierarchyInterface::HierarchyInterface():
|
---|
9 | mFrameId(0), mNumTraversedNodes(0), mSceneRoot(0),
|
---|
10 | mPreviousNode(0), mCurrentTestIdx(0), mUseOptimization(false)
|
---|
11 | //, mIsShadowPass(false)
|
---|
12 | {
|
---|
13 | mDistanceQueue = new DistanceQueue(GreaterDistance<HierarchyNode *>(this));
|
---|
14 | }
|
---|
15 | //-----------------------------------------------------------------------
|
---|
16 | HierarchyInterface::~HierarchyInterface()
|
---|
17 | {
|
---|
18 | delete mDistanceQueue;
|
---|
19 | }
|
---|
20 | //-----------------------------------------------------------------------
|
---|
21 | void HierarchyInterface::SetSceneRoot(HierarchyNode *root)
|
---|
22 | {
|
---|
23 | mSceneRoot = root;
|
---|
24 | }
|
---|
25 | //-----------------------------------------------------------------------
|
---|
26 | void HierarchyInterface::InitFrame(HierarchyNode *root)
|
---|
27 | {
|
---|
28 | ++ mFrameId;
|
---|
29 | mCurrentTestIdx = 0;
|
---|
30 | mNumTraversedNodes = 0;
|
---|
31 | mRenderedNodes.clear();
|
---|
32 |
|
---|
33 | SetSceneRoot(root);
|
---|
34 | mDistanceQueue->push(mSceneRoot);
|
---|
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::GetSceneRoot() const
|
---|
54 | {
|
---|
55 | return mSceneRoot;
|
---|
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::SetUseOptimization(bool useOptimization)
|
---|
69 | {
|
---|
70 | mUseOptimization = useOptimization;
|
---|
71 | }
|
---|
72 | //-----------------------------------------------------------------------
|
---|
73 | std::vector<HierarchyNode *> *HierarchyInterface::GetRenderedNodes()
|
---|
74 | {
|
---|
75 | return &mRenderedNodes;
|
---|
76 | }
|
---|
77 |
|
---|
78 | } // namespace GtpVisibility
|
---|