1 | #ifndef _VssPreprocessor_H__
|
---|
2 | #define _VssPreprocessor_H__
|
---|
3 |
|
---|
4 | #include <fstream>
|
---|
5 | using namespace std;
|
---|
6 |
|
---|
7 | #include "Preprocessor.h"
|
---|
8 | #include "VssRay.h"
|
---|
9 | class VssTree;
|
---|
10 | class VssTreeLeaf;
|
---|
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;
|
---|
18 | int mVssSamplesPerPass;
|
---|
19 | int mInitialSamples;
|
---|
20 | int mVssSamples;
|
---|
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 | VssPreprocessor();
|
---|
33 | ~VssPreprocessor();
|
---|
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 | 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
|
---|
72 | );
|
---|
73 |
|
---|
74 |
|
---|
75 | bool
|
---|
76 | ExportVssTreeLeaf(char *filename,
|
---|
77 | VssTree *tree,
|
---|
78 | VssTreeLeaf *leaf);
|
---|
79 |
|
---|
80 | void
|
---|
81 | ExportVssTreeLeaves(VssTree *tree, const int number);
|
---|
82 |
|
---|
83 |
|
---|
84 | bool
|
---|
85 | ExportVssTree(char *filename,
|
---|
86 | VssTree *tree,
|
---|
87 | const Vector3 &dir
|
---|
88 | );
|
---|
89 |
|
---|
90 |
|
---|
91 | float
|
---|
92 | GetAvgPvsSize(VssTree *tree,
|
---|
93 | const vector<AxisAlignedBox3> &viewcells
|
---|
94 | );
|
---|
95 |
|
---|
96 | void CastRay(const BspTree &tree, const VssRay & vssRay);
|
---|
97 |
|
---|
98 | int AddObjectSamples(Intersectable *obj, const Ray &ray);
|
---|
99 | };
|
---|
100 |
|
---|
101 |
|
---|
102 |
|
---|
103 | #endif
|
---|