Skip to content

Commit 147d9c3

Browse files
authored
Merge pull request #74 from tgdflav/master
fixed exception when loading obj with texture coordinates but no material assigned
2 parents 07de2c7 + cfa902a commit 147d9c3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Obj2Tiles.Library/Geometry/MeshUtils.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,20 @@ public static IMesh LoadMesh(string fileName, out string[] dependencies)
8888
var vt2 = int.Parse(second[1]);
8989
var vt3 = int.Parse(third[1]);
9090

91+
var materialIndex = 0;
92+
if (currentMaterial != string.Empty)
93+
{
94+
materialIndex = materialsDict[currentMaterial];
95+
}
96+
9197
var faceT = new FaceT(
9298
v1 - 1,
9399
v2 - 1,
94100
v3 - 1,
95101
vt1 - 1,
96102
vt2 - 1,
97103
vt3 - 1,
98-
materialsDict[currentMaterial]);
104+
materialIndex);
99105

100106
facesT.Add(faceT);
101107
}

0 commit comments

Comments
 (0)