BRender Technical Reference Manual:4 Data Structures (Alphabetical Reference):br_modelpick2d_cbfn
The Call-Back Function


The Call-Back Function

This type defines a call-back function, which is called by 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.

The typedef

(See 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

Related Functions

The function that invokes this call-back is BrModelPick2D()231.

For a function that calls a call-back for each model actor beneath a specific pixel, see BrScenePick2D()84.

Related Structures

See br_pick2d_cbfn268 for a call-back from which this one is typically called.

See br_model_custom_cbfn247 for details of functions (used from within rendering call-backs) that can convert model co-ordinates into screen co-ordinates, e.g. BrPointToScreenXY()251.



An application defined call-back function that is called by BrModelPick2D()
231. 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.

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_model228.

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_face122.

int vertex

The index giving the vertex nearest the intersection point. This is the vertex vertices[vertex] in the br_face122 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.

The function is called from within BrModelPick2D()231.

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 BrModelPick2D()231.

Possible uses include:

See Also:
br_model228, br_pick2d_cbfn268, br_pick3d_cbfn270.

Generated with CERN WebMaker