//const float DefaultSmoothingAngleInRadians = (float)( 175f * Math.PI / 180 ); public static void CalculateNormals(VertexInfo[] vertices, bool normalizeVectorNormal) { if (vertices.Length == 0) { return; } foreach (var polygonIndexRange in CalcMiscProcess.EnumeratePolygons(vertices)) { CalculateNormalForFace(vertices, polygonIndexRange, normalizeVectorNormal); } }
/// <summary> /// Requirements : normals and UV coordinates must be present. /// </summary> /// <param name="vertices"></param> /// <param name="tangents"></param> /// <param name="bitangents"></param> /// <param name="getTextureCoord">if null then texCoord0 is used, if not null this delegete than takes the necessary texCoord</param> public static void CalculateTangents(VertexInfo[] vertices, out Vector3F[] tangents, out Vector3F[] bitangents, GetTextureCoord getTextureCoord = null) { tangents = new Vector3F[vertices.Length]; bitangents = new Vector3F[vertices.Length]; if (vertices.Length == 0) { return; } foreach (var polygonIndexRange in CalcMiscProcess.EnumeratePolygons(vertices)) { CalculateTangentForFace(vertices, polygonIndexRange, tangents, bitangents, getTextureCoord); } //SmoothTangents( vertices, tangents, bitangents, FbxMath.ComputePositionEpsilon( vertices ), maxSmoothingAngleInRadians ); }