[C++] btTriangleIndexVertexArray question

Ripiz
Posts: 47
Joined: Mon Aug 16, 2010 10:43 am

[C++] btTriangleIndexVertexArray question

Post by Ripiz »

I am sorry if there is some documentation ( I wasn't able to find it ), but what parameters function btTriangleIndexVertexArray() takes?
If I understood right, first parameter is number of triangles I'm passing, second and third not sure, 4th number of vertex/vertices, 5th array of those vertexes, and 6th size of vertex.

Am I right? What about those missing parameters?

Thanks in advance.


P.S. If there's number of verts passed, why function can't automatically assume I'm passing 3 times less triangles than verts? :(
User avatar
jarno
Posts: 57
Joined: Tue Mar 16, 2010 1:42 am

Re: [C++] btTriangleIndexVertexArray question

Post by jarno »

numTriangles: number of triangles
triangleIndexBase: the array of vertex indices that makes up the triangles
triangleIndexStride: the number of bytes to skip in the vertex indices array to go from the start of one triangle to the start of the next triangle. Typically this is 3 times the sizeof the vertex index type.
numVertices: number of vertices
vertexBase: the array of vertex positions
vertexStride: the number of bytes to skip in the vertex position array to go from the start of one vertex to the start of the next vertex. If the vertex position is composed of 3 floats for example, then this would be 3*sizeof(float). If it is 3 doubles with 1 double as padding, then 4*sizeof(double), for example.

As multiple triangles can use the same vertex, and hence the same vertex index, the number of vertices is generally not equal to 3 times the number of triangles.

You can search through the demos to find examples of using btTriangleIndexVertexArray. Benchmarks/BenchmarkDemo.cpp for example.

---JvdL---
Ripiz
Posts: 47
Joined: Mon Aug 16, 2010 10:43 am

Re: [C++] btTriangleIndexVertexArray question

Post by Ripiz »

What if I pass unindexed vertexes, can I pass second parameter as 0 without crashing?
User avatar
jarno
Posts: 57
Joined: Tue Mar 16, 2010 1:42 am

Re: [C++] btTriangleIndexVertexArray question

Post by jarno »

No that will not work.

It's also a bad idea to use a mesh where the vertices are not shared. You end up with a triangle soup, with no information about what triangles are adjacent to what other triangles. There is a real danger of weird things happening when objects for example roll over an edge from one triangle to another. Bullet will not know that the triangles are connected and should be considered a continuous surface.

Furthermore, having many degenerate vertices can hurt performance, simply because there will be far more vertices to process than what is really needed for the mesh.

---JvdL---
jekonaa
Posts: 2
Joined: Wed Mar 09, 2011 6:30 am

Re: [C++] btTriangleIndexVertexArray question

Post by jekonaa »

How do i insert images or videos into a C program because I am trying to make this ds homebrew but all i really have trouble on is inserting the videos.
__________________________
keyword research ~ keyword tool ~ keyword tracking ~ affiliate elite
Last edited by jekonaa on Sat Mar 12, 2011 12:08 pm, edited 1 time in total.
Ripiz
Posts: 47
Joined: Mon Aug 16, 2010 10:43 am

Re: [C++] btTriangleIndexVertexArray question

Post by Ripiz »

Video is A LOT OF IMAGES. So create like 1000 images to make about 50 second video. Unless you know some video encoding algorithm.