Skip to content

[models] Get Triangles of mesh #2555

Answered by chriscamacho
CrezyDud asked this question in Q&A
Discussion options

You must be logged in to vote

I made a paint3d experiment quite a while ago, after ray colliding with a model I then drilled into the models tris....

            int triangleCount = model->meshes[m].vertexCount/3;

        // Test against all triangles in mesh
        for (int i = 0; i < triangleCount; i++)
        {
            Vector3 a, b, c;
            Vector2 u1,u2,u3;
            Vector3 *vertdata = (Vector3 *)model->meshes[m].vertices;
            Vector2 *uvdata = (Vector2*)model->meshes[m].texcoords;

            if (model->meshes[m].indices)
            {
                a = vertdata[model->meshes[m].indices[i*3 + 0]];
                b = vertdata[model->meshes[m].indices[i*3 + 1]];
                c = vert…

Replies: 8 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@CrezyDud
Comment options

@WiiBot
Comment options

Answer selected by CrezyDud
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@CrezyDud
Comment options

Comment options

You must be logged in to vote
1 reply
@CrezyDud
Comment options

Comment options

You must be logged in to vote
2 replies
@CrezyDud
Comment options

@chriscamacho
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #2552 on June 25, 2022 17:10.