Skip to content

Commit

Permalink
refactor: new float[3] -> RcVec3f
Browse files Browse the repository at this point in the history
  • Loading branch information
ikpil committed Oct 15, 2023
1 parent 30cbf71 commit 628c4ef
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/DotRecast.Core/RcObjImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,14 @@ private static void ReadVertex(string line, RcObjImporterContext context)
{
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)
Expand All @@ -80,12 +79,11 @@ private static float[] ReadVector3f(string line)
}

// 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)
Expand Down

0 comments on commit 628c4ef

Please sign in to comment.