Scene picking

New Message Reply Date view Thread view Subject view Author view

none (dragon++at++hni.uni-paderborn.de)
Sat, 23 Jan 1999 09:34:52 +0100


Hi,

i'm currently working on some scene picking and i am having trouble
to retrieve the vertices of the triangle, which was hit.

Here's the code, which i use:

    pfVec3 hitPoint;
    pfNode *pfnode;
    pfHit **hit;
    pfVec3 vertices[3];

    mode = PFTRAV_IS_PRIM | PFPK_M_NEAREST | PFTRAV_LOD_CUR |
PFTRAV_IS_CULL_BACK;
    numHits = pfChanPick(vgGetPfChan(channel), mode, nx, ny, 0.0f,
&hit);

    pfQueryHit(hit[i], PFQHIT_FLAGS, (float *) &flags);
    if(flags & (PFHIT_POINT | PFHIT_VERTS)) //
alwasy equals PFHIT_POINT
    { pfQueryHit(hit[i], PFQHIT_NODE, (void *) &pfnode);
        numVertices = pfQueryHit(hit[i], PFQHIT_VERTS,(void*) &vertices)
/ sizeof(pfVec3);
        pfQueryHit(hit[i], PFQHIT_POINT, (void *) &hitPoint);
    }

Although all pfQueryHits do the right thing, the query for PFQHIT_VERTS
doesn't. While the hitPoint is correct,
the vertices array contains the same pfVec3, with coordinates x=y=z near
0, in all three array cells.

What have i done wrong? Is there another way to retrieve the vertices of
the triangle hit in an channel pick?

Thanx in advance,

Carsten Scharfe
Heinz Nixdorf Institute
Paderborn, Germany

dragon++at++hni.uni-paderborn.de


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Fri Apr 23 1999 - 01:35:16 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.