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 | #include "SamplingStrategy.h"
|
---|
10 |
|
---|
11 | namespace GtpVisibilityPreprocessor {
|
---|
12 |
|
---|
13 |
|
---|
14 | class RssTree;
|
---|
15 | class RssTreeLeaf;
|
---|
16 |
|
---|
17 |
|
---|
18 | /** Sampling based visibility preprocessing. The implementation is
|
---|
19 | based on heuristical sampling of view space
|
---|
20 | */
|
---|
21 | class RssPreprocessor : public Preprocessor {
|
---|
22 |
|
---|
23 | public:
|
---|
24 | vector<SamplingStrategy *> mDistributions;
|
---|
25 | MixtureDistribution *mMixtureDistribution;
|
---|
26 | int mSamplesPerPass;
|
---|
27 | int mRssSamplesPerPass;
|
---|
28 | int mInitialSamples;
|
---|
29 | int mRssSamples;
|
---|
30 | bool mUseImportanceSampling;
|
---|
31 | bool mUseRssTree;
|
---|
32 |
|
---|
33 | bool mExportPvs;
|
---|
34 | bool mExportRssTree;
|
---|
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 |
|
---|
73 | bool
|
---|
74 | ExportRayAnimation(const char *filename,
|
---|
75 | const vector<VssRayContainer> &vssRays
|
---|
76 | );
|
---|
77 |
|
---|
78 | void
|
---|
79 | ExportObjectRays(VssRayContainer &rays,
|
---|
80 | const int objectId);
|
---|
81 |
|
---|
82 | int
|
---|
83 | GenerateImportanceRays(RssTree *vssTree,
|
---|
84 | const int desiredSamples,
|
---|
85 | SimpleRayContainer &rays
|
---|
86 | );
|
---|
87 |
|
---|
88 |
|
---|
89 | bool
|
---|
90 | ExportRssTreeLeaf(char *filename,
|
---|
91 | RssTree *tree,
|
---|
92 | RssTreeLeaf *leaf);
|
---|
93 |
|
---|
94 | void
|
---|
95 | ExportRssTreeLeaves(RssTree *tree, const int number);
|
---|
96 |
|
---|
97 |
|
---|
98 | bool
|
---|
99 | ExportRssTree(char *filename,
|
---|
100 | RssTree *tree,
|
---|
101 | const Vector3 &dir
|
---|
102 | );
|
---|
103 |
|
---|
104 |
|
---|
105 | float
|
---|
106 | GetAvgPvsSize(RssTree *tree,
|
---|
107 | const vector<AxisAlignedBox3> &viewcells
|
---|
108 | );
|
---|
109 |
|
---|
110 |
|
---|
111 | void
|
---|
112 | ExportPvs(char *filename,
|
---|
113 | RssTree *rssTree
|
---|
114 | );
|
---|
115 |
|
---|
116 |
|
---|
117 | void
|
---|
118 | ComputeRenderError();
|
---|
119 |
|
---|
120 | /** Redefininition of the get sample rays method from the preprocessor */
|
---|
121 | int
|
---|
122 | GenerateRays(const int number,
|
---|
123 | SamplingStrategy &strategy,
|
---|
124 | SimpleRayContainer &rays);
|
---|
125 |
|
---|
126 | };
|
---|
127 |
|
---|
128 |
|
---|
129 | };
|
---|
130 |
|
---|
131 | #endif
|
---|