Changes

Jump to: navigation, search

Studyapplocator

57 bytes added, 14:10, 1 April 2018
Profile generated
Another area that will be speed up the program would be the render function
<code> <nowiki> for (unsigned y = 0; y < heightIMG_RES; ++y) { for (unsigned x = 0; x < widthIMG_RES; ++x, ++pixel) { int k = x + y * IMG_RES; float xx = (2 * ((x + 0.5) * invWidthiwidth) - 1) * angle viewangle * aspectratio; float yy = (1 - 2 * ((y + 0.5) * invHeightiheight)) * angleviewangle; Vec3f raydir, rayorig; raydir.init(xx, yy, -1); raydir.normalize(); *pixel = trace(Vec3f rayorig.init(0); trace(rayorig, raydir, spheres0, 0pixel, sphere, k); } </nowiki></code>
This function traces the rays for each pixel of the image traces it and returns a color.
53
edits

Navigation menu