[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 |
|
---|
| 12 | /** Sampling based visibility preprocessing. The implementation is based on heuristical
|
---|
| 13 | sampling of view space */
|
---|
| 14 | class VssPreprocessor : public Preprocessor {
|
---|
| 15 | public:
|
---|
[434] | 16 | int mPass;
|
---|
[372] | 17 | int mSamplesPerPass;
|
---|
[427] | 18 | int mVssSamplesPerPass;
|
---|
[403] | 19 | int mInitialSamples;
|
---|
| 20 | int mVssSamples;
|
---|
[434] | 21 | bool mUseImportanceSampling;
|
---|
[403] | 22 |
|
---|
[434] | 23 | AxisAlignedBox3 *mViewSpaceBox;
|
---|
[427] | 24 |
|
---|
[434] | 25 | ofstream mStats;
|
---|
[376] | 26 |
|
---|
[372] | 27 | ObjectContainer mObjects;
|
---|
[376] | 28 |
|
---|
[434] | 29 | // rays cast during the processing
|
---|
[376] | 30 | VssRayContainer mVssRays;
|
---|
[372] | 31 |
|
---|
| 32 | VssPreprocessor();
|
---|
| 33 | ~VssPreprocessor();
|
---|
| 34 |
|
---|
| 35 | virtual bool ComputeVisibility();
|
---|
| 36 |
|
---|
[434] | 37 | Vector3
|
---|
| 38 | GetViewpoint(AxisAlignedBox3 *viewSpaceBox);
|
---|
[376] | 39 |
|
---|
[434] | 40 | Vector3
|
---|
| 41 | GetDirection(const Vector3 &viewpoint,
|
---|
| 42 | AxisAlignedBox3 *viewSpaceBox
|
---|
| 43 | );
|
---|
[376] | 44 |
|
---|
[372] | 45 | void
|
---|
| 46 | SetupRay(Ray &ray,
|
---|
[434] | 47 | const Vector3 &point,
|
---|
| 48 | const Vector3 &direction
|
---|
| 49 | );
|
---|
[372] | 50 |
|
---|
| 51 |
|
---|
[376] | 52 |
|
---|
[434] | 53 | int
|
---|
| 54 | CastRay(
|
---|
| 55 | Vector3 &viewPoint,
|
---|
| 56 | Vector3 &direction,
|
---|
| 57 | VssRayContainer &vssRays
|
---|
[401] | 58 |
|
---|
[434] | 59 | );
|
---|
[372] | 60 |
|
---|
[374] | 61 |
|
---|
[434] | 62 | bool
|
---|
| 63 | ExportRays(const char *filename,
|
---|
| 64 | const VssRayContainer &vssRays,
|
---|
| 65 | const int number
|
---|
| 66 | );
|
---|
| 67 |
|
---|
| 68 | int
|
---|
| 69 | GenerateImportanceRays(VssTree *vssTree,
|
---|
| 70 | const int desiredSamples,
|
---|
| 71 | SimpleRayContainer &rays
|
---|
[427] | 72 | );
|
---|
| 73 |
|
---|
[401] | 74 |
|
---|
[434] | 75 | bool
|
---|
| 76 | ExportVssTreeLeaf(char *filename,
|
---|
| 77 | VssTree *tree,
|
---|
| 78 | VssTreeLeaf *leaf);
|
---|
[427] | 79 |
|
---|
[434] | 80 | void
|
---|
| 81 | ExportVssTreeLeaves(VssTree *tree, const int number);
|
---|
| 82 |
|
---|
[427] | 83 |
|
---|
[434] | 84 | bool
|
---|
| 85 | ExportVssTree(char *filename,
|
---|
[438] | 86 | VssTree *tree,
|
---|
| 87 | const Vector3 &dir
|
---|
| 88 | );
|
---|
[434] | 89 |
|
---|
| 90 |
|
---|
| 91 | float
|
---|
| 92 | GetAvgPvsSize(VssTree *tree,
|
---|
| 93 | const vector<AxisAlignedBox3> &viewcells
|
---|
| 94 | );
|
---|
| 95 |
|
---|
| 96 | void CastRay(const BspTree &tree, const VssRay & vssRay);
|
---|
[427] | 97 |
|
---|
[434] | 98 | int AddObjectSamples(Intersectable *obj, const Ray &ray);
|
---|
[372] | 99 | };
|
---|
| 100 |
|
---|
| 101 |
|
---|
| 102 |
|
---|
| 103 | #endif
|
---|