[447] | 1 | #ifndef _RssPreprocessor_H__
|
---|
| 2 | #define _RssPreprocessor_H__
|
---|
| 3 |
|
---|
| 4 | #include <fstream>
|
---|
| 5 | using namespace std;
|
---|
| 6 |
|
---|
| 7 | #include "Preprocessor.h"
|
---|
| 8 | #include "VssRay.h"
|
---|
| 9 | class RssTree;
|
---|
| 10 | class RssTreeLeaf;
|
---|
| 11 |
|
---|
| 12 | /** Sampling based visibility preprocessing. The implementation is based on heuristical
|
---|
| 13 | sampling of view space */
|
---|
| 14 | class RssPreprocessor : public Preprocessor {
|
---|
| 15 | public:
|
---|
| 16 | int mPass;
|
---|
| 17 | int mSamplesPerPass;
|
---|
| 18 | int mRssSamplesPerPass;
|
---|
| 19 | int mInitialSamples;
|
---|
| 20 | int mRssSamples;
|
---|
| 21 | bool mUseImportanceSampling;
|
---|
| 22 |
|
---|
| 23 | AxisAlignedBox3 *mViewSpaceBox;
|
---|
| 24 |
|
---|
| 25 | ofstream mStats;
|
---|
| 26 |
|
---|
| 27 | ObjectContainer mObjects;
|
---|
| 28 |
|
---|
| 29 | // rays cast during the processing
|
---|
| 30 | VssRayContainer mVssRays;
|
---|
| 31 |
|
---|
| 32 | RssPreprocessor();
|
---|
| 33 | ~RssPreprocessor();
|
---|
| 34 |
|
---|
| 35 | virtual bool ComputeVisibility();
|
---|
| 36 |
|
---|
| 37 | Vector3
|
---|
| 38 | GetViewpoint(AxisAlignedBox3 *viewSpaceBox);
|
---|
| 39 |
|
---|
| 40 | Vector3
|
---|
| 41 | GetDirection(const Vector3 &viewpoint,
|
---|
| 42 | AxisAlignedBox3 *viewSpaceBox
|
---|
| 43 | );
|
---|
| 44 |
|
---|
| 45 | void
|
---|
| 46 | SetupRay(Ray &ray,
|
---|
| 47 | const Vector3 &point,
|
---|
| 48 | const Vector3 &direction
|
---|
| 49 | );
|
---|
| 50 |
|
---|
| 51 |
|
---|
| 52 |
|
---|
| 53 | int
|
---|
| 54 | CastRay(
|
---|
| 55 | Vector3 &viewPoint,
|
---|
| 56 | Vector3 &direction,
|
---|
| 57 | VssRayContainer &vssRays
|
---|
| 58 |
|
---|
| 59 | );
|
---|
| 60 |
|
---|
| 61 |
|
---|
| 62 |
|
---|
| 63 | virtual bool BuildBspTree() { return false; }
|
---|
| 64 |
|
---|
| 65 |
|
---|
| 66 | bool
|
---|
| 67 | ExportRays(const char *filename,
|
---|
| 68 | const VssRayContainer &vssRays,
|
---|
| 69 | const int number
|
---|
| 70 | );
|
---|
| 71 |
|
---|
| 72 | int
|
---|
| 73 | GenerateImportanceRays(RssTree *vssTree,
|
---|
| 74 | const int desiredSamples,
|
---|
| 75 | SimpleRayContainer &rays
|
---|
| 76 | );
|
---|
| 77 |
|
---|
| 78 |
|
---|
| 79 | bool
|
---|
| 80 | ExportRssTreeLeaf(char *filename,
|
---|
| 81 | RssTree *tree,
|
---|
| 82 | RssTreeLeaf *leaf);
|
---|
| 83 |
|
---|
| 84 | void
|
---|
| 85 | ExportRssTreeLeaves(RssTree *tree, const int number);
|
---|
| 86 |
|
---|
| 87 |
|
---|
| 88 | bool
|
---|
| 89 | ExportRssTree(char *filename,
|
---|
| 90 | RssTree *tree,
|
---|
| 91 | const Vector3 &dir
|
---|
| 92 | );
|
---|
| 93 |
|
---|
| 94 |
|
---|
| 95 | float
|
---|
| 96 | GetAvgPvsSize(RssTree *tree,
|
---|
| 97 | const vector<AxisAlignedBox3> &viewcells
|
---|
| 98 | );
|
---|
| 99 |
|
---|
| 100 |
|
---|
| 101 | void
|
---|
| 102 | ExportPvs(char *filename,
|
---|
| 103 | RssTree *rssTree
|
---|
| 104 | );
|
---|
[450] | 105 |
|
---|
| 106 | void
|
---|
| 107 | CastRay(const BspTree &tree, const VssRay & vssRay);
|
---|
| 108 |
|
---|
| 109 | int
|
---|
| 110 | AddObjectSamples(Intersectable *obj, const Ray &ray);
|
---|
| 111 |
|
---|
| 112 |
|
---|
[447] | 113 |
|
---|
| 114 | };
|
---|
| 115 |
|
---|
| 116 |
|
---|
| 117 |
|
---|
| 118 | #endif
|
---|