aboutsummaryrefslogtreecommitdiff
path: root/source/Material.hpp
diff options
context:
space:
mode:
authorrtk0c <[email protected]>2022-04-19 12:36:02 -0700
committerrtk0c <[email protected]>2022-04-19 12:36:02 -0700
commit3290bb2b2dec223f0312c6d5fc3edf71d5d6e46f (patch)
tree1293b330f07ef410b1aea22e338c99c5ca07356b /source/Material.hpp
parent07e8754e4d799e44678b595177e79e6eaa621268 (diff)
Changeset: 12 Add hardcoded dependencies for IresManager, migrate Shader to Ires
Diffstat (limited to 'source/Material.hpp')
-rw-r--r--source/Material.hpp18
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;
};