1 | #ifndef _RssPreprocessor_H__
|
---|
2 | #define _RssPreprocessor_H__
|
---|
3 |
|
---|
4 | #include <fstream>
|
---|
5 | //
|
---|
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 |
|
---|
74 | void
|
---|
75 | ExportObjectRays(VssRayContainer &rays,
|
---|
76 | const int objectId);
|
---|
77 |
|
---|
78 | int
|
---|
79 | GenerateImportanceRays(RssTree *vssTree,
|
---|
80 | const int desiredSamples,
|
---|
81 | SimpleRayContainer &rays
|
---|
82 | );
|
---|
83 |
|
---|
84 |
|
---|
85 | bool
|
---|
86 | ExportRssTreeLeaf(char *filename,
|
---|
87 | RssTree *tree,
|
---|
88 | RssTreeLeaf *leaf);
|
---|
89 |
|
---|
90 | void
|
---|
91 | ExportRssTreeLeaves(RssTree *tree, const int number);
|
---|
92 |
|
---|
93 |
|
---|
94 | bool
|
---|
95 | ExportRssTree(char *filename,
|
---|
96 | RssTree *tree,
|
---|
97 | const Vector3 &dir
|
---|
98 | );
|
---|
99 |
|
---|
100 |
|
---|
101 | float
|
---|
102 | GetAvgPvsSize(RssTree *tree,
|
---|
103 | const vector<AxisAlignedBox3> &viewcells
|
---|
104 | );
|
---|
105 |
|
---|
106 |
|
---|
107 | void
|
---|
108 | ExportPvs(char *filename,
|
---|
109 | RssTree *rssTree
|
---|
110 | );
|
---|
111 |
|
---|
112 |
|
---|
113 |
|
---|
114 | /** Redefininition of the get sample rays method from the preprocessor */
|
---|
115 | int
|
---|
116 | GenerateRays(const int number,
|
---|
117 | SamplingStrategy &strategy,
|
---|
118 | SimpleRayContainer &rays);
|
---|
119 |
|
---|
120 | };
|
---|
121 |
|
---|
122 |
|
---|
123 | };
|
---|
124 |
|
---|
125 | #endif
|
---|