All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
EmscriptenTextureFileLoader.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "ITextureFileLoader.h"
6 #include "Types.h"
7 #include "Helpers.h"
8 #include "GLHelpers.h"
9 #include "IJpegLoader.h"
10 #include "ICallback.h"
11 #include <string>
12 #include <vector>
13 
14 namespace Eegeo
15 {
16  namespace Emscripten
17  {
18  using namespace Eegeo::Helpers;
19 
21  {
22  Eegeo::Helpers::IFileIO* m_pFileIO;
23  int m_mapId;
24 
25  bool LoadPng(Eegeo::Helpers::GLHelpers::TextureInfo &textureInfo, const std::string& filename, bool mipmap, bool invertVertically);
26 
27  bool LoadJpg(Eegeo::Helpers::GLHelpers::TextureInfo& textureInfo, const std::string& filename, bool mipmap, bool invertVertically);
28 
29  public:
31  virtual ~EmscriptenTextureFileLoader();
32 
33  virtual bool LoadTexture(Eegeo::Helpers::GLHelpers::TextureInfo& info, const std::string& fileName, bool mipmap = false);
34 
35  virtual Rendering::AsyncTexturing::IAsyncTextureLoad& LoadFromFileAsync(
37  const std::string& fileName,
38  void* pUserData,
39  bool mipmap=false);
40 
41  virtual Rendering::AsyncTexturing::IAsyncTextureLoad& LoadCubeFromFileAsync(
43  const Helpers::CubeTextureName& textureName,
44  void* pUserData);
45 
46  virtual bool LoadFromBuffer(
48  const std::string& fileExtension,
49  const Byte* resourceBuffer,
50  size_t bufferSizeBytes,
51  bool mipmap=false);
52 
53  virtual Rendering::AsyncTexturing::IAsyncTextureLoad& LoadFromBufferAsync(
55  const std::string& fileExtension,
56  const std::vector<Byte>& resourceBuffer,
57  void* pUserData,
58  bool mipmap=false);
59 
60  virtual Rendering::AsyncTexturing::IAsyncTextureLoad& LoadCubeFromBuffersAsync(
62  const std::vector<const std::vector<Byte>*>& cubeFaceBuffers,
63  void* pUserData
64  );
65 
66  virtual bool LoadFromCubeFaces(Eegeo::Helpers::GLHelpers::TextureInfo& out_textureInfo,
67  const std::vector<const std::vector<Byte>*>& cubeFaceBuffers);
68 
69  virtual bool LoadFromCubeFaces(Eegeo::Helpers::GLHelpers::TextureInfo& out_textureInfo,
70  const CubeFaceFileNames& cubeFaceFileNames);
71 
72  virtual bool LoadCubeTexture(Eegeo::Helpers::GLHelpers::TextureInfo& out_textureInfo,
73  const Helpers::CubeTextureName& textureName);
74 
75  inline int GetMapId() const { return m_mapId; }
76  };
77  }
78 }