17 #include <embree3/rtcore_ray.h>
18 #include <embree3/rtcore_scene.h>
69 rtcInitIntersectContext(&
context);
78 const uint visibility)
80 rtc_ray.org_x = ray.
P.
x;
81 rtc_ray.org_y = ray.
P.
y;
82 rtc_ray.org_z = ray.
P.
z;
83 rtc_ray.dir_x = ray.
D.
x;
84 rtc_ray.dir_y = ray.
D.
y;
85 rtc_ray.dir_z = ray.
D.
z;
88 rtc_ray.time = ray.
time;
89 rtc_ray.mask = visibility;
94 const uint visibility)
97 rayhit.hit.geomID = RTC_INVALID_GEOMETRY_ID;
98 rayhit.hit.primID = RTC_INVALID_GEOMETRY_ID;
106 bool is_hair = hit->geomID & 1;
107 isect->
u = is_hair ? hit->u : 1.0f - hit->v - hit->u;
108 isect->
v = is_hair ? hit->v : hit->u;
109 isect->
t = ray->tfar;
110 isect->Ng =
make_float3(hit->Ng_x, hit->Ng_y, hit->Ng_z);
111 if (hit->instID[0] != RTC_INVALID_GEOMETRY_ID) {
112 RTCScene inst_scene = (RTCScene)rtcGetGeometryUserData(
113 rtcGetGeometry(
kernel_data.bvh.scene, hit->instID[0]));
114 isect->
prim = hit->primID +
115 (
intptr_t)rtcGetGeometryUserData(rtcGetGeometry(inst_scene, hit->geomID));
116 isect->
object = hit->instID[0] / 2;
119 isect->
prim = hit->primID + (
intptr_t)rtcGetGeometryUserData(
120 rtcGetGeometry(
kernel_data.bvh.scene, hit->geomID));
132 isect->
u = 1.0f - hit->v - hit->u;
134 isect->
t = ray->tfar;
135 isect->Ng =
make_float3(hit->Ng_x, hit->Ng_y, hit->Ng_z);
136 RTCScene inst_scene = (RTCScene)rtcGetGeometryUserData(
137 rtcGetGeometry(
kernel_data.bvh.scene, local_object_id * 2));
138 isect->
prim = hit->primID +
139 (
intptr_t)rtcGetGeometryUserData(rtcGetGeometry(inst_scene, hit->geomID));
140 isect->
object = local_object_id;
IntersectContext(CCLIntersectContext *ctx)
CCLIntersectContext * userRayExt
RTCIntersectContext context
ccl_device_inline void kernel_embree_convert_sss_hit(KernelGlobals *kg, const RTCRay *ray, const RTCHit *hit, Intersection *isect, int local_object_id)
ccl_device_inline void kernel_embree_setup_rayhit(const Ray &ray, RTCRayHit &rayhit, const uint visibility)
ccl_device_inline void kernel_embree_convert_hit(KernelGlobals *kg, const RTCRay *ray, const RTCHit *hit, Intersection *isect)
ccl_device_inline void kernel_embree_setup_ray(const Ray &ray, RTCRay &rtc_ray, const uint visibility)
#define kernel_tex_fetch(tex, index)
#define ccl_device_inline
#define CCL_NAMESPACE_END
#define make_float3(x, y, z)
LocalIntersection * local_isect
CCLIntersectContext(KernelGlobals *kg_, RayType type_)