Skip to main content
gamedev.net
🔒 Locked

D3DXIntersect

Started by luasitdown Jan 28, 2006 at 12:20 PM 0 replies 850+ views
Original Post
luasitdown
luasitdown
HRESULT WINAPI D3DXIntersect( LPD3DXBASEMESH pMesh, const D3DXVECTOR3 *pRayPos, const D3DXVECTOR3 *pRayDir, BOOL *pHit, DWORD *pFaceIndex, FLOAT *pU, FLOAT *pV, FLOAT *pDist, LPD3DXBUFFER *ppAllHits, DWORD *pCountOfHits ); 1 this function has many parameter. I just wanna the coordinate of intersect point. so are the pU pV pFaceIndex ppAllHits pCountOfHits unuseful? Do I still need deine variable for the output parameter? It seem it can not be set 0 if you do not need them. 2. it is ppAllHits data type typedef struct _D3DXINTERSECTINFO { DWORD FaceIndex; FLOAT U; FLOAT V; FLOAT Dist; } D3DXINTERSECTINFO, *LPD3DXINTERSECTINFO; it seem ppAllHits has also pu pv dist, what is different between ppAllHits and FLOAT *PU ,PV pDist?
neneboricua19
neneboricua19
Quote:
Original post by luasitdown
this function has many parameter. I just wanna the coordinate of intersect point. so are the pU pV pFaceIndex ppAllHits pCountOfHits unuseful?
Do I still need deine variable for the output parameter?
It seem it can not be set 0 if you do not need them.

If all you want is the closest intersection point, then the only thing you need is the "pDist" value. The intersection point can then be found by:

Point = vOrigin + (*pDist)*vRay;

I think only the last two parameters could be set to NULL.
Quote:
Original post by luasitdown
2. it is ppAllHits data type
typedef struct _D3DXINTERSECTINFO {
DWORD FaceIndex;
FLOAT U;
FLOAT V;
FLOAT Dist;
} D3DXINTERSECTINFO, *LPD3DXINTERSECTINFO;

it seem ppAllHits has also pu pv dist, what is different between ppAllHits and
FLOAT *PU ,PV pDist?

Depending on the mesh, a ray could intersect the mesh at more than one point. This array of intersection structures gives details about each point of intersection. The pU, pV, and pDist parameters give information about the closest point of intersection.

neneboricua

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.