renders a single pixel with eyelight shading */
| 212 | |
| 213 | /* renders a single pixel with eyelight shading */ |
| 214 | Vec3fa renderPixelDebugShader(const DebugShaderData& data, float x, float y, const ISPCCamera& camera, RayStats& stats, const RTCFeatureFlags feature_mask) |
| 215 | { |
| 216 | /* initialize ray */ |
| 217 | Ray ray; |
| 218 | ray.org = Vec3ff(camera.xfm.p); |
| 219 | ray.dir = Vec3ff(normalize(x*camera.xfm.l.vx + y*camera.xfm.l.vy + camera.xfm.l.vz)); |
| 220 | ray.tnear() = 0.0f; |
| 221 | ray.tfar = inf; |
| 222 | ray.geomID = RTC_INVALID_GEOMETRY_ID; |
| 223 | ray.primID = RTC_INVALID_GEOMETRY_ID; |
| 224 | ray.mask = -1; |
| 225 | ray.time() = data.debug; |
| 226 | |
| 227 | /* intersect ray with scene */ |
| 228 | int64_t c0 = get_tsc(); |
| 229 | if (data.shader == SHADER_OCCLUSION) |
| 230 | { |
| 231 | RTCOccludedArguments args; |
| 232 | rtcInitOccludedArguments(&args); |
| 233 | args.feature_mask = feature_mask; |
| 234 | rtcTraversableOccluded1(data.traversable,RTCRay_(ray),&args); |
| 235 | } |
| 236 | else |
| 237 | { |
| 238 | RTCIntersectArguments args; |
| 239 | rtcInitIntersectArguments(&args); |
| 240 | args.feature_mask = feature_mask; |
| 241 | rtcTraversableIntersect1(data.traversable,RTCRayHit_(ray),&args); |
| 242 | } |
| 243 | |
| 244 | int64_t c1 = get_tsc(); |
| 245 | RayStats_addRay(stats); |
| 246 | |
| 247 | /* shade pixel */ |
| 248 | switch (data.shader) |
| 249 | { |
| 250 | case SHADER_EYELIGHT: |
| 251 | if (ray.geomID == RTC_INVALID_GEOMETRY_ID) |
| 252 | return Vec3fa(0.0f); |
| 253 | else if (dot(ray.dir,ray.Ng) < 0.0f) |
| 254 | return Vec3fa(0.0f,abs(dot(ray.dir,normalize(ray.Ng))),0.0f); |
| 255 | else |
| 256 | return Vec3fa(abs(dot(ray.dir,normalize(ray.Ng))),0.0f,0.0f); |
| 257 | |
| 258 | case SHADER_OCCLUSION: |
| 259 | if (ray.tfar >= 0.0f) |
| 260 | return Vec3fa(0.0f,0.0f,0.0f); |
| 261 | else |
| 262 | return Vec3fa(1.0f,1.0f,1.0f); |
| 263 | |
| 264 | case SHADER_UV: |
| 265 | if (ray.geomID == RTC_INVALID_GEOMETRY_ID) return Vec3fa(0.0f,0.0f,0.0f); |
| 266 | else return Vec3fa(ray.u,ray.v,1.0f-ray.u-ray.v); |
| 267 | |
| 268 | case SHADER_TEXCOORDS: |
| 269 | case SHADER_TEXCOORDS_GRID: |
| 270 | |
| 271 | #if !defined(__SYCL_DEVICE_ONLY__) |
nothing calls this directly
no test coverage detected