9 #include "PerspectiveCamera.hxx"
13 void RenderFrameCone(const std::string
& fileName
)
15 /* Scene definition */
18 scene
.ParseOBJ("cone.obj", 1.0f
);
20 // alter the camera definition appropriately to see the cow
21 // you may need to implement some set/get routines for the scene class
22 scene
.setCamera(new PerspectiveCamera(Vec3f(0,0,0.5),
30 Image
img(scene
.camera()->resX(),scene
.camera()->resY()); // image array
32 #pragma omp parallel for
33 for(int y
= 0; y
< scene
.camera()->resY(); y
++)
35 for (int x
= 0; x
< scene
.camera()->resX(); x
++)
38 /* Initialize your ray here */
40 scene
.camera()->InitRay(x
+0.5,y
+0.5,ray
); // initialize ray
42 Vec3f col
= scene
.RayTrace(ray
);
44 img(x
,y
) = col
; // store pixel color
47 img
.WritePPM(fileName
); // write final image
52 #define RESX 640 // image x-resolution
53 #define RESY 480 // image y-resolution
57 RenderFrameCone("cone.ppm");
This page took 0.048932 seconds and 5 git commands to generate.