source: branches/VUT/0.3/GtpVisibility/src/HierarchyInterface.cpp @ 174

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