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

Function device_pick

tutorials/common/tutorial/tutorial_device.cpp:17–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15
16/* returns the point seen through specified pixel */
17extern "C" bool device_pick(const float x,
18 const float y,
19 const ISPCCamera& camera,
20 Vec3fa& hitPos)
21{
22 /* initialize ray */
23 Ray1 ray;
24 ray.org = Vec3ff(camera.xfm.p);
25 ray.dir = Vec3ff(normalize(x*camera.xfm.l.vx + y*camera.xfm.l.vy + camera.xfm.l.vz));
26 ray.tnear() = 0.0f;
27 ray.tfar = inf;
28 ray.geomID = RTC_INVALID_GEOMETRY_ID;
29 ray.primID = RTC_INVALID_GEOMETRY_ID;
30 ray.mask = -1;
31 ray.time() = g_debug;
32
33 /* intersect ray with scene */
34#if defined(__SYCL_DEVICE_ONLY__)
35 rtcTraversableIntersect1(g_traversable,RTCRayHit1_(ray));
36#else
37 rtcIntersect1(g_scene,RTCRayHit1_(ray));
38#endif
39
40 /* shade pixel */
41 if (ray.geomID == RTC_INVALID_GEOMETRY_ID) {
42 hitPos = Vec3fa(0.0f,0.0f,0.0f);
43 return false;
44 }
45 else {
46 hitPos = ray.org + ray.tfar*ray.dir;
47 return true;
48 }
49}
50
51Vec2f getTextureCoordinatesSubdivMesh(void* _mesh, const unsigned int primID, const float u, const float v)
52{

Callers 1

clickFuncMethod · 0.85

Calls 7

RTCRayHit1_Function · 0.85
rtcIntersect1Function · 0.85
tnearMethod · 0.80
timeMethod · 0.80
normalizeFunction · 0.50
rtcTraversableIntersect1Function · 0.50
Vec3faClass · 0.50

Tested by

no test coverage detected