diff options
Diffstat (limited to 'source/Material.hpp')
-rw-r--r-- | source/Material.hpp | 18 |
1 files changed, 12 insertions, 6 deletions
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 <string_view> #include <vector> +// 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<Shader> mShader; std::vector<ScalarUniform> mBoundScalars; std::vector<VectorUniform> 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; }; |