Intersects the specified ray with the given mesh subset. This provides similar functionality to D3DXIntersect.
HRESULT D3DXIntersectSubset( LPD3DXBASEMESH pMesh, DWORD AttribId, CONST D3DXVECTOR3 * pRayPos, CONST D3DXVECTOR3 * pRayDir, BOOL * pHit, DWORD * pFaceIndex, FLOAT * pU, FLOAT * pV, FLOAT * pDist, LPD3DXBUFFER * ppAllHits, DWORD * pCountOfHits );
If the function succeeds, the return value is D3D_OK. If the function fails, the return value can be the following value: E_OUTOFMEMORY.
The D3DXIntersectSubset function provides a way to understand points in and around a triangle, independent of where the triangle is actually located. This function returns the resulting point by using the following equation: V1 + U(V2 - V1) + V(V3 - V1).
Any point in the plane V1V2V3 can be represented by the barycentric coordinate (U,V). The parameter U controls how much V2 gets weighted into the result and the parameter V controls how much V3 gets weighted into the result. Lastly, the value of [1 - (U + V)] controls how much V1 gets weighted into the result.
Barycentric coordinates are a form of general coordinates. In this context, using barycentric coordinates represents a change in coordinate systems. What holds true for Cartesian coordinates holds true for barycentric coordinates.
Barycentric coordinates define a point inside a triangle in terms of the triangle's vertices. For a more in-depth description of barycentric coordinates, see Mathworld's Barycentric Coordinates Description.
Header: Declared in D3dx9mesh.h.