Overlay: Port edit uv shaders to use shaderCreateInfo
This should have no functional changes.
This commit is contained in:
parent
237857cc26
commit
b95601fa1a
@ -1315,11 +1315,7 @@ GPUShader *OVERLAY_shader_edit_uv_edges_get(void)
|
||||
{
|
||||
OVERLAY_Shaders *sh_data = &e_data.sh_data[0];
|
||||
if (!sh_data->edit_uv_edges) {
|
||||
sh_data->edit_uv_edges = DRW_shader_create_with_shaderlib(datatoc_edit_uv_edges_vert_glsl,
|
||||
datatoc_edit_uv_edges_geom_glsl,
|
||||
datatoc_edit_uv_edges_frag_glsl,
|
||||
e_data.lib,
|
||||
NULL);
|
||||
sh_data->edit_uv_edges = GPU_shader_create_from_info_name("overlay_edit_uv_edges_select");
|
||||
}
|
||||
return sh_data->edit_uv_edges;
|
||||
}
|
||||
@ -1328,12 +1324,8 @@ GPUShader *OVERLAY_shader_edit_uv_edges_for_edge_select_get(void)
|
||||
{
|
||||
OVERLAY_Shaders *sh_data = &e_data.sh_data[0];
|
||||
if (!sh_data->edit_uv_edges_for_edge_select) {
|
||||
sh_data->edit_uv_edges_for_edge_select = DRW_shader_create_with_shaderlib(
|
||||
datatoc_edit_uv_edges_vert_glsl,
|
||||
datatoc_edit_uv_edges_geom_glsl,
|
||||
datatoc_edit_uv_edges_frag_glsl,
|
||||
e_data.lib,
|
||||
"#define USE_EDGE_SELECT\n");
|
||||
sh_data->edit_uv_edges_for_edge_select = GPU_shader_create_from_info_name(
|
||||
"overlay_edit_uv_edges");
|
||||
}
|
||||
return sh_data->edit_uv_edges_for_edge_select;
|
||||
}
|
||||
@ -1342,12 +1334,7 @@ GPUShader *OVERLAY_shader_edit_uv_face_get(void)
|
||||
{
|
||||
OVERLAY_Shaders *sh_data = &e_data.sh_data[0];
|
||||
if (!sh_data->edit_uv_faces) {
|
||||
sh_data->edit_uv_faces = DRW_shader_create_with_shaderlib(
|
||||
datatoc_edit_uv_faces_vert_glsl,
|
||||
NULL,
|
||||
datatoc_gpu_shader_flat_color_frag_glsl,
|
||||
e_data.lib,
|
||||
"#define blender_srgb_to_framebuffer_space(a) a\n");
|
||||
sh_data->edit_uv_faces = GPU_shader_create_from_info_name("overlay_edit_uv_faces");
|
||||
}
|
||||
return sh_data->edit_uv_faces;
|
||||
}
|
||||
@ -1356,12 +1343,7 @@ GPUShader *OVERLAY_shader_edit_uv_face_dots_get(void)
|
||||
{
|
||||
OVERLAY_Shaders *sh_data = &e_data.sh_data[0];
|
||||
if (!sh_data->edit_uv_face_dots) {
|
||||
sh_data->edit_uv_face_dots = DRW_shader_create_with_shaderlib(
|
||||
datatoc_edit_uv_face_dots_vert_glsl,
|
||||
NULL,
|
||||
datatoc_gpu_shader_flat_color_frag_glsl,
|
||||
e_data.lib,
|
||||
"#define blender_srgb_to_framebuffer_space(a) a\n");
|
||||
sh_data->edit_uv_face_dots = GPU_shader_create_from_info_name("overlay_edit_uv_face_dots");
|
||||
}
|
||||
return sh_data->edit_uv_face_dots;
|
||||
}
|
||||
@ -1370,8 +1352,7 @@ GPUShader *OVERLAY_shader_edit_uv_verts_get(void)
|
||||
{
|
||||
OVERLAY_Shaders *sh_data = &e_data.sh_data[0];
|
||||
if (!sh_data->edit_uv_verts) {
|
||||
sh_data->edit_uv_verts = DRW_shader_create_with_shaderlib(
|
||||
datatoc_edit_uv_verts_vert_glsl, NULL, datatoc_edit_uv_verts_frag_glsl, e_data.lib, NULL);
|
||||
sh_data->edit_uv_verts = GPU_shader_create_from_info_name("overlay_edit_uv_verts");
|
||||
}
|
||||
|
||||
return sh_data->edit_uv_verts;
|
||||
@ -1381,12 +1362,8 @@ GPUShader *OVERLAY_shader_edit_uv_stretching_area_get(void)
|
||||
{
|
||||
OVERLAY_Shaders *sh_data = &e_data.sh_data[0];
|
||||
if (!sh_data->edit_uv_stretching_area) {
|
||||
sh_data->edit_uv_stretching_area = DRW_shader_create_with_shaderlib(
|
||||
datatoc_edit_uv_stretching_vert_glsl,
|
||||
NULL,
|
||||
datatoc_gpu_shader_2D_smooth_color_frag_glsl,
|
||||
e_data.lib,
|
||||
"#define blender_srgb_to_framebuffer_space(a) a\n");
|
||||
sh_data->edit_uv_stretching_area = GPU_shader_create_from_info_name(
|
||||
"overlay_edit_uv_stretching_area");
|
||||
}
|
||||
|
||||
return sh_data->edit_uv_stretching_area;
|
||||
@ -1396,12 +1373,8 @@ GPUShader *OVERLAY_shader_edit_uv_stretching_angle_get(void)
|
||||
{
|
||||
OVERLAY_Shaders *sh_data = &e_data.sh_data[0];
|
||||
if (!sh_data->edit_uv_stretching_angle) {
|
||||
sh_data->edit_uv_stretching_angle = DRW_shader_create_with_shaderlib(
|
||||
datatoc_edit_uv_stretching_vert_glsl,
|
||||
NULL,
|
||||
datatoc_gpu_shader_2D_smooth_color_frag_glsl,
|
||||
e_data.lib,
|
||||
"#define blender_srgb_to_framebuffer_space(a) a\n#define STRETCH_ANGLE\n");
|
||||
sh_data->edit_uv_stretching_angle = GPU_shader_create_from_info_name(
|
||||
"overlay_edit_uv_stretching_angle");
|
||||
}
|
||||
|
||||
return sh_data->edit_uv_stretching_angle;
|
||||
@ -1411,12 +1384,8 @@ GPUShader *OVERLAY_shader_edit_uv_tiled_image_borders_get(void)
|
||||
{
|
||||
OVERLAY_Shaders *sh_data = &e_data.sh_data[0];
|
||||
if (!sh_data->edit_uv_tiled_image_borders) {
|
||||
sh_data->edit_uv_tiled_image_borders = DRW_shader_create_with_shaderlib(
|
||||
datatoc_edit_uv_tiled_image_borders_vert_glsl,
|
||||
NULL,
|
||||
datatoc_gpu_shader_uniform_color_frag_glsl,
|
||||
e_data.lib,
|
||||
"#define blender_srgb_to_framebuffer_space(a) a\n");
|
||||
sh_data->edit_uv_tiled_image_borders = GPU_shader_create_from_info_name(
|
||||
"overlay_edit_uv_tiled_image_borders");
|
||||
}
|
||||
return sh_data->edit_uv_tiled_image_borders;
|
||||
}
|
||||
|
@ -1,20 +1,5 @@
|
||||
#pragma BLENDER_REQUIRE(common_globals_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(common_overlay_lib.glsl)
|
||||
|
||||
uniform int lineStyle;
|
||||
uniform bool doSmoothWire;
|
||||
uniform float alpha;
|
||||
uniform float dashLength;
|
||||
|
||||
in float selectionFac_f;
|
||||
noperspective in float edgeCoord_f;
|
||||
noperspective in vec2 stipplePos_f;
|
||||
flat in vec2 stippleStart_f;
|
||||
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
|
||||
#define M_1_SQRTPI 0.5641895835477563 /* 1/sqrt(pi) */
|
||||
|
||||
/**
|
||||
* We want to know how much a pixel is covered by a line.
|
||||
* We replace the square pixel with acircle of the same area and try to find the intersection area.
|
||||
@ -22,6 +7,7 @@ layout(location = 0) out vec4 fragColor;
|
||||
* The formula for the area uses inverse trig function and is quite complexe. Instead,
|
||||
* we approximate it by using the smoothstep function and a 1.05 factor to the disc radius.
|
||||
*/
|
||||
#define M_1_SQRTPI 0.5641895835477563 /* 1/sqrt(pi) */
|
||||
#define DISC_RADIUS (M_1_SQRTPI * 1.05)
|
||||
#define GRID_LINE_SMOOTH_START (0.5 - DISC_RADIUS)
|
||||
#define GRID_LINE_SMOOTH_END (0.5 + DISC_RADIUS)
|
||||
@ -31,37 +17,37 @@ void main()
|
||||
vec4 inner_color = vec4(vec3(0.0), 1.0);
|
||||
vec4 outer_color = vec4(0.0);
|
||||
|
||||
vec2 dd = fwidth(stipplePos_f);
|
||||
float line_distance = distance(stipplePos_f, stippleStart_f) / max(dd.x, dd.y);
|
||||
vec2 dd = fwidth(geom_out.stipplePos);
|
||||
float line_distance = distance(geom_out.stipplePos, geom_out.stippleStart) / max(dd.x, dd.y);
|
||||
|
||||
if (lineStyle == OVERLAY_UV_LINE_STYLE_OUTLINE) {
|
||||
#ifdef USE_EDGE_SELECT
|
||||
/* TODO(@campbellbarton): The current wire-edit color contrast enough against the selection.
|
||||
* Look into changing the default theme color instead of reducing contrast with edge-select. */
|
||||
inner_color = (selectionFac_f != 0.0) ? colorEdgeSelect : (colorWireEdit * 0.5);
|
||||
inner_color = (geom_out.selectionFac != 0.0) ? colorEdgeSelect : (colorWireEdit * 0.5);
|
||||
#else
|
||||
inner_color = mix(colorWireEdit, colorEdgeSelect, selectionFac_f);
|
||||
inner_color = mix(colorWireEdit, colorEdgeSelect, geom_out.selectionFac);
|
||||
#endif
|
||||
outer_color = vec4(vec3(0.0), 1.0);
|
||||
}
|
||||
else if (lineStyle == OVERLAY_UV_LINE_STYLE_DASH) {
|
||||
if (fract(line_distance / dashLength) < 0.5) {
|
||||
inner_color = mix(vec4(vec3(0.35), 1.0), colorEdgeSelect, selectionFac_f);
|
||||
inner_color = mix(vec4(vec3(0.35), 1.0), colorEdgeSelect, geom_out.selectionFac);
|
||||
}
|
||||
}
|
||||
else if (lineStyle == OVERLAY_UV_LINE_STYLE_BLACK) {
|
||||
vec4 base_color = vec4(vec3(0.0), 1.0);
|
||||
inner_color = mix(base_color, colorEdgeSelect, selectionFac_f);
|
||||
inner_color = mix(base_color, colorEdgeSelect, geom_out.selectionFac);
|
||||
}
|
||||
else if (lineStyle == OVERLAY_UV_LINE_STYLE_WHITE) {
|
||||
vec4 base_color = vec4(1.0);
|
||||
inner_color = mix(base_color, colorEdgeSelect, selectionFac_f);
|
||||
inner_color = mix(base_color, colorEdgeSelect, geom_out.selectionFac);
|
||||
}
|
||||
else if (lineStyle == OVERLAY_UV_LINE_STYLE_SHADOW) {
|
||||
inner_color = colorUVShadow;
|
||||
}
|
||||
|
||||
float dist = abs(edgeCoord_f) - max(sizeEdge - 0.5, 0.0);
|
||||
float dist = abs(geom_out.edgeCoord) - max(sizeEdge - 0.5, 0.0);
|
||||
float dist_outer = dist - max(sizeEdge, 1.0);
|
||||
float mix_w;
|
||||
float mix_w_outer;
|
||||
|
@ -1,28 +1,15 @@
|
||||
#pragma BLENDER_REQUIRE(common_globals_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(common_overlay_lib.glsl)
|
||||
|
||||
layout(lines) in;
|
||||
layout(triangle_strip, max_vertices = 4) out;
|
||||
|
||||
in float selectionFac[2];
|
||||
flat in vec2 stippleStart[2];
|
||||
noperspective in vec2 stipplePos[2];
|
||||
|
||||
uniform int lineStyle;
|
||||
uniform bool doSmoothWire;
|
||||
|
||||
out float selectionFac_f;
|
||||
noperspective out float edgeCoord_f;
|
||||
noperspective out vec2 stipplePos_f;
|
||||
flat out vec2 stippleStart_f;
|
||||
|
||||
void do_vertex(
|
||||
vec4 pos, float selection_fac, vec2 stipple_start, vec2 stipple_pos, float coord, vec2 offset)
|
||||
{
|
||||
selectionFac_f = selection_fac;
|
||||
edgeCoord_f = coord;
|
||||
stippleStart_f = stipple_start;
|
||||
stipplePos_f = stipple_pos;
|
||||
geom_out.selectionFac = selection_fac;
|
||||
geom_out.edgeCoord = coord;
|
||||
geom_out.stippleStart = stipple_start;
|
||||
geom_out.stipplePos = stipple_pos;
|
||||
|
||||
gl_Position = pos;
|
||||
/* Multiply offset by 2 because gl_Position range is [-1..1]. */
|
||||
@ -52,20 +39,22 @@ void main()
|
||||
vec2 line = ss_pos[0] - ss_pos[1];
|
||||
vec2 line_dir = normalize(line);
|
||||
vec2 line_perp = vec2(-line_dir.y, line_dir.x);
|
||||
vec2 edge_ofs = line_perp * sizeViewportInv * ceil(half_size);
|
||||
vec2 edge_ofs = line_perp * drw_view.viewport_size_inverse * ceil(half_size);
|
||||
float selectFac0 = geom_in[0].selectionFac;
|
||||
float selectFac1 = geom_in[1].selectionFac;
|
||||
#ifdef USE_EDGE_SELECT
|
||||
/* No blending with edge selection. */
|
||||
float selectFac0 = selectionFac[0];
|
||||
float selectFac1 = selectionFac[0];
|
||||
#else
|
||||
float selectFac0 = selectionFac[0];
|
||||
float selectFac1 = selectionFac[1];
|
||||
selectFac1 = selectFac0;
|
||||
#endif
|
||||
|
||||
do_vertex(pos0, selectFac0, stippleStart[0], stipplePos[0], half_size, edge_ofs.xy);
|
||||
do_vertex(pos0, selectFac0, stippleStart[0], stipplePos[0], -half_size, -edge_ofs.xy);
|
||||
do_vertex(pos1, selectFac1, stippleStart[1], stipplePos[1], half_size, edge_ofs.xy);
|
||||
do_vertex(pos1, selectFac1, stippleStart[1], stipplePos[1], -half_size, -edge_ofs.xy);
|
||||
do_vertex(
|
||||
pos0, selectFac0, geom_in[0].stippleStart, geom_in[0].stipplePos, half_size, edge_ofs.xy);
|
||||
do_vertex(
|
||||
pos0, selectFac0, geom_in[0].stippleStart, geom_in[0].stipplePos, -half_size, -edge_ofs.xy);
|
||||
do_vertex(
|
||||
pos1, selectFac1, geom_in[1].stippleStart, geom_in[1].stipplePos, half_size, edge_ofs.xy);
|
||||
do_vertex(
|
||||
pos1, selectFac1, geom_in[1].stippleStart, geom_in[1].stipplePos, -half_size, -edge_ofs.xy);
|
||||
|
||||
EndPrimitive();
|
||||
}
|
||||
|
@ -1,21 +1,12 @@
|
||||
#pragma BLENDER_REQUIRE(common_globals_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
|
||||
|
||||
in vec3 pos;
|
||||
in vec2 au;
|
||||
in int flag;
|
||||
|
||||
out float selectionFac;
|
||||
noperspective out vec2 stipplePos;
|
||||
flat out vec2 stippleStart;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 world_pos = point_object_to_world(vec3(au, 0.0));
|
||||
gl_Position = point_world_to_ndc(world_pos);
|
||||
/* Snap vertices to the pixel grid to reduce artifacts. */
|
||||
vec2 half_viewport_res = sizeViewport.xy * 0.5;
|
||||
vec2 half_pixel_offset = sizeViewportInv * 0.5;
|
||||
vec2 half_viewport_res = drw_view.viewport_size * 0.5;
|
||||
vec2 half_pixel_offset = drw_view.viewport_size_inverse * 0.5;
|
||||
gl_Position.xy = floor(gl_Position.xy * half_viewport_res) / half_viewport_res +
|
||||
half_pixel_offset;
|
||||
|
||||
@ -24,7 +15,7 @@ void main()
|
||||
#else
|
||||
bool is_select = (flag & VERT_UV_SELECT) != 0;
|
||||
#endif
|
||||
selectionFac = is_select ? 1.0 : 0.0;
|
||||
geom_in.selectionFac = is_select ? 1.0 : 0.0;
|
||||
/* Move selected edges to the top
|
||||
* 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. */
|
||||
@ -32,5 +23,5 @@ void main()
|
||||
gl_Position.z = depth;
|
||||
|
||||
/* Avoid precision loss. */
|
||||
stippleStart = stipplePos = 500.0 + 500.0 * (gl_Position.xy / gl_Position.w);
|
||||
geom_in.stippleStart = geom_in.stipplePos = 500.0 + 500.0 * (gl_Position.xy / gl_Position.w);
|
||||
}
|
||||
|
@ -1,13 +1,5 @@
|
||||
#pragma BLENDER_REQUIRE(common_globals_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
|
||||
|
||||
uniform float pointSize;
|
||||
|
||||
in vec2 au;
|
||||
in int flag;
|
||||
|
||||
flat out vec4 finalColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 world_pos = point_object_to_world(vec3(au, 0.0));
|
||||
|
@ -1,13 +1,5 @@
|
||||
#pragma BLENDER_REQUIRE(common_globals_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
|
||||
|
||||
uniform float uvOpacity;
|
||||
|
||||
in vec2 au;
|
||||
in int flag;
|
||||
|
||||
flat out vec4 finalColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 world_pos = point_object_to_world(vec3(au, 0.0));
|
||||
|
@ -1,21 +1,5 @@
|
||||
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
|
||||
|
||||
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;
|
||||
|
@ -1,9 +1,4 @@
|
||||
|
||||
in vec4 outlineColor;
|
||||
in vec4 radii;
|
||||
in vec4 fillColor;
|
||||
out vec4 fragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
float dist = length(gl_PointCoord - vec2(0.5));
|
||||
|
@ -1,17 +1,5 @@
|
||||
#pragma BLENDER_REQUIRE(common_globals_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
|
||||
|
||||
uniform float pointSize;
|
||||
uniform float outlineWidth;
|
||||
uniform vec4 color;
|
||||
|
||||
in vec2 au;
|
||||
in int flag;
|
||||
|
||||
out vec4 fillColor;
|
||||
out vec4 outlineColor;
|
||||
out vec4 radii;
|
||||
|
||||
/* TODO: Theme? */
|
||||
const vec4 pinned_col = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
|
||||
|
@ -2,12 +2,15 @@
|
||||
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_edit_flat_color_iface, "").flat(Type::VEC4, "finalColor");
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_edit_nopersp_color_iface, "")
|
||||
.no_perspective(Type::VEC4, "finalColor");
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Edit Mesh
|
||||
* \{ */
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_edit_mesh_color_iface, "").flat(Type::VEC4, "finalColor");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_edit_mesh_common)
|
||||
.define("blender_srgb_to_framebuffer_space(a)", "a")
|
||||
.sampler(0, ImageType::DEPTH_2D, "depthTex")
|
||||
@ -71,7 +74,7 @@ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_face)
|
||||
.vertex_in(0, Type::VEC3, "pos")
|
||||
.vertex_in(1, Type::IVEC4, "data")
|
||||
.vertex_in(2, Type::VEC3, "vnor")
|
||||
.vertex_out(overlay_edit_mesh_color_iface)
|
||||
.vertex_out(overlay_edit_flat_color_iface)
|
||||
.fragment_source("gpu_shader_3D_smooth_color_frag.glsl")
|
||||
.additional_info("overlay_edit_mesh_common");
|
||||
|
||||
@ -82,7 +85,7 @@ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_facedot)
|
||||
.vertex_in(1, Type::IVEC4, "data")
|
||||
.vertex_in(2, Type::VEC4, "norAndFlag")
|
||||
.define("vnor", "norAndFlag.xyz")
|
||||
.vertex_out(overlay_edit_mesh_color_iface)
|
||||
.vertex_out(overlay_edit_flat_color_iface)
|
||||
.fragment_source("gpu_shader_point_varying_color_frag.glsl")
|
||||
.additional_info("overlay_edit_mesh_common");
|
||||
|
||||
@ -98,7 +101,7 @@ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_normal)
|
||||
.push_constant(Type::FLOAT, "normalScreenSize")
|
||||
.push_constant(Type::FLOAT, "alpha")
|
||||
.push_constant(Type::BOOL, "isConstantScreenSizeNormals")
|
||||
.vertex_out(overlay_edit_mesh_color_iface)
|
||||
.vertex_out(overlay_edit_flat_color_iface)
|
||||
.fragment_out(0, Type::VEC4, "fragColor")
|
||||
.vertex_source("edit_mesh_normal_vert.glsl")
|
||||
.fragment_source("gpu_shader_flat_color_frag.glsl")
|
||||
@ -123,7 +126,7 @@ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_skin_root)
|
||||
.vertex_in(0, Type::VEC3, "pos")
|
||||
.vertex_in(1, Type::FLOAT, "size")
|
||||
.vertex_in(2, Type::VEC3, "local_pos")
|
||||
.vertex_out(overlay_edit_mesh_color_iface)
|
||||
.vertex_out(overlay_edit_flat_color_iface)
|
||||
.fragment_out(0, Type::VEC4, "fragColor")
|
||||
.vertex_source("edit_mesh_skin_root_vert.glsl")
|
||||
.fragment_source("gpu_shader_flat_color_frag.glsl")
|
||||
@ -162,3 +165,130 @@ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_skin_root_clipped)
|
||||
.additional_info("overlay_edit_mesh_skin_root", "drw_clipped");
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Edit UV
|
||||
* \{ */
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_edit_uv_iface, "geom_in")
|
||||
.smooth(Type::FLOAT, "selectionFac")
|
||||
.no_perspective(Type::VEC2, "stipplePos")
|
||||
.flat(Type::VEC2, "stippleStart");
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_edit_uv_geom_iface, "geom_out")
|
||||
.smooth(Type::FLOAT, "selectionFac")
|
||||
.no_perspective(Type::FLOAT, "edgeCoord")
|
||||
.no_perspective(Type::VEC2, "stipplePos")
|
||||
.flat(Type::VEC2, "stippleStart");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges)
|
||||
.do_static_compilation(true)
|
||||
.vertex_in(0, Type::VEC2, "au")
|
||||
.vertex_in(1, Type::INT, "flag")
|
||||
.vertex_out(overlay_edit_uv_iface)
|
||||
.geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4)
|
||||
.geometry_out(overlay_edit_uv_geom_iface)
|
||||
.push_constant(Type::INT, "lineStyle")
|
||||
.push_constant(Type::BOOL, "doSmoothWire")
|
||||
.push_constant(Type::FLOAT, "alpha")
|
||||
.push_constant(Type::FLOAT, "dashLength")
|
||||
.fragment_out(0, Type::VEC4, "fragColor")
|
||||
.vertex_source("edit_uv_edges_vert.glsl")
|
||||
.geometry_source("edit_uv_edges_geom.glsl")
|
||||
.fragment_source("edit_uv_edges_frag.glsl")
|
||||
.additional_info("draw_mesh", "draw_globals");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges_select)
|
||||
.do_static_compilation(true)
|
||||
.define("USE_EDGE_SELECT")
|
||||
.additional_info("overlay_edit_uv_edges");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_edit_uv_faces)
|
||||
.do_static_compilation(true)
|
||||
/* NOTE: Color already in Linear space. Which is what we want. */
|
||||
.define("srgbTarget", "false")
|
||||
.vertex_in(0, Type::VEC2, "au")
|
||||
.vertex_in(1, Type::INT, "flag")
|
||||
.push_constant(Type::FLOAT, "uvOpacity")
|
||||
.vertex_out(overlay_edit_flat_color_iface)
|
||||
.fragment_out(0, Type::VEC4, "fragColor")
|
||||
.vertex_source("edit_uv_faces_vert.glsl")
|
||||
.fragment_source("gpu_shader_flat_color_frag.glsl")
|
||||
.additional_info("draw_mesh", "draw_globals");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_edit_uv_face_dots)
|
||||
.do_static_compilation(true)
|
||||
/* NOTE: Color already in Linear space. Which is what we want. */
|
||||
.define("srgbTarget", "false")
|
||||
.vertex_in(0, Type::VEC2, "au")
|
||||
.vertex_in(1, Type::INT, "flag")
|
||||
.push_constant(Type::FLOAT, "pointSize")
|
||||
.vertex_out(overlay_edit_flat_color_iface)
|
||||
.fragment_out(0, Type::VEC4, "fragColor")
|
||||
.vertex_source("edit_uv_face_dots_vert.glsl")
|
||||
.fragment_source("gpu_shader_flat_color_frag.glsl")
|
||||
.additional_info("draw_mesh", "draw_globals");
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_edit_uv_vert_iface, "")
|
||||
.smooth(Type::VEC4, "fillColor")
|
||||
.smooth(Type::VEC4, "outlineColor")
|
||||
.smooth(Type::VEC4, "radii");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_edit_uv_verts)
|
||||
.do_static_compilation(true)
|
||||
/* NOTE: Color already in Linear space. Which is what we want. */
|
||||
.define("srgbTarget", "false")
|
||||
.vertex_in(0, Type::VEC2, "au")
|
||||
.vertex_in(1, Type::INT, "flag")
|
||||
.push_constant(Type::FLOAT, "pointSize")
|
||||
.push_constant(Type::FLOAT, "outlineWidth")
|
||||
.push_constant(Type::VEC4, "color")
|
||||
.vertex_out(overlay_edit_uv_vert_iface)
|
||||
.fragment_out(0, Type::VEC4, "fragColor")
|
||||
.vertex_source("edit_uv_verts_vert.glsl")
|
||||
.fragment_source("edit_uv_verts_frag.glsl")
|
||||
.additional_info("draw_mesh", "draw_globals");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_edit_uv_tiled_image_borders)
|
||||
.do_static_compilation(true)
|
||||
/* NOTE: Color already in Linear space. Which is what we want. */
|
||||
.define("srgbTarget", "false")
|
||||
.vertex_in(0, Type::VEC3, "pos")
|
||||
.push_constant(Type::VEC4, "color")
|
||||
.fragment_out(0, Type::VEC4, "fragColor")
|
||||
.vertex_source("edit_uv_tiled_image_borders_vert.glsl")
|
||||
.fragment_source("gpu_shader_uniform_color_frag.glsl")
|
||||
.additional_info("draw_mesh");
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name UV Stretching
|
||||
* \{ */
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_edit_uv_stretching)
|
||||
/* NOTE: Color already in Linear space. Which is what we want. */
|
||||
.define("srgbTarget", "false")
|
||||
.vertex_in(0, Type::VEC2, "pos")
|
||||
.push_constant(Type::VEC2, "aspect")
|
||||
.vertex_out(overlay_edit_nopersp_color_iface)
|
||||
.fragment_out(0, Type::VEC4, "fragColor")
|
||||
.vertex_source("edit_uv_stretching_vert.glsl")
|
||||
.fragment_source("gpu_shader_2D_smooth_color_frag.glsl")
|
||||
.additional_info("draw_mesh", "draw_globals");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_edit_uv_stretching_area)
|
||||
.do_static_compilation(true)
|
||||
.vertex_in(1, Type::FLOAT, "ratio")
|
||||
.push_constant(Type::FLOAT, "totalAreaRatio")
|
||||
.push_constant(Type::FLOAT, "totalAreaRatioInv")
|
||||
.additional_info("overlay_edit_uv_stretching");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_edit_uv_stretching_angle)
|
||||
.do_static_compilation(true)
|
||||
.define("STRETCH_ANGLE")
|
||||
.vertex_in(1, Type::VEC2, "uv_angles")
|
||||
.vertex_in(2, Type::FLOAT, "angle")
|
||||
.additional_info("overlay_edit_uv_stretching");
|
||||
|
||||
/** \} */
|
||||
|
@ -1,5 +1,9 @@
|
||||
#define COMMON_GLOBALS_LIB
|
||||
|
||||
#ifdef USE_GPU_SHADER_CREATE_INFO
|
||||
#error "Use draw_globals as additional_info instead of common_globals_lib.glsl"
|
||||
#endif
|
||||
|
||||
/* keep in sync with GlobalsUboStorage */
|
||||
layout(std140) uniform globalsBlock
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user