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

Function renderPixelStandard

tutorials/lazy_geometry/lazy_geometry_device.cpp:277–307  ·  view source on GitHub ↗

task that renders a single screen tile */

Source from the content-addressed store, hash-verified

275
276/* task that renders a single screen tile */
277Vec3fa renderPixelStandard(float x, float y, const ISPCCamera& camera, RayStats& stats)
278{
279 /* initialize ray */
280 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, -1, RTC_INVALID_GEOMETRY_ID, RTC_INVALID_GEOMETRY_ID);
281 ray.instID[0] = 4;
282
283 /* intersect ray with scene */
284 rtcIntersect1(g_scene,RTCRayHit_(ray));
285 RayStats_addRay(stats);
286
287 /* shade pixels */
288 Vec3fa color = Vec3fa(0.0f);
289 if (ray.geomID != RTC_INVALID_GEOMETRY_ID)
290 {
291 Vec3fa diffuse = Vec3fa(1.0f);
292 color = color + diffuse*0.5;
293 Vec3fa lightDir = normalize(Vec3fa(-1,-1,-1));
294
295 /* initialize shadow ray */
296 Ray shadow(ray.org + ray.tfar*ray.dir, neg(lightDir), 0.001f, inf);
297
298 /* trace shadow ray */
299 rtcOccluded1(g_scene,RTCRay_(shadow));
300 RayStats_addShadowRay(stats);
301
302 /* add light contribution */
303 if (shadow.tfar >= 0.0f)
304 color = color + diffuse*clamp(-dot(lightDir,normalize(ray.Ng)),0.0f,1.0f);
305 }
306 return color;
307}
308
309/* renders a single screen tile */
310void renderTileStandard(int taskIndex,

Callers 1

renderTileStandardFunction · 0.70

Calls 11

rtcIntersect1Function · 0.85
RTCRayHit_Function · 0.85
RayStats_addRayFunction · 0.85
negFunction · 0.85
rtcOccluded1Function · 0.85
RTCRay_Function · 0.85
RayStats_addShadowRayFunction · 0.85
Vec3faClass · 0.50
normalizeFunction · 0.50
clampFunction · 0.50
dotFunction · 0.50

Tested by

no test coverage detected