Skip to content

Commit 2bb2c57

Browse files
committed
code review fixes
- make MeshInfo a class - store normals and tangents as local variables
1 parent fc30063 commit 2bb2c57

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

Assets/FbxExporters/Editor/FbxExporter.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ static void OnContextItem (MenuCommand command)
876876
///<summary>
877877
///Information about the mesh that is important for exporting.
878878
///</summary>
879-
public struct MeshInfo
879+
public class MeshInfo
880880
{
881881
/// <summary>
882882
/// The transform of the mesh.
@@ -948,12 +948,15 @@ public Vector3 [] Binormals {
948948
/// => Math.cross (normal, tangent.xyz) * tangent.w
949949
if (m_Binormals == null || m_Binormals.Length == 0)
950950
{
951-
m_Binormals = new Vector3 [Normals.Length];
951+
var normals = Normals;
952+
var tangents = Tangents;
952953

953-
for (int i = 0; i < Normals.Length; i++)
954-
m_Binormals [i] = Vector3.Cross (Normals [i],
955-
Tangents [i])
956-
* Tangents [i].w;
954+
m_Binormals = new Vector3 [normals.Length];
955+
956+
for (int i = 0; i < normals.Length; i++)
957+
m_Binormals [i] = Vector3.Cross (normals [i],
958+
tangents [i])
959+
* tangents [i].w;
957960

958961
}
959962
return m_Binormals;
@@ -1100,7 +1103,7 @@ private MeshInfo GetMeshInfo (GameObject gameObject, bool requireRenderer = true
11001103
}
11011104
}
11021105
if (!mesh) {
1103-
return new MeshInfo ();
1106+
return new MeshInfo(null);
11041107
}
11051108
return new MeshInfo (gameObject, mesh);
11061109
}

0 commit comments

Comments
 (0)