Sign in to follow this  

D3DXIntersect

This topic is 4340 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

This topic is 4340 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this