[Bf-blender-cvs] [1a71f9d2b81] master: Curves: use radius of middle point to determine curve shape

Jacques Lucke noreply at git.blender.org
Wed Jun 8 16:52:28 CEST 2022


Commit: 1a71f9d2b8174009d1a79fd555ed33d20dc5c078
Author: Jacques Lucke
Date:   Wed Jun 8 16:52:13 2022 +0200
Branches: master
https://developer.blender.org/rB1a71f9d2b8174009d1a79fd555ed33d20dc5c078

Curves: use radius of middle point to determine curve shape

See {rBb69aad60bda23a53482b2c2ae98715c23a715bc8}
for more details.

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

M	source/blender/draw/intern/draw_curves.cc

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

diff --git a/source/blender/draw/intern/draw_curves.cc b/source/blender/draw/intern/draw_curves.cc
index 749383edc6d..c40f2275968 100644
--- a/source/blender/draw/intern/draw_curves.cc
+++ b/source/blender/draw/intern/draw_curves.cc
@@ -339,8 +339,15 @@ DRWShadingGroup *DRW_shgroup_curves_create_sub(Object *object,
     blender::VArray<float> radii = curves_component.attribute_get_for_read(
         "radius", ATTR_DOMAIN_POINT, 0.005f);
     const blender::IndexRange first_curve_points = curves.points_for_curve(0);
+    const float first_radius = radii[first_curve_points.first()];
+    const float last_radius = radii[first_curve_points.last()];
+    const float middle_radius = radii[first_curve_points.size() / 2];
     hair_rad_root = radii[first_curve_points.first()];
     hair_rad_tip = radii[first_curve_points.last()];
+    hair_rad_shape = std::clamp(
+        safe_divide(middle_radius - first_radius, last_radius - first_radius) * 2.0f - 1.0f,
+        -1.0f,
+        1.0f);
   }
 
   DRW_shgroup_uniform_texture(shgrp, "hairPointBuffer", curves_cache->final[subdiv].proc_tex);



More information about the Bf-blender-cvs mailing list