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