source: trunk/VUT/GtpVisibility/src/HierarchyInterface.cpp @ 316

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

queries are realized as templates

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