source: branches/VUT/DummyModules/GtpVisibility/include/DistanceQueue.h @ 59

Revision 59, 1.0 KB checked in by mattausch, 20 years ago (diff)

completely changed file structure plus software design

Line 
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*/
19template <typename T> class GreaterDistance
20{
21public:
22        GreaterDistance(HierarchyInterface *hierarchyInterface): mHierarchyInterface(hierarchyInterface)
23        {}
24       
25        bool operator() (T v1, T v2) const
26        {
27                return mHierarchyInterface->HasGreaterDistance(v1, v2);
28        }
29               
30private:
31        HierarchyInterface *mHierarchyInterface;
32};
33
34/** A priority queue where closer hierarchy nodes are given a higher priority.
35*/
36typedef std::priority_queue<HierarchyNode *, std::vector<HierarchyNode *>, GreaterDistance<std::vector<HierarchyNode *>::value_type> > DistanceQueue;
37
38} // namespace GtpVisibility
39
40#endif // DistanceQueue_H
Note: See TracBrowser for help on using the repository browser.