All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
MaterialSelectionController.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Types.h"
6 #include "Collision.h"
7 #include "CollisionVisualization.h"
8 #include "VectorMath.h"
9 #include "Camera.h"
10 #include "Buildings.h"
11 #include "ICallback.h"
12 #include "Rendering.h"
13 
14 
15 #include <unordered_map>
16 #include <vector>
17 #include <string>
18 
19 namespace Eegeo
20 {
21  namespace CollisionVisualization
22  {
24  {
25  public:
28  const Collision::ICollisionBvhProvider& collisionBvhProvider,
29  MaterialSelectionRenderableFactory& renderableFactory,
31  Resources::Buildings::LandmarkToRenderableRepository& landmarkToRenderableRepository
32  );
33 
35 
36  bool IsSelected(const std::string& materialId) const;
37  bool IsFlashing(const std::string& materialId) const;
38 
39  void Select(const std::string& materialId);
40  void SetFlashingState(const std::string& materialId, bool flashing);
41  void CycleFlashing(const std::string& materialId);
42  void Deselect(const std::string& materialId);
43  void DeselectAll();
44 
45  void Update(float dt);
46  void Draw(const Eegeo::Camera::RenderCamera& renderCamera);
47 
48  void NotifyCollisionResourcesChanged();
49  private:
50  typedef std::unordered_map<const MaterialSelectionModelEntry*, MultiMaterialSelectionView*> ModelEntryToView;
51 
52  void RefreshViewRenderables();
53  void RemoveAllViews();
54  std::vector<std::string> GetAssociatedLandmarkTextureNames(const std::string& prefix) const;
55  std::vector<std::string> GetAllSelectedCollisionMaterialIds() const;
56 
57  void HandleLandmarkRenderableAdded(const std::string& landmarkMaterialName, Rendering::Renderables::CustomLandmarkRenderable& landmarkRenderable);
58  void HandleLandmarkRenderableRemoved(const std::string& landmarkMaterialName, Rendering::Renderables::CustomLandmarkRenderable& landmarkRenderable);
59 
60  MaterialSelectionModel& m_model;
61  const Collision::ICollisionBvhProvider& m_collisionBvhProvider;
62  MaterialSelectionRenderableFactory& m_renderableFactory;
64  Resources::Buildings::LandmarkToRenderableRepository& m_landmarkToRenderableRepository;
65 
66  ModelEntryToView m_modelEntryToView;
67 
68  float m_flashingPhase;
69  bool m_needRefreshViewRenderables;
70 
71  const v4 m_color;
72  const float m_flashFrequency;
73  const float m_flashSaturateScale;
74  const float m_flashAlphaMin;
75  const float m_flashAlphaMax;
76 
79  };
80 
81  }
82 }