. It is called for each model actor in an actor hierarchy that is beneath a particular screen pixel (corresponding to a particular camera). It's typically used to implement picking functions for user interfaces.
fwproto.hfor a precise declaration)
int br_pick2d_cbfn(br_actor*, const br_model*, const br_material*, const br_vector3*, const br_vector3*, br_scalar, br_scalar, void*) 2D pick call-back
For a function that calls a call-back for each model actor whose bounds intersect a specific bounds, see
for a similar 3D call-back.
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 model actor whose bounds intersect the ray passing from a camera through a particular screen pixel (see
int BR_CALLBACK CBFnPick2D(br_actor* a, const br_model* model, const br_material* material, const br_vector3* ray_pos, const br_vector3* ray_dir, br_scalar t_near, br_scalar t_far, void* arg)
br_actor * a
Pointer to model actor whose model bounds intersect the pick ray.
const br_model * model
Pointer to the model attributed to the model actor whose bounds intersect the pick ray (may be an inherited model).
const br_material * material
Pointer to the default material attributed to the model actor that may be used by the model (may be an inherited material).
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. This position has no special significance, i.e. it is not necessarily the position of the view-point.
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 magnitude has no special significance, i.e. it is not necessarily the position of the model.
The co-efficient giving the position of the entry point of the pick ray into the bounds of the intersecting model, in the model's co-ordinate space. To obtain this position refer to the following formula.
The co-efficient giving the position of the exit point of the pick ray out of the bounds of the intersecting model, in the model's co-ordinate space. To obtain this position refer to the following formula.
void * arg
The corresponding value specified in the call of
Preconditions: BRender has completed initialisation. A model's bounds intersect the pick ray. The order in which intersections are computed is undefined.
Effects: Behaviour is up to the application.
Return zero continue the search for intersecting model actors, non-zero to terminate. A non-zero value will be returned by
Remarks: For borderline cases, the pick ray is defined to be such that if a model's rendering would appear in the pixel then the model's bounds will intersect the ray. The precise sub-pixel position of the ray is consistent, but undefined.
Example: Possible uses include: