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

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

added loading and storing rays capability

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"
9class RssTree;
10class RssTreeLeaf;
11
12
13/** Sampling based visibility preprocessing. The implementation is based on heuristical
14    sampling of view space */
15class RssPreprocessor : public Preprocessor {
16public:
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   /// if initial samples should be loaded from file
42  bool mLoadInitialSamples;
43  /// if initial samples should be stored in file
44  bool mStoreInitialSamples;
45
46  RssPreprocessor();
47  ~RssPreprocessor();
48
49  virtual bool ComputeVisibility();
50
51  Vector3
52  GetViewpoint(AxisAlignedBox3 *viewSpaceBox);
53
54  Vector3
55  GetDirection(const Vector3 &viewpoint,
56                           AxisAlignedBox3 *viewSpaceBox
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                  VssRayContainer &vssRays
72
73                  );
74               
75
76       
77  virtual bool BuildBspTree() { return false; }
78
79
80  bool
81  ExportRays(const char *filename,
82                         const VssRayContainer &vssRays,
83                         const int number
84                         );
85
86  int
87  GenerateImportanceRays(RssTree *vssTree,
88                                                 const int desiredSamples,
89                                                 SimpleRayContainer &rays
90                                                 );
91
92
93  bool
94  ExportRssTreeLeaf(char *filename,
95                                        RssTree *tree,
96                                        RssTreeLeaf *leaf);
97
98  void
99  ExportRssTreeLeaves(RssTree *tree, const int number);
100       
101
102  bool
103  ExportRssTree(char *filename,
104                                RssTree *tree,
105                                const Vector3 &dir
106                                );
107
108
109  float
110  GetAvgPvsSize(RssTree *tree,
111                                const vector<AxisAlignedBox3> &viewcells
112                                );
113 
114
115  void
116  ExportPvs(char *filename,
117                        RssTree *rssTree
118                        );
119
120};
121
122
123
124#endif
Note: See TracBrowser for help on using the repository browser.