[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 |
|
---|
[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:
|
---|
| 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 |
|
---|
[1251] | 58 | #if 0 // matt:: moved up into preprocessor
|
---|
[447] | 59 | int
|
---|
| 60 | CastRay(
|
---|
| 61 | Vector3 &viewPoint,
|
---|
| 62 | Vector3 &direction,
|
---|
[537] | 63 | const float probability,
|
---|
[447] | 64 | VssRayContainer &vssRays
|
---|
| 65 | );
|
---|
[1251] | 66 | #endif
|
---|
[447] | 67 | virtual bool BuildBspTree() { return false; }
|
---|
[563] | 68 |
|
---|
[447] | 69 |
|
---|
| 70 | bool
|
---|
| 71 | ExportRays(const char *filename,
|
---|
| 72 | const VssRayContainer &vssRays,
|
---|
| 73 | const int number
|
---|
| 74 | );
|
---|
| 75 |
|
---|
[1112] | 76 | bool
|
---|
| 77 | ExportRayAnimation(const char *filename,
|
---|
| 78 | const vector<VssRayContainer> &vssRays
|
---|
| 79 | );
|
---|
| 80 |
|
---|
[576] | 81 | void
|
---|
| 82 | ExportObjectRays(VssRayContainer &rays,
|
---|
| 83 | const int objectId);
|
---|
| 84 |
|
---|
[447] | 85 | int
|
---|
| 86 | GenerateImportanceRays(RssTree *vssTree,
|
---|
| 87 | const int desiredSamples,
|
---|
| 88 | SimpleRayContainer &rays
|
---|
| 89 | );
|
---|
| 90 |
|
---|
| 91 |
|
---|
| 92 | bool
|
---|
| 93 | ExportRssTreeLeaf(char *filename,
|
---|
| 94 | RssTree *tree,
|
---|
| 95 | RssTreeLeaf *leaf);
|
---|
| 96 |
|
---|
| 97 | void
|
---|
| 98 | ExportRssTreeLeaves(RssTree *tree, const int number);
|
---|
| 99 |
|
---|
| 100 |
|
---|
| 101 | bool
|
---|
| 102 | ExportRssTree(char *filename,
|
---|
| 103 | RssTree *tree,
|
---|
| 104 | const Vector3 &dir
|
---|
| 105 | );
|
---|
| 106 |
|
---|
| 107 |
|
---|
| 108 | float
|
---|
| 109 | GetAvgPvsSize(RssTree *tree,
|
---|
| 110 | const vector<AxisAlignedBox3> &viewcells
|
---|
| 111 | );
|
---|
| 112 |
|
---|
| 113 |
|
---|
| 114 | void
|
---|
| 115 | ExportPvs(char *filename,
|
---|
| 116 | RssTree *rssTree
|
---|
| 117 | );
|
---|
[450] | 118 |
|
---|
[492] | 119 |
|
---|
| 120 | void
|
---|
| 121 | ComputeRenderError();
|
---|
| 122 |
|
---|
[563] | 123 | /** Redefininition of the get sample rays method from the preprocessor */
|
---|
| 124 | bool
|
---|
| 125 | GenerateRays(
|
---|
| 126 | const int number,
|
---|
| 127 | const int sampleType,
|
---|
| 128 | SimpleRayContainer &rays
|
---|
| 129 | );
|
---|
| 130 |
|
---|
[447] | 131 | };
|
---|
| 132 |
|
---|
| 133 |
|
---|
[863] | 134 | };
|
---|
[447] | 135 |
|
---|
| 136 | #endif
|
---|