All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
UnityAsyncTextureLoader.h
1 #pragma once
2 
3 #include "IAsyncTextureObserver.h"
4 #include "UnityMaterialToTextureMap.h"
5 #include "UnityCallbacks.h"
6 #include "Helpers.h"
7 
8 #include <unordered_map>
9 #include <string>
10 #include <vector>
11 
12 namespace Eegeo
13 {
14  namespace Unity
15  {
17  {
18  public:
19 
21  UnityMaterialToTextureMap& materialToTextureMap,
22  const TextureCallbacks& textureCallbacks);
23 
24  Rendering::AsyncTexturing::IAsyncTexture& LoadTextureForMaterialFromRequestor(
25  const std::string& assetPath,
26  const std::string& disambiguatedMaterialName,
28 
29  Rendering::AsyncTexturing::IAsyncTexture& LoadCubeTextureForMaterialFromRequestor(
30  const Helpers::CubeTextureName& textureName,
31  const std::string& disambiguatedMaterialName,
33 
34  void AddTextureRequestForMaterial(
36  const void* requestHandle,
37  const std::string& materialName);
38 
39  private:
40 
41  void OnTextureLoadSuccess(const Rendering::AsyncTexturing::IAsyncTexture& loadedTexture);
42 
43  void OnTextureLoadFail(const Rendering::AsyncTexturing::IAsyncTexture& loadedTexture);
44 
45  typedef std::pair<std::string, const void*> TMaterialNameTextureRequestPair;
46  typedef std::vector<TMaterialNameTextureRequestPair> TMaterialNameTextureRequestPairVector;
47  std::unordered_map<std::string, TMaterialNameTextureRequestPairVector> m_inFlightAssetPathsToMaterials;
48  UnityMaterialToTextureMap& m_materialToTextureMap;
49  const TextureCallbacks& m_textureCallbacks;
50  };
51  }
52 }