source: GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.h @ 1112

Revision 1112, 2.6 KB checked in by bittner, 18 years ago (diff)

Merge with Olivers code

Line 
1#ifndef _RssPreprocessor_H__
2#define _RssPreprocessor_H__
3
4#include <fstream>
5using namespace std;
6
7#include "Preprocessor.h"
8#include "VssRay.h"
9
10namespace GtpVisibilityPreprocessor {
11
12
13class RssTree;
14class RssTreeLeaf;
15
16
17/** Sampling based visibility preprocessing. The implementation is based on heuristical
18    sampling of view space */
19class RssPreprocessor : public Preprocessor {
20 
21public:
22  int mPass;
23  int mSamplesPerPass;
24  int mRssSamplesPerPass;
25  int mInitialSamples;
26  int mRssSamples;
27  bool mUseImportanceSampling;
28
29  bool mExportPvs;
30  bool mExportRssTree;
31  bool mExportRays;
32  int mExportNumRays;
33
34  bool mUseViewcells;
35  bool mUpdateSubdivision;
36
37  bool mObjectBasedSampling;
38  bool mDirectionalSampling;
39 
40  AxisAlignedBox3 *mViewSpaceBox;
41
42  ofstream mStats;
43  RssTree *mRssTree;
44
45  // rays cast during the processing
46  VssRayContainer mVssRays;
47       
48   /// if initial samples should be loaded from file
49  bool mLoadInitialSamples;
50  /// if initial samples should be stored in file
51  bool mStoreInitialSamples;
52
53  RssPreprocessor();
54  ~RssPreprocessor();
55
56  virtual bool ComputeVisibility();
57
58
59  void
60  SetupRay(Ray &ray,
61                   const Vector3 &point,
62                   const Vector3 &direction
63                   );
64
65
66       
67  int
68  CastRay(
69                  Vector3 &viewPoint,
70                  Vector3 &direction,
71                  const float probability,
72                  VssRayContainer &vssRays
73
74                  );
75               
76
77       
78  virtual bool BuildBspTree() { return false; }
79 
80  void
81  CastRays(
82                   SimpleRayContainer &rays,
83                   VssRayContainer &vssRays
84                   );
85
86  bool
87  ExportRays(const char *filename,
88                         const VssRayContainer &vssRays,
89                         const int number
90                         );
91
92  bool
93  ExportRayAnimation(const char *filename,
94                                         const vector<VssRayContainer> &vssRays
95                                         );
96
97  void
98  ExportObjectRays(VssRayContainer &rays,
99                                   const int objectId);
100       
101  int
102  GenerateImportanceRays(RssTree *vssTree,
103                                                 const int desiredSamples,
104                                                 SimpleRayContainer &rays
105                                                 );
106
107
108  bool
109  ExportRssTreeLeaf(char *filename,
110                                        RssTree *tree,
111                                        RssTreeLeaf *leaf);
112
113  void
114  ExportRssTreeLeaves(RssTree *tree, const int number);
115       
116
117  bool
118  ExportRssTree(char *filename,
119                                RssTree *tree,
120                                const Vector3 &dir
121                                );
122
123
124  float
125  GetAvgPvsSize(RssTree *tree,
126                                const vector<AxisAlignedBox3> &viewcells
127                                );
128 
129
130  void
131  ExportPvs(char *filename,
132                        RssTree *rssTree
133                        );
134
135
136  void
137  ComputeRenderError();
138
139  /** Redefininition of the get sample rays method from the preprocessor */
140  bool
141  GenerateRays(
142                           const int number,
143                           const int sampleType,
144                           SimpleRayContainer &rays
145                           );
146
147};
148
149
150};
151
152#endif
Note: See TracBrowser for help on using the repository browser.