. It is called for each face of a particular model that intersects a given ray. It's typically used to implement face picking functions for user interfaces.
fwproto.hfor a precise declaration)
int br_modelpick2d_cbfn(br_model*, const br_material*, const br_vector3*, const br_vector3*, br_scalar, int, int, int, const br_vector3*, const br_vector2*, void*) Face pick
For a function that calls a call-back for each model actor beneath a specific pixel, see
for a call-back from which this one is typically called.
for details of functions (used from within rendering call-backs) that can convert model co-ordinates into screen co-ordinates, e.g.
An application defined call-back function that is called by
. It is called for each face that intersects a specific section of a particular ray in a model's co-ordinate space.
int BR_CALLBACK CBFnModelPick2D(br_model* model, const br_material* material, const br_vector3* ray_pos, const br_vector3* ray_dir, br_scalar t, int face, int edge, int vertex, const br_vector3* p, const br_vector2* map, void* arg)
br_model * model
Pointer to the model to pick from.
const br_material * material
Pointer to the default material attributed to the model.
const br_vector3 * ray_pos
Pointer to a 3D vector giving a starting position of the pick ray in the model's co-ordinate space.
const br_vector3 * ray_dir
Pointer to a 3D vector giving direction of ray from view-point through pixel in the model's co-ordinate space.
The co-efficient giving the position of the intersection of the face with the pick ray. The position is supplied in
The index of the face intersecting the ray. See
The index giving the edge nearest the intersection point. This is the edge from
The index giving the vertex nearest the intersection point. This is the vertex
] in the
const br_vector3 * p
The position of the point at which the ray intersects the face, obtained using the following formula.
const br_vector2* map
The texture co-ordinates of the intersection point on the face. Apply the (perspective correct) material's texture map transform to obtain the row and column indices into the texture map.
void * arg
The corresponding value specified in the call of
Preconditions: The function is called from within
Effects: Behaviour is up to the application.
Return zero to continue the search for intersecting faces, non-zero to terminate. A non-zero value will be returned by
Example: Possible uses include: