[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 |
|
---|
[1251] | 17 | /** Sampling based visibility preprocessing. The implementation is
|
---|
| 18 | based on heuristical sampling of view space
|
---|
| 19 | */
|
---|
[447] | 20 | class RssPreprocessor : public Preprocessor {
|
---|
[492] | 21 |
|
---|
[447] | 22 | public:
|
---|
[1771] | 23 | vector<SamplingStrategy *> mDistributions;
|
---|
[447] | 24 | int mSamplesPerPass;
|
---|
| 25 | int mRssSamplesPerPass;
|
---|
| 26 | int mInitialSamples;
|
---|
| 27 | int mRssSamples;
|
---|
| 28 | bool mUseImportanceSampling;
|
---|
[1785] | 29 | bool mUseRssTree;
|
---|
[447] | 30 |
|
---|
[464] | 31 | bool mExportPvs;
|
---|
| 32 | bool mExportRssTree;
|
---|
| 33 | bool mExportRays;
|
---|
| 34 | int mExportNumRays;
|
---|
| 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 | bool
|
---|
| 73 | ExportRays(const char *filename,
|
---|
| 74 | const VssRayContainer &vssRays,
|
---|
| 75 | const int number
|
---|
| 76 | );
|
---|
| 77 |
|
---|
[1112] | 78 | bool
|
---|
| 79 | ExportRayAnimation(const char *filename,
|
---|
| 80 | const vector<VssRayContainer> &vssRays
|
---|
| 81 | );
|
---|
| 82 |
|
---|
[576] | 83 | void
|
---|
| 84 | ExportObjectRays(VssRayContainer &rays,
|
---|
| 85 | const int objectId);
|
---|
| 86 |
|
---|
[447] | 87 | int
|
---|
| 88 | GenerateImportanceRays(RssTree *vssTree,
|
---|
| 89 | const int desiredSamples,
|
---|
| 90 | SimpleRayContainer &rays
|
---|
| 91 | );
|
---|
| 92 |
|
---|
| 93 |
|
---|
| 94 | bool
|
---|
| 95 | ExportRssTreeLeaf(char *filename,
|
---|
| 96 | RssTree *tree,
|
---|
| 97 | RssTreeLeaf *leaf);
|
---|
| 98 |
|
---|
| 99 | void
|
---|
| 100 | ExportRssTreeLeaves(RssTree *tree, const int number);
|
---|
| 101 |
|
---|
| 102 |
|
---|
| 103 | bool
|
---|
| 104 | ExportRssTree(char *filename,
|
---|
| 105 | RssTree *tree,
|
---|
| 106 | const Vector3 &dir
|
---|
| 107 | );
|
---|
| 108 |
|
---|
| 109 |
|
---|
| 110 | float
|
---|
| 111 | GetAvgPvsSize(RssTree *tree,
|
---|
| 112 | const vector<AxisAlignedBox3> &viewcells
|
---|
| 113 | );
|
---|
| 114 |
|
---|
| 115 |
|
---|
| 116 | void
|
---|
| 117 | ExportPvs(char *filename,
|
---|
| 118 | RssTree *rssTree
|
---|
| 119 | );
|
---|
[450] | 120 |
|
---|
[492] | 121 |
|
---|
| 122 | void
|
---|
| 123 | ComputeRenderError();
|
---|
| 124 |
|
---|
[563] | 125 | /** Redefininition of the get sample rays method from the preprocessor */
|
---|
[1765] | 126 | int
|
---|
[563] | 127 | GenerateRays(
|
---|
| 128 | const int number,
|
---|
| 129 | const int sampleType,
|
---|
| 130 | SimpleRayContainer &rays
|
---|
| 131 | );
|
---|
| 132 |
|
---|
[447] | 133 | };
|
---|
| 134 |
|
---|
| 135 |
|
---|
[863] | 136 | };
|
---|
[447] | 137 |
|
---|
| 138 | #endif
|
---|