[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 |
|
---|
[517] | 39 | bool mDelayedViewCellsConstruction;
|
---|
| 40 |
|
---|
[372] | 41 | VssPreprocessor();
|
---|
| 42 | ~VssPreprocessor();
|
---|
| 43 |
|
---|
| 44 | virtual bool ComputeVisibility();
|
---|
| 45 |
|
---|
[434] | 46 | Vector3
|
---|
| 47 | GetViewpoint(AxisAlignedBox3 *viewSpaceBox);
|
---|
[376] | 48 |
|
---|
[434] | 49 | Vector3
|
---|
| 50 | GetDirection(const Vector3 &viewpoint,
|
---|
| 51 | AxisAlignedBox3 *viewSpaceBox
|
---|
| 52 | );
|
---|
[376] | 53 |
|
---|
[372] | 54 | void
|
---|
| 55 | SetupRay(Ray &ray,
|
---|
[434] | 56 | const Vector3 &point,
|
---|
| 57 | const Vector3 &direction
|
---|
| 58 | );
|
---|
[372] | 59 |
|
---|
| 60 |
|
---|
[376] | 61 |
|
---|
[434] | 62 | int
|
---|
| 63 | CastRay(
|
---|
| 64 | Vector3 &viewPoint,
|
---|
| 65 | Vector3 &direction,
|
---|
| 66 | VssRayContainer &vssRays
|
---|
[401] | 67 |
|
---|
[434] | 68 | );
|
---|
[372] | 69 |
|
---|
[374] | 70 |
|
---|
[434] | 71 | bool
|
---|
| 72 | ExportRays(const char *filename,
|
---|
| 73 | const VssRayContainer &vssRays,
|
---|
| 74 | const int number
|
---|
| 75 | );
|
---|
| 76 |
|
---|
| 77 | int
|
---|
| 78 | GenerateImportanceRays(VssTree *vssTree,
|
---|
| 79 | const int desiredSamples,
|
---|
| 80 | SimpleRayContainer &rays
|
---|
[427] | 81 | );
|
---|
| 82 |
|
---|
[401] | 83 |
|
---|
[434] | 84 | bool
|
---|
| 85 | ExportVssTreeLeaf(char *filename,
|
---|
| 86 | VssTree *tree,
|
---|
| 87 | VssTreeLeaf *leaf);
|
---|
[427] | 88 |
|
---|
[434] | 89 | void
|
---|
| 90 | ExportVssTreeLeaves(VssTree *tree, const int number);
|
---|
| 91 |
|
---|
[427] | 92 |
|
---|
[434] | 93 | bool
|
---|
| 94 | ExportVssTree(char *filename,
|
---|
[438] | 95 | VssTree *tree,
|
---|
| 96 | const Vector3 &dir
|
---|
| 97 | );
|
---|
[434] | 98 |
|
---|
| 99 |
|
---|
| 100 | float
|
---|
| 101 | GetAvgPvsSize(VssTree *tree,
|
---|
| 102 | const vector<AxisAlignedBox3> &viewcells
|
---|
| 103 | );
|
---|
| 104 |
|
---|
| 105 | void CastRay(const BspTree &tree, const VssRay & vssRay);
|
---|
[530] | 106 |
|
---|
[535] | 107 | void TestBeamCasting(VssTree *tre, ViewCellsManager *vm, const ObjectContainer &objects);
|
---|
[532] | 108 |
|
---|
| 109 | bool mTestBeamSampling;
|
---|
[372] | 110 | };
|
---|
| 111 |
|
---|
| 112 |
|
---|
| 113 |
|
---|
| 114 | #endif
|
---|