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

Revision 1221, 2.9 KB checked in by mattausch, 18 years ago (diff)

added intel ray tracing

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  int mPass;
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  void
59  SetupRay(Ray &ray,
60                   const Vector3 &point,
61                   const Vector3 &direction
62                   );
63
64
65       
66  int
67  CastRay(
68                  const Vector3 &viewPoint,
69                  const Vector3 &direction,
70                  VssRayContainer &vssRays,
71                  const AxisAlignedBox3 &box
72                  );
73
74
75  bool
76  ExportRays(const char *filename,
77                         const VssRayContainer &vssRays,
78                         const int number
79                         );
80
81  int
82  GenerateImportanceRays(VssTree *vssTree,
83                                                 const int desiredSamples,
84                                                 SimpleRayContainer &rays
85                                                 );
86
87
88  bool
89  ExportVssTreeLeaf(char *filename,
90                                        VssTree *tree,
91                                        VssTreeLeaf *leaf);
92
93  void
94  ExportVssTreeLeaves(VssTree *tree, const int number);
95       
96
97  bool
98  ExportVssTree(char *filename,
99                                VssTree *tree,
100                                const Vector3 &dir
101                                );
102
103
104  float
105  GetAvgPvsSize(VssTree *tree,
106                                const vector<AxisAlignedBox3> &viewcells
107                                );
108 
109  void CastRay(const BspTree &tree, const VssRay & vssRay);
110
111  void TestBeamCasting(VssTree *tre, ViewCellsManager *vm, const ObjectContainer &objects);
112
113  bool mTestBeamSampling;
114
115protected:
116        int CastInternalRay(
117                const Vector3 &viewPoint,
118                const Vector3 &direction,
119                VssRayContainer &vssRays,
120                const AxisAlignedBox3 &sbox);
121
122        int CastIntelDoubleRay(
123                const Vector3 &viewPoint,
124                const Vector3 &direction,
125                VssRayContainer &vssRays,
126                const AxisAlignedBox3 &sbox);
127
128        Intersectable *CastIntelSingleRay(
129                        const Vector3 &viewPoint,
130                        const Vector3 &direction,
131                        Vector3 &tPoint,
132                        const AxisAlignedBox3 &abox);
133
134        void CastRays16(SimpleRayContainer &rays,
135                                        VssRayContainer &vssRays,
136                                        const AxisAlignedBox3 &sbox);
137};
138
139}
140
141#endif
Note: See TracBrowser for help on using the repository browser.