source: GTP/trunk/Lib/Vis/Preprocessing/src/HashPvs.h @ 2102

Revision 2102, 2.3 KB checked in by mattausch, 17 years ago (diff)
Line 
1#ifndef __HASHPVS_H
2#define __HASHPVS_H
3
4#include <hash_map>
5#include <vector>
6#include "common.h"
7#include <math.h>
8#include "PvsBase.h"
9
10
11using namespace std;
12
13namespace GtpVisibilityPreprocessor {
14
15class KdNode;
16class BspNode;
17class Ray;
18class Intersectable;
19class ViewCell;
20
21
22/** Template class representing the Potentially Visible Set (PVS)
23        mainly from a view cell, but also e.g., from objects.
24*/
25template<typename T>
26class HashPvs: public PvsBase<T>
27{
28        template<typename T>
29                friend class PvsIterator2;
30
31public:
32
33        HashPvs() {};
34        //virtual ~HashPvs() {};
35
36        int GetSize() const;
37        bool Empty() const;
38
39        /** Adds sample to PVS.
40                @returns contribution of sample (0 or 1)
41        */
42        float AddSample(T sample);
43
44        /** Adds sample to PVS without checking for presence of the sample
45                warning: pvs remains unsorted!
46        */
47        void AddSampleDirty(T sample);
48
49        /** Adds sample dirty (on the end of the vector) but
50                first checks if sample is already in clean part of the pvs.
51        */
52        bool AddSampleDirtyCheck(T sample);
53
54        /** Sort pvs entries - this should always be called after a
55                sequence of AddSampleDirty calls
56        */
57        void Sort();
58
59        /** Clears the pvs.
60        */
61        void Clear(const bool trim = true);
62
63        //static void Merge(PvsBase &mergedPvs, const PvsBase &a, const PvsBase &b);
64
65        bool IsDirty() const;
66
67        bool RequiresResort() const;
68
69        //typename PvsIterator<T> GetIterator() const;
70
71protected:
72
73        /// vector of PVS entries
74        vector<T> mEntries;
75
76        /// Number of samples used to create the PVS
77        int mSamples;
78};
79
80
81template <typename T>
82int HashPvs<T>::GetSize() const
83{
84        return 0;
85}
86
87
88template <typename T>
89bool HashPvs<T>::Empty() const
90{
91        return false;
92}
93
94
95template <typename T>
96float HashPvs<T>::AddSample(T sample)
97{
98        return 0;
99}
100       
101
102template <typename T>
103void HashPvs<T>::AddSampleDirty(T sample)
104{
105}
106
107
108template <typename T>
109bool HashPvs<T>::AddSampleDirtyCheck(T sample)
110{
111        return false;
112}
113
114
115template <typename T>
116void HashPvs<T>::Sort()
117{
118}
119
120
121template <typename T>
122void HashPvs<T>::Clear(const bool trim = true)
123{
124}
125
126
127template <typename T>
128bool HashPvs<T>::IsDirty() const
129{
130        return false;
131}
132
133
134template <typename T>
135bool HashPvs<T>::RequiresResort() const
136{
137        return false;
138}
139
140//typename PvsIterator<T> GetIterator() const;
141
142}
143
144#endif
145
Note: See TracBrowser for help on using the repository browser.