[2582] | 1 | #ifndef _HavranRayCaster_H__
|
---|
| 2 | #define _HavranRayCaster_H__
|
---|
| 3 |
|
---|
| 4 | #include "RayCaster.h"
|
---|
| 5 | #include "Containers.h"
|
---|
| 6 | #include <string>
|
---|
[2592] | 7 | #include "ktbconf.h"
|
---|
| 8 | #include "raypack.h"
|
---|
[2582] | 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 int CastRay(
|
---|
| 41 | const SimpleRay &simpleRay,
|
---|
| 42 | VssRayContainer &vssRays,
|
---|
| 43 | const AxisAlignedBox3 &box,
|
---|
| 44 | const bool castDoubleRay,
|
---|
| 45 | const bool pruneInvalidRays = true
|
---|
| 46 | );
|
---|
| 47 |
|
---|
| 48 | virtual void CastRays16(SimpleRayContainer &rays,
|
---|
| 49 | VssRayContainer &vssRays,
|
---|
| 50 | const AxisAlignedBox3 &sbox,
|
---|
| 51 | const bool castDoubleRay,
|
---|
| 52 | const bool pruneInvalidRays = true
|
---|
| 53 | );
|
---|
| 54 |
|
---|
| 55 | virtual void CastRays16(SimpleRayContainer &rays,
|
---|
| 56 | int offset,
|
---|
| 57 | VssRayContainer &vssRays,
|
---|
| 58 | const AxisAlignedBox3 &sbox,
|
---|
| 59 | const bool castDoubleRay,
|
---|
| 60 | const bool pruneInvalidRays = true
|
---|
| 61 | );
|
---|
| 62 | void
|
---|
| 63 | CastSimpleForwardRays(SimpleRayContainer &rays,
|
---|
| 64 | const AxisAlignedBox3 &sbox
|
---|
| 65 | );
|
---|
| 66 |
|
---|
| 67 | virtual void CastRays(
|
---|
| 68 | SimpleRayContainer &rays,
|
---|
| 69 | VssRayContainer &vssRays,
|
---|
| 70 | const AxisAlignedBox3 &sbox,
|
---|
| 71 | const bool castDoubleRay,
|
---|
| 72 | const bool pruneInvalidRays = true);
|
---|
[2592] | 73 |
|
---|
| 74 | // Using packet of 4 rays supposing that these are coherent
|
---|
| 75 | // We give a box to which each ray is clipped to before the
|
---|
| 76 | // ray shooting is computed !
|
---|
| 77 | virtual void CastRaysPacket4(Vector3 &minBox,
|
---|
| 78 | Vector3 &maxBox,
|
---|
| 79 | Vector3 origin4[],
|
---|
| 80 | Vector3 direction4[],
|
---|
| 81 | int result4[],
|
---|
| 82 | float dist4[]);
|
---|
| 83 |
|
---|
| 84 | #ifdef _USE_HAVRAN_SSE
|
---|
| 85 | // Just for testing concept
|
---|
| 86 | virtual void CastRaysPacket2x2(RayPacket2x2 &raysPack,
|
---|
| 87 | bool castDoubleRay,
|
---|
| 88 | const bool pruneInvalidRays = true);
|
---|
| 89 | #endif
|
---|
| 90 |
|
---|
| 91 | bool ExportBinTree(const string &filename);
|
---|
| 92 | bool ImportBinTree(const string &filename, ObjectContainer &objects);
|
---|
| 93 |
|
---|
[2582] | 94 | protected:
|
---|
| 95 | CKTB *mKtbtree;
|
---|
| 96 | static RayPacket2x2 raypack;
|
---|
| 97 | };
|
---|
| 98 |
|
---|
| 99 |
|
---|
| 100 | } // namespace
|
---|
| 101 |
|
---|
| 102 | #endif
|
---|