All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
EnvironmentMaterialRepository.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Types.h"
6 #include "IMaterialProvider.h"
7 #include "Rendering.h"
8 #include "VectorMathDecl.h"
9 #include "CityThemes.h"
10 #include "IdTypes.h"
11 #include <string>
12 
13 namespace Eegeo
14 {
15  namespace Rendering
16  {
18  {
19  private:
20  IMaterialRepository* m_pDiffuseMaterialRepository;
21  IMaterialRepository* m_pLightMappedDiffuseMaterialRepository;
22  IMaterialRepository* m_pFoggedMaterialRepository;
23  IMaterialRepository* m_pTransitionMaterialRepository;
24 
25  IMaterialRepository* m_pCurrentMaterialRepository;
26 
27  public:
29  IMaterialRepository& diffuseMaterialRepository,
30  IMaterialRepository& lightMappedMaterialRepository,
31  IMaterialRepository& foggedMaterialRepository,
32  IMaterialRepository& transitionMaterialRepository
33  );
34 
36 
37  bool ContainsMaterial(const std::string& materialName) const;
38 
39  Rendering::Materials::IMaterial* GetMaterial(const std::string& materialName) const;
40 
41  std::vector<Rendering::Materials::IMaterial*> GetMaterials() const;
42 
43  void SetCurrentRepository(
44  const Resources::CityThemes::CityThemeState& fromState,
45  const EnvironmentStateTextures* fromTextures,
47  const EnvironmentStateTextures* toTextures
48  );
49 
50  void UpdateMaterials(float deltaTime, const dv3& ecefCameraPosition);
51 
52  void UpdateAnimatedEnvironmentMaterials(float deltaTime, const dv3& ecefCameraPosition, IMaterialRepository* pRepository);
53 
54  void SetTransitionParam(float t);
55 
56  private:
57  void SetFromToDiffuseTextures(
58  const EnvironmentStateTextures& fromStateTextures,
59  const EnvironmentStateTextures& toStateTextures,
60  const std::string& fromLandmarkPostfix,
61  const std::string& toLandmarkPostfix
62  );
63 
64  void SetFromToTexturesOnMaterial(
65  const std::string& materialName,
66  AsyncTexturing::IAsyncTexture& fromTextureId,
68  );
69 
70  void SetFromToTexturesOnLightmappedMaterial(
71  const std::string& materialName,
72  AsyncTexturing::IAsyncTexture& fromTextureId,
74  );
75 
76  void SetDiffuseTextures(
77  const EnvironmentStateTextures& stateTextures,
78  const std::string& landmarkPostfix
79  );
80 
81  void SetSingleTextureOnMaterial(
82  const std::string& materialName,
84  );
85 
86  void SetWaterTexturesOnWaterMaterial(
87  const std::string& materialName,
88  AsyncTexturing::IAsyncTexture& diffuseTextureId,
89  AsyncTexturing::IAsyncTexture& normalMapTextureId,
90  AsyncTexturing::IAsyncTexture* reflectionMapTextureId
91  );
92 
93  void SetWaterTexturesOnWaterTransitionMaterial(
94  const std::string& materialName,
95  AsyncTexturing::IAsyncTexture& fromDiffuseTextureId,
96  AsyncTexturing::IAsyncTexture& toDiffuseTextureId,
97  AsyncTexturing::IAsyncTexture& normalMapTextureId,
98  AsyncTexturing::IAsyncTexture* fromReflectionMapTextureId,
99  AsyncTexturing::IAsyncTexture* toReflectionMapTextureId
100  );
101 
102  bool HasLightmap(const Resources::CityThemes::CityThemeState& state) const;
103  bool HasFogging(const Resources::CityThemes::CityThemeState& state) const;
104  bool TexturesDiffer(const EnvironmentStateTextures& fromTextures, const EnvironmentStateTextures& toTextures);
105  void UpdateTransitionParamForMaterial(const std::string& materialName, float t);
106  void UpdateTransitionParamForWaterMaterial(const std::string& materialName, float t);
107  void UpdateTransitionParamForLightmappedMaterial(const std::string& materialName, float t);
108  };
109  }
110 }