MCPcopy Create free account
hub / github.com/aras-p/ToyPathTracer / UpdateTest

Function UpdateTest

Cpp/Source/Test.cpp:302–342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

300}
301
302void UpdateTest(float time, int frameCount, int screenWidth, int screenHeight, unsigned testFlags)
303{
304 if (testFlags & kFlagAnimate)
305 {
306 s_Spheres[1].center.y = cosf(time) + 1.0f;
307 s_Spheres[8].center.z = sinf(time) * 0.3f;
308 }
309 float3 lookfrom(0, 2, 3);
310 float3 lookat(0, 0, 0);
311 float distToFocus = 3;
312#if DO_MITSUBA_COMPARE
313 float aperture = 0.0f;
314#else
315 float aperture = 0.1f;
316#endif
317#if DO_BIG_SCENE
318 aperture *= 0.2f;
319#endif
320
321 s_EmissiveSphereCount = 0;
322 for (int i = 0; i < kSphereCount; ++i)
323 {
324 Sphere& s = s_Spheres[i];
325 s.UpdateDerivedData();
326 s_SpheresSoA.centerX[i] = s.center.x;
327 s_SpheresSoA.centerY[i] = s.center.y;
328 s_SpheresSoA.centerZ[i] = s.center.z;
329 s_SpheresSoA.sqRadius[i] = s.radius * s.radius;
330 s_SpheresSoA.invRadius[i] = s.invRadius;
331
332 // Remember IDs of emissive spheres (light sources)
333 const Material& smat = s_SphereMats[i];
334 if (smat.emissive.x > 0 || smat.emissive.y > 0 || smat.emissive.z > 0)
335 {
336 s_EmissiveSpheres[s_EmissiveSphereCount] = i;
337 s_EmissiveSphereCount++;
338 }
339 }
340
341 s_Cam = Camera(lookfrom, lookat, float3(0, 1, 0), 60, float(screenWidth) / float(screenHeight), aperture, distToFocus);
342}
343
344void DrawTest(float time, int frameCount, int screenWidth, int screenHeight, float* backbuffer, int& outRayCount, unsigned testFlags)
345{

Callers 3

RenderFrameGPUFunction · 0.85
RenderFrameCPUFunction · 0.85
renderFunction · 0.85

Calls 3

UpdateDerivedDataMethod · 0.80
CameraClass · 0.70
float3Class · 0.70

Tested by

no test coverage detected