RwPickScene(RwScene *scene, RwInt32 vpx, RwInt32 vpy, RwCamera *camera, RwPickRecord *pick);
Description
Finds the frontmost clump of the scene whose projection on the cameras viewport "contains" the specified point.
Arguments
scene Pointer to the scene.
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 cameras 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.
If the pick records type is rwNAPICKOBJECT, then no clumps were picked.
If the pick records 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 vertex picked, 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