br_modelpick2d_cbfn
BrModelPick2D()
231
. 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.
typedef
fwproto.h
for 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
BrModelPick2D()
231
.
For a function that calls a call-back for each model actor beneath a specific pixel, see BrScenePick2D()
84.
br_pick2d_cbfn
268
for a call-back from which this one is typically called.
See br_model_custom_cbfn
247 for details of functions (used from within rendering call-backs) that can convert model co-ordinates into screen co-ordinates, e.g.
BrPointToScreenXY()
251.
Specification
Description:
An application defined call-back function that is called by CBFnModelPick2D()
BrModelPick2D()
231. It is called for each face that intersects a specific section of a particular ray in a model's co-ordinate space.
Declaration:
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)
Arguments:
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.
br_scalar t
The co-efficient giving the position of the intersection of the face with the pick ray. The position is supplied in p
.
int face
The index of the face intersecting the ray. See faces
of br_model
228.
int edge
The index giving the edge nearest the intersection point. This is the edge from vertices
[
edge
]
to vertices
[(
edge
+1)%3]
. See br_face
122.
int vertex
The index giving the vertex nearest the intersection point. This is the vertex vertices
[
vertex
]
in the br_face
122 structure.
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 BrModelPick2D()
231
that invoked this call-back.
Preconditions: The function is called from within
BrModelPick2D()
231
.Effects: Behaviour is up to the application.
Result:
int
Return zero to continue the search for intersecting faces, non-zero to terminate. A non-zero value will be returned by BrModelPick2D()
231.
Example: Possible uses include:
br_model
228
, br_pick2d_cbfn
268
, br_pick3d_cbfn
270
.