source: trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.h @ 490

Revision 490, 1.9 KB checked in by mattausch, 19 years ago (diff)

added loading and storing rays capability

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"
9class VssTree;
10class VssTreeLeaf;
11
12
13/** Sampling based visibility preprocessing. The implementation is based on heuristical
14    sampling of view space */
15class VssPreprocessor : public Preprocessor {
16public:
17  int mPass;
18  int mSamplesPerPass;
19  int mVssSamplesPerPass;
20  int mInitialSamples;
21  int mVssSamples;
22  bool mUseImportanceSampling;
23
24  AxisAlignedBox3 *mViewSpaceBox;
25
26  ofstream mStats;
27       
28  ObjectContainer mObjects;
29
30  /// if initial samples should be loaded from file
31  bool mLoadInitialSamples;
32  /// if initial samples should be stored in file
33  bool mStoreInitialSamples;
34
35  // rays cast during the processing
36  VssRayContainer mVssRays;
37       
38  VssPreprocessor();
39  ~VssPreprocessor();
40
41  virtual bool ComputeVisibility();
42
43  Vector3
44  GetViewpoint(AxisAlignedBox3 *viewSpaceBox);
45
46  Vector3
47  GetDirection(const Vector3 &viewpoint,
48                           AxisAlignedBox3 *viewSpaceBox
49                           );
50       
51  void
52  SetupRay(Ray &ray,
53                   const Vector3 &point,
54                   const Vector3 &direction
55                   );
56
57
58       
59  int
60  CastRay(
61                  Vector3 &viewPoint,
62                  Vector3 &direction,
63                  VssRayContainer &vssRays
64
65                  );
66
67
68  bool
69  ExportRays(const char *filename,
70                         const VssRayContainer &vssRays,
71                         const int number
72                         );
73
74  int
75  GenerateImportanceRays(VssTree *vssTree,
76                                                 const int desiredSamples,
77                                                 SimpleRayContainer &rays
78                                                 );
79
80
81  bool
82  ExportVssTreeLeaf(char *filename,
83                                        VssTree *tree,
84                                        VssTreeLeaf *leaf);
85
86  void
87  ExportVssTreeLeaves(VssTree *tree, const int number);
88       
89
90  bool
91  ExportVssTree(char *filename,
92                                VssTree *tree,
93                                const Vector3 &dir
94                                );
95
96
97  float
98  GetAvgPvsSize(VssTree *tree,
99                                const vector<AxisAlignedBox3> &viewcells
100                                );
101 
102  void CastRay(const BspTree &tree, const VssRay & vssRay);
103};
104
105
106
107#endif
Note: See TracBrowser for help on using the repository browser.