[372] | 1 | #ifndef _VssPreprocessor_H__
|
---|
| 2 | #define _VssPreprocessor_H__
|
---|
| 3 |
|
---|
| 4 | #include <fstream>
|
---|
| 5 | using namespace std;
|
---|
| 6 |
|
---|
| 7 | #include "Preprocessor.h"
|
---|
[376] | 8 | #include "VssRay.h"
|
---|
[401] | 9 | class VssTree;
|
---|
[427] | 10 | class VssTreeLeaf;
|
---|
[372] | 11 |
|
---|
[487] | 12 |
|
---|
[372] | 13 | /** Sampling based visibility preprocessing. The implementation is based on heuristical
|
---|
| 14 | sampling of view space */
|
---|
| 15 | class VssPreprocessor : public Preprocessor {
|
---|
| 16 | public:
|
---|
[434] | 17 | int mPass;
|
---|
[372] | 18 | int mSamplesPerPass;
|
---|
[427] | 19 | int mVssSamplesPerPass;
|
---|
[403] | 20 | int mInitialSamples;
|
---|
| 21 | int mVssSamples;
|
---|
[434] | 22 | bool mUseImportanceSampling;
|
---|
[403] | 23 |
|
---|
[434] | 24 | AxisAlignedBox3 *mViewSpaceBox;
|
---|
[427] | 25 |
|
---|
[434] | 26 | ofstream mStats;
|
---|
[376] | 27 |
|
---|
[372] | 28 | ObjectContainer mObjects;
|
---|
[376] | 29 |
|
---|
[490] | 30 | /// if initial samples should be loaded from file
|
---|
| 31 | bool mLoadInitialSamples;
|
---|
| 32 | /// if initial samples should be stored in file
|
---|
| 33 | bool mStoreInitialSamples;
|
---|
[501] | 34 | /// if box around view space should be used
|
---|
| 35 | bool mUseViewSpaceBox;
|
---|
[434] | 36 | // rays cast during the processing
|
---|
[376] | 37 | VssRayContainer mVssRays;
|
---|
[372] | 38 |
|
---|
| 39 | VssPreprocessor();
|
---|
| 40 | ~VssPreprocessor();
|
---|
| 41 |
|
---|
| 42 | virtual bool ComputeVisibility();
|
---|
| 43 |
|
---|
[434] | 44 | Vector3
|
---|
| 45 | GetViewpoint(AxisAlignedBox3 *viewSpaceBox);
|
---|
[376] | 46 |
|
---|
[434] | 47 | Vector3
|
---|
| 48 | GetDirection(const Vector3 &viewpoint,
|
---|
| 49 | AxisAlignedBox3 *viewSpaceBox
|
---|
| 50 | );
|
---|
[376] | 51 |
|
---|
[372] | 52 | void
|
---|
| 53 | SetupRay(Ray &ray,
|
---|
[434] | 54 | const Vector3 &point,
|
---|
| 55 | const Vector3 &direction
|
---|
| 56 | );
|
---|
[372] | 57 |
|
---|
| 58 |
|
---|
[376] | 59 |
|
---|
[434] | 60 | int
|
---|
| 61 | CastRay(
|
---|
| 62 | Vector3 &viewPoint,
|
---|
| 63 | Vector3 &direction,
|
---|
| 64 | VssRayContainer &vssRays
|
---|
[401] | 65 |
|
---|
[434] | 66 | );
|
---|
[372] | 67 |
|
---|
[374] | 68 |
|
---|
[434] | 69 | bool
|
---|
| 70 | ExportRays(const char *filename,
|
---|
| 71 | const VssRayContainer &vssRays,
|
---|
| 72 | const int number
|
---|
| 73 | );
|
---|
| 74 |
|
---|
| 75 | int
|
---|
| 76 | GenerateImportanceRays(VssTree *vssTree,
|
---|
| 77 | const int desiredSamples,
|
---|
| 78 | SimpleRayContainer &rays
|
---|
[427] | 79 | );
|
---|
| 80 |
|
---|
[401] | 81 |
|
---|
[434] | 82 | bool
|
---|
| 83 | ExportVssTreeLeaf(char *filename,
|
---|
| 84 | VssTree *tree,
|
---|
| 85 | VssTreeLeaf *leaf);
|
---|
[427] | 86 |
|
---|
[434] | 87 | void
|
---|
| 88 | ExportVssTreeLeaves(VssTree *tree, const int number);
|
---|
| 89 |
|
---|
[427] | 90 |
|
---|
[434] | 91 | bool
|
---|
| 92 | ExportVssTree(char *filename,
|
---|
[438] | 93 | VssTree *tree,
|
---|
| 94 | const Vector3 &dir
|
---|
| 95 | );
|
---|
[434] | 96 |
|
---|
| 97 |
|
---|
| 98 | float
|
---|
| 99 | GetAvgPvsSize(VssTree *tree,
|
---|
| 100 | const vector<AxisAlignedBox3> &viewcells
|
---|
| 101 | );
|
---|
| 102 |
|
---|
| 103 | void CastRay(const BspTree &tree, const VssRay & vssRay);
|
---|
[372] | 104 | };
|
---|
| 105 |
|
---|
| 106 |
|
---|
| 107 |
|
---|
| 108 | #endif
|
---|