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

Function renderPixelStandard

tutorials/next_hit/next_hit_device.cpp:306–402  ·  view source on GitHub ↗

task that renders a single screen tile */

Source from the content-addressed store, hash-verified

304
305/* task that renders a single screen tile */
306Vec3ff 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())

Callers 2

renderTileStandardFunction · 0.70
renderFrameStandardFunction · 0.70

Calls 12

RandomSampler_initFunction · 0.85
single_passFunction · 0.85
multi_passFunction · 0.85
MurmurHash3_mixFunction · 0.85
MurmurHash3_finalizeFunction · 0.85
RandomSampler_getFloatFunction · 0.85
Vec3faClass · 0.50
normalizeFunction · 0.50
maxFunction · 0.50
minFunction · 0.50
clampFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected