[59] | 1 | #include "HierarchyInterface.h"
|
---|
| 2 |
|
---|
[74] | 3 | #include <windows.h>
|
---|
[59] | 4 |
|
---|
| 5 | namespace GtpVisibility {
|
---|
| 6 |
|
---|
| 7 | //-----------------------------------------------------------------------
|
---|
| 8 | HierarchyInterface::HierarchyInterface():
|
---|
[130] | 9 | mFrameId(0), mNumTraversedNodes(0), mSceneRoot(0),
|
---|
| 10 | mPreviousNode(0), mCurrentTestIdx(0), mUseOptimization(false)
|
---|
[112] | 11 | //, mIsShadowPass(false)
|
---|
[59] | 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 | {
|
---|
[130] | 28 | ++ mFrameId;
|
---|
[85] | 29 | mCurrentTestIdx = 0;
|
---|
[59] | 30 | mNumTraversedNodes = 0;
|
---|
[130] | 31 | mRenderedNodes.clear();
|
---|
[59] | 32 |
|
---|
| 33 | SetSceneRoot(root);
|
---|
| 34 | mDistanceQueue->push(mSceneRoot);
|
---|
| 35 | }
|
---|
| 36 | //-----------------------------------------------------------------------
|
---|
[74] | 37 | unsigned int HierarchyInterface::GetFrameId() const
|
---|
[59] | 38 | {
|
---|
| 39 | return mFrameId;
|
---|
| 40 | }
|
---|
| 41 | //-----------------------------------------------------------------------
|
---|
| 42 | DistanceQueue *HierarchyInterface::GetQueue()
|
---|
| 43 | {
|
---|
| 44 | return mDistanceQueue;
|
---|
| 45 | }
|
---|
[74] | 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 | {
|
---|
[130] | 65 | return (unsigned int)mRenderedNodes.size();
|
---|
[74] | 66 | }
|
---|
[130] | 67 | //-----------------------------------------------------------------------
|
---|
[86] | 68 | void HierarchyInterface::SetUseOptimization(bool useOptimization)
|
---|
| 69 | {
|
---|
| 70 | mUseOptimization = useOptimization;
|
---|
| 71 | }
|
---|
[130] | 72 | //-----------------------------------------------------------------------
|
---|
| 73 | std::vector<HierarchyNode *> *HierarchyInterface::GetRenderedNodes()
|
---|
| 74 | {
|
---|
| 75 | return &mRenderedNodes;
|
---|
| 76 | }
|
---|
[86] | 77 |
|
---|
[59] | 78 | } // namespace GtpVisibility
|
---|