| 15 | |
| 16 | /* returns the point seen through specified pixel */ |
| 17 | extern "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 | |
| 51 | Vec2f getTextureCoordinatesSubdivMesh(void* _mesh, const unsigned int primID, const float u, const float v) |
| 52 | { |
no test coverage detected