[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,
|
---|
| 80 | VssRayContainer &vssRays
|
---|
| 81 |
|
---|
| 82 | );
|
---|
| 83 |
|
---|
| 84 |
|
---|
| 85 |
|
---|
| 86 | virtual bool BuildBspTree() { return false; }
|
---|
| 87 |
|
---|
| 88 |
|
---|
| 89 | bool
|
---|
| 90 | ExportRays(const char *filename,
|
---|
| 91 | const VssRayContainer &vssRays,
|
---|
| 92 | const int number
|
---|
| 93 | );
|
---|
| 94 |
|
---|
| 95 | int
|
---|
| 96 | GenerateImportanceRays(RssTree *vssTree,
|
---|
| 97 | const int desiredSamples,
|
---|
| 98 | SimpleRayContainer &rays
|
---|
| 99 | );
|
---|
| 100 |
|
---|
| 101 |
|
---|
| 102 | bool
|
---|
| 103 | ExportRssTreeLeaf(char *filename,
|
---|
| 104 | RssTree *tree,
|
---|
| 105 | RssTreeLeaf *leaf);
|
---|
| 106 |
|
---|
| 107 | void
|
---|
| 108 | ExportRssTreeLeaves(RssTree *tree, const int number);
|
---|
| 109 |
|
---|
| 110 |
|
---|
| 111 | bool
|
---|
| 112 | ExportRssTree(char *filename,
|
---|
| 113 | RssTree *tree,
|
---|
| 114 | const Vector3 &dir
|
---|
| 115 | );
|
---|
| 116 |
|
---|
| 117 |
|
---|
| 118 | float
|
---|
| 119 | GetAvgPvsSize(RssTree *tree,
|
---|
| 120 | const vector<AxisAlignedBox3> &viewcells
|
---|
| 121 | );
|
---|
| 122 |
|
---|
| 123 |
|
---|
| 124 | void
|
---|
| 125 | ExportPvs(char *filename,
|
---|
| 126 | RssTree *rssTree
|
---|
| 127 | );
|
---|
[450] | 128 |
|
---|
[492] | 129 |
|
---|
| 130 | void
|
---|
| 131 | ComputeRenderError();
|
---|
| 132 |
|
---|
[447] | 133 | };
|
---|
| 134 |
|
---|
| 135 |
|
---|
| 136 |
|
---|
| 137 | #endif
|
---|