Overlay: Port edit lattice shaders to use shaderCreateInfo
This should have no functional changes.
This commit is contained in:
@@ -508,18 +508,10 @@ GPUShader *OVERLAY_shader_edit_gpencil_wire(void)
|
||||
GPUShader *OVERLAY_shader_edit_lattice_point(void)
|
||||
{
|
||||
const DRWContextState *draw_ctx = DRW_context_state_get();
|
||||
const GPUShaderConfigData *sh_cfg = &GPU_shader_cfg_data[draw_ctx->sh_cfg];
|
||||
OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg];
|
||||
if (!sh_data->edit_lattice_point) {
|
||||
sh_data->edit_lattice_point = GPU_shader_create_from_arrays({
|
||||
.vert = (const char *[]){sh_cfg->lib,
|
||||
datatoc_common_globals_lib_glsl,
|
||||
datatoc_common_view_lib_glsl,
|
||||
datatoc_edit_lattice_point_vert_glsl,
|
||||
NULL},
|
||||
.frag = (const char *[]){datatoc_gpu_shader_point_varying_color_frag_glsl, NULL},
|
||||
.defs = (const char *[]){sh_cfg->def, NULL},
|
||||
});
|
||||
sh_data->edit_lattice_point = GPU_shader_create_from_info_name(
|
||||
draw_ctx->sh_cfg ? "overlay_edit_lattice_point_clipped" : "overlay_edit_lattice_point");
|
||||
}
|
||||
return sh_data->edit_lattice_point;
|
||||
}
|
||||
@@ -527,18 +519,10 @@ GPUShader *OVERLAY_shader_edit_lattice_point(void)
|
||||
GPUShader *OVERLAY_shader_edit_lattice_wire(void)
|
||||
{
|
||||
const DRWContextState *draw_ctx = DRW_context_state_get();
|
||||
const GPUShaderConfigData *sh_cfg = &GPU_shader_cfg_data[draw_ctx->sh_cfg];
|
||||
OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg];
|
||||
if (!sh_data->edit_lattice_wire) {
|
||||
sh_data->edit_lattice_wire = GPU_shader_create_from_arrays({
|
||||
.vert = (const char *[]){sh_cfg->lib,
|
||||
datatoc_common_globals_lib_glsl,
|
||||
datatoc_common_view_lib_glsl,
|
||||
datatoc_edit_lattice_wire_vert_glsl,
|
||||
NULL},
|
||||
.frag = (const char *[]){datatoc_gpu_shader_3D_smooth_color_frag_glsl, NULL},
|
||||
.defs = (const char *[]){sh_cfg->def, NULL},
|
||||
});
|
||||
sh_data->edit_lattice_wire = GPU_shader_create_from_info_name(
|
||||
draw_ctx->sh_cfg ? "overlay_edit_lattice_wire_clipped" : "overlay_edit_lattice_wire");
|
||||
}
|
||||
return sh_data->edit_lattice_wire;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
|
||||
in vec3 pos;
|
||||
in int data;
|
||||
|
||||
out vec4 finalColor;
|
||||
#pragma BLENDER_REQUIRE(common_view_clipping_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
|
||||
|
||||
void main()
|
||||
{
|
||||
@@ -26,7 +24,5 @@ void main()
|
||||
|
||||
gl_PointSize = sizeVertex * 2.0;
|
||||
|
||||
#ifdef USE_WORLD_CLIP_PLANES
|
||||
world_clip_planes_calc_clip_distance(world_pos);
|
||||
#endif
|
||||
view_clipping_distances(world_pos);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
|
||||
uniform sampler1D weightTex;
|
||||
|
||||
in vec3 pos;
|
||||
in float weight;
|
||||
|
||||
out vec4 finalColor;
|
||||
#pragma BLENDER_REQUIRE(common_view_clipping_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
|
||||
|
||||
#define no_active_weight 666.0
|
||||
|
||||
@@ -32,7 +28,5 @@ void main()
|
||||
vec3 world_pos = point_object_to_world(pos);
|
||||
gl_Position = point_world_to_ndc(world_pos);
|
||||
|
||||
#ifdef USE_WORLD_CLIP_PLANES
|
||||
world_clip_planes_calc_clip_distance(world_pos);
|
||||
#endif
|
||||
view_clipping_distances(world_pos);
|
||||
}
|
||||
|
||||
@@ -360,3 +360,42 @@ GPU_SHADER_CREATE_INFO(overlay_edit_curve_wire_clipped)
|
||||
.additional_info("overlay_edit_curve_wire", "drw_clipped");
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Edit Curve
|
||||
* \{ */
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_edit_lattice_point)
|
||||
.do_static_compilation(true)
|
||||
/* NOTE: Color already in Linear space. Which is what we want. */
|
||||
.define("srgbTarget", "false")
|
||||
.vertex_in(0, Type::VEC3, "pos")
|
||||
.vertex_in(1, Type::INT, "data")
|
||||
.vertex_out(overlay_edit_flat_color_iface)
|
||||
.fragment_out(0, Type::VEC4, "fragColor")
|
||||
.vertex_source("edit_lattice_point_vert.glsl")
|
||||
.fragment_source("gpu_shader_point_varying_color_frag.glsl")
|
||||
.additional_info("draw_mesh", "draw_globals");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_edit_lattice_point_clipped)
|
||||
.do_static_compilation(true)
|
||||
.additional_info("overlay_edit_lattice_point", "drw_clipped");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_edit_lattice_wire)
|
||||
.do_static_compilation(true)
|
||||
/* NOTE: Color already in Linear space. Which is what we want. */
|
||||
.define("srgbTarget", "false")
|
||||
.vertex_in(0, Type::VEC3, "pos")
|
||||
.vertex_in(1, Type::FLOAT, "weight")
|
||||
.sampler(0, ImageType::FLOAT_1D, "weightTex")
|
||||
.vertex_out(overlay_edit_smooth_color_iface)
|
||||
.fragment_out(0, Type::VEC4, "fragColor")
|
||||
.vertex_source("edit_lattice_wire_vert.glsl")
|
||||
.fragment_source("gpu_shader_3D_smooth_color_frag.glsl")
|
||||
.additional_info("draw_mesh", "draw_globals");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_edit_lattice_wire_clipped)
|
||||
.do_static_compilation(true)
|
||||
.additional_info("overlay_edit_lattice_wire", "drw_clipped");
|
||||
|
||||
/** \} */
|
||||
|
||||
Reference in New Issue
Block a user