source: GTP/trunk/Lib/Vis/OnlineCullingCHC/src/HierarchyInterface.cpp @ 2455

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