From 165048ded469d04f29999a277caa2b54b91aa9c0 Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 16 Feb 2022 20:48:55 +0100 Subject: [PATCH] Get the dimensions from the texture instead of the image in texture_get_uv_rect of the material cache. This fixes some of the uv related issues on the webgl backend. --- material_cache/prop_material_cache_pcm.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/material_cache/prop_material_cache_pcm.cpp b/material_cache/prop_material_cache_pcm.cpp index 2dbb909..0b37018 100644 --- a/material_cache/prop_material_cache_pcm.cpp +++ b/material_cache/prop_material_cache_pcm.cpp @@ -93,8 +93,8 @@ Rect2 PropMaterialCachePCM::texture_get_uv_rect(const Ref &texture) { return Rect2(0, 0, 1, 1); } - float w = image->get_width(); - float h = image->get_height(); + float w = tex->get_width(); + float h = tex->get_height(); region.position = Size2(region.position.x / w, region.position.y / h); region.size = Size2(region.size.x / w, region.size.y / h);