From 628c4ef0ced82cd5878d7e5dcee01a5086d15a99 Mon Sep 17 00:00:00 2001 From: ikpil Date: Sun, 15 Oct 2023 21:30:55 +0900 Subject: [PATCH] refactor: new float[3] -> RcVec3f --- src/DotRecast.Core/RcObjImporter.cs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/DotRecast.Core/RcObjImporter.cs b/src/DotRecast.Core/RcObjImporter.cs index 28d0eeb..ad17c56 100644 --- a/src/DotRecast.Core/RcObjImporter.cs +++ b/src/DotRecast.Core/RcObjImporter.cs @@ -63,15 +63,14 @@ namespace DotRecast.Core { if (line.StartsWith("v ")) { - float[] vert = ReadVector3f(line); - foreach (float vp in vert) - { - context.vertexPositions.Add(vp); - } + var vert = ReadVector3f(line); + context.vertexPositions.Add(vert.X); + context.vertexPositions.Add(vert.Y); + context.vertexPositions.Add(vert.Z); } } - private static float[] ReadVector3f(string line) + private static RcVec3f ReadVector3f(string line) { string[] v = line.Split(' ', StringSplitOptions.RemoveEmptyEntries); if (v.Length < 4) @@ -80,12 +79,11 @@ namespace DotRecast.Core } // fix - https://github.com/ikpil/DotRecast/issues/7 - return new float[] - { + return new RcVec3f( float.Parse(v[1], CultureInfo.InvariantCulture), float.Parse(v[2], CultureInfo.InvariantCulture), float.Parse(v[3], CultureInfo.InvariantCulture) - }; + ); } private static void ReadFace(string line, RcObjImporterContext context)