diff options
author | Thomas Dinges <blender@dingto.org> | 2014-02-12 06:27:18 +0400 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2014-02-12 06:27:41 +0400 |
commit | 9c8bf7302d1bdac6aa57a6e672ce669e792e6837 (patch) | |
tree | 7a6ae812393a67502bbf1bd92931ef03f8e22576 /intern/cycles/blender | |
parent | 5c8d5c70cf9b01ba067c625bb0e5c0d26c76cb79 (diff) |
Cycles: Avoid unnecessary dot products in Mesh/Hair export code.
Diffstat (limited to 'intern/cycles/blender')
-rw-r--r-- | intern/cycles/blender/blender_curves.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/blender/blender_mesh.cpp | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/intern/cycles/blender/blender_curves.cpp b/intern/cycles/blender/blender_curves.cpp index 49728c577cc..92c51b0aad3 100644 --- a/intern/cycles/blender/blender_curves.cpp +++ b/intern/cycles/blender/blender_curves.cpp @@ -437,7 +437,7 @@ void ExportCurveTriangleGeometry(Mesh *mesh, ParticleCurveData *CData, int resol continue; float3 firstxbasis = cross(make_float3(1.0f,0.0f,0.0f),CData->curvekey_co[CData->curve_firstkey[curve]+1] - CData->curvekey_co[CData->curve_firstkey[curve]]); - if(len_squared(firstxbasis)!= 0.0f) + if(!is_zero(firstxbasis)) firstxbasis = normalize(firstxbasis); else firstxbasis = normalize(cross(make_float3(0.0f,1.0f,0.0f),CData->curvekey_co[CData->curve_firstkey[curve]+1] - CData->curvekey_co[CData->curve_firstkey[curve]])); diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp index c761c004fe7..61c6ef6af1b 100644 --- a/intern/cycles/blender/blender_mesh.cpp +++ b/intern/cycles/blender/blender_mesh.cpp @@ -249,8 +249,8 @@ static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector< bool smooth = f->use_smooth(); if(n == 4) { - if(len_squared(cross(mesh->verts[vi[1]] - mesh->verts[vi[0]], mesh->verts[vi[2]] - mesh->verts[vi[0]])) == 0.0f || - len_squared(cross(mesh->verts[vi[2]] - mesh->verts[vi[0]], mesh->verts[vi[3]] - mesh->verts[vi[0]])) == 0.0f) { + if(is_zero(cross(mesh->verts[vi[1]] - mesh->verts[vi[0]], mesh->verts[vi[2]] - mesh->verts[vi[0]])) || + is_zero(cross(mesh->verts[vi[2]] - mesh->verts[vi[0]], mesh->verts[vi[3]] - mesh->verts[vi[0]]))) { mesh->set_triangle(ti++, vi[0], vi[1], vi[3], shader, smooth); mesh->set_triangle(ti++, vi[2], vi[3], vi[1], shader, smooth); } |