[177] | 1 | #ifndef __PVS_H
|
---|
| 2 | #define __PVS_H
|
---|
| 3 |
|
---|
| 4 | #include <map>
|
---|
| 5 |
|
---|
| 6 | class KdNode;
|
---|
[240] | 7 | class BspNode;
|
---|
[191] | 8 | class Ray;
|
---|
[308] | 9 | class Intersectable;
|
---|
[177] | 10 |
|
---|
| 11 | struct LtKdNode
|
---|
| 12 | {
|
---|
| 13 | bool operator()(const KdNode *a,
|
---|
| 14 | const KdNode *b) const
|
---|
| 15 | {
|
---|
| 16 | return a < b;
|
---|
| 17 | }
|
---|
| 18 |
|
---|
| 19 | };
|
---|
| 20 |
|
---|
[240] | 21 | /** Superclass for all types of PVS data.
|
---|
| 22 | */
|
---|
| 23 | class Pvs {
|
---|
| 24 | public:
|
---|
| 25 | Pvs(): mSamples(0) {}
|
---|
| 26 | int mSamples;
|
---|
| 27 |
|
---|
| 28 | virtual int Compress() = 0;
|
---|
| 29 | virtual int GetSize() = 0;
|
---|
| 30 | };
|
---|
| 31 |
|
---|
[177] | 32 | struct KdPvsData {
|
---|
| 33 | int mVisibleSamples;
|
---|
| 34 | KdPvsData() {}
|
---|
| 35 | KdPvsData(const int samples):mVisibleSamples(samples) {}
|
---|
| 36 | };
|
---|
| 37 |
|
---|
| 38 | typedef std::map<KdNode *, KdPvsData, LtKdNode> KdPvsMap;
|
---|
| 39 |
|
---|
| 40 |
|
---|
[240] | 41 | class KdPvs: public Pvs {
|
---|
[177] | 42 | public:
|
---|
[240] | 43 |
|
---|
[177] | 44 | KdPvsMap mEntries;
|
---|
[191] | 45 |
|
---|
[240] | 46 | KdPvs():mEntries() {}
|
---|
[191] | 47 |
|
---|
[177] | 48 | KdPvsData *Find(KdNode *node);
|
---|
| 49 | int AddNodeSample(KdNode *node);
|
---|
| 50 | int Compress() {return 0;}
|
---|
[265] | 51 | int GetSize() { return (int)mEntries.size(); }
|
---|
[177] | 52 | void GetData(const int index,
|
---|
| 53 | KdNode *&node,
|
---|
| 54 | KdPvsData &data
|
---|
| 55 | );
|
---|
| 56 |
|
---|
| 57 | };
|
---|
| 58 |
|
---|
[240] | 59 | struct LtBspNode
|
---|
| 60 | {
|
---|
| 61 | bool operator()(const BspNode *a,
|
---|
| 62 | const BspNode *b) const
|
---|
| 63 | {
|
---|
| 64 | return a < b;
|
---|
| 65 | }
|
---|
| 66 | };
|
---|
[191] | 67 |
|
---|
[240] | 68 | struct BspPvsData {
|
---|
| 69 | int mVisibleSamples;
|
---|
| 70 | BspPvsData() {}
|
---|
| 71 | BspPvsData(const int samples): mVisibleSamples(samples) {}
|
---|
| 72 | };
|
---|
[191] | 73 |
|
---|
[240] | 74 | typedef std::map<BspNode *, BspPvsData, LtBspNode> BspPvsMap;
|
---|
| 75 |
|
---|
| 76 | class BspPvs: public Pvs
|
---|
| 77 | {
|
---|
| 78 | public:
|
---|
| 79 | BspPvs(): mEntries() {}
|
---|
| 80 |
|
---|
| 81 | BspPvsMap mEntries;
|
---|
| 82 |
|
---|
| 83 | BspPvsData *Find(BspNode *node);
|
---|
| 84 | int AddNodeSample(BspNode *node);
|
---|
| 85 |
|
---|
| 86 | int Compress() {return 0;}
|
---|
| 87 |
|
---|
[260] | 88 | int GetSize() {return (int)mEntries.size();}
|
---|
[240] | 89 |
|
---|
| 90 | void GetData(const int index,
|
---|
| 91 | BspNode *&node,
|
---|
| 92 | BspPvsData &data);
|
---|
| 93 | };
|
---|
| 94 |
|
---|
[308] | 95 |
|
---|
| 96 | struct LtIntersectable
|
---|
| 97 | {
|
---|
| 98 | bool operator()(const Intersectable *a,
|
---|
| 99 | const Intersectable *b) const
|
---|
| 100 | {
|
---|
| 101 | return a < b;
|
---|
| 102 | }
|
---|
| 103 | };
|
---|
| 104 |
|
---|
| 105 | struct ViewCellPvsData {
|
---|
| 106 | int mVisibleSamples;
|
---|
| 107 | ViewCellPvsData() {}
|
---|
| 108 | ViewCellPvsData(const int samples): mVisibleSamples(samples) {}
|
---|
| 109 | };
|
---|
| 110 |
|
---|
| 111 | typedef std::map<Intersectable *, ViewCellPvsData, LtIntersectable> ViewCellPvsMap;
|
---|
| 112 |
|
---|
| 113 | class ViewCellPvs
|
---|
| 114 | {
|
---|
| 115 | public:
|
---|
| 116 | ViewCellPvs(): mEntries() {}
|
---|
| 117 |
|
---|
| 118 | ViewCellPvsMap mEntries;
|
---|
| 119 |
|
---|
| 120 | int Compress() {return 0;}
|
---|
| 121 | int GetSize() {return (int)mEntries.size();}
|
---|
| 122 |
|
---|
| 123 | ViewCellPvsData *Find(Intersectable *obj);
|
---|
| 124 | int AddObject(Intersectable *obj);
|
---|
| 125 |
|
---|
| 126 | void GetData(const int index,
|
---|
| 127 | Intersectable *&obj,
|
---|
| 128 | ViewCellPvsData &data);
|
---|
| 129 |
|
---|
| 130 | };
|
---|
| 131 |
|
---|
[177] | 132 | #endif
|
---|
| 133 |
|
---|