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