1 | #ifndef _RssPreprocessor_H__
|
---|
2 | #define _RssPreprocessor_H__
|
---|
3 |
|
---|
4 | #include <fstream>
|
---|
5 | using namespace std;
|
---|
6 |
|
---|
7 |
|
---|
8 | #include "Preprocessor.h"
|
---|
9 | #include "VssRay.h"
|
---|
10 | class RssTree;
|
---|
11 | class RssTreeLeaf;
|
---|
12 |
|
---|
13 |
|
---|
14 | /** Sampling based visibility preprocessing. The implementation is based on heuristical
|
---|
15 | sampling of view space */
|
---|
16 | class RssPreprocessor : public Preprocessor {
|
---|
17 |
|
---|
18 | public:
|
---|
19 | int mPass;
|
---|
20 | int mSamplesPerPass;
|
---|
21 | int mRssSamplesPerPass;
|
---|
22 | int mInitialSamples;
|
---|
23 | int mRssSamples;
|
---|
24 | bool mUseImportanceSampling;
|
---|
25 |
|
---|
26 | bool mExportPvs;
|
---|
27 | bool mExportRssTree;
|
---|
28 | bool mExportRays;
|
---|
29 | int mExportNumRays;
|
---|
30 |
|
---|
31 | bool mUseViewcells;
|
---|
32 | bool mUpdateSubdivision;
|
---|
33 |
|
---|
34 | bool mObjectBasedSampling;
|
---|
35 | bool mDirectionalSampling;
|
---|
36 |
|
---|
37 | AxisAlignedBox3 *mViewSpaceBox;
|
---|
38 |
|
---|
39 | ofstream mStats;
|
---|
40 | RssTree *mRssTree;
|
---|
41 |
|
---|
42 | // rays cast during the processing
|
---|
43 | VssRayContainer mVssRays;
|
---|
44 |
|
---|
45 | /// if initial samples should be loaded from file
|
---|
46 | bool mLoadInitialSamples;
|
---|
47 | /// if initial samples should be stored in file
|
---|
48 | bool mStoreInitialSamples;
|
---|
49 |
|
---|
50 | RssPreprocessor();
|
---|
51 | ~RssPreprocessor();
|
---|
52 |
|
---|
53 | virtual bool ComputeVisibility();
|
---|
54 |
|
---|
55 |
|
---|
56 | void
|
---|
57 | SetupRay(Ray &ray,
|
---|
58 | const Vector3 &point,
|
---|
59 | const Vector3 &direction
|
---|
60 | );
|
---|
61 |
|
---|
62 |
|
---|
63 |
|
---|
64 | int
|
---|
65 | CastRay(
|
---|
66 | Vector3 &viewPoint,
|
---|
67 | Vector3 &direction,
|
---|
68 | const float probability,
|
---|
69 | VssRayContainer &vssRays
|
---|
70 |
|
---|
71 | );
|
---|
72 |
|
---|
73 |
|
---|
74 |
|
---|
75 | virtual bool BuildBspTree() { return false; }
|
---|
76 |
|
---|
77 | void
|
---|
78 | CastRays(
|
---|
79 | SimpleRayContainer &rays,
|
---|
80 | VssRayContainer &vssRays
|
---|
81 | );
|
---|
82 |
|
---|
83 | bool
|
---|
84 | ExportRays(const char *filename,
|
---|
85 | const VssRayContainer &vssRays,
|
---|
86 | const int number
|
---|
87 | );
|
---|
88 |
|
---|
89 | int
|
---|
90 | GenerateImportanceRays(RssTree *vssTree,
|
---|
91 | const int desiredSamples,
|
---|
92 | SimpleRayContainer &rays
|
---|
93 | );
|
---|
94 |
|
---|
95 |
|
---|
96 | bool
|
---|
97 | ExportRssTreeLeaf(char *filename,
|
---|
98 | RssTree *tree,
|
---|
99 | RssTreeLeaf *leaf);
|
---|
100 |
|
---|
101 | void
|
---|
102 | ExportRssTreeLeaves(RssTree *tree, const int number);
|
---|
103 |
|
---|
104 |
|
---|
105 | bool
|
---|
106 | ExportRssTree(char *filename,
|
---|
107 | RssTree *tree,
|
---|
108 | const Vector3 &dir
|
---|
109 | );
|
---|
110 |
|
---|
111 |
|
---|
112 | float
|
---|
113 | GetAvgPvsSize(RssTree *tree,
|
---|
114 | const vector<AxisAlignedBox3> &viewcells
|
---|
115 | );
|
---|
116 |
|
---|
117 |
|
---|
118 | void
|
---|
119 | ExportPvs(char *filename,
|
---|
120 | RssTree *rssTree
|
---|
121 | );
|
---|
122 |
|
---|
123 |
|
---|
124 | void
|
---|
125 | ComputeRenderError();
|
---|
126 |
|
---|
127 | /** Redefininition of the get sample rays method from the preprocessor */
|
---|
128 | bool
|
---|
129 | GenerateRays(
|
---|
130 | const int number,
|
---|
131 | const int sampleType,
|
---|
132 | SimpleRayContainer &rays
|
---|
133 | );
|
---|
134 |
|
---|
135 | };
|
---|
136 |
|
---|
137 |
|
---|
138 |
|
---|
139 | #endif
|
---|