diff options
author | LaG1924 <lag1924@gmail.com> | 2021-11-27 15:03:36 +0100 |
---|---|---|
committer | LaG1924 <lag1924@gmail.com> | 2021-11-27 15:03:36 +0100 |
commit | 7f3ed11618df0cce5c3d799e0b3f4c009714f2c3 (patch) | |
tree | 8827c3ba45b52cdda6524df70ce58c8ca1c55e79 /src/Gal.hpp | |
parent | Added PostProcess class (diff) | |
download | AltCraft-7f3ed11618df0cce5c3d799e0b3f4c009714f2c3.tar AltCraft-7f3ed11618df0cce5c3d799e0b3f4c009714f2c3.tar.gz AltCraft-7f3ed11618df0cce5c3d799e0b3f4c009714f2c3.tar.bz2 AltCraft-7f3ed11618df0cce5c3d799e0b3f4c009714f2c3.tar.lz AltCraft-7f3ed11618df0cce5c3d799e0b3f4c009714f2c3.tar.xz AltCraft-7f3ed11618df0cce5c3d799e0b3f4c009714f2c3.tar.zst AltCraft-7f3ed11618df0cce5c3d799e0b3f4c009714f2c3.zip |
Diffstat (limited to 'src/Gal.hpp')
-rw-r--r-- | src/Gal.hpp | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/src/Gal.hpp b/src/Gal.hpp index 4757e37..234e49a 100644 --- a/src/Gal.hpp +++ b/src/Gal.hpp @@ -20,7 +20,7 @@ namespace Gal { struct PipelineInstance; struct FramebufferConfig; struct Framebuffer; - struct ShaderParameters; + struct ShaderParametersBuffer; struct Shader; @@ -131,7 +131,7 @@ namespace Gal { virtual std::shared_ptr<Framebuffer> GetDefaultFramebuffer() = 0; - virtual std::shared_ptr<ShaderParameters> GetGlobalShaderParameters() = 0; + virtual std::shared_ptr<ShaderParametersBuffer> GetGlobalShaderParameters() = 0; virtual std::shared_ptr<Shader> LoadVertexShader(std::string_view code) = 0; @@ -250,34 +250,22 @@ namespace Gal { virtual void SetTexture(size_t location, std::shared_ptr<Texture> texture) = 0; }; - struct ShaderParameters { - virtual ~ShaderParameters() = default; + struct ShaderParametersBuffer { + virtual ~ShaderParametersBuffer() = default; - virtual void AddGlobalShaderParameter(std::string_view name, Type type) = 0; + template<typename T> + T* Get() { + return reinterpret_cast<T*>(GetDataPtr()); + } - virtual void SetGlobalShaderParameter(std::string_view name, float value) = 0; + template<typename T> + void Resize() { + Resize(sizeof(T)); + } - virtual void SetGlobalShaderParameter(std::string_view name, double value) = 0; + virtual std::byte* GetDataPtr() = 0; - virtual void SetGlobalShaderParameter(std::string_view name, int8_t value) = 0; - - virtual void SetGlobalShaderParameter(std::string_view name, int16_t value) = 0; - - virtual void SetGlobalShaderParameter(std::string_view name, int32_t value) = 0; - - virtual void SetGlobalShaderParameter(std::string_view name, uint8_t value) = 0; - - virtual void SetGlobalShaderParameter(std::string_view name, uint16_t value) = 0; - - virtual void SetGlobalShaderParameter(std::string_view name, uint32_t value) = 0; - - virtual void SetGlobalShaderParameter(std::string_view name, glm::vec2 value) = 0; - - virtual void SetGlobalShaderParameter(std::string_view name, glm::vec3 value) = 0; - - virtual void SetGlobalShaderParameter(std::string_view name, glm::vec4 value) = 0; - - virtual void SetGlobalShaderParameter(std::string_view name, glm::mat4 value) = 0; + virtual void Resize(size_t newSize) = 0; }; struct Shader { |