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

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