Merge branch 'blender-v5.1-release'

This commit is contained in:
Miguel Pozo 2026-03-12 15:30:19 +01:00
commit c806cc465c
4 changed files with 33 additions and 10 deletions

View file

@ -551,6 +551,8 @@ class ShaderModule {
StaticShader wireframe_mesh = shader_selectable("overlay_wireframe");
/* Draw objects without edges for the wireframe overlay. */
StaticShader wireframe_points = shader_selectable("overlay_wireframe_points");
StaticShader wireframe_points_with_radius = shader_selectable(
"overlay_wireframe_points_with_radius");
StaticShader wireframe_curve = shader_selectable("overlay_wireframe_curve");
StaticShader fluid_grid_lines_flags = shader_selectable_no_clip(

View file

@ -35,9 +35,10 @@ class Wireframe : Overlay {
struct ColoringPass {
PassMain::Sub *curves_ps_ = nullptr;
PassMain::Sub *mesh_ps_ = nullptr;
PassMain::Sub *pointcloud_ps_ = nullptr;
/* Variant for meshes that force drawing all edges. */
PassMain::Sub *mesh_all_edges_ps_ = nullptr;
PassMain::Sub *points_ps_ = nullptr;
PassMain::Sub *pointcloud_ps_ = nullptr;
} colored, non_colored;
/* Copy of the depth buffer to be able to read it during wireframe rendering. */
@ -102,7 +103,9 @@ class Wireframe : Overlay {
overlay::ShaderModule &sh = *res.shaders;
ps.mesh_ps_ = shader_pass(sh.wireframe_mesh.get(), "Mesh", use_color, wire_threshold);
ps.mesh_all_edges_ps_ = shader_pass(sh.wireframe_mesh.get(), "Wire", use_color, 1.0f);
ps.pointcloud_ps_ = shader_pass(sh.wireframe_points.get(), "PtCloud", use_color, 1.0f);
ps.points_ps_ = shader_pass(sh.wireframe_points.get(), "Points", use_color, 1.0f);
ps.pointcloud_ps_ = shader_pass(
sh.wireframe_points_with_radius.get(), "PtCloud", use_color, 1.0f);
ps.curves_ps_ = shader_pass(sh.wireframe_curve.get(), "Curve", use_color, 1.0f);
};
@ -199,7 +202,7 @@ class Wireframe : Overlay {
gpu::Batch *geom;
if ((mesh.edges_num == 0) && (mesh.verts_num > 0)) {
geom = DRW_cache_mesh_all_verts_get(ob_ref.object);
coloring.pointcloud_ps_->draw(
coloring.points_ps_->draw(
geom, manager.unique_handle(ob_ref), res.select_id(ob_ref).get());
}
else if ((geom = DRW_cache_mesh_loose_edges_get(ob_ref.object))) {
@ -226,7 +229,7 @@ class Wireframe : Overlay {
if (DRW_object_get_data_for_drawing<Volume>(*ob_ref.object).display.wireframe_type ==
VOLUME_WIREFRAME_POINTS)
{
coloring.pointcloud_ps_->draw(
coloring.points_ps_->draw(
geom, manager.unique_handle(ob_ref), res.select_id(ob_ref).get());
}
else {

View file

@ -87,13 +87,12 @@ FLAT(float4, final_color)
FLAT(float4, final_color_inner)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(overlay_wireframe_points_base)
GPU_SHADER_CREATE_INFO(overlay_wireframe_points_common)
DEFINE("POINTS")
PUSH_CONSTANT(float, ndc_offset_factor)
PUSH_CONSTANT(bool, use_coloring)
PUSH_CONSTANT(bool, is_transform)
PUSH_CONSTANT(int, color_type)
VERTEX_IN(0, float4, pos_rad)
VERTEX_OUT(overlay_wireframe_points_iface)
VERTEX_SOURCE("overlay_wireframe_vert.glsl")
FRAGMENT_SOURCE("overlay_wireframe_frag.glsl")
@ -104,6 +103,11 @@ ADDITIONAL_INFO(draw_object_infos)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_wireframe_points_base)
VERTEX_IN(0, float3, pos)
ADDITIONAL_INFO(overlay_wireframe_points_common)
GPU_SHADER_CREATE_END()
/* clang-format off */
CREATE_INFO_VARIANT(overlay_wireframe_points, overlay_wireframe_points_base, draw_modelmat)
CREATE_INFO_VARIANT(overlay_wireframe_points_selectable, overlay_wireframe_points_base, draw_modelmat_with_custom_id, overlay_select)
@ -111,6 +115,19 @@ CREATE_INFO_VARIANT(overlay_wireframe_points_clipped, overlay_wireframe_points,
CREATE_INFO_VARIANT(overlay_wireframe_points_selectable_clipped, overlay_wireframe_points_selectable, drw_clipped)
/* clang-format on */
GPU_SHADER_CREATE_INFO(overlay_wireframe_points_with_radius_base)
DEFINE("WITH_RADIUS")
VERTEX_IN(0, float4, pos_rad)
ADDITIONAL_INFO(overlay_wireframe_points_common)
GPU_SHADER_CREATE_END()
/* clang-format off */
CREATE_INFO_VARIANT(overlay_wireframe_points_with_radius, overlay_wireframe_points_with_radius_base, draw_modelmat)
CREATE_INFO_VARIANT(overlay_wireframe_points_with_radius_selectable, overlay_wireframe_points_with_radius_base, draw_modelmat_with_custom_id, overlay_select)
CREATE_INFO_VARIANT(overlay_wireframe_points_with_radius_clipped, overlay_wireframe_points_with_radius, drw_clipped)
CREATE_INFO_VARIANT(overlay_wireframe_points_with_radius_selectable_clipped, overlay_wireframe_points_with_radius_selectable, drw_clipped)
/* clang-format on */
GPU_SHADER_INTERFACE_INFO(overlay_edit_uv_iface_wireframe)
SMOOTH(float, selection_fac)
FLAT(float2, stipple_start)

View file

@ -95,14 +95,15 @@ void main()
* while keeping object coloring mode working (see #134011). */
float no_nor_facing = (color_type == V3D_SHADING_SINGLE_COLOR) ? 0.0f : 0.5f;
#ifdef POINTS
float3 pos = pos_rad.xyz;
#ifdef WITH_RADIUS
float3 wpos = drw_point_object_to_world(pos_rad.xyz);
wpos += drw_world_incident_vector(wpos) * pos_rad.w;
#else
float3 wpos = drw_point_object_to_world(pos);
#endif
float3 wpos = drw_point_object_to_world(pos);
#if defined(POINTS)
gl_PointSize = theme.sizes.vert * 2.0f;
wpos += drw_world_incident_vector(wpos) * pos_rad.w;
#elif defined(CURVES)
float facing = no_nor_facing;
#else