diff options
author | Jeroen Bakker <jeroen@blender.org> | 2019-12-18 18:10:01 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2019-12-19 10:34:31 +0300 |
commit | 4440739699bb237da8126168117e501aec770e89 (patch) | |
tree | eb16398ad9d5b6ace12a7dfebae804c7e3c92f63 | |
parent | 0971f56bac242e983db4e089f11b2fd818a0b904 (diff) |
Fix T72236: UV Stretching Overlay
The ratio for area stretching was packed into an unsigned int, but could
contain negative numbers. This flipped the negative numbers to high
positive numbers and rendered the wrong color in the stretching overlay.
I can remember during {T63755} I had to flip the sign to get the
correct result, but couldn't find out why that was needed. Now I know.
Reviewed By: fclem, mano-wii
Differential Revision: https://developer.blender.org/D6440
-rw-r--r-- | source/blender/draw/intern/draw_cache_extract_mesh.c | 4 | ||||
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_2D_edituvs_stretch_vert.glsl | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/draw/intern/draw_cache_extract_mesh.c b/source/blender/draw/intern/draw_cache_extract_mesh.c index 7d0cb7c7076..4bd0aac1ecc 100644 --- a/source/blender/draw/intern/draw_cache_extract_mesh.c +++ b/source/blender/draw/intern/draw_cache_extract_mesh.c @@ -2721,7 +2721,7 @@ static void *extract_stretch_area_init(const MeshRenderData *mr, void *buf) { static GPUVertFormat format = {0}; if (format.attr_len == 0) { - GPU_vertformat_attr_add(&format, "ratio", GPU_COMP_U16, 1, GPU_FETCH_INT_TO_FLOAT_UNIT); + GPU_vertformat_attr_add(&format, "ratio", GPU_COMP_I16, 1, GPU_FETCH_INT_TO_FLOAT_UNIT); } GPUVertBuf *vbo = buf; @@ -2788,7 +2788,7 @@ static void mesh_stretch_area_finish(const MeshRenderData *mr, void *buf, void * /* Convert in place to avoid an extra allocation */ uint16_t *poly_stretch = (uint16_t *)area_ratio; for (int p = 0; p < mr->poly_len; p++) { - poly_stretch[p] = area_ratio[p] * 65534.0f; + poly_stretch[p] = area_ratio[p] * SHRT_MAX; } /* Copy face data for each loop. */ diff --git a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_stretch_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_stretch_vert.glsl index b0fa9eaed21..3254a7e1508 100644 --- a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_stretch_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_stretch_vert.glsl @@ -90,7 +90,7 @@ void main() stretch = stretch; stretch = 1.0 - stretch * stretch; #else - float stretch = 1.0 - area_ratio_to_stretch(ratio, totalAreaRatio, -totalAreaRatioInv); + float stretch = 1.0 - area_ratio_to_stretch(ratio, totalAreaRatio, totalAreaRatioInv); #endif |