internal void ValidateNormals(Validation.ValidationContext result) { result = result.GetContext(this); SourceBufferView.ValidateBufferUsageGPU(result, BufferMode.ARRAY_BUFFER); result.CheckLinkMustBeAnyOf(nameof(Dimensions), Dimensions, DimensionType.VEC3); if (!this.LogicalParent.MeshQuantizationAllowed) { result.CheckLinkMustBeAnyOf(nameof(Normalized), Normalized, false); result.CheckLinkMustBeAnyOf(nameof(Encoding), Encoding, EncodingType.FLOAT); } else { if (Normalized) { result.CheckLinkMustBeAnyOf(nameof(Encoding), Encoding, EncodingType.BYTE, EncodingType.SHORT); } else { result.CheckLinkMustBeAnyOf(nameof(Encoding), Encoding, EncodingType.FLOAT); } } var normals = this.AsVector3Array(); for (int i = 0; i < normals.Count; ++i) { if (result.TryFixUnitLengthOrError(i, normals[i])) { normals[i] = normals[i].SanitizeNormal(); } } }