[2102] | 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 |
|
---|
| 11 | using namespace std;
|
---|
| 12 |
|
---|
| 13 | namespace GtpVisibilityPreprocessor {
|
---|
| 14 |
|
---|
| 15 | class KdNode;
|
---|
| 16 | class BspNode;
|
---|
| 17 | class Ray;
|
---|
| 18 | class Intersectable;
|
---|
| 19 | class 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 | */
|
---|
| 25 | template<typename T>
|
---|
| 26 | class HashPvs: public PvsBase<T>
|
---|
| 27 | {
|
---|
| 28 | template<typename T>
|
---|
| 29 | friend class PvsIterator2;
|
---|
| 30 |
|
---|
| 31 | public:
|
---|
| 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 |
|
---|
| 71 | protected:
|
---|
| 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 |
|
---|
| 81 | template <typename T>
|
---|
| 82 | int HashPvs<T>::GetSize() const
|
---|
| 83 | {
|
---|
| 84 | return 0;
|
---|
| 85 | }
|
---|
| 86 |
|
---|
| 87 |
|
---|
| 88 | template <typename T>
|
---|
| 89 | bool HashPvs<T>::Empty() const
|
---|
| 90 | {
|
---|
| 91 | return false;
|
---|
| 92 | }
|
---|
| 93 |
|
---|
| 94 |
|
---|
| 95 | template <typename T>
|
---|
| 96 | float HashPvs<T>::AddSample(T sample)
|
---|
| 97 | {
|
---|
| 98 | return 0;
|
---|
| 99 | }
|
---|
| 100 |
|
---|
| 101 |
|
---|
| 102 | template <typename T>
|
---|
| 103 | void HashPvs<T>::AddSampleDirty(T sample)
|
---|
| 104 | {
|
---|
| 105 | }
|
---|
| 106 |
|
---|
| 107 |
|
---|
| 108 | template <typename T>
|
---|
| 109 | bool HashPvs<T>::AddSampleDirtyCheck(T sample)
|
---|
| 110 | {
|
---|
| 111 | return false;
|
---|
| 112 | }
|
---|
| 113 |
|
---|
| 114 |
|
---|
| 115 | template <typename T>
|
---|
| 116 | void HashPvs<T>::Sort()
|
---|
| 117 | {
|
---|
| 118 | }
|
---|
| 119 |
|
---|
| 120 |
|
---|
| 121 | template <typename T>
|
---|
| 122 | void HashPvs<T>::Clear(const bool trim = true)
|
---|
| 123 | {
|
---|
| 124 | }
|
---|
| 125 |
|
---|
| 126 |
|
---|
| 127 | template <typename T>
|
---|
| 128 | bool HashPvs<T>::IsDirty() const
|
---|
| 129 | {
|
---|
| 130 | return false;
|
---|
| 131 | }
|
---|
| 132 |
|
---|
| 133 |
|
---|
| 134 | template <typename T>
|
---|
| 135 | bool HashPvs<T>::RequiresResort() const
|
---|
| 136 | {
|
---|
| 137 | return false;
|
---|
| 138 | }
|
---|
| 139 |
|
---|
| 140 | //typename PvsIterator<T> GetIterator() const;
|
---|
| 141 |
|
---|
| 142 | }
|
---|
| 143 |
|
---|
| 144 | #endif
|
---|
| 145 |
|
---|