| … | … | @@ -92,6 +92,14 @@ int VirtualTexture::get_mip_levels() const { return _mip_levels; } |
| 92 | 92 | // ── Texture registration ────────────────────────────────────────────────────── |
| 93 | 93 | |
| 94 | 94 | int VirtualTexture::register_texture(const String &name, int width, int height) { |
| 95 | // Dedup: return existing ID if already registered with same name | |
| 96 | for (auto &tex : _textures) { | |
| 97 | if (tex.active && tex.name == name) { | |
| 98 | UtilityFunctions::print("VirtualTexture: Reusing texture '", name, "' id=", tex.id); | |
| 99 | return tex.id; | |
| 100 | } | |
| 101 | } | |
| 102 | ||
| 95 | 103 | int id = _next_texture_id++; |
| 96 | 104 | RegisteredTexture tex; |
| 97 | 105 | tex.id = id; |