All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
PinViewRenderer.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Types.h"
6 #include "VectorMath.h"
7 #include "Pins.h"
8 #include "Camera.h"
9 #include "Rendering.h"
10 #include "IRenderableFilter.h"
11 #include "Helpers.h"
12 #include "GLHelpers.h"
13 #include "LayerIds.h"
14 #include "IdTypes.h"
15 
16 #include <vector>
17 
18 namespace Eegeo
19 {
20  namespace Pins
21  {
29  {
30  public:
40  static PinViewRenderer* Create(
41  const Rendering::EnvironmentFlatteningService& environmentFlatteningService,
42  Eegeo::Rendering::RenderableFilters& renderableFilters,
43  Rendering::Shaders::ShaderIdGenerator& shaderIdGenerator,
44  Rendering::Materials::MaterialIdGenerator& materialIdGenerator,
47  Eegeo::Rendering::GlBufferPool& glBufferPool,
48  const Eegeo::Rendering::ITexturePageLayout& texturePageLayout,
49  const Eegeo::Rendering::TTextureId textureId,
50  const Eegeo::Rendering::LayerIds::Values layerId,
51  const Rendering::ScreenProperties& screenProperties,
52  const bool useLegacyScaling
53  );
54 
66  const Rendering::EnvironmentFlatteningService& environmentFlatteningService,
67  Eegeo::Rendering::RenderableFilters& renderableFilters,
68  const Eegeo::Rendering::ITexturePageLayout& texturePageLayout,
72  const Eegeo::Rendering::ScreenProperties& screenProperties,
73  const bool useLegacyScaling);
74 
75  ~PinViewRenderer();
76 
80  void AddView(PinView& viewToAdd);
81 
85  void RemoveView(PinView& viewToRemove);
86 
89  void Update(const Camera::RenderCamera& renderCamera);
90 
93  void UpdateScreenProperties(const Eegeo::Rendering::ScreenProperties& screenProperties);
94 
100  bool TryGetViewsIntersectingScreenPoint(const v2& screenPoint, std::vector<PinView*>& outIntersectingViews) const;
101 
106  void EnqueueRenderables(const Rendering::RenderContext& renderContext, Rendering::RenderQueue& renderQueue);
107 
108  private:
109 
110  static const float LegacyScaleModifier;
111 
114  const Rendering::EnvironmentFlatteningService& m_environmentFlatteningService;
115  Eegeo::Rendering::Renderables::BatchedSpriteRenderable* m_pBatchedSpriteRenderable;
116  const Eegeo::Rendering::ITexturePageLayout& m_pinIconsTexturePageLayout;
117 
118  typedef std::vector<PinView*> TViews;
119  TViews m_views;
120  TViews m_visibleViews;
121 
122  float m_screenHeight;
123  float m_screenPixelScale;
124  float m_screenOversampleScale;
125 
126  const bool m_useLegacyScaling;
127 
128  bool ContainsView(const PinView& view) const;
129  };
130  }
131 }
132