hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/src/rendering
diff options
context:
space:
mode:
Diffstat (limited to 'src/rendering')
-rw-r--r--src/rendering/shader.h1
-rw-r--r--src/rendering/texture.cpp30
-rw-r--r--src/rendering/texture.h8
3 files changed, 39 insertions, 0 deletions
diff --git a/src/rendering/shader.h b/src/rendering/shader.h
index 814f0cf..3e05132 100644
--- a/src/rendering/shader.h
+++ b/src/rendering/shader.h
@@ -34,6 +34,7 @@ namespace Donut
virtual void memory_barrier(uint32_t barriers) = 0;
virtual const std::string& get_name() const = 0;
+ virtual uint32_t get_renderer_id() const = 0;
static Shader* create(const std::string& filepath);
static Shader* create(const std::string& name, const std::string& vertex_src, const std::string& fragment_src);
diff --git a/src/rendering/texture.cpp b/src/rendering/texture.cpp
index e14c09c..a33edd0 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::get_api())
+ {
+ case RendererAPI::API::OpenGL:
+ return create_ref<OpenGLCubemapTexture>(width, height);
+ case RendererAPI::API::Vulkan:
+ return create_ref<VulkanCubemapTexture>(width, height);
+ case RendererAPI::API::None:
+ return nullptr;
+ default:
+ return nullptr;
+ }
+ }
+
+ Ref<CubemapTexture> CubemapTexture::create_from_hdri(const std::string& path)
+ {
+ switch (Renderer::get_api())
+ {
+ case RendererAPI::API::OpenGL:
+ return create_ref<OpenGLCubemapTexture>(path);
+ case RendererAPI::API::Vulkan:
+ return create_ref<VulkanCubemapTexture>(path);
+ case RendererAPI::API::None:
+ return nullptr;
+ default:
+ return nullptr;
+ }
+ }
};
diff --git a/src/rendering/texture.h b/src/rendering/texture.h
index cc5c59e..195605c 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> create_from_hdri(const std::string& path);
+ };
};