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

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