[59] | 1 | #include "HierarchyInterface.h"
|
---|
| 2 |
|
---|
[74] | 3 | #include <windows.h>
|
---|
[59] | 4 |
|
---|
| 5 | namespace GtpVisibility {
|
---|
| 6 |
|
---|
| 7 | //-----------------------------------------------------------------------
|
---|
| 8 | HierarchyInterface::HierarchyInterface():
|
---|
[74] | 9 | mFrameId(0), mNumTraversedNodes(0), mNumRenderedNodes(0),
|
---|
[86] | 10 | mSceneRoot(0), mPreviousNode(0), mCurrentTestIdx(0), mUseOptimization(true)
|
---|
[59] | 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 | {
|
---|
[74] | 27 | mFrameId ++;
|
---|
[85] | 28 | mCurrentTestIdx = 0;
|
---|
[59] | 29 | mNumTraversedNodes = 0;
|
---|
| 30 | mNumRenderedNodes = 0;
|
---|
| 31 |
|
---|
| 32 | SetSceneRoot(root);
|
---|
| 33 | mDistanceQueue->push(mSceneRoot);
|
---|
| 34 | }
|
---|
| 35 | //-----------------------------------------------------------------------
|
---|
[74] | 36 | unsigned int HierarchyInterface::GetFrameId() const
|
---|
[59] | 37 | {
|
---|
| 38 | return mFrameId;
|
---|
| 39 | }
|
---|
| 40 | //-----------------------------------------------------------------------
|
---|
| 41 | DistanceQueue *HierarchyInterface::GetQueue()
|
---|
| 42 | {
|
---|
| 43 | return mDistanceQueue;
|
---|
| 44 | }
|
---|
[74] | 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 | }
|
---|
[86] | 66 |
|
---|
| 67 | void HierarchyInterface::SetUseOptimization(bool useOptimization)
|
---|
| 68 | {
|
---|
| 69 | mUseOptimization = useOptimization;
|
---|
| 70 | }
|
---|
| 71 |
|
---|
[59] | 72 | } // namespace GtpVisibility
|
---|