@@ -65,9 +65,15 @@ function loadOBJ(path::String)
65
65
elseif command == " vn"
66
66
push! ( temp_normals, parse .(Float32,lines) )
67
67
elseif command == " vt"
68
- push! ( temp_texturecoords, parse .(Float32,lines) )
68
+ uvw = parse .(Float32, lines)
69
+ # HACK strip the w coordinate if encountered. TODO save appropriate uvw type texture coordinate.
70
+ if length (uvw) > 2
71
+ push! ( temp_texturecoords, TextureCoordinate (uvw[1 ], uvw[2 ]) )
72
+ else
73
+ push! ( temp_texturecoords, uvw )
74
+ end
69
75
# Handle faces
70
- elseif command == " f"
76
+ elseif command == " f"
71
77
# Handle missing texture coordinate indices case, ie.
72
78
# f v1//vn1 v2//vn2 v3//vn3 ...
73
79
if any ( x-> occursin (" //" , x), lines )
@@ -85,7 +91,7 @@ function loadOBJ(path::String)
85
91
append! ( normalFaces[end ], normalIndices )
86
92
# Handle full indices case, ie.
87
93
# f v1/vt1/vn1 v2/vt2/vn2 v3/vt2/vn3 ...
88
- elseif any (x-> occursin (" /" , x), lines)
94
+ elseif any (x-> occursin (" /" , x), lines)
89
95
indexes = split .(lines, " /" )
90
96
91
97
vertIndices = UInt32[]
0 commit comments