diff options
Diffstat (limited to 'source/blender/io/alembic/exporter/abc_writer_hair.cc')
-rw-r--r-- | source/blender/io/alembic/exporter/abc_writer_hair.cc | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/source/blender/io/alembic/exporter/abc_writer_hair.cc b/source/blender/io/alembic/exporter/abc_writer_hair.cc index 80f2cadd08c..e8c156a2b8d 100644 --- a/source/blender/io/alembic/exporter/abc_writer_hair.cc +++ b/source/blender/io/alembic/exporter/abc_writer_hair.cc @@ -136,6 +136,7 @@ void ABCHairWriter::write_hair_sample(const HierarchyContext &context, MTFace *mtface = mesh->mtface; MFace *mface = mesh->mface; MVert *mverts = mesh->mvert; + const float(*vert_normals)[3] = BKE_mesh_vertex_normals_ensure(mesh); if ((!mtface || !mface) && !uv_warning_shown_) { std::fprintf(stderr, @@ -173,8 +174,17 @@ void ABCHairWriter::write_hair_sample(const HierarchyContext &context, psys_interpolate_uvs(tface, face->v4, pa->fuv, r_uv); uv_values.emplace_back(r_uv[0], r_uv[1]); - psys_interpolate_face( - mverts, face, tface, nullptr, mapfw, vec, normal, nullptr, nullptr, nullptr); + psys_interpolate_face(mverts, + vert_normals, + face, + tface, + nullptr, + mapfw, + vec, + normal, + nullptr, + nullptr, + nullptr); copy_yup_from_zup(tmp_nor.getValue(), normal); norm_values.push_back(tmp_nor); @@ -206,10 +216,7 @@ void ABCHairWriter::write_hair_sample(const HierarchyContext &context, if (vtx[o] == num) { uv_values.emplace_back(tface->uv[o][0], tface->uv[o][1]); - - MVert *mv = mverts + vtx[o]; - - normal_short_to_float_v3(normal, mv->no); + copy_v3_v3(normal, vert_normals[vtx[o]]); copy_yup_from_zup(tmp_nor.getValue(), normal); norm_values.push_back(tmp_nor); found = true; @@ -250,6 +257,7 @@ void ABCHairWriter::write_hair_child_sample(const HierarchyContext &context, MTFace *mtface = mesh->mtface; MVert *mverts = mesh->mvert; + const float(*vert_normals)[3] = BKE_mesh_vertex_normals_ensure(mesh); ParticleSystem *psys = context.particle_system; ParticleSettings *part = psys->part; @@ -281,8 +289,17 @@ void ABCHairWriter::write_hair_child_sample(const HierarchyContext &context, psys_interpolate_uvs(tface, face->v4, pc->fuv, r_uv); uv_values.emplace_back(r_uv[0], r_uv[1]); - psys_interpolate_face( - mverts, face, tface, nullptr, mapfw, vec, tmpnor, nullptr, nullptr, nullptr); + psys_interpolate_face(mverts, + vert_normals, + face, + tface, + nullptr, + mapfw, + vec, + tmpnor, + nullptr, + nullptr, + nullptr); /* Convert Z-up to Y-up. */ norm_values.emplace_back(tmpnor[0], tmpnor[2], -tmpnor[1]); |