diff options
author | Jacques Lucke <jacques@blender.org> | 2022-06-08 17:52:13 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-06-08 17:52:13 +0300 |
commit | 1a71f9d2b8174009d1a79fd555ed33d20dc5c078 (patch) | |
tree | 5efb23f2cdd54187739dc2ccc48155b46641e394 /source/blender/draw | |
parent | cc1cc46099d732f355e297c25af193fb9325d8f8 (diff) |
Curves: use radius of middle point to determine curve shape
See {rBb69aad60bda23a53482b2c2ae98715c23a715bc8}
for more details.
Diffstat (limited to 'source/blender/draw')
-rw-r--r-- | source/blender/draw/intern/draw_curves.cc | 7 |
1 files changed, 7 insertions, 0 deletions
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); |