[447] | 1 | #ifndef _RssPreprocessor_H__
|
---|
| 2 | #define _RssPreprocessor_H__
|
---|
| 3 |
|
---|
| 4 | #include <fstream>
|
---|
| 5 | using namespace std;
|
---|
| 6 |
|
---|
[492] | 7 |
|
---|
[447] | 8 | #include "Preprocessor.h"
|
---|
| 9 | #include "VssRay.h"
|
---|
| 10 | class RssTree;
|
---|
| 11 | class RssTreeLeaf;
|
---|
| 12 |
|
---|
[487] | 13 |
|
---|
[447] | 14 | /** Sampling based visibility preprocessing. The implementation is based on heuristical
|
---|
| 15 | sampling of view space */
|
---|
| 16 | class RssPreprocessor : public Preprocessor {
|
---|
[492] | 17 |
|
---|
[447] | 18 | public:
|
---|
| 19 | int mPass;
|
---|
| 20 | int mSamplesPerPass;
|
---|
| 21 | int mRssSamplesPerPass;
|
---|
| 22 | int mInitialSamples;
|
---|
| 23 | int mRssSamples;
|
---|
| 24 | bool mUseImportanceSampling;
|
---|
| 25 |
|
---|
[464] | 26 | bool mExportPvs;
|
---|
| 27 | bool mExportRssTree;
|
---|
| 28 | bool mExportRays;
|
---|
| 29 | int mExportNumRays;
|
---|
| 30 |
|
---|
| 31 | bool mUseViewcells;
|
---|
| 32 | bool mUpdateSubdivision;
|
---|
[492] | 33 |
|
---|
| 34 | bool mObjectBasedSampling;
|
---|
| 35 | bool mDirectionalSampling;
|
---|
[464] | 36 |
|
---|
[447] | 37 | AxisAlignedBox3 *mViewSpaceBox;
|
---|
| 38 |
|
---|
| 39 | ofstream mStats;
|
---|
[487] | 40 |
|
---|
[447] | 41 |
|
---|
| 42 | // rays cast during the processing
|
---|
| 43 | VssRayContainer mVssRays;
|
---|
| 44 |
|
---|
[490] | 45 | /// if initial samples should be loaded from file
|
---|
| 46 | bool mLoadInitialSamples;
|
---|
| 47 | /// if initial samples should be stored in file
|
---|
| 48 | bool mStoreInitialSamples;
|
---|
| 49 |
|
---|
[447] | 50 | RssPreprocessor();
|
---|
| 51 | ~RssPreprocessor();
|
---|
| 52 |
|
---|
| 53 | virtual bool ComputeVisibility();
|
---|
| 54 |
|
---|
| 55 | Vector3
|
---|
| 56 | GetViewpoint(AxisAlignedBox3 *viewSpaceBox);
|
---|
| 57 |
|
---|
| 58 | Vector3
|
---|
| 59 | GetDirection(const Vector3 &viewpoint,
|
---|
| 60 | AxisAlignedBox3 *viewSpaceBox
|
---|
| 61 | );
|
---|
[492] | 62 |
|
---|
| 63 | Vector3
|
---|
| 64 | InitialGetDirection(const Vector3 &viewpoint,
|
---|
| 65 | AxisAlignedBox3 *viewSpaceBox
|
---|
| 66 | );
|
---|
| 67 |
|
---|
[447] | 68 | void
|
---|
| 69 | SetupRay(Ray &ray,
|
---|
| 70 | const Vector3 &point,
|
---|
| 71 | const Vector3 &direction
|
---|
| 72 | );
|
---|
| 73 |
|
---|
| 74 |
|
---|
| 75 |
|
---|
| 76 | int
|
---|
| 77 | CastRay(
|
---|
| 78 | Vector3 &viewPoint,
|
---|
| 79 | Vector3 &direction,
|
---|
[537] | 80 | const float probability,
|
---|
[447] | 81 | VssRayContainer &vssRays
|
---|
| 82 |
|
---|
| 83 | );
|
---|
| 84 |
|
---|
| 85 |
|
---|
| 86 |
|
---|
| 87 | virtual bool BuildBspTree() { return false; }
|
---|
| 88 |
|
---|
| 89 |
|
---|
| 90 | bool
|
---|
| 91 | ExportRays(const char *filename,
|
---|
| 92 | const VssRayContainer &vssRays,
|
---|
| 93 | const int number
|
---|
| 94 | );
|
---|
| 95 |
|
---|
| 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 |
|
---|
[447] | 134 | };
|
---|
| 135 |
|
---|
| 136 |
|
---|
| 137 |
|
---|
| 138 | #endif
|
---|