All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
OSXTextureFileLoader.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 "GLState.h"
9 #include "GLHelpers.h"
10 #include "IJpegLoader.h"
11 #include "IPNGDecoder.h"
12 #include <string>
13 
14 namespace Eegeo
15 {
16  namespace OSX
17  {
19  {
20  Eegeo::Helpers::IFileIO* m_pFileIO;
23 
24  bool LoadPng(Eegeo::Helpers::GLHelpers::TextureInfo &textureInfo, const std::string& filename, bool mipmap, bool invertVertically);
25 
26  bool LoadPngFromStream(Eegeo::Helpers::GLHelpers::TextureInfo &textureInfo, std::istream& stream, bool mipmap, bool invertVertically);
27  bool LoadPngFromBuffer(Eegeo::Helpers::GLHelpers::TextureInfo &textureInfo, const void* resourceBuffer, size_t resourceBufferSizeBytes, bool mipmap, bool invertVertically);
28  static GLenum CalcPNGGLPixelFormat(int color_type);
29 
30  bool LoadJpg(Eegeo::Helpers::GLHelpers::TextureInfo& textureInfo, const std::string& filename, bool mipmap, bool invertVertically);
31 
32  public:
34  virtual ~OSXTextureFileLoader();
35 
36  virtual bool LoadTexture(Eegeo::Helpers::GLHelpers::TextureInfo& info, const std::string& fileName, bool mipmap = false);
37  virtual bool LoadFromBuffer(Eegeo::Helpers::GLHelpers::TextureInfo& textureInfo, const std::string& fileExtension, const Byte* resourceBuffer, size_t bufferSizeBytes, bool mipmap=false);
38  virtual bool LoadFromCubeFaces(Eegeo::Helpers::GLHelpers::TextureInfo& out_textureInfo, const Helpers::CubeFaceFileNames& cubeFaceFileNames);
39  virtual bool LoadFromCubeFaces(Eegeo::Helpers::GLHelpers::TextureInfo& out_textureInfo, const std::vector<const std::vector<Byte>*>& cubeFaceBuffers);
40  virtual bool LoadCubeTexture(Eegeo::Helpers::GLHelpers::TextureInfo& out_textureInfo,
41  const Helpers::CubeTextureName& textureName);
42 
44  const std::string& fileName,
45  void* pUserData,
46  bool mipmap = false);
47 
49  const Helpers::CubeTextureName& textureName,
50  void* pUserData);
51 
53  const std::string& fileExtension,
54  const std::vector<Byte>& resourceBuffer,
55  void* pUserData,
56  bool mipmap = false
57  );
58 
60  const std::vector<const std::vector<Byte>*>& cubeFaceBuffers,
61  void* pUserData
62  );
63  };
64  }
65 }