diff options
author | Jacques Lucke <jacques@blender.org> | 2022-03-21 20:54:31 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-03-21 20:59:03 +0300 |
commit | a58be397e2bfbefa0324dbe861b018dd2784ee0d (patch) | |
tree | 4ad14d927e10974e95d3be0a32436888a5260a91 /source/blender/blenlib | |
parent | f8d19ec5a3d8c14d0c71464867ad1af10ee50eb5 (diff) |
Curves: new Add brush
This adds a new Add brush for the new curves object type in sculpt mode.
The brush is used to insert new curves (typically hair) on the surface object.
Supported features:
* Add single curve exactly at the cursor position when `Add Amount` is 1.
* Front faces only.
* Independent interpolate shape and interpolate length settings.
* Smooth and flat shading affects curve shape interpolation.
* Spherical and projection brush.
This also adds the `surface_triangle_index` and `surface_triangle_coordinate`
attributes. Those store information about what position on the surface each
added curve is attached to:
* `surface_triangle_index` (`int`): Index of the internal triangle that a curve
is attached to. `-1` when the curve is not attached to the surface.
* `surface_triangle_coordinate` (`float2`): First two numbers of a barycentric
coordinate that reference a specific position within the triangle.
Ref T96444.
Differential Revision: https://developer.blender.org/D14340
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_kdopbvh.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_kdopbvh.h b/source/blender/blenlib/BLI_kdopbvh.h index 5e56eec2ec6..38f3e1ee290 100644 --- a/source/blender/blenlib/BLI_kdopbvh.h +++ b/source/blender/blenlib/BLI_kdopbvh.h @@ -324,3 +324,32 @@ extern const float bvhtree_kdop_axes[13][3]; #ifdef __cplusplus } #endif + +#ifdef __cplusplus + +# include "BLI_function_ref.hh" +# include "BLI_math_vector.hh" + +namespace blender { + +using BVHTree_RangeQuery_CPP = FunctionRef<void(int index, const float3 &co, float dist_sq)>; + +inline void BLI_bvhtree_range_query_cpp(BVHTree &tree, + const float3 co, + float radius, + BVHTree_RangeQuery_CPP fn) +{ + BLI_bvhtree_range_query( + &tree, + co, + radius, + [](void *userdata, const int index, const float co[3], const float dist_sq) { + BVHTree_RangeQuery_CPP fn = *static_cast<BVHTree_RangeQuery_CPP *>(userdata); + fn(index, co, dist_sq); + }, + &fn); +} + +} // namespace blender + +#endif |