All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
EnvironmentTextures.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 "IdTypes.h"
8 #include "CityThemes.h"
9 #include "IAsyncTexture.h"
10 #include <string>
11 #include <vector>
12 #include <map>
13 
14 #define LOG_ENVIRONMENT_TEXTURES_DEBUG_MESSAGES
15 
16 #if defined (LOG_ENVIRONMENT_TEXTURES_DEBUG_MESSAGES)
17 #define DEBUG_LOG Eegeo_TTY
18 #else
19 #define DEBUG_LOG if (1) {} else Eegeo_TTY
20 #endif
21 
22 namespace Eegeo
23 {
24  namespace Rendering
25  {
27  {
28 
29  private:
30  typedef std::vector<IEnvironmentTexturesObserver*> TObservers;
31 
32  typedef std::map<std::string, AsyncTexturing::IAsyncTexture*> TEnvironmentTextures;
33  typedef std::map<std::string, EnvironmentStateTextures*> TEnvironmentStates;
34  typedef std::map<std::string, AsyncTexturing::IAsyncTexture*> TEnvironmentAsyncTextures;
35 
36  TEnvironmentAsyncTextures m_urlToEnvironmentAsyncTexture;
37  TEnvironmentStates m_currentEnvironmentStates;
38  TEnvironmentTextures m_urlToEnvironmentTexture;
39  TObservers m_observers;
40 
41  public:
43 
44  bool HasEnvironmentTexture(const std::string& textureUrl);
45  AsyncTexturing::IAsyncTexture& AddOrUseEnvironmentTexture(const std::string& textureUrl, const Helpers::GLHelpers::TextureInfo& textureInfo);
46  void ReleaseTexturesForAllStates();
47  void ReleaseTexturesForState(std::string& stateName);
48  void FreeUnusedTextures();
49  void AddTexturesForState(const Resources::CityThemes::CityThemeState& state, EnvironmentStateTextures* stateTextures);
50  void RegisterAsyncTexture(const std::string& url, Rendering::AsyncTexturing::IAsyncTexture* asyncTexture);
51  bool HasAsyncTexture(const std::string& textureUrl);
52  void RegisterObserver(IEnvironmentTexturesObserver& observer);
53  void RemoveObserver(IEnvironmentTexturesObserver& observer);
54  const EnvironmentStateTextures& GetTexturesForState(const std::string& stateName);
55  };
56  }
57 }