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