diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-07-14 17:49:44 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-08-14 20:05:26 +0300 |
commit | 9c010c44f4201ab114b3facc69d0343525a1779f (patch) | |
tree | 744271becd24cead6c900e4f023d8c0bfa6138b6 /source/blender/blenlib/intern/math_geom.c | |
parent | 45a45f7d66211e82a3a3288782ad9523e8fdc516 (diff) |
Mesh Batch Cache: Refactor + Multithread
For clarity sake, the batch cache now uses exclusively per Loop attributes.
While this is a bit of a waste of VRAM (for the few case where per vert
attribs are enough) it reduces the complexity and amount of overall VBO
to update in general situations.
This patch also makes the VertexBuffers filling multithreaded. This make
the update of dense meshes a bit faster. The main bottleneck is the
IndexBuffers update which cannot be multithreaded efficiently (have to
increment a counter and/or do a final sorting pass).
We introduce the concept of "extract" functions/step.
All extract functions are executed in one thread each and if possible,
using multiple thread for looping over all elements.
Reviewed By: brecht
Differential Revision: http://developer.blender.org/D5424
Diffstat (limited to 'source/blender/blenlib/intern/math_geom.c')
-rw-r--r-- | source/blender/blenlib/intern/math_geom.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index bb3d2786ca6..06fd5c70772 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -5730,6 +5730,27 @@ float form_factor_hemi_poly( } /** + * Check if the edge is convex or concave + * (depends on face winding) + * Copied from BM_edge_is_convex(). + */ +bool is_edge_convex_v3(const float v1[3], + const float v2[3], + const float f1_no[3], + const float f2_no[3]) +{ + if (!equals_v3v3(f1_no, f2_no)) { + float cross[3]; + float l_dir[3]; + cross_v3_v3v3(cross, f1_no, f2_no); + /* we assume contiguous normals, otherwise the result isn't meaningful */ + sub_v3_v3v3(l_dir, v2, v1); + return (dot_v3v3(l_dir, cross) > 0.0f); + } + return false; +} + +/** * Evaluate if entire quad is a proper convex quad */ bool is_quad_convex_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3]) |