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