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

Method occluded

kernels/geometry/instance_array_intersector.cpp:42–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40 }
41
42 bool InstanceArrayIntersector1::occluded(const Precalculations& pre, Ray& ray, RayQueryContext* context, const Primitive& prim)
43 {
44 const InstanceArray* instance = context->scene->get<InstanceArray>(prim.instID_);
45 Accel* object = instance->getObject(prim.primID_);
46 if (!object) return false;
47
48 /* perform ray mask test */
49#if defined(EMBREE_RAY_MASK)
50 if ((ray.mask & instance->mask) == 0)
51 return false;
52#endif
53
54 RTCRayQueryContext* user_context = context->user;
55 bool occluded = false;
56 if (likely(instance_id_stack::push(user_context, prim.instID_, prim.primID_)))
57 {
58 const AffineSpace3fa world2local = instance->getWorld2Local(prim.primID_);
59 Accel* object = instance->getObject(prim.primID_);
60 const Vec3ff ray_org = ray.org;
61 const Vec3ff ray_dir = ray.dir;
62 ray.org = Vec3ff(xfmPoint(world2local, ray_org), ray.tnear());
63 ray.dir = Vec3ff(xfmVector(world2local, ray_dir), ray.time());
64 RayQueryContext newcontext((Scene*)object, user_context, context->args);
65 object->intersectors.occluded((RTCRay&)ray, &newcontext);
66 ray.org = ray_org;
67 ray.dir = ray_dir;
68 occluded = ray.tfar < 0.0f;
69 instance_id_stack::pop(user_context);
70 }
71 return occluded;
72 }
73
74 bool InstanceArrayIntersector1::pointQuery(PointQuery* query, PointQueryContext* context, const Primitive& prim)
75 {

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