[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:
|
---|
| 16 | int mPass;
|
---|
| 17 | int mSamplesPerPass;
|
---|
[427] | 18 | int mVssSamplesPerPass;
|
---|
[403] | 19 | int mInitialSamples;
|
---|
| 20 | int mVssSamples;
|
---|
| 21 | bool mUseImportanceSampling;
|
---|
| 22 |
|
---|
[427] | 23 | AxisAlignedBox3 *mViewSpaceBox;
|
---|
| 24 |
|
---|
[403] | 25 | ofstream mStats;
|
---|
[376] | 26 |
|
---|
[372] | 27 | ObjectContainer mObjects;
|
---|
[376] | 28 |
|
---|
| 29 | // rays cast during the processing
|
---|
| 30 | VssRayContainer mVssRays;
|
---|
[372] | 31 |
|
---|
| 32 | VssPreprocessor();
|
---|
| 33 | ~VssPreprocessor();
|
---|
| 34 |
|
---|
| 35 | virtual bool ComputeVisibility();
|
---|
| 36 |
|
---|
[376] | 37 | Vector3
|
---|
[382] | 38 | GetViewpoint(AxisAlignedBox3 *viewSpaceBox);
|
---|
[376] | 39 |
|
---|
| 40 | Vector3
|
---|
[427] | 41 | GetDirection(const Vector3 &viewpoint,
|
---|
| 42 | AxisAlignedBox3 *viewSpaceBox
|
---|
| 43 | );
|
---|
[376] | 44 |
|
---|
[372] | 45 | void
|
---|
| 46 | SetupRay(Ray &ray,
|
---|
[374] | 47 | const Vector3 &point,
|
---|
| 48 | const Vector3 &direction
|
---|
| 49 | );
|
---|
[372] | 50 |
|
---|
| 51 |
|
---|
[376] | 52 |
|
---|
[386] | 53 | int
|
---|
[376] | 54 | CastRay(
|
---|
| 55 | Vector3 &viewPoint,
|
---|
[401] | 56 | Vector3 &direction,
|
---|
| 57 | VssRayContainer &vssRays
|
---|
| 58 |
|
---|
[376] | 59 | );
|
---|
| 60 |
|
---|
[372] | 61 |
|
---|
| 62 |
|
---|
[374] | 63 | virtual bool BuildBspTree() { return false; }
|
---|
| 64 |
|
---|
[427] | 65 |
|
---|
| 66 | bool
|
---|
| 67 | ExportRays(const char *filename,
|
---|
| 68 | const VssRayContainer &vssRays,
|
---|
| 69 | const int number
|
---|
| 70 | );
|
---|
| 71 |
|
---|
[401] | 72 | int
|
---|
[427] | 73 | GenerateImportanceRays(VssTree *vssTree,
|
---|
| 74 | const int desiredSamples,
|
---|
| 75 | SimpleRayContainer &rays
|
---|
| 76 | );
|
---|
[401] | 77 |
|
---|
[427] | 78 |
|
---|
| 79 | bool
|
---|
| 80 | ExportVssTreeLeaf(char *filename,
|
---|
| 81 | VssTree *tree,
|
---|
| 82 | VssTreeLeaf *leaf);
|
---|
| 83 |
|
---|
| 84 | void
|
---|
| 85 | ExportVssTreeLeaves(VssTree *tree, const int number);
|
---|
| 86 |
|
---|
[429] | 87 | void CastRay(const BspTree &tree, const VssRay & vssRay);
|
---|
[427] | 88 |
|
---|
[429] | 89 | int AddObjectSamples(Intersectable *obj, const Ray &ray);
|
---|
[372] | 90 | };
|
---|
| 91 |
|
---|
| 92 |
|
---|
| 93 |
|
---|
| 94 | #endif
|
---|