RenderWare V2.1

Previous Page Index Next Page

RwPickRecord *

RwPickClump(RwClump *clump, RwInt32 vpx, RwInt32 vpy, RwCamera *camera, RwPickRecord *pick);

Description

Finds the frontmost polygon of the clump whose projection on the camera’s viewport "contains" the specified point.

Arguments

clump Pointer to the clump.

vpx X coordinate (in viewport space coordinates).

vpy Y coordinate (in viewport space coordinates).

camera Pointer to the camera.

pick Pointer to the pick record.

Return Value

A pointer to the argument pick if successful, and NULL otherwise.

Comments

vpx and vpy must be in viewport rather than device space coordinates. To convert from a point in device space coordinates (such as the position of the mouse) to viewport space coordinates simply subtract the X and Y coordinates of the camera’s viewport from the X and Y coordinates of the point.

The pick record has a type field that will have either the value rwNAPICKOBJECT or rwPICKCLUMP. The former means that the clump was not picked.

If the pick record’s type is rwPICKCLUMP, then assuming that pick is a pick record structure whose address was passed as the last argument of the function, upon return from the function:

pick.object.clump.clump

is a pointer to the clump picked,

pick.object.clump.polygon

is a pointer to the polygon picked,

pick.object.clump.vertex

is an RwPickVertexData structure giving information about the picked vertex, and

pick.object.clump.wcpoint

is the world space coordinates of the actual point picked.

RwPickVertexData is defined as follows:

typedef struct
{
RwInt32 vindex;
RwInt32 d2;
} RwPickVertexData;

Fields vindex and d2 specify respectively the index of the vertex picked and the square of its distance (in viewport space units) from the actual pick position.

See Also

RwPickScene()