[447] | 1 | #ifndef _RssPreprocessor_H__
|
---|
| 2 | #define _RssPreprocessor_H__
|
---|
| 3 |
|
---|
| 4 | #include <fstream>
|
---|
| 5 | using namespace std;
|
---|
| 6 |
|
---|
| 7 | #include "Preprocessor.h"
|
---|
| 8 | #include "VssRay.h"
|
---|
[863] | 9 |
|
---|
| 10 | namespace GtpVisibilityPreprocessor {
|
---|
| 11 |
|
---|
| 12 |
|
---|
[447] | 13 | class RssTree;
|
---|
| 14 | class RssTreeLeaf;
|
---|
| 15 |
|
---|
[1737] | 16 | class SamplingDistribution {
|
---|
| 17 | public:
|
---|
| 18 | SamplingDistribution() {}
|
---|
| 19 | SamplingDistribution(const int t):mType(t) {}
|
---|
| 20 | int mType;
|
---|
| 21 | int mRays;
|
---|
| 22 | float mContribution;
|
---|
| 23 | float mTime;
|
---|
| 24 | };
|
---|
| 25 |
|
---|
[1251] | 26 | /** Sampling based visibility preprocessing. The implementation is
|
---|
| 27 | based on heuristical sampling of view space
|
---|
| 28 | */
|
---|
[447] | 29 | class RssPreprocessor : public Preprocessor {
|
---|
[492] | 30 |
|
---|
[447] | 31 | public:
|
---|
[1737] | 32 | vector<SamplingDistribution> mDistributions;
|
---|
[447] | 33 | int mSamplesPerPass;
|
---|
| 34 | int mRssSamplesPerPass;
|
---|
| 35 | int mInitialSamples;
|
---|
| 36 | int mRssSamples;
|
---|
| 37 | bool mUseImportanceSampling;
|
---|
| 38 |
|
---|
[464] | 39 | bool mExportPvs;
|
---|
| 40 | bool mExportRssTree;
|
---|
| 41 | bool mExportRays;
|
---|
| 42 | int mExportNumRays;
|
---|
| 43 |
|
---|
| 44 | bool mUseViewcells;
|
---|
| 45 | bool mUpdateSubdivision;
|
---|
[492] | 46 |
|
---|
| 47 | bool mObjectBasedSampling;
|
---|
| 48 | bool mDirectionalSampling;
|
---|
[464] | 49 |
|
---|
[1563] | 50 | //AxisAlignedBox3 *mViewSpaceBox;
|
---|
[447] | 51 |
|
---|
[1737] | 52 |
|
---|
[447] | 53 | ofstream mStats;
|
---|
[563] | 54 | RssTree *mRssTree;
|
---|
[487] | 55 |
|
---|
[447] | 56 | // rays cast during the processing
|
---|
| 57 | VssRayContainer mVssRays;
|
---|
| 58 |
|
---|
[490] | 59 | /// if initial samples should be loaded from file
|
---|
| 60 | bool mLoadInitialSamples;
|
---|
| 61 | /// if initial samples should be stored in file
|
---|
| 62 | bool mStoreInitialSamples;
|
---|
| 63 |
|
---|
[447] | 64 | RssPreprocessor();
|
---|
| 65 | ~RssPreprocessor();
|
---|
| 66 |
|
---|
| 67 | virtual bool ComputeVisibility();
|
---|
| 68 |
|
---|
[1251] | 69 | #if 0 // matt:: moved up into preprocessor
|
---|
[447] | 70 | int
|
---|
| 71 | CastRay(
|
---|
| 72 | Vector3 &viewPoint,
|
---|
| 73 | Vector3 &direction,
|
---|
[537] | 74 | const float probability,
|
---|
[447] | 75 | VssRayContainer &vssRays
|
---|
| 76 | );
|
---|
[1251] | 77 | #endif
|
---|
[447] | 78 | virtual bool BuildBspTree() { return false; }
|
---|
[563] | 79 |
|
---|
[447] | 80 |
|
---|
| 81 | bool
|
---|
| 82 | ExportRays(const char *filename,
|
---|
| 83 | const VssRayContainer &vssRays,
|
---|
| 84 | const int number
|
---|
| 85 | );
|
---|
| 86 |
|
---|
[1112] | 87 | bool
|
---|
| 88 | ExportRayAnimation(const char *filename,
|
---|
| 89 | const vector<VssRayContainer> &vssRays
|
---|
| 90 | );
|
---|
| 91 |
|
---|
[576] | 92 | void
|
---|
| 93 | ExportObjectRays(VssRayContainer &rays,
|
---|
| 94 | const int objectId);
|
---|
| 95 |
|
---|
[447] | 96 | int
|
---|
| 97 | GenerateImportanceRays(RssTree *vssTree,
|
---|
| 98 | const int desiredSamples,
|
---|
| 99 | SimpleRayContainer &rays
|
---|
| 100 | );
|
---|
| 101 |
|
---|
| 102 |
|
---|
| 103 | bool
|
---|
| 104 | ExportRssTreeLeaf(char *filename,
|
---|
| 105 | RssTree *tree,
|
---|
| 106 | RssTreeLeaf *leaf);
|
---|
| 107 |
|
---|
| 108 | void
|
---|
| 109 | ExportRssTreeLeaves(RssTree *tree, const int number);
|
---|
| 110 |
|
---|
| 111 |
|
---|
| 112 | bool
|
---|
| 113 | ExportRssTree(char *filename,
|
---|
| 114 | RssTree *tree,
|
---|
| 115 | const Vector3 &dir
|
---|
| 116 | );
|
---|
| 117 |
|
---|
| 118 |
|
---|
| 119 | float
|
---|
| 120 | GetAvgPvsSize(RssTree *tree,
|
---|
| 121 | const vector<AxisAlignedBox3> &viewcells
|
---|
| 122 | );
|
---|
| 123 |
|
---|
| 124 |
|
---|
| 125 | void
|
---|
| 126 | ExportPvs(char *filename,
|
---|
| 127 | RssTree *rssTree
|
---|
| 128 | );
|
---|
[450] | 129 |
|
---|
[492] | 130 |
|
---|
| 131 | void
|
---|
| 132 | ComputeRenderError();
|
---|
| 133 |
|
---|
[563] | 134 | /** Redefininition of the get sample rays method from the preprocessor */
|
---|
| 135 | bool
|
---|
| 136 | GenerateRays(
|
---|
| 137 | const int number,
|
---|
| 138 | const int sampleType,
|
---|
| 139 | SimpleRayContainer &rays
|
---|
| 140 | );
|
---|
| 141 |
|
---|
[447] | 142 | };
|
---|
| 143 |
|
---|
| 144 |
|
---|
[863] | 145 | };
|
---|
[447] | 146 |
|
---|
| 147 | #endif
|
---|