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

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