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

Revision 726, 2.4 KB checked in by mattausch, 19 years ago (diff)

improved performance of TerrainSceneManager?
revisit octreescenemanager

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        // initialise for front-to-back rendering
32
33        ++ mFrameId;
34        mCurrentTestIdx = 0;
35        mNumTraversedNodes = 0;
36        mVisibleNodes.clear();
37
38        mDistanceQueue->push(mHierarchyRoot);
39}
40//-----------------------------------------------------------------------
41unsigned int HierarchyInterface::GetFrameId() const
42{
43        return mFrameId;
44}
45//-----------------------------------------------------------------------
46DistanceQueue *HierarchyInterface::GetQueue()
47{
48        return mDistanceQueue;
49}
50//-----------------------------------------------------------------------
51bool HierarchyInterface::CheckFrustumVisible(HierarchyNode *node)
52{
53        bool intersects = false;
54        return CheckFrustumVisible(node, intersects);
55}
56//-----------------------------------------------------------------------
57HierarchyNode *HierarchyInterface::GetHierarchyRoot() const
58{
59        return mHierarchyRoot;
60}
61//-----------------------------------------------------------------------
62unsigned int HierarchyInterface::GetNumTraversedNodes()
63{
64        return mNumTraversedNodes;
65}
66//-----------------------------------------------------------------------
67unsigned int HierarchyInterface::GetNumRenderedNodes()
68{
69        return (unsigned int)mVisibleNodes.size();
70}
71//-----------------------------------------------------------------------
72void HierarchyInterface::TestGeometryForVisibleLeaves(bool testGeometry)
73{
74        mTestGeometryForVisibleLeaves = testGeometry;
75}
76//-----------------------------------------------------------------------
77std::vector<HierarchyNode *> *HierarchyInterface::GetVisibleNodes()
78{
79        return &mVisibleNodes;
80}
81} // namespace GtpVisibility
Note: See TracBrowser for help on using the repository browser.