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