source: GTP/trunk/Lib/Vis/OnlineCullingCHC/include/DistanceQueue.h @ 726

Revision 726, 1.1 KB checked in by mattausch, 19 years ago (diff)

improved performance of TerrainSceneManager?
revisit octreescenemanager

RevLine 
[59]1#ifndef _DistanceQueue_H__
2#define _DistanceQueue_H__
3
4#include "OcclusionQuery.h"
5
6#include <queue>
7
8namespace GtpVisibility {
9
10/*  We define HierarchyNode as void * because
11        there is no common ancestor for hierarchy nodes in Ogre
12*/
13typedef void HierarchyNode;
14
15class HierarchyInterface;
16/** This class implements the less operator for the priority queue, i.e.,
17        a greater distance has a lower priority in the queue.
18*/
[316]19template <typename T> class GtDistance
[59]20{
21public:
[316]22        GtDistance(HierarchyInterface *hierarchyInterface): mHierarchyInterface(hierarchyInterface)
[59]23        {}
24       
[726]25        bool operator() (const T v1, const T v2) const
[59]26        {
[726]27                //return false;
28                return mHierarchyInterface->GetSquaredDistance(v1) > mHierarchyInterface->GetSquaredDistance(v2);
[59]29        }
30               
31private:
32        HierarchyInterface *mHierarchyInterface;
33};
34
35/** A priority queue where closer hierarchy nodes are given a higher priority.
36*/
[316]37typedef std::priority_queue<HierarchyNode *, std::vector<HierarchyNode *>, GtDistance<std::vector<HierarchyNode *>::value_type> > DistanceQueue;
[59]38
39} // namespace GtpVisibility
40
41#endif // DistanceQueue_H
Note: See TracBrowser for help on using the repository browser.