source: GTP/trunk/Lib/Vis/Preprocessing/src/VssPreprocessor.h @ 1251

Revision 1251, 2.1 KB checked in by mattausch, 18 years ago (diff)
Line 
1#ifndef _VssPreprocessor_H__
2#define _VssPreprocessor_H__
3
4#include <fstream>
5using namespace std;
6
7#include "Preprocessor.h"
8#include "VssRay.h"
9
10namespace GtpVisibilityPreprocessor {
11
12class VssTree;
13class VssTreeLeaf;
14
15
16
17/** Sampling based visibility preprocessing. The implementation is based on heuristical
18    sampling of view space */
19class VssPreprocessor : public Preprocessor {
20public:
21 
22  int mSamplesPerPass;
23  int mVssSamplesPerPass;
24  int mInitialSamples;
25  int mVssSamples;
26  bool mUseImportanceSampling;
27  bool mEnlargeViewSpace;
28  AxisAlignedBox3 *mViewSpaceBox;
29
30  ofstream mStats;
31       
32  ObjectContainer mObjects;
33
34  /// if initial samples should be loaded from file
35  bool mLoadInitialSamples;
36  /// if initial samples should be stored in file
37  bool mStoreInitialSamples;
38  /// if box around view space should be used
39  bool mUseViewSpaceBox;
40  // rays cast during the processing
41  VssRayContainer mVssRays;
42       
43  VssPreprocessor();
44  ~VssPreprocessor();
45
46  virtual bool ComputeVisibility();
47
48  Vector3
49  GetViewpoint(AxisAlignedBox3 *viewSpaceBox);
50
51  Vector3
52  GetDirection(const Vector3 &viewpoint,
53                           AxisAlignedBox3 *viewSpaceBox
54                           );
55       
56  void CastRays(SimpleRayContainer &rays, VssRayContainer &vssRays);
57
58  bool
59  ExportRays(const char *filename,
60                         const VssRayContainer &vssRays,
61                         const int number
62                         );
63
64  int
65  GenerateImportanceRays(VssTree *vssTree,
66                                                 const int desiredSamples,
67                                                 SimpleRayContainer &rays
68                                                 );
69
70
71  bool
72  ExportVssTreeLeaf(char *filename,
73                                        VssTree *tree,
74                                        VssTreeLeaf *leaf);
75
76  void
77  ExportVssTreeLeaves(VssTree *tree, const int number);
78       
79
80  bool
81  ExportVssTree(char *filename,
82                                VssTree *tree,
83                                const Vector3 &dir
84                                );
85
86
87  float
88  GetAvgPvsSize(VssTree *tree,
89                                const vector<AxisAlignedBox3> &viewcells
90                                );
91 
92  void TestBeamCasting(VssTree *tre, ViewCellsManager *vm, const ObjectContainer &objects);
93
94  bool mTestBeamSampling;
95
96protected:
97               
98 
99
100        void CastRays16(SimpleRayContainer &rays,
101                                        VssRayContainer &vssRays,
102                                        const AxisAlignedBox3 &sbox);
103};
104
105}
106
107#endif
Note: See TracBrowser for help on using the repository browser.