Add support for unnamed triangle groups

This commit is contained in:
Edwin Jakobs
2020-03-10 11:11:08 +01:00
parent f663677cfa
commit d795ef91f3

View File

@@ -140,7 +140,7 @@ fun loadOBJ(lines: List<String>): Map<String, List<Triangle>> {
"vt" -> textureCoords += Vector2(tokens[1].toDouble(), tokens[2].toDouble()) "vt" -> textureCoords += Vector2(tokens[1].toDouble(), tokens[2].toDouble())
"g" -> { "g" -> {
activeMesh = mutableListOf() activeMesh = mutableListOf()
meshes[tokens[1]] = activeMesh meshes[tokens.getOrNull(1)?:"no-name-${meshes.size}"] = activeMesh
} }
"f" -> { "f" -> {
val indices = tokens.subList(1, tokens.size).map { it.split("/") }.map { val indices = tokens.subList(1, tokens.size).map { it.split("/") }.map {