diff --git a/mesh/MeshTransforms.cs b/mesh/MeshTransforms.cs index 99cfe776..2642b6a9 100644 --- a/mesh/MeshTransforms.cs +++ b/mesh/MeshTransforms.cs @@ -45,6 +45,7 @@ public static Frame3f Rotate(Frame3f f, Vector3d origin, Quaterniond rotation) } public static void Rotate(IDeformableMesh mesh, Vector3d origin, Quaternionf rotation) { + bool bHasNormals = mesh.HasVertexNormals; int NV = mesh.MaxVertexID; for ( int vid = 0; vid < NV; ++vid ) { if (mesh.IsVertex(vid)) { @@ -53,6 +54,8 @@ public static void Rotate(IDeformableMesh mesh, Vector3d origin, Quaternionf rot v = (Vector3d)(rotation * (Vector3f)v); v += origin; mesh.SetVertex(vid, v); + if ( bHasNormals ) + mesh.SetVertexNormal(vid, (Vector3f)(rotation * mesh.GetVertexNormal(vid)) ); } } }