All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
FrustumRadar.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Types.h"
6 #include "VectorMath.h"
7 
8 namespace Eegeo
9 {
10  struct BoundingBox;
11 
12  enum
13  {
14  kVisible = 0x01,
15  kMinX = 0x02,
16  kMaxX = 0x04,
17  kMinY = 0x08,
18  kMaxY = 0x10,
19  kMinZ = 0x20,
20  kMaxZ = 0x40,
21  };
22 
23  enum
24  {
25  kResultOutside,
26  kResultInside,
27  kResultClipped,
28  kResultInvalid = 0xff,
29  };
30 
32  {
33  Eegeo::m44 m_world;
34 
35  float m_nearD;
36  float m_farD;
37 
38  float m_tang;
39  float m_sphereX;
40  float m_sphereY;
41 
42  float m_ratio;
43  float m_width;
44  float m_height;
45 
46  public:
47  FrustumRadar(const Eegeo::m44& world, float fov, float _near, float _far, float _ratio);
48 
49  u32 TestPoint(const Eegeo::v3& point);
50  u32 GetPointVisibilty(const Eegeo::v3& point);
51 
52  u32 TestBoundingBox(const BoundingBox& box);
53  u32 TestSphere(const Eegeo::v3& point, float radius);
54 
55 #if MATH_NEON && !TARGET_IPHONE_SIMULATOR
56  u32 TestBoundingBoxNeon(const BoundingBox& box);
57  u32 TestSphereNeon(const Eegeo::v3& point, float radius);
58 #else
59  u32 TestBoundingBoxNonNeon(const BoundingBox& box);
60  u32 TestSphereNonNeon(const Eegeo::v3& point, float radius);
61 #endif
62 
63  const Eegeo::m44& getWorld() const { return m_world; }
64  };
65 
66  inline u32 FrustumRadar::TestBoundingBox(const BoundingBox& box)
67  {
68 #if MATH_NEON && !TARGET_IPHONE_SIMULATOR
69  return TestBoundingBoxNeon(box);
70 #else
71  return TestBoundingBoxNonNeon(box);
72 #endif
73  }
74 
75  inline u32 FrustumRadar::TestSphere(const Eegeo::v3& point, float radius)
76  {
77 #if MATH_NEON && !TARGET_IPHONE_SIMULATOR
78  return TestSphereNeon(point, radius);
79 #else
80  return TestSphereNonNeon(point, radius);
81 #endif
82  }
83 }