[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 |
|
---|
[487] | 16 |
|
---|
[447] | 17 | /** Sampling based visibility preprocessing. The implementation is based on heuristical
|
---|
| 18 | sampling of view space */
|
---|
| 19 | class RssPreprocessor : public Preprocessor {
|
---|
[492] | 20 |
|
---|
[447] | 21 | public:
|
---|
| 22 | int mPass;
|
---|
| 23 | int mSamplesPerPass;
|
---|
| 24 | int mRssSamplesPerPass;
|
---|
| 25 | int mInitialSamples;
|
---|
| 26 | int mRssSamples;
|
---|
| 27 | bool mUseImportanceSampling;
|
---|
| 28 |
|
---|
[464] | 29 | bool mExportPvs;
|
---|
| 30 | bool mExportRssTree;
|
---|
| 31 | bool mExportRays;
|
---|
| 32 | int mExportNumRays;
|
---|
| 33 |
|
---|
| 34 | bool mUseViewcells;
|
---|
| 35 | bool mUpdateSubdivision;
|
---|
[492] | 36 |
|
---|
| 37 | bool mObjectBasedSampling;
|
---|
| 38 | bool mDirectionalSampling;
|
---|
[464] | 39 |
|
---|
[447] | 40 | AxisAlignedBox3 *mViewSpaceBox;
|
---|
| 41 |
|
---|
| 42 | ofstream mStats;
|
---|
[563] | 43 | RssTree *mRssTree;
|
---|
[487] | 44 |
|
---|
[447] | 45 | // rays cast during the processing
|
---|
| 46 | VssRayContainer mVssRays;
|
---|
| 47 |
|
---|
[490] | 48 | /// if initial samples should be loaded from file
|
---|
| 49 | bool mLoadInitialSamples;
|
---|
| 50 | /// if initial samples should be stored in file
|
---|
| 51 | bool mStoreInitialSamples;
|
---|
| 52 |
|
---|
[447] | 53 | RssPreprocessor();
|
---|
| 54 | ~RssPreprocessor();
|
---|
| 55 |
|
---|
| 56 | virtual bool ComputeVisibility();
|
---|
| 57 |
|
---|
| 58 |
|
---|
| 59 | void
|
---|
| 60 | SetupRay(Ray &ray,
|
---|
| 61 | const Vector3 &point,
|
---|
| 62 | const Vector3 &direction
|
---|
| 63 | );
|
---|
| 64 |
|
---|
| 65 |
|
---|
| 66 |
|
---|
| 67 | int
|
---|
| 68 | CastRay(
|
---|
| 69 | Vector3 &viewPoint,
|
---|
| 70 | Vector3 &direction,
|
---|
[537] | 71 | const float probability,
|
---|
[447] | 72 | VssRayContainer &vssRays
|
---|
| 73 |
|
---|
| 74 | );
|
---|
| 75 |
|
---|
| 76 |
|
---|
| 77 |
|
---|
| 78 | virtual bool BuildBspTree() { return false; }
|
---|
[563] | 79 |
|
---|
| 80 | void
|
---|
| 81 | CastRays(
|
---|
| 82 | SimpleRayContainer &rays,
|
---|
| 83 | VssRayContainer &vssRays
|
---|
| 84 | );
|
---|
[447] | 85 |
|
---|
| 86 | bool
|
---|
| 87 | ExportRays(const char *filename,
|
---|
| 88 | const VssRayContainer &vssRays,
|
---|
| 89 | const int number
|
---|
| 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
|
---|