IDirect3DRMFrame2::RayPick

Searches the hierarchy starting at this Direct3DRMFrame2 object and calculates the intersections between any visuals and the ray specified by the dvPosition and dvDirection parameters in the coordinate space specified by the lpRefFrame parameter.

HRESULT RayPick(
LPDIRECT3DRMFRAME lpRefFrame,
LPD3DRMRAY ray,
DWORD dwFlags,
LPD3DRMPICKED2ARRAY* lplpPicked2Array
);

Parameters

lpRefFrame

Address of the Direct3DRMFrame object that contains the ray.

ray

A pointer to a D3DRMRAY structure that contains two D3DVECTOR structures. The first D3DVECTOR structure is the vector direction of the ray. The second D3DVECTOR structure is the position of the origin of the ray.

dwFlags

Can be one of the following values:

D3DRMRAYPICK_ONLYBOUNDINGBOXES - Only intersections with bounding boxes of the visuals in the hierarchy are returned. Does not check for exact face intersections.

D3DRMRAYPICK_IGNOREFURTHERPRIMITIVES - Only the closest visual that intersects the ray is returned. Ignores visuals further away than the closest one found so far in a search.

D3DRMRAYPICK_INTERPOLATEUV - Interpolate texture coordinates.

D3DRMRAYPICK_INTERPOLATECOLOR - Interpolate color.

D3DRMRAYPICK_INTERPOLATENORMAL - Interpolate normal.

lplpPicked2Array

The address of a pointer to be initialized with a valid pointer to the IDirect3DRMPicked2Array interface. You then call the IDirect3DRMPicked2Array::GetPick method to retrieve a visual object, an IDirect3DRMFrameArray interface, and a D3DRMPICKDESC2 structure. The array of frames is the path through the hierarchy leading to the visual object that intersected the ray. The D3DRMPICKDESC2 structure contains the face and group identifiers, pick position, horizontal and vertical texture coordinates for the vertex, vertex normal, and color of the intersected objects.

If you specify D3DRMRAYPICK_ONLYBOUNDINGBOXES, the texture, normal and color data in the D3DRMPICKDESC2 structure will be invalid.

Return Values

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible return codes, see Direct3D Retained-Mode Return Values.

Remarks

There are two kinds of flags: optimization flags and interpolation flags. Optimization flags allow you to limit the search and therefore make it faster. Interpolation flags specify what to interpolate if a primitive is hit. The three interpolation choices are color, normal, and texture coordinates.

The ray is specified in the reference frame coordinate space (pointed to by lpRefFrame). If the reference frame is NULL, the ray is specified in world coordinates.