From: Mikko Rasa Date: Fri, 14 Jul 2023 21:08:28 +0000 (+0300) Subject: Add getters for textures and samplers in RenderMethod X-Git-Url: https://git.tdb.fi/?a=commitdiff_plain;h=68a5c400f14fcca2ee7edd0787114cf97df45e37;p=libs%2Fgl.git Add getters for textures and samplers in RenderMethod --- diff --git a/source/materials/rendermethod.cpp b/source/materials/rendermethod.cpp index 9e9a477e..e489dbe7 100644 --- a/source/materials/rendermethod.cpp +++ b/source/materials/rendermethod.cpp @@ -98,6 +98,18 @@ Tag RenderMethod::get_texture_tag(const string &slot) const return (i!=textures.end() ? i->tag : Tag()); } +const Texture *RenderMethod::get_texture(Tag tag) const +{ + auto i = find_member(textures, tag, &TextureSlot::tag); + return (i!=textures.end() ? i->texture : nullptr); +} + +const Sampler *RenderMethod::get_sampler(Tag tag) const +{ + auto i = find_member(textures, tag, &TextureSlot::tag); + return (i!=textures.end() ? i->sampler : nullptr); +} + void RenderMethod::set_face_cull(CullMode fc) { face_cull = fc; diff --git a/source/materials/rendermethod.h b/source/materials/rendermethod.h index d8d8b4c7..b3140dd3 100644 --- a/source/materials/rendermethod.h +++ b/source/materials/rendermethod.h @@ -111,6 +111,8 @@ public: const std::string &get_material_slot_name() const { return material_slot; } void set_texture(Tag, const Texture *, const Sampler * = 0); Tag get_texture_tag(const std::string &) const; + const Texture *get_texture(Tag) const; + const Sampler *get_sampler(Tag) const; void set_face_cull(CullMode); CullMode get_face_cull() const { return face_cull; } void set_blend(const Blend &);