MCPcopy Create free account
hub / github.com/RenderKit/embree / intersect

Method intersect

kernels/geometry/instance_array_intersector.cpp:14–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12 namespace isa
13 {
14 void InstanceArrayIntersector1::intersect(const Precalculations& pre, RayHit& ray, RayQueryContext* context, const Primitive& prim)
15 {
16 InstanceArray* instance = context->scene->get<InstanceArray>(prim.instID_);
17 Accel* object = instance->getObject(prim.primID_);
18 if (!object) return;
19
20 /* perform ray mask test */
21#if defined(EMBREE_RAY_MASK)
22 if ((ray.mask & instance->mask) == 0)
23 return;
24#endif
25
26 RTCRayQueryContext* user_context = context->user;
27 if (likely(instance_id_stack::push(user_context, prim.instID_, prim.primID_)))
28 {
29 const AffineSpace3fa world2local = instance->getWorld2Local(prim.primID_);
30 const Vec3ff ray_org = ray.org;
31 const Vec3ff ray_dir = ray.dir;
32 ray.org = Vec3ff(xfmPoint(world2local, ray_org), ray.tnear());
33 ray.dir = Vec3ff(xfmVector(world2local, ray_dir), ray.time());
34 RayQueryContext newcontext((Scene*)object, user_context, context->args);
35 object->intersectors.intersect((RTCRayHit&)ray, &newcontext);
36 ray.org = ray_org;
37 ray.dir = ray_dir;
38 instance_id_stack::pop(user_context);
39 }
40 }
41
42 bool InstanceArrayIntersector1::occluded(const Precalculations& pre, Ray& ray, RayQueryContext* context, const Primitive& prim)
43 {

Callers

nothing calls this directly

Calls 9

pushFunction · 0.85
popFunction · 0.85
getObjectMethod · 0.80
tnearMethod · 0.80
timeMethod · 0.80
xfmPointFunction · 0.50
xfmVectorFunction · 0.50
noneFunction · 0.50
getWorld2LocalMethod · 0.45

Tested by

no test coverage detected