All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
EmscriptenAsyncTextureLoad.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "IAsyncTextureLoad.h"
6 #include "Helpers.h"
7 #include "Types.h"
8 #include "GLHelpers.h"
9 #include "ICallback.h"
10 #include "AsyncTexturing.h"
11 #include <string>
12 #include <vector>
13 
14 namespace Eegeo
15 {
16  namespace Emscripten
17  {
19  {
21  std::string m_fileExtension;
22  const std::vector<Byte>* m_pResourceBuffer;
23  void* m_pUserData;
24  bool m_mipmap;
25  bool m_use565Format;
26  bool m_flipVertically;
27  GLuint m_textureId;
28  bool m_cancelled;
29  bool m_started;
30  int m_mapId;
31  bool m_mapExists;
32 
34  Helpers::ITextureFileLoader& textureLoader,
36  const std::string& fileExtension,
37  const std::vector<Byte>* pResourceBuffer,
38  void* pUserData,
39  bool mipmap,
40  bool use565Format,
41  bool flipVertically,
42  int mapId);
43 
45 
46  void BeginAsyncTextureDecode();
47 
48  public:
49 
50  static EmscriptenAsyncTextureLoad& Build(
51  Helpers::ITextureFileLoader& textureLoader,
53  const std::string& fileExtension,
54  const std::vector<Byte>& resourceBuffer,
55  void* pUserData,
56  bool mipmap,
57  bool use565Format,
58  bool flipVertically,
59  int mapId);
60 
61  virtual void Begin();
62 
63  virtual void Cancel();
64 
65  void HandleTextureDecodingComplete(GLuint textureId, bool success, int width, int height, bool mapWasRemoved);
66  };
67  }
68 }