[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 |
|
---|
[1112] | 92 | bool
|
---|
| 93 | ExportRayAnimation(const char *filename,
|
---|
| 94 | const vector<VssRayContainer> &vssRays
|
---|
| 95 | );
|
---|
| 96 |
|
---|
[576] | 97 | void
|
---|
| 98 | ExportObjectRays(VssRayContainer &rays,
|
---|
| 99 | const int objectId);
|
---|
| 100 |
|
---|
[447] | 101 | int
|
---|
| 102 | GenerateImportanceRays(RssTree *vssTree,
|
---|
| 103 | const int desiredSamples,
|
---|
| 104 | SimpleRayContainer &rays
|
---|
| 105 | );
|
---|
| 106 |
|
---|
| 107 |
|
---|
| 108 | bool
|
---|
| 109 | ExportRssTreeLeaf(char *filename,
|
---|
| 110 | RssTree *tree,
|
---|
| 111 | RssTreeLeaf *leaf);
|
---|
| 112 |
|
---|
| 113 | void
|
---|
| 114 | ExportRssTreeLeaves(RssTree *tree, const int number);
|
---|
| 115 |
|
---|
| 116 |
|
---|
| 117 | bool
|
---|
| 118 | ExportRssTree(char *filename,
|
---|
| 119 | RssTree *tree,
|
---|
| 120 | const Vector3 &dir
|
---|
| 121 | );
|
---|
| 122 |
|
---|
| 123 |
|
---|
| 124 | float
|
---|
| 125 | GetAvgPvsSize(RssTree *tree,
|
---|
| 126 | const vector<AxisAlignedBox3> &viewcells
|
---|
| 127 | );
|
---|
| 128 |
|
---|
| 129 |
|
---|
| 130 | void
|
---|
| 131 | ExportPvs(char *filename,
|
---|
| 132 | RssTree *rssTree
|
---|
| 133 | );
|
---|
[450] | 134 |
|
---|
[492] | 135 |
|
---|
| 136 | void
|
---|
| 137 | ComputeRenderError();
|
---|
| 138 |
|
---|
[563] | 139 | /** Redefininition of the get sample rays method from the preprocessor */
|
---|
| 140 | bool
|
---|
| 141 | GenerateRays(
|
---|
| 142 | const int number,
|
---|
| 143 | const int sampleType,
|
---|
| 144 | SimpleRayContainer &rays
|
---|
| 145 | );
|
---|
| 146 |
|
---|
[447] | 147 | };
|
---|
| 148 |
|
---|
| 149 |
|
---|
[863] | 150 | };
|
---|
[447] | 151 |
|
---|
| 152 | #endif
|
---|