-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How would one extract the triangles from the IQM file? #21
Comments
The positions array is just a big flat array of vertex coordinates, and the The only problem is you need to remove the vertex index is a vertex On Wed, Feb 10, 2016 at 4:04 AM, FuzzyQuills [email protected]
|
Oh wait, so the triangles array points to 3 vec3's not three floats? I'll fiddle around and see if that works. :) EDIT: That kind of makes sense actually; I assume that's how OpenGL handles it then when calling glDrawElements()... (Simply jumping to tris[index]*3) |
Yep, that was it. :) I'm still lazily constructing vec3's, but at least I got it to work.
`` |
Hello. I ask if this is possible:
Essentially, I am using IQM format in my game engine, but for my physics engine to work, I feed in an array of this struct:
struct Triangle { Vec3 p1; Vec3 p2; Vec3 p3; }
For loading the IQM files, I'm using a modified version of the demo implementation, wrapped into a special class I wrote myself.
Now, rendering's fine, but how would one actually extract the vertex coordinates from the stream, using the indices, and put that into an array of that struct above? my attempt was this:
note that trisSoup is a class using an std::vector of the triangle struct.
With that code, i would assume it's correct to address with the tris array, but I end up with a big mess instead of my platform when I do a test rendering of the mesh. I assume this is because I messed up something in the exporting macro...
So, my question is: what is the right way to get a list of triangles from the IQM's vertex stream?
Regards
FuzzyQuills
The text was updated successfully, but these errors were encountered: