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

Revision 2306, 2.5 KB checked in by mattausch, 18 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),
12mSavedNode(NULL),
13mCurrentTestIdx(0),
14mTestGeometryForVisibleLeaves(false)
15{       
16        mDistanceQueue = new DistanceQueue(GtDistance<HierarchyNode *>(this));
17}
18//-----------------------------------------------------------------------
19HierarchyInterface::~HierarchyInterface()
20{               
21        delete mDistanceQueue;
22}
23//-----------------------------------------------------------------------
24void HierarchyInterface::SetHierarchyRoot(HierarchyNode *root)
25{
26        mHierarchyRoot = root;
27}
28//-----------------------------------------------------------------------
29void HierarchyInterface::InitTraversal()
30{
31        //////////////
32        //-- initialise for hierarchical traversal
33
34        ++ mFrameId;
35
36        mCurrentTestIdx = 0;
37        mNumTraversedNodes = 0;
38        mVisibleNodes.clear();
39
40        mDistanceQueue->push(mHierarchyRoot);
41}
42//-----------------------------------------------------------------------
43unsigned int HierarchyInterface::GetFrameId() const
44{
45        return mFrameId;
46}
47//-----------------------------------------------------------------------
48DistanceQueue *HierarchyInterface::GetQueue()
49{
50        return mDistanceQueue;
51}
52//-----------------------------------------------------------------------
53bool HierarchyInterface::CheckFrustumVisible(HierarchyNode *node)
54{
55        bool intersects = false;
56        return CheckFrustumVisible(node, intersects);
57}
58//-----------------------------------------------------------------------
59HierarchyNode *HierarchyInterface::GetHierarchyRoot() const
60{
61        return mHierarchyRoot;
62}
63//-----------------------------------------------------------------------
64unsigned int HierarchyInterface::GetNumTraversedNodes()
65{
66        return mNumTraversedNodes;
67}
68//-----------------------------------------------------------------------
69unsigned int HierarchyInterface::GetNumRenderedNodes()
70{
71        return (unsigned int)mVisibleNodes.size();
72}
73//-----------------------------------------------------------------------
74void HierarchyInterface::TestGeometryForVisibleLeaves(bool testGeometry)
75{
76        mTestGeometryForVisibleLeaves = testGeometry;
77}
78//-----------------------------------------------------------------------
79std::vector<HierarchyNode *> *HierarchyInterface::GetVisibleNodes()
80{
81        return &mVisibleNodes;
82}
83} // namespace GtpVisibility
Note: See TracBrowser for help on using the repository browser.