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 | void
|
---|
90 | ExportObjectRays(VssRayContainer &rays,
|
---|
91 | const int objectId);
|
---|
92 |
|
---|
93 | int
|
---|
94 | GenerateImportanceRays(RssTree *vssTree,
|
---|
95 | const int desiredSamples,
|
---|
96 | SimpleRayContainer &rays
|
---|
97 | );
|
---|
98 |
|
---|
99 |
|
---|
100 | bool
|
---|
101 | ExportRssTreeLeaf(char *filename,
|
---|
102 | RssTree *tree,
|
---|
103 | RssTreeLeaf *leaf);
|
---|
104 |
|
---|
105 | void
|
---|
106 | ExportRssTreeLeaves(RssTree *tree, const int number);
|
---|
107 |
|
---|
108 |
|
---|
109 | bool
|
---|
110 | ExportRssTree(char *filename,
|
---|
111 | RssTree *tree,
|
---|
112 | const Vector3 &dir
|
---|
113 | );
|
---|
114 |
|
---|
115 |
|
---|
116 | float
|
---|
117 | GetAvgPvsSize(RssTree *tree,
|
---|
118 | const vector<AxisAlignedBox3> &viewcells
|
---|
119 | );
|
---|
120 |
|
---|
121 |
|
---|
122 | void
|
---|
123 | ExportPvs(char *filename,
|
---|
124 | RssTree *rssTree
|
---|
125 | );
|
---|
126 |
|
---|
127 |
|
---|
128 | void
|
---|
129 | ComputeRenderError();
|
---|
130 |
|
---|
131 | /** Redefininition of the get sample rays method from the preprocessor */
|
---|
132 | bool
|
---|
133 | GenerateRays(
|
---|
134 | const int number,
|
---|
135 | const int sampleType,
|
---|
136 | SimpleRayContainer &rays
|
---|
137 | );
|
---|
138 |
|
---|
139 | };
|
---|
140 |
|
---|
141 |
|
---|
142 |
|
---|
143 | #endif
|
---|