All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
PlaceNameViewBuilder.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Types.h"
6 #include "Rendering.h"
7 #include "Fonts.h"
8 #include "TextMeshes.h"
9 #include "Space.h"
10 #include "LayerIds.h"
11 #include "PlaceNames.h"
12 #include "VectorMath.h"
13 #include <vector>
14 #include <string>
15 #include <map>
16 
17 namespace Eegeo
18 {
19  namespace Resources
20  {
21  namespace PlaceNames
22  {
23  // Unicode codepoints for icon glyphs - in Dingbats range U+2701 onwards
24  enum IconCodepoint
25  {
26  NONE = 0,
27  TRAFFIC_LIGHTS = 9985,
28  PARK = 9986,
29  AIRPORT = 9987,
30  STATION = 9988,
31  STAR = 9989,
32  GOLF = 9990,
33  COFFEE = 9991,
34  FOOD = 9992,
35  GAS_STATION = 9993,
36  NIGHTLIFE = 9994,
37  FERRY = 9995,
38  };
39 
41  {
42  public:
46  const Fonts::FontInstance& font,
47  const Fonts::FontMaterialSet& materialSet,
48  Rendering::LayerIds::Values layerId,
49  float screenOversampleScale
50  );
51  virtual ~PlaceNameViewBuilder();
52 
53  PlaceNameView* CreatePlaceNameView(const std::vector<u32>& textUtf32,
54  const std::string& iconKey,
55  float fontSize,
56  const dv3& positionEcef,
57  const std::string& debugName,
58  const Space::CubeMap::CubeMapCellInfo& cellInfo,
59  bool hasUnderline = false,
60  float unflattenableHeightOffset = 0.0f);
61 
62  static const float UNDERLINE_POINTER_HEIGHT;
63  static const float UNDERLINE_POINTER_HEIGHT_LOW_LEVEL;
64 
65  private:
67  const Fonts::FontInstance& m_font;
69  const Fonts::FontMaterialSet& m_materialSet;
70  Rendering::LayerIds::Values m_layerId;
71 
72  std::vector<Rendering::VertexTypes::TextVertex> m_underlineVertices;
73  const float m_underlineHorizontalOffset;
74  const float m_underlineThickness;
75  const float m_shadowOffset;
76  const float m_screenOversampleScale;
77  const float m_categoryScale;
78  int m_underlineCharacterTexturePage;
79  std::map<const std::string, IconCodepoint> m_iconCodepointMap;
80 
81  const v4 m_foregroundColor;
82  const v4 m_outlineColor;
83  const v4 m_shadowColor;
84 
85  const float m_haloWidth;
86  const float m_haloHardness;
87 
88  void BuildTextMeshes(const std::vector<u32>& textUtf32, const std::string& iconKey, float fontSize, float altitude, const std::string& debugName, const Space::CubeMap::CubeMapCellInfo& cellInfo, bool hasUnderline, TextMeshes::TextMeshBuilderResult& out_builderResult);
89 
90  void AddIconGeometry(u32 iconCodepointUft32, float iconSize, float xOffset, float yOffset, float altitude, bool hasUnderline);
91  void AddUnderlineGeometry(float textWidth, float underlineHeight, float altitude);
92  void InitUnderlineGeometry();
93  void BuildIconCodepointMap();
94  };
95  }
96  }
97 }