diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/collada/GeometryExporter.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp index b29b4c9c484..a0eddadfe78 100644 --- a/source/blender/collada/GeometryExporter.cpp +++ b/source/blender/collada/GeometryExporter.cpp @@ -606,7 +606,7 @@ void GeometryExporter::create_normals(std::vector<Normal> &normals, std::vector< MVert *verts = me->mvert; MLoop *mloops = me->mloop; - float(*lnors)[3]; + float(*lnors)[3] = NULL; bool use_custom_normals = false; BKE_mesh_calc_normals_split(me); @@ -630,14 +630,19 @@ void GeometryExporter::create_normals(std::vector<Normal> &normals, std::vector< last_normal_index++; } - MLoop *mloop = mloops + mpoly->loopstart; BCPolygonNormalsIndices poly_indices; for (int loop_index = 0; loop_index < mpoly->totloop; loop_index++) { unsigned int loop_idx = mpoly->loopstart + loop_index; if (use_vertex_normals) { - float normalized[3]; - normalize_v3_v3(normalized, lnors[loop_idx]); + + if (use_custom_normals) { + normalize_v3_v3(normalized, lnors[loop_idx]); + } + else { + normal_short_to_float_v3(normalized, verts[mloops[loop_index].v].no); + normalize_v3(normalized); + } Normal n = { normalized[0], normalized[1], normalized[2] }; if (shared_normal_indices.find(n) != shared_normal_indices.end()) { |