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