Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Werner <stefan.werner@tangent-animation.com>2018-11-23 15:08:15 +0300
committerStefan Werner <stefan.werner@tangent-animation.com>2018-11-23 15:19:53 +0300
commit071f4f4ce0b9520ab0c73d6d68365ad449ca8b80 (patch)
tree9f37bfcac669366b9ad5fb7605f2fbbed9b71b0a /source/blender/bmesh/intern/bmesh_query.c
parent0a2b2d59a5897212ba3771503feb6770fb636bc8 (diff)
Cycles: Improved robustness of hair motion blur.motion_curve_fix
In some instances, the number of control vertices of a hair could change mid-frame. Cycles would then be unable to calculate proper motion blur for those hairs. This adds interpolated CVs to fill in for the missing data. While this will not necessarily result in a fully accurate reconstruction of the guide hair, it preserves motion blur instead of disabling it. Reviewers: #cycles, sergey Reviewed By: #cycles, sergey Subscribers: sergey, brecht, #cycles Tags: #cycles Differential Revision: https://developer.blender.org/D3695
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_query.c')
-rw-r--r--source/blender/bmesh/intern/bmesh_query.c44
1 files changed, 39 insertions, 5 deletions
diff --git a/source/blender/bmesh/intern/bmesh_query.c b/source/blender/bmesh/intern/bmesh_query.c
index 540888ac0b9..e1f16508b8b 100644
--- a/source/blender/bmesh/intern/bmesh_query.c
+++ b/source/blender/bmesh/intern/bmesh_query.c
@@ -792,7 +792,7 @@ bool BM_vert_edge_pair(BMVert *v, BMEdge **r_e_a, BMEdge **r_e_b)
}
/**
- * Returns the number of edges around this vertex.
+ * Returns the number of edges around this vertex.
*/
int BM_vert_edge_count(const BMVert *v)
{
@@ -817,7 +817,7 @@ int BM_vert_edge_count_nonwire(const BMVert *v)
return count;
}
/**
- * Returns the number of faces around this edge
+ * Returns the number of faces around this edge
*/
int BM_edge_face_count(const BMEdge *e)
{
@@ -1311,7 +1311,7 @@ bool BM_edge_share_face_check(BMEdge *e1, BMEdge *e2)
}
/**
- * Test if e1 shares any quad faces with e2
+ * Test if e1 shares any quad faces with e2
*/
bool BM_edge_share_quad_check(BMEdge *e1, BMEdge *e2)
{
@@ -1334,7 +1334,7 @@ bool BM_edge_share_quad_check(BMEdge *e1, BMEdge *e2)
}
/**
- * Tests to see if e1 shares a vertex with e2
+ * Tests to see if e1 shares a vertex with e2
*/
bool BM_edge_share_vert_check(BMEdge *e1, BMEdge *e2)
{
@@ -1345,7 +1345,7 @@ bool BM_edge_share_vert_check(BMEdge *e1, BMEdge *e2)
}
/**
- * Return the shared vertex between the two edges or NULL
+ * Return the shared vertex between the two edges or NULL
*/
BMVert *BM_edge_share_vert(BMEdge *e1, BMEdge *e2)
{
@@ -1678,6 +1678,40 @@ float BM_edge_calc_face_angle(const BMEdge *e)
}
/**
+* \brief BMESH EDGE/FACE ANGLE
+*
+* Calculates the angle between two faces in world space.
+* Assumes the face normals are correct.
+*
+* \return angle in radians
+*/
+float BM_edge_calc_face_angle_with_imat3_ex(const BMEdge *e, float imat3[3][3], const float fallback)
+{
+ if (BM_edge_is_manifold(e)) {
+ const BMLoop *l1 = e->l;
+ const BMLoop *l2 = e->l->radial_next;
+ float no1[3], no2[3];
+ copy_v3_v3(no1, l1->f->no);
+ copy_v3_v3(no2, l2->f->no);
+
+ mul_transposed_m3_v3(imat3, no1);
+ mul_transposed_m3_v3(imat3, no2);
+
+ normalize_v3(no1);
+ normalize_v3(no2);
+
+ return angle_normalized_v3v3(no1, no2);
+ }
+ else {
+ return fallback;
+ }
+}
+float BM_edge_calc_face_angle_with_imat3(const BMEdge *e, float imat3[3][3])
+{
+ return BM_edge_calc_face_angle_with_imat3_ex(e, imat3, DEG2RADF(90.0f));
+}
+
+/**
* \brief BMESH EDGE/FACE ANGLE
*
* Calculates the angle between two faces.