From 3290bb2b2dec223f0312c6d5fc3edf71d5d6e46f Mon Sep 17 00:00:00 2001 From: rtk0c Date: Tue, 19 Apr 2022 12:36:02 -0700 Subject: Changeset: 12 Add hardcoded dependencies for IresManager, migrate Shader to Ires --- source/Material.hpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'source/Material.hpp') diff --git a/source/Material.hpp b/source/Material.hpp index 7cf5603..623a022 100644 --- a/source/Material.hpp +++ b/source/Material.hpp @@ -15,8 +15,14 @@ #include #include +// Forward declarations +class Material; +class IresMaterial; + class Material : public RefCounted { -public: // NOTE: public for internal helpers and editor + friend class IresMaterial; + +public: // NOTE: specialize between scalar vs matrix vs vector to save memory enum UniformType : uint16_t { @@ -62,6 +68,7 @@ public: // NOTE: public for internal helpers and editor /* Transient */ GLint location; }; + IresMaterial* mIres = nullptr; RcPtr mShader; std::vector mBoundScalars; std::vector mBoundVectors; @@ -91,12 +98,11 @@ public: Shader* GetShader() const; void SetShader(Shader* shader); + IresMaterial* GetIres() const { return mIres; } + bool IsValid() const; void UseUniforms() const; - - bool Write(rapidjson::Value& value, rapidjson::Document& root) const; - bool Read(const rapidjson::Value& value); }; class IresMaterial : public IresObject { @@ -111,6 +117,6 @@ public: void ShowEditor(EditorInstance& editor) override; - void Write(rapidjson::Value& value, rapidjson::Document& root) const override; - void Read(const rapidjson::Value& value) override; + void Write(IresWritingContext& ctx, rapidjson::Value& value, rapidjson::Document& root) const override; + void Read(IresLoadingContext& ctx, const rapidjson::Value& value) override; }; -- cgit v1.2.3-70-g09d2