From 4c856cc3c0425fef1d123fe846ab19fbb10ab6c6 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 21 Mar 2021 17:50:19 +0200 Subject: [PATCH] Add a collection parameter to RenderPass::set_material If the pass did not already have a shader, it will try to create one from the material and fail if it has no collection. --- source/materials/renderpass.cpp | 4 ++-- source/materials/renderpass.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/materials/renderpass.cpp b/source/materials/renderpass.cpp index 5ee50f8a..810b3673 100644 --- a/source/materials/renderpass.cpp +++ b/source/materials/renderpass.cpp @@ -117,11 +117,11 @@ const string &RenderPass::get_slotted_uniform_name(const string &slot) const return i->second; } -void RenderPass::set_material(const Material *mat) +void RenderPass::set_material(const Material *mat, DataFile::Collection *coll) { material = mat; material.keep(); - finalize_material(0); + finalize_material(coll); } void RenderPass::set_texture(unsigned index, const Texture *tex, const Sampler *samp) diff --git a/source/materials/renderpass.h b/source/materials/renderpass.h index 96b892df..b674945e 100644 --- a/source/materials/renderpass.h +++ b/source/materials/renderpass.h @@ -87,7 +87,7 @@ public: const Program *get_shader_program() const { return shprog.get(); } const ProgramData *get_shader_data() const { return shdata.get(); } const std::string &get_slotted_uniform_name(const std::string &) const; - void set_material(const Material *); + void set_material(const Material *, DataFile::Collection * = 0); const Material *get_material() const { return material.get(); } const std::string &get_material_slot_name() const { return material_slot; } void set_texture(unsigned, const Texture *, const Sampler * = 0); -- 2.43.0