| 1 | //************************************ bs::framework - Copyright 2018 Marko Pintera **************************************// |
| 2 | //*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********// |
| 3 | #pragma once |
| 4 | |
| 5 | #include "BsGLPrerequisites.h" |
| 6 | #include "BsGLTexture.h" |
| 7 | #include "BsGLSupport.h" |
| 8 | #include "Managers/BsTextureManager.h" |
| 9 | |
| 10 | namespace bs |
| 11 | { |
| 12 | /** @addtogroup GL |
| 13 | * @{ |
| 14 | */ |
| 15 | |
| 16 | /** Handles creation of OpenGL textures. */ |
| 17 | class GLTextureManager : public TextureManager |
| 18 | { |
| 19 | public: |
| 20 | GLTextureManager(ct::GLSupport& support); |
| 21 | virtual ~GLTextureManager() = default; |
| 22 | |
| 23 | /** |
| 24 | * Converts the provided format for the specified texture type and usage into a format that is supported by OpenGL. |
| 25 | */ |
| 26 | PixelFormat getNativeFormat(TextureType ttype, PixelFormat format, int usage, bool hwGamma) override; |
| 27 | |
| 28 | protected: |
| 29 | /** @copydoc TextureManager::createRenderTextureImpl */ |
| 30 | SPtr<RenderTexture> createRenderTextureImpl(const RENDER_TEXTURE_DESC& desc) override; |
| 31 | |
| 32 | ct::GLSupport& mGLSupport; |
| 33 | }; |
| 34 | |
| 35 | namespace ct |
| 36 | { |
| 37 | /** Handles creation of OpenGL textures. */ |
| 38 | class GLTextureManager : public TextureManager |
| 39 | { |
| 40 | public: |
| 41 | GLTextureManager(GLSupport& support); |
| 42 | |
| 43 | protected: |
| 44 | /** @copydoc TextureManager::createTextureInternal */ |
| 45 | SPtr<Texture> createTextureInternal(const TEXTURE_DESC& desc, |
| 46 | const SPtr<PixelData>& initialData = nullptr, GpuDeviceFlags deviceMask = GDF_DEFAULT) override; |
| 47 | |
| 48 | /** @copydoc TextureManager::createRenderTextureInternal */ |
| 49 | SPtr<RenderTexture> createRenderTextureInternal(const RENDER_TEXTURE_DESC& desc, |
| 50 | UINT32 deviceIdx = 0) override; |
| 51 | |
| 52 | GLSupport& mGLSupport; |
| 53 | }; |
| 54 | } |
| 55 | |
| 56 | /** @} */ |
| 57 | } |