Fix textured decal on android

This commit is contained in:
luboslenco
2023-03-14 20:05:27 +01:00
parent 34c316b8f8
commit 0d2d199edd
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -263,7 +263,7 @@ class MakePaint {
frag.add_uniform('sampler2D texbrushstencil', '_texbrushstencil');
frag.add_uniform('vec4 stencilTransform', '_stencilTransform');
frag.write('vec2 stencil_uv = vec2((sp.xy - stencilTransform.xy) / stencilTransform.z * vec2(aspectRatio, 1.0));');
frag.write('vec2 stencil_size = textureSize(texbrushstencil, 0);');
frag.write('vec2 stencil_size = vec2(textureSize(texbrushstencil, 0));');
frag.write('float stencil_ratio = stencil_size.y / stencil_size.x;');
frag.write('stencil_uv -= vec2(0.5 / stencil_ratio, 0.5);');
frag.write('stencil_uv = vec2(stencil_uv.x * cos(stencilTransform.w) - stencil_uv.y * sin(stencilTransform.w),
+1 -1
View File
@@ -1768,7 +1768,7 @@ class MaterialParser {
var tex_store = store_var_name(node);
if (sample_keep_aspect) {
curshader.write('vec2 ${tex_store}_size = textureSize($tex_name, 0);');
curshader.write('vec2 ${tex_store}_size = vec2(textureSize($tex_name, 0));');
curshader.write('float ${tex_store}_ax = ${tex_store}_size.x / ${tex_store}_size.y;');
curshader.write('float ${tex_store}_ay = ${tex_store}_size.y / ${tex_store}_size.x;');
curshader.write('vec2 ${tex_store}_uv = ((${uv_name}.xy / ${sample_uv_scale} - vec2(0.5, 0.5)) * vec2(max(${tex_store}_ay, 1.0), max(${tex_store}_ax, 1.0))) + vec2(0.5, 0.5);');