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 | class RssTree;
|
---|
10 | class RssTreeLeaf;
|
---|
11 |
|
---|
12 |
|
---|
13 | /** Sampling based visibility preprocessing. The implementation is based on heuristical
|
---|
14 | sampling of view space */
|
---|
15 | class RssPreprocessor : public Preprocessor {
|
---|
16 | public:
|
---|
17 | int mPass;
|
---|
18 | int mSamplesPerPass;
|
---|
19 | int mRssSamplesPerPass;
|
---|
20 | int mInitialSamples;
|
---|
21 | int mRssSamples;
|
---|
22 | bool mUseImportanceSampling;
|
---|
23 |
|
---|
24 | bool mExportPvs;
|
---|
25 | bool mExportRssTree;
|
---|
26 | bool mExportRays;
|
---|
27 | int mExportNumRays;
|
---|
28 |
|
---|
29 | bool mUseViewcells;
|
---|
30 | bool mUpdateSubdivision;
|
---|
31 |
|
---|
32 | AxisAlignedBox3 *mViewSpaceBox;
|
---|
33 |
|
---|
34 | ofstream mStats;
|
---|
35 |
|
---|
36 | ObjectContainer mObjects;
|
---|
37 |
|
---|
38 | // rays cast during the processing
|
---|
39 | VssRayContainer mVssRays;
|
---|
40 |
|
---|
41 | RssPreprocessor();
|
---|
42 | ~RssPreprocessor();
|
---|
43 |
|
---|
44 | virtual bool ComputeVisibility();
|
---|
45 |
|
---|
46 | Vector3
|
---|
47 | GetViewpoint(AxisAlignedBox3 *viewSpaceBox);
|
---|
48 |
|
---|
49 | Vector3
|
---|
50 | GetDirection(const Vector3 &viewpoint,
|
---|
51 | AxisAlignedBox3 *viewSpaceBox
|
---|
52 | );
|
---|
53 |
|
---|
54 | void
|
---|
55 | SetupRay(Ray &ray,
|
---|
56 | const Vector3 &point,
|
---|
57 | const Vector3 &direction
|
---|
58 | );
|
---|
59 |
|
---|
60 |
|
---|
61 |
|
---|
62 | int
|
---|
63 | CastRay(
|
---|
64 | Vector3 &viewPoint,
|
---|
65 | Vector3 &direction,
|
---|
66 | VssRayContainer &vssRays
|
---|
67 |
|
---|
68 | );
|
---|
69 |
|
---|
70 |
|
---|
71 |
|
---|
72 | virtual bool BuildBspTree() { return false; }
|
---|
73 |
|
---|
74 |
|
---|
75 | bool
|
---|
76 | ExportRays(const char *filename,
|
---|
77 | const VssRayContainer &vssRays,
|
---|
78 | const int number
|
---|
79 | );
|
---|
80 |
|
---|
81 | int
|
---|
82 | GenerateImportanceRays(RssTree *vssTree,
|
---|
83 | const int desiredSamples,
|
---|
84 | SimpleRayContainer &rays
|
---|
85 | );
|
---|
86 |
|
---|
87 |
|
---|
88 | bool
|
---|
89 | ExportRssTreeLeaf(char *filename,
|
---|
90 | RssTree *tree,
|
---|
91 | RssTreeLeaf *leaf);
|
---|
92 |
|
---|
93 | void
|
---|
94 | ExportRssTreeLeaves(RssTree *tree, const int number);
|
---|
95 |
|
---|
96 |
|
---|
97 | bool
|
---|
98 | ExportRssTree(char *filename,
|
---|
99 | RssTree *tree,
|
---|
100 | const Vector3 &dir
|
---|
101 | );
|
---|
102 |
|
---|
103 |
|
---|
104 | float
|
---|
105 | GetAvgPvsSize(RssTree *tree,
|
---|
106 | const vector<AxisAlignedBox3> &viewcells
|
---|
107 | );
|
---|
108 |
|
---|
109 |
|
---|
110 | void
|
---|
111 | ExportPvs(char *filename,
|
---|
112 | RssTree *rssTree
|
---|
113 | );
|
---|
114 |
|
---|
115 | };
|
---|
116 |
|
---|
117 |
|
---|
118 |
|
---|
119 | #endif
|
---|