diff options
Diffstat (limited to 'source/blender/gpu/shaders')
6 files changed, 0 insertions, 255 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_frag.glsl b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_frag.glsl deleted file mode 100644 index 108fc85c4a5..00000000000 --- a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_frag.glsl +++ /dev/null @@ -1,30 +0,0 @@ - - -uniform float dashWidth; - -#ifdef SMOOTH_COLOR -noperspective in vec4 finalColor; -#else -flat in vec4 finalColor; -#endif - -noperspective in vec2 stipple_pos; -flat in vec2 stipple_start; - -out vec4 fragColor; - -void main() -{ - fragColor = finalColor; - - /* Avoid passing viewport size */ - vec2 dd = fwidth(stipple_pos); - - float dist = distance(stipple_start, stipple_pos) / max(dd.x, dd.y); - - if (fract(dist / dashWidth) > 0.5) { - fragColor.rgb = vec3(0.0); - } - - fragColor = blender_srgb_to_framebuffer_space(fragColor); -} diff --git a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_vert.glsl deleted file mode 100644 index 69fe5c93a61..00000000000 --- a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_vert.glsl +++ /dev/null @@ -1,38 +0,0 @@ - -uniform mat4 ModelViewProjectionMatrix; -uniform vec4 edgeColor; -uniform vec4 selectColor; - -in vec2 pos; -in int flag; - -#ifdef SMOOTH_COLOR -noperspective out vec4 finalColor; -#else -flat out vec4 finalColor; -#endif - -noperspective out vec2 stipple_pos; -flat out vec2 stipple_start; - -/* TODO: Port drawing to draw manager and - * remove constants duplications. */ -#define VERT_UV_SELECT (1 << 3) -#define EDGE_UV_SELECT (1 << 5) - -void main() -{ -#ifdef SMOOTH_COLOR - bool is_select = (flag & VERT_UV_SELECT) != 0; -#else - bool is_select = (flag & EDGE_UV_SELECT) != 0; -#endif - - gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0); - gl_Position.z = float(!is_select); - - /* Avoid precision loss. */ - stipple_start = stipple_pos = 500.0 + 500.0 * (gl_Position.xy / gl_Position.w); - - finalColor = (is_select) ? selectColor : edgeColor; -} diff --git a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_facedots_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_facedots_vert.glsl deleted file mode 100644 index 7a94fc088c4..00000000000 --- a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_facedots_vert.glsl +++ /dev/null @@ -1,19 +0,0 @@ - -uniform mat4 ModelViewProjectionMatrix; -uniform vec4 vertColor; -uniform vec4 selectColor; - -in vec2 pos; -in int flag; - -out vec4 finalColor; - -/* TODO: Port drawing to draw manager and - * remove constants duplications. */ -#define FACE_UV_SELECT (1 << 7) - -void main() -{ - gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0); - finalColor = ((flag & FACE_UV_SELECT) != 0) ? selectColor : vertColor; -} diff --git a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_faces_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_faces_vert.glsl deleted file mode 100644 index 6fc41271cf5..00000000000 --- a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_faces_vert.glsl +++ /dev/null @@ -1,26 +0,0 @@ - -uniform mat4 ModelViewProjectionMatrix; -uniform vec4 faceColor; -uniform vec4 selectColor; -uniform vec4 activeColor; - -in vec2 pos; -in int flag; - -flat out vec4 finalColor; - -/* TODO: Port drawing to draw manager and - * remove constants duplications. */ -#define FACE_UV_ACTIVE (1 << 6) -#define FACE_UV_SELECT (1 << 7) - -void main() -{ - gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0); - - bool is_selected = (flag & FACE_UV_SELECT) != 0; - bool is_active = (flag & FACE_UV_ACTIVE) != 0; - - finalColor = (is_selected) ? selectColor : faceColor; - finalColor = (is_active) ? activeColor : finalColor; -} diff --git a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_points_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_points_vert.glsl deleted file mode 100644 index bec565be1df..00000000000 --- a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_points_vert.glsl +++ /dev/null @@ -1,44 +0,0 @@ - -uniform mat4 ModelViewProjectionMatrix; -uniform vec4 vertColor; -uniform vec4 selectColor; -uniform vec4 pinnedColor; -uniform float pointSize; -uniform float outlineWidth; - -in vec2 pos; -in int flag; - -out vec4 fillColor; -out vec4 outlineColor; -out vec4 radii; - -/* TODO: Port drawing to draw manager and - * remove constants duplications. */ -#define VERT_UV_SELECT (1 << 3) -#define VERT_UV_PINNED (1 << 4) - -void main() -{ - gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0); - gl_PointSize = pointSize; - - bool is_selected = (flag & VERT_UV_SELECT) != 0; - bool is_pinned = (flag & VERT_UV_PINNED) != 0; - - vec4 deselect_col = (is_pinned) ? pinnedColor : vertColor; - fillColor = (is_selected) ? selectColor : deselect_col; - outlineColor = (is_pinned) ? pinnedColor : vec4(fillColor.rgb, 0.0); - - /* Calculate concentric radii in pixels. */ - float radius = 0.5 * pointSize; - - /* Start at the outside and progress toward the center. */ - radii[0] = radius; - radii[1] = radius - 1.0; - radii[2] = radius - outlineWidth; - radii[3] = radius - outlineWidth - 1.0; - - /* Convert to PointCoord units. */ - radii /= pointSize; -} 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 deleted file mode 100644 index 3254a7e1508..00000000000 --- a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_stretch_vert.glsl +++ /dev/null @@ -1,98 +0,0 @@ - -uniform mat4 ModelViewProjectionMatrix; -uniform vec2 aspect; - -in vec2 pos; - -#ifdef STRETCH_ANGLE -in vec2 uv_angles; -in float angle; - -#else -in float ratio; -uniform float totalAreaRatio; -uniform float totalAreaRatioInv; - -#endif - -noperspective out vec4 finalColor; - -vec3 weight_to_rgb(float weight) -{ - vec3 r_rgb; - float blend = ((weight / 2.0) + 0.5); - - if (weight <= 0.25) { /* blue->cyan */ - r_rgb[0] = 0.0; - r_rgb[1] = blend * weight * 4.0; - r_rgb[2] = blend; - } - else if (weight <= 0.50) { /* cyan->green */ - r_rgb[0] = 0.0; - r_rgb[1] = blend; - r_rgb[2] = blend * (1.0 - ((weight - 0.25) * 4.0)); - } - else if (weight <= 0.75) { /* green->yellow */ - r_rgb[0] = blend * ((weight - 0.50) * 4.0); - r_rgb[1] = blend; - r_rgb[2] = 0.0; - } - else if (weight <= 1.0) { /* yellow->red */ - r_rgb[0] = blend; - r_rgb[1] = blend * (1.0 - ((weight - 0.75) * 4.0)); - r_rgb[2] = 0.0; - } - else { - /* exceptional value, unclamped or nan, - * avoid uninitialized memory use */ - r_rgb[0] = 1.0; - r_rgb[1] = 0.0; - r_rgb[2] = 1.0; - } - - return r_rgb; -} - -#define M_PI 3.1415926535897932 - -vec2 angle_to_v2(float angle) -{ - return vec2(cos(angle), sin(angle)); -} - -/* Adapted from BLI_math_vector.h */ -float angle_normalized_v2v2(vec2 v1, vec2 v2) -{ - v1 = normalize(v1 * aspect); - v2 = normalize(v2 * aspect); - /* this is the same as acos(dot_v3v3(v1, v2)), but more accurate */ - bool q = (dot(v1, v2) >= 0.0); - vec2 v = (q) ? (v1 - v2) : (v1 + v2); - float a = 2.0 * asin(length(v) / 2.0); - return (q) ? a : M_PI - a; -} - -float area_ratio_to_stretch(float ratio, float tot_ratio, float inv_tot_ratio) -{ - ratio *= (ratio > 0.0f) ? tot_ratio : -inv_tot_ratio; - return (ratio > 1.0f) ? (1.0f / ratio) : ratio; -} - -void main() -{ - gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0); - -#ifdef STRETCH_ANGLE - vec2 v1 = angle_to_v2(uv_angles.x * M_PI); - vec2 v2 = angle_to_v2(uv_angles.y * M_PI); - float uv_angle = angle_normalized_v2v2(v1, v2) / M_PI; - float stretch = 1.0 - abs(uv_angle - angle); - stretch = stretch; - stretch = 1.0 - stretch * stretch; -#else - float stretch = 1.0 - area_ratio_to_stretch(ratio, totalAreaRatio, totalAreaRatioInv); - -#endif - - finalColor = vec4(weight_to_rgb(stretch), 1.0); -} |