From: Mikko Rasa Date: Fri, 14 Jul 2023 21:10:00 +0000 (+0300) Subject: Rename Text::texture_slot to texture_tag X-Git-Url: https://git.tdb.fi/?a=commitdiff_plain;h=baa38da7f7fade7e4c5db47932406f0fff444d0a;p=libs%2Fgl.git Rename Text::texture_slot to texture_tag It refers to the actual binding, so calling it a slot can be confusing. --- diff --git a/source/render/text.cpp b/source/render/text.cpp index a51d2cf1..184865e1 100644 --- a/source/render/text.cpp +++ b/source/render/text.cpp @@ -10,40 +10,40 @@ using namespace std; namespace Msp { namespace GL { -Text::Text(const Font &f, const Technique *tech, Tag tex_slot): +Text::Text(const Font &f, const Technique *tech, Tag tex_tag): ObjectInstance(object), font(f), mesh((TEXCOORD2, VERTEX2)) { object.set_mesh(&mesh); if(tech) - set_technique(tech, tex_slot); + set_technique(tech, tex_tag); } -void Text::set_technique(const Technique *tech, Tag tex_slot) +void Text::set_technique(const Technique *tech, Tag tex_tag) { if(tech) { - if(!tex_slot.id && tech->has_method(Tag())) + if(!tex_tag.id && tech->has_method(Tag())) if(const Program *shprog = tech->get_method(Tag()).get_shader_program()) { if(shprog->get_uniform_location(Tag("font_tex"))>=0) - tex_slot = "font_tex"; + tex_tag = "font_tex"; else if(shprog->get_uniform_location(Tag("color_tex"))>=0) - tex_slot = "color_tex"; + tex_tag = "color_tex"; else if(shprog->get_uniform_location(Tag("diffuse_map"))>=0) - tex_slot = "diffuse_map"; + tex_tag = "diffuse_map"; else if(shprog->get_uniform_location(Tag("base_color_map"))>=0) - tex_slot = "base_color_map"; + tex_tag = "base_color_map"; } object.set_technique(tech); - texture_slot = tex_slot; + texture_tag = tex_tag; } else { object.set_technique(0); - texture_slot = Tag(); + texture_tag = Tag(); } } @@ -109,7 +109,7 @@ void Text::set_alignment(float h, float v) void Text::setup_render(Renderer &renderer, Tag tag) const { ObjectInstance::setup_render(renderer, tag); - renderer.set_texture(texture_slot, &font.get_texture()); + renderer.set_texture(texture_tag, &font.get_texture()); } } // namespace GL diff --git a/source/render/text.h b/source/render/text.h index 2276b862..aa98cc96 100644 --- a/source/render/text.h +++ b/source/render/text.h @@ -41,7 +41,7 @@ private: const Font &font; Mesh mesh; Object object; - Tag texture_slot; + Tag texture_tag; float horz_align = 0.0f; float vert_offset = 0.0f; float width = 0.0f;