diff options
Diffstat (limited to 'src/Rendering')
| -rw-r--r-- | src/Rendering/Shader.h | 1 | ||||
| -rw-r--r-- | src/Rendering/Texture.cpp | 30 | ||||
| -rw-r--r-- | src/Rendering/Texture.h | 8 |
3 files changed, 39 insertions, 0 deletions
diff --git a/src/Rendering/Shader.h b/src/Rendering/Shader.h index e2d8d2a..483102d 100644 --- a/src/Rendering/Shader.h +++ b/src/Rendering/Shader.h @@ -34,6 +34,7 @@ namespace Donut virtual void MemoryBarrier(uint32_t barriers) = 0; virtual const std::string& GetName() const = 0; + virtual uint32_t GetRendererID() const = 0; static Shader* Create(const std::string& filepath); static Shader* Create(const std::string& name, const std::string& vertexSrc, const std::string& fragmentSrc); diff --git a/src/Rendering/Texture.cpp b/src/Rendering/Texture.cpp index a96b816..93b8a75 100644 --- a/src/Rendering/Texture.cpp +++ b/src/Rendering/Texture.cpp @@ -35,4 +35,34 @@ namespace Donut return nullptr; } } + + Ref<CubemapTexture> CubemapTexture::Create(uint32_t width, uint32_t height) + { + switch (Renderer::GetAPI()) + { + case RendererAPI::API::OpenGL: + return CreateRef<OpenGLCubemapTexture>(width, height); + case RendererAPI::API::Vulkan: + return CreateRef<VulkanCubemapTexture>(width, height); + case RendererAPI::API::None: + return nullptr; + default: + return nullptr; + } + } + + Ref<CubemapTexture> CubemapTexture::CreateFromHDRI(const std::string& path) + { + switch (Renderer::GetAPI()) + { + case RendererAPI::API::OpenGL: + return CreateRef<OpenGLCubemapTexture>(path); + case RendererAPI::API::Vulkan: + return CreateRef<VulkanCubemapTexture>(path); + case RendererAPI::API::None: + return nullptr; + default: + return nullptr; + } + } };
\ No newline at end of file diff --git a/src/Rendering/Texture.h b/src/Rendering/Texture.h index 21941ee..3e53b2d 100644 --- a/src/Rendering/Texture.h +++ b/src/Rendering/Texture.h @@ -31,4 +31,12 @@ namespace Donut static Ref<Texture2D> Create(uint32_t width, uint32_t height); static Ref<Texture2D> Create(const std::string& path); }; + + class CubemapTexture + : public Texture + { + public: + static Ref<CubemapTexture> Create(uint32_t width, uint32_t height); + static Ref<CubemapTexture> CreateFromHDRI(const std::string& path); + }; };
\ No newline at end of file |
