[Bf-blender-cvs] [b07a6c20677] temp-gpu-image-engine: Remove repeat code from vert shader.

Jeroen Bakker noreply at git.blender.org
Fri Dec 3 11:12:48 CET 2021


Commit: b07a6c206771f6f9e7cee87013a68ce19400d763
Author: Jeroen Bakker
Date:   Fri Dec 3 11:09:08 2021 +0100
Branches: temp-gpu-image-engine
https://developer.blender.org/rBb07a6c206771f6f9e7cee87013a68ce19400d763

Remove repeat code from vert shader.

===================================================================

M	source/blender/draw/engines/image/shaders/engine_image_vert.glsl

===================================================================

diff --git a/source/blender/draw/engines/image/shaders/engine_image_vert.glsl b/source/blender/draw/engines/image/shaders/engine_image_vert.glsl
index 1314928098f..a86f7ef8b3b 100644
--- a/source/blender/draw/engines/image/shaders/engine_image_vert.glsl
+++ b/source/blender/draw/engines/image/shaders/engine_image_vert.glsl
@@ -6,6 +6,8 @@
 uniform int drawFlags;
 
 in vec3 pos;
+
+/* Normalized screen space uv coordinates. */
 out vec2 uvs;
 
 void main()
@@ -13,21 +15,14 @@ void main()
   /* `pos` contains the coordinates of a quad (-1..1). but we need the coordinates of an image
    * plane (0..1) */
   vec3 image_pos = pos * 0.5 + 0.5;
+  uvs = image_pos.xy;
 
-  if ((drawFlags & IMAGE_DRAW_FLAG_DO_REPEAT) != 0) {
-    gl_Position = vec4(pos.xy, IMAGE_Z_DEPTH, 1.0);
-    uvs = point_view_to_object(image_pos).xy;
-  }
-  else {
-    vec3 world_pos = point_object_to_world(image_pos);
-    vec4 position = point_world_to_ndc(world_pos);
-    /* Move drawn pixels to the front. In the overlay engine the depth is used
-     * to detect if a transparency texture or the background color should be drawn.
-     * Vertices are between 0.0 and 0.2, Edges between 0.2 and 0.4
-     * actual pixels are at 0.75, 1.0 is used for the background. */
-    position.z = IMAGE_Z_DEPTH;
-    gl_Position = position;
-    /* UDIM texture uses the world position for tile selection. */
-    uvs = image_pos.xy; 
-  }
+  vec3 world_pos = point_object_to_world(image_pos);
+  vec4 position = point_world_to_ndc(world_pos);
+  /* Move drawn pixels to the front. In the overlay engine the depth is used
+   * to detect if a transparency texture or the background color should be drawn.
+   * Vertices are between 0.0 and 0.2, Edges between 0.2 and 0.4
+   * actual pixels are at 0.75, 1.0 is used for the background. */
+  position.z = IMAGE_Z_DEPTH;
+  gl_Position = position;
 }



More information about the Bf-blender-cvs mailing list