source: GTP/trunk/Lib/Vis/Preprocessing/src/HavranRayCaster.h @ 2623

Revision 2623, 2.7 KB checked in by mattausch, 16 years ago (diff)
Line 
1#ifndef _HavranRayCaster_H__
2#define _HavranRayCaster_H__
3
4#include "RayCaster.h"
5#include "Containers.h"
6#include <string>
7#include "ktbconf.h"
8#include "raypack.h"
9
10namespace GtpVisibilityPreprocessor {
11
12
13class Intersectable;
14class VssRay;
15class KdTree;
16class Ray;
17class SimpleRayContainer;
18class AxisAlignedBox3;
19class Vector3;
20struct VssRayContainer;
21class Preprocessor;
22struct SimpleRay;
23class CKTB;
24 
25
26/** This class provides an interface for ray casting.
27*/
28class HavranRayCaster: public RayCaster
29{
30public:
31  /** Default constructor initialising e.g., KD tree
32   */
33  HavranRayCaster(const Preprocessor &preprocessor);
34  virtual ~HavranRayCaster();
35
36  void Build(ObjectContainer &objlist);
37 
38  int Type() const { return HAVRAN_RAYCASTER; }
39   
40  virtual void AddDynamicObjecs(const ObjectContainer &objects, const Matrix4x4 &m){};
41  virtual void UpdateDynamicObjects(const Matrix4x4 &m){};
42  virtual void DeleteDynamicObjects(){};
43
44  virtual int CastRay(
45                      const SimpleRay &simpleRay,
46                      VssRayContainer &vssRays,
47                      const AxisAlignedBox3 &box,
48                      const bool castDoubleRay,
49                      const bool pruneInvalidRays = true
50                      );
51 
52  virtual void CastRays16(SimpleRayContainer &rays,
53                          VssRayContainer &vssRays,
54                          const AxisAlignedBox3 &sbox,
55                          const bool castDoubleRay,
56                          const bool pruneInvalidRays = true
57                          );
58
59  virtual void CastRays16(SimpleRayContainer &rays,
60                          int offset,
61                          VssRayContainer &vssRays,
62                          const AxisAlignedBox3 &sbox,
63                          const bool castDoubleRay,
64                          const bool pruneInvalidRays = true
65                          ); 
66  void
67  CastSimpleForwardRays(SimpleRayContainer &rays,
68                        const AxisAlignedBox3 &sbox
69                        );
70
71  virtual void CastRays(
72                        SimpleRayContainer &rays,
73                        VssRayContainer &vssRays,
74                        const AxisAlignedBox3 &sbox,
75                        const bool castDoubleRay,
76                        const bool pruneInvalidRays = true);
77
78  // Using packet of 4 rays supposing that these are coherent
79  // We give a box to which each ray is clipped to before the
80  // ray shooting is computed !
81  virtual void CastRaysPacket4(const Vector3 &minBox,
82                               const Vector3 &maxBox,
83                               const Vector3 origin4[],
84                               const Vector3 direction4[],
85                               int     result4[],
86                               float   dist4[]);
87
88#ifdef _USE_HAVRAN_SSE 
89  // Just for testing concept
90  virtual void CastRaysPacket2x2(RayPacket2x2 &raysPack,
91                                 bool castDoubleRay,
92                                 const bool pruneInvalidRays = true);
93#endif 
94
95  bool ExportBinTree(const string &filename);
96  bool ImportBinTree(const string &filename, ObjectContainer &objects);
97 
98protected:
99  CKTB *mKtbtree;
100  static RayPacket2x2 raypack;
101};
102
103
104} // namespace
105
106#endif
Note: See TracBrowser for help on using the repository browser.