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 | vector<SamplingStrategy *> mDistributions;
|
---|
24 | int mSamplesPerPass;
|
---|
25 | int mRssSamplesPerPass;
|
---|
26 | int mInitialSamples;
|
---|
27 | int mRssSamples;
|
---|
28 | bool mUseImportanceSampling;
|
---|
29 | bool mUseRssTree;
|
---|
30 |
|
---|
31 | bool mExportPvs;
|
---|
32 | bool mExportRssTree;
|
---|
33 | bool mExportRays;
|
---|
34 | int mExportNumRays;
|
---|
35 |
|
---|
36 | bool mUseViewcells;
|
---|
37 | bool mUpdateSubdivision;
|
---|
38 |
|
---|
39 | bool mObjectBasedSampling;
|
---|
40 | bool mDirectionalSampling;
|
---|
41 |
|
---|
42 | //AxisAlignedBox3 *mViewSpaceBox;
|
---|
43 |
|
---|
44 |
|
---|
45 | RssTree *mRssTree;
|
---|
46 |
|
---|
47 | // rays cast during the processing
|
---|
48 | VssRayContainer mVssRays;
|
---|
49 |
|
---|
50 | /// if initial samples should be loaded from file
|
---|
51 | bool mLoadInitialSamples;
|
---|
52 | /// if initial samples should be stored in file
|
---|
53 | bool mStoreInitialSamples;
|
---|
54 |
|
---|
55 | RssPreprocessor();
|
---|
56 | ~RssPreprocessor();
|
---|
57 |
|
---|
58 | virtual bool ComputeVisibility();
|
---|
59 |
|
---|
60 | #if 0 // matt:: moved up into preprocessor
|
---|
61 | int
|
---|
62 | CastRay(
|
---|
63 | Vector3 &viewPoint,
|
---|
64 | Vector3 &direction,
|
---|
65 | const float probability,
|
---|
66 | VssRayContainer &vssRays
|
---|
67 | );
|
---|
68 | #endif
|
---|
69 | virtual bool BuildBspTree() { return false; }
|
---|
70 |
|
---|
71 |
|
---|
72 | bool
|
---|
73 | ExportRays(const char *filename,
|
---|
74 | const VssRayContainer &vssRays,
|
---|
75 | const int number
|
---|
76 | );
|
---|
77 |
|
---|
78 | bool
|
---|
79 | ExportRayAnimation(const char *filename,
|
---|
80 | const vector<VssRayContainer> &vssRays
|
---|
81 | );
|
---|
82 |
|
---|
83 | void
|
---|
84 | ExportObjectRays(VssRayContainer &rays,
|
---|
85 | const int objectId);
|
---|
86 |
|
---|
87 | int
|
---|
88 | GenerateImportanceRays(RssTree *vssTree,
|
---|
89 | const int desiredSamples,
|
---|
90 | SimpleRayContainer &rays
|
---|
91 | );
|
---|
92 |
|
---|
93 |
|
---|
94 | bool
|
---|
95 | ExportRssTreeLeaf(char *filename,
|
---|
96 | RssTree *tree,
|
---|
97 | RssTreeLeaf *leaf);
|
---|
98 |
|
---|
99 | void
|
---|
100 | ExportRssTreeLeaves(RssTree *tree, const int number);
|
---|
101 |
|
---|
102 |
|
---|
103 | bool
|
---|
104 | ExportRssTree(char *filename,
|
---|
105 | RssTree *tree,
|
---|
106 | const Vector3 &dir
|
---|
107 | );
|
---|
108 |
|
---|
109 |
|
---|
110 | float
|
---|
111 | GetAvgPvsSize(RssTree *tree,
|
---|
112 | const vector<AxisAlignedBox3> &viewcells
|
---|
113 | );
|
---|
114 |
|
---|
115 |
|
---|
116 | void
|
---|
117 | ExportPvs(char *filename,
|
---|
118 | RssTree *rssTree
|
---|
119 | );
|
---|
120 |
|
---|
121 |
|
---|
122 | void
|
---|
123 | ComputeRenderError();
|
---|
124 |
|
---|
125 | /** Redefininition of the get sample rays method from the preprocessor */
|
---|
126 | int
|
---|
127 | GenerateRays(
|
---|
128 | const int number,
|
---|
129 | const int sampleType,
|
---|
130 | SimpleRayContainer &rays
|
---|
131 | );
|
---|
132 |
|
---|
133 | };
|
---|
134 |
|
---|
135 |
|
---|
136 | };
|
---|
137 |
|
---|
138 | #endif
|
---|