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.

This commit is contained in:
Relintai 2022-02-16 20:48:55 +01:00
parent 401666b560
commit 165048ded4

View File

@ -93,8 +93,8 @@ Rect2 PropMaterialCachePCM::texture_get_uv_rect(const Ref<Texture> &texture) {
return Rect2(0, 0, 1, 1); return Rect2(0, 0, 1, 1);
} }
float w = image->get_width(); float w = tex->get_width();
float h = image->get_height(); float h = tex->get_height();
region.position = Size2(region.position.x / w, region.position.y / h); region.position = Size2(region.position.x / w, region.position.y / h);
region.size = Size2(region.size.x / w, region.size.y / h); region.size = Size2(region.size.x / w, region.size.y / h);