1rtcSetGeometryIntersectFunEcmtbiroene(3R)ay Tracing KretrcnSeeltsGe3ometryIntersectFunction(3)
2
3
4
5   NAME
6              rtcSetGeometryIntersectFunction - sets the callback function to
7                intersect a user geometry
8
9   SYNOPSIS
10              #include <embree3/rtcore.h>
11
12              struct RTCIntersectFunctionNArguments
13              {
14                int* valid;
15                void* geometryUserPtr;
16                unsigned int primID;
17                struct RTCIntersectContext* context;
18                struct RTCRayHitN* rayhit;
19                unsigned int N;
20                unsigned int geomID;
21              };
22
23              typedef void (*RTCIntersectFunctionN)(
24                const struct RTCIntersectFunctionNArguments* args
25              );
26
27              void rtcSetGeometryIntersectFunction(
28                RTCGeometry geometry,
29                RTCIntersectFunctionN intersect
30              );
31
32   DESCRIPTION
33       The  rtcSetGeometryIntersectFunction function registers a ray/primitive
34       intersection callback function (intersect argument) for  the  specified
35       user geometry (geometry argument).
36
37       Only a single callback function can be registered per geometry and fur‐
38       ther invocations overwrite the previously set callback function.  Pass‐
39       ing NULL as function pointer disables the registered callback function.
40
41       The  registered  callback  function is invoked by rtcIntersect-type ray
42       queries to calculate the intersection of a ray packet of variable  size
43       with  one user-defined primitive.  The callback function of type RTCIn‐
44       tersectFunctionN gets passed a number of arguments through  the  RTCIn‐
45       tersectFunctionNArguments  structure.   The  value  N specifies the ray
46       packet size, valid points to an array of integers that specify  whether
47       the corresponding ray is valid (-1) or invalid (0), the geometryUserPtr
48       member points to the geometry user data previously set through  rtcSet‐
49       GeometryUserData, the context member points to the intersection context
50       passed to the ray query, the rayhit member points  to  a  ray  and  hit
51       packet  of variable size N, and the geomID and primID member identifies
52       the geometry ID and primitive ID of the primitive to intersect.
53
54       The ray component of the rayhit structure contains valid data, in  par‐
55       ticular  the tfar value is the current closest hit distance found.  All
56       data inside the hit component of the rayhit structure are undefined and
57       should not be read by the function.
58
59       The  task of the callback function is to intersect each active ray from
60       the ray packet with the specified user primitive.  If the  user-defined
61       primitive is missed by a ray of the ray packet, the function should re‐
62       turn without modifying the ray or hit.  If an intersection of  the  us‐
63       er-defined  primitive  with  the ray was found in the valid range (from
64       tnear to tfar), it should update the hit distance of the ray (tfar mem‐
65       ber)  and  the hit (u, v, Ng, instID, geomID, primID members).  In par‐
66       ticular, the currently intersected instance is  stored  in  the  instID
67       field  of  the intersection context, which must be deep copied into the
68       instID member of the hit.
69
70       As a primitive might have multiple intersections with a ray, the inter‐
71       section filter function needs to be invoked by the user geometry inter‐
72       section callback for each encountered intersection, if filtering of in‐
73       tersections  is desired.  This can be achieved through the rtcFilterIn‐
74       tersection call.
75
76       Within the user geometry intersect function, it is safe  to  trace  new
77       rays and create new scenes and geometries.
78
79   EXIT STATUS
80       On  failure  an  error  code is set that can be queried using rtcGetDe‐
81       viceError.
82
83   SEE ALSO
84       [rtcSetGeometryOccludedFunction], [rtcSetGeometryUserData], [rtcFilter‐
85       Intersection]
86
87
88
89                                            rtcSetGeometryIntersectFunction(3)
Impressum