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 |
|
---|
10 | namespace GtpVisibilityPreprocessor {
|
---|
11 |
|
---|
12 |
|
---|
13 | class Intersectable;
|
---|
14 | class VssRay;
|
---|
15 | class KdTree;
|
---|
16 | class Ray;
|
---|
17 | class SimpleRayContainer;
|
---|
18 | class AxisAlignedBox3;
|
---|
19 | class Vector3;
|
---|
20 | struct VssRayContainer;
|
---|
21 | class Preprocessor;
|
---|
22 | struct SimpleRay;
|
---|
23 | class CKTB;
|
---|
24 |
|
---|
25 |
|
---|
26 | /** This class provides an interface for ray casting.
|
---|
27 | */
|
---|
28 | class HavranRayCaster: public RayCaster
|
---|
29 | {
|
---|
30 | public:
|
---|
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 |
|
---|
98 | protected:
|
---|
99 | CKTB *mKtbtree;
|
---|
100 | static RayPacket2x2 raypack;
|
---|
101 | };
|
---|
102 |
|
---|
103 |
|
---|
104 | } // namespace
|
---|
105 |
|
---|
106 | #endif
|
---|