-
-
Save williame/5799b75baf6bff3137ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vertices, faces = [], [] | |
for line in open("teapot.obj"): | |
if line.strip(): # not an empty line | |
line = line.split() | |
if line[0] == "v": # is a vertex? In the form "v x y z [...]" where x y z are float | |
vertices.append(map(float, line[1:])[:3]) # we want first three axis | |
elif line[0] == "f": # is a face? In the form "f v1[/t1/...] v2[...] ... vN[...] | |
faces.append(map((lambda x: int(x.split("/")[0])), line[1:])) # we only want vertex index |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment