diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-30 05:55:41 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-30 05:55:41 +1000 |
commit | fd5247321f36e7cb50dd90cb9bd1b5d60a3a289f (patch) | |
tree | 8603fa144341728da19da8df5d6790be792ceef1 /source/application/StarRenderer_opengl20.hpp | |
parent | d5fbd2001b0ad3591a7f969dfd75c809ab55b40e (diff) |
Split world & interface shaders
Diffstat (limited to 'source/application/StarRenderer_opengl20.hpp')
-rw-r--r-- | source/application/StarRenderer_opengl20.hpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/source/application/StarRenderer_opengl20.hpp b/source/application/StarRenderer_opengl20.hpp index ff82d3a..5add227 100644 --- a/source/application/StarRenderer_opengl20.hpp +++ b/source/application/StarRenderer_opengl20.hpp @@ -20,12 +20,15 @@ public: String rendererId() const override; Vec2U screenSize() const override; - void setEffectConfig(Json const& effectConfig, StringMap<String> const& shaders) override; + void loadEffectConfig(String const& name, Json const& effectConfig, StringMap<String> const& shaders) override; + void setEffectParameter(String const& parameterName, RenderEffectParameter const& parameter) override; void setEffectTexture(String const& textureName, Image const& image) override; void setScissorRect(Maybe<RectI> const& scissorRect) override; + bool switchEffectConfig(String const& name) override; + TexturePtr createTexture(Image const& texture, TextureAddressing addressing, TextureFiltering filtering) override; void setSizeLimitEnabled(bool enabled) override; void setMultiTexturingEnabled(bool enabled) override; @@ -155,6 +158,13 @@ private: RefPtr<GlLoneTexture> textureValue; }; + struct Effect { + GLuint program; + Json config; + StringMap<EffectParameter> parameters; + StringMap<EffectTexture> textures; + }; + static void logGlErrorSummary(String prefix); static void uploadTextureImage(PixelFormat pixelFormat, Vec2U size, uint8_t const* data); @@ -166,6 +176,8 @@ private: void renderGlBuffer(GlRenderBuffer const& renderBuffer, Mat3F const& transformation); + void setupGlUniforms(GLuint program); + Vec2U m_screenSize; GLuint m_program = 0; @@ -181,10 +193,11 @@ private: GLint m_screenSizeUniform = -1; GLint m_vertexTransformUniform = -1; + StringMap<Effect> m_effects; + Effect* m_currentEffect; + RefPtr<GlTexture> m_whiteTexture; - StringMap<EffectParameter> m_effectParameters; - StringMap<EffectTexture> m_effectTextures; Maybe<RectI> m_scissorRect; bool m_limitTextureGroupSize; |