diff --git a/source/SharpGL/Core/SharpGL.Serialization/Wavefront/ObjFileFormat.cs b/source/SharpGL/Core/SharpGL.Serialization/Wavefront/ObjFileFormat.cs index 4ff432b0..740c8f6c 100644 --- a/source/SharpGL/Core/SharpGL.Serialization/Wavefront/ObjFileFormat.cs +++ b/source/SharpGL/Core/SharpGL.Serialization/Wavefront/ObjFileFormat.cs @@ -21,6 +21,9 @@ private System.Drawing.Color ReadMaterialColor(string line, float alpha) string[] lineParts = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (lineParts.Length >= 4) { + lineParts[1] = lineParts[1].Replace(".", ","); + lineParts[2] = lineParts[1].Replace(".", ","); + lineParts[3] = lineParts[1].Replace(".", ","); // Convert float a,r,g,b values to byte values. Make sure they fall in 0-255 range. int a = Convert.ToInt32(255 * alpha); if (a < 0) a = 0; if (a > 255) a = 255; @@ -169,7 +172,9 @@ public Scene LoadData(string path) { // Get the texture coord strings. string[] values = line.Substring(3).Split(split, StringSplitOptions.RemoveEmptyEntries); - + float x = float.Parse(values[0]); + float y = float.Parse(values[1]); + // Parse texture coordinates. float u = float.Parse(values[0]); float v = float.Parse(values[1]); @@ -185,6 +190,9 @@ public Scene LoadData(string path) { // Get the normal coord strings. string[] values = line.Substring(3).Split(split, StringSplitOptions.RemoveEmptyEntries); + values[0] = values[0].Replace(".", ","); + values[1] = values[1].Replace(".", ","); + values[2] = values[2].Replace(".", ","); // Parse normal coordinates. float x = float.Parse(values[0]); @@ -202,6 +210,9 @@ public Scene LoadData(string path) { // Get the vertex coord strings. string[] values = line.Substring(2).Split(split, StringSplitOptions.RemoveEmptyEntries); + values[0] = values[0].Replace(".", ","); + values[1] = values[1].Replace(".", ","); + values[2] = values[2].Replace(".", ","); // Parse vertex coordinates. float x = float.Parse(values[0]); @@ -396,4 +407,4 @@ public string Filter get { return "Wavefont Obj Files (*.obj)|*.obj"; } } } -} \ No newline at end of file +}