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 | /// if initial samples should be loaded from file
|
---|
31 | bool mLoadInitialSamples;
|
---|
32 | /// if initial samples should be stored in file
|
---|
33 | bool mStoreInitialSamples;
|
---|
34 | /// if box around view space should be used
|
---|
35 | bool mUseViewSpaceBox;
|
---|
36 | // rays cast during the processing
|
---|
37 | VssRayContainer mVssRays;
|
---|
38 |
|
---|
39 | bool mDelayedViewCellsConstruction;
|
---|
40 |
|
---|
41 | VssPreprocessor();
|
---|
42 | ~VssPreprocessor();
|
---|
43 |
|
---|
44 | virtual bool ComputeVisibility();
|
---|
45 |
|
---|
46 | Vector3
|
---|
47 | GetViewpoint(AxisAlignedBox3 *viewSpaceBox);
|
---|
48 |
|
---|
49 | Vector3
|
---|
50 | GetDirection(const Vector3 &viewpoint,
|
---|
51 | AxisAlignedBox3 *viewSpaceBox
|
---|
52 | );
|
---|
53 |
|
---|
54 | void
|
---|
55 | SetupRay(Ray &ray,
|
---|
56 | const Vector3 &point,
|
---|
57 | const Vector3 &direction
|
---|
58 | );
|
---|
59 |
|
---|
60 |
|
---|
61 |
|
---|
62 | int
|
---|
63 | CastRay(
|
---|
64 | Vector3 &viewPoint,
|
---|
65 | Vector3 &direction,
|
---|
66 | VssRayContainer &vssRays
|
---|
67 |
|
---|
68 | );
|
---|
69 |
|
---|
70 |
|
---|
71 | bool
|
---|
72 | ExportRays(const char *filename,
|
---|
73 | const VssRayContainer &vssRays,
|
---|
74 | const int number
|
---|
75 | );
|
---|
76 |
|
---|
77 | int
|
---|
78 | GenerateImportanceRays(VssTree *vssTree,
|
---|
79 | const int desiredSamples,
|
---|
80 | SimpleRayContainer &rays
|
---|
81 | );
|
---|
82 |
|
---|
83 |
|
---|
84 | bool
|
---|
85 | ExportVssTreeLeaf(char *filename,
|
---|
86 | VssTree *tree,
|
---|
87 | VssTreeLeaf *leaf);
|
---|
88 |
|
---|
89 | void
|
---|
90 | ExportVssTreeLeaves(VssTree *tree, const int number);
|
---|
91 |
|
---|
92 |
|
---|
93 | bool
|
---|
94 | ExportVssTree(char *filename,
|
---|
95 | VssTree *tree,
|
---|
96 | const Vector3 &dir
|
---|
97 | );
|
---|
98 |
|
---|
99 |
|
---|
100 | float
|
---|
101 | GetAvgPvsSize(VssTree *tree,
|
---|
102 | const vector<AxisAlignedBox3> &viewcells
|
---|
103 | );
|
---|
104 |
|
---|
105 | void CastRay(const BspTree &tree, const VssRay & vssRay);
|
---|
106 |
|
---|
107 | void TestBeamCasting(VssTree *tre, ViewCellsManager *vm);
|
---|
108 |
|
---|
109 | bool mTestBeamSampling;
|
---|
110 | };
|
---|
111 |
|
---|
112 |
|
---|
113 |
|
---|
114 | #endif
|
---|