Skip to content

Instantly share code, notes, and snippets.

@jsimmons
Last active August 11, 2017 18:20
Show Gist options
  • Save jsimmons/3bb4e583e5e39206b4511e9f087115a2 to your computer and use it in GitHub Desktop.
Save jsimmons/3bb4e583e5e39206b4511e9f087115a2 to your computer and use it in GitHub Desktop.
I presume this is how I did it last time...
typedef float f;typedef int i;
f t[2<<15];
void parse_obj() {
f *l=t;i c;while((c=getchar())!=EOF)if((c=='v'||c=='f')&&scanf(" %f %f %f\n",l,l+1,l+2)==3)if(c=='v')l+=3;else{
I k=(I){*l,*(l+1),*(l+2)};
printf("FACE (%f, %f, %f), (%f, %f %f), (%f, %f, %f)\n",
t[k.x*3],t[k.x*3+1],t[k.x*3+2],
t[k.y*3],t[k.y*3+1],t[k.y*3+2],
t[k.z*3],t[k.z*3+1],t[k.z*3+2]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment