All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
CubeMapCellInfo.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Types.h"
6 #include "MortonKey.h"
7 #include "VectorMath.h"
8 #include "EarthConstants.h"
9 #include "CubeMap.h"
10 #include <string>
11 
12 #define CubeMapCellInfo_DebugString 0
13 
14 namespace Eegeo
15 {
16  namespace Space
17  {
18  namespace CubeMap
19  {
21  {
22  public:
24  : m_key(key)
25 #if CubeMapCellInfo_DebugString
26  , m_debugKeyString(key.ToString())
27 #endif
28  {
29  m_normalisedFaceCentre = CubeMap::KeyToFaceCentre(key, 1.0);
30  m_faceCentre = m_normalisedFaceCentre * EarthConstants::CubeSideLengthHalf;
31  m_quadTreeLevel = key.Depth() - 1;
32 
33  m_faceIndex = key.Face();
34  m_faceCentreECEF = CubeMap::FacePointToWorld(m_faceIndex, m_faceCentre, EarthConstants::CubeSideLengthHalf);
35  m_normalisedWidth = 1.0 / (1 << (m_quadTreeLevel));
36  }
37 
38 
39  const Eegeo::Streaming::MortonKey& GetKey() const { return m_key; }
40  int GetFaceIndex() const { return m_faceIndex; }
41  const Eegeo::dv2& GetFaceCentre() const { return m_faceCentre; }
42  const Eegeo::dv2& GetNormalisedFaceCentre() const { return m_normalisedFaceCentre; }
43  const Eegeo::dv3& GetFaceCentreECEF() const { return m_faceCentreECEF;}
44  int GetQuadTreeLevel() const { return m_quadTreeLevel; }
45  double GetNormalisedWidth() const { return m_normalisedWidth; }
46 
47  private:
49  Eegeo::dv3 m_faceCentreECEF;
50  Eegeo::dv2 m_faceCentre;
51  Eegeo::dv2 m_normalisedFaceCentre;
52  double m_normalisedWidth;
53  int m_faceIndex;
54  int m_quadTreeLevel;
55 #if CubeMapCellInfo_DebugString
56  std::string m_debugKeyString;
57 #endif
58  };
59 
60  }
61  }
62 }
63 #undef CubeMapCellInfo_DebugString