task that renders a single screen tile */
| 304 | |
| 305 | /* task that renders a single screen tile */ |
| 306 | Vec3ff renderPixelStandard(const TutorialData& data, float x, float y, |
| 307 | const unsigned int width, |
| 308 | const unsigned int height, |
| 309 | const ISPCCamera& camera, |
| 310 | RayStats& stats, |
| 311 | const RTCFeatureFlags feature_mask) |
| 312 | { |
| 313 | /* initialize sampler */ |
| 314 | const int ix = (int)x; |
| 315 | const int iy = (int)y; |
| 316 | RandomSampler mysampler; |
| 317 | RandomSampler_init(mysampler, ix, iy, 0); |
| 318 | |
| 319 | /* initialize ray */ |
| 320 | Ray ray(Vec3fa(camera.xfm.p), Vec3fa(normalize(x*camera.xfm.l.vx + y*camera.xfm.l.vy + camera.xfm.l.vz)), 0.0f, inf, 0.0f); |
| 321 | ray.Ng = {0.0f, 1.0f, 0.0f}; |
| 322 | ray.flags = 0; |
| 323 | ray.id = 0; |
| 324 | ray.u = ray.v = 0.0f; |
| 325 | |
| 326 | /* either gather hits in single pass or using multiple passes */ |
| 327 | HitList hits(data); |
| 328 | switch (data.next_hit_mode) |
| 329 | { |
| 330 | case SINGLE_PASS: |
| 331 | single_pass(data,ray,hits,mysampler,stats,feature_mask); |
| 332 | break; |
| 333 | |
| 334 | case MULTI_PASS_FIXED_NEXT_HITS: |
| 335 | multi_pass (data,ray,hits,data.max_next_hits,mysampler,stats,feature_mask); |
| 336 | break; |
| 337 | #if !defined(EMBREE_SYCL_TUTORIAL) |
| 338 | case MULTI_PASS_OPTIMAL_NEXT_HITS: { |
| 339 | int num_prev_hits = max(1,data.num_prev_hits[iy*width+ix]); |
| 340 | multi_pass (data,ray,hits,num_prev_hits,mysampler,stats,feature_mask); |
| 341 | break; |
| 342 | } |
| 343 | case MULTI_PASS_ESTIMATED_NEXT_HITS: { |
| 344 | int estimated_num_next_hits = (int) min((float)data.max_next_hits, max(1.0f, 0.5f/data.curve_opacity)); |
| 345 | multi_pass (data,ray,hits,estimated_num_next_hits,mysampler,stats,feature_mask); |
| 346 | break; |
| 347 | } |
| 348 | #endif |
| 349 | default: |
| 350 | assert(false); |
| 351 | } |
| 352 | |
| 353 | /* verify result with gathering all hits */ |
| 354 | bool has_error = false; |
| 355 | if (data.verify || data.visualize_errors) |
| 356 | { |
| 357 | /* repeat using a single pass, which is assumed to produce the correct result */ |
| 358 | HitList verify_hits(data); |
| 359 | RandomSampler verify_sampler; |
| 360 | RandomSampler_init(verify_sampler, ix, iy, 0); |
| 361 | single_pass(data,ray,verify_hits,verify_sampler,stats,feature_mask); |
| 362 | |
| 363 | if (verify_hits.size() != hits.size()) |
no test coverage detected