2013-09-05 21:58:58 -07:00
|
|
|
/* charles.c
|
|
|
|
*
|
|
|
|
* Entry point for Charles, including main().
|
|
|
|
*
|
|
|
|
* Eryn Wells <eryn@erynwells.me>
|
|
|
|
*/
|
|
|
|
|
2013-09-09 22:48:52 -07:00
|
|
|
#include <cstdio>
|
2013-09-07 16:10:42 -07:00
|
|
|
|
2013-09-08 08:45:32 -07:00
|
|
|
#include "basics.h"
|
2013-09-11 08:38:39 -07:00
|
|
|
#include "light.h"
|
2013-09-10 21:02:40 -07:00
|
|
|
#include "object_sphere.h"
|
|
|
|
#include "scene.h"
|
|
|
|
#include "writer_png.h"
|
2013-09-07 16:10:42 -07:00
|
|
|
|
2013-09-09 22:51:55 -07:00
|
|
|
const char *OUT_FILE = "charles_out.png";
|
2013-09-07 16:10:42 -07:00
|
|
|
|
2013-09-05 21:58:58 -07:00
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc,
|
|
|
|
const char *argv[])
|
|
|
|
{
|
2013-09-10 21:02:40 -07:00
|
|
|
Scene scene = Scene();
|
2013-09-07 16:10:42 -07:00
|
|
|
|
2013-09-10 21:02:40 -07:00
|
|
|
// Make some spheres.
|
|
|
|
Sphere *s1 = new Sphere(Vector3(233, 290, 0), 100.0);
|
|
|
|
Sphere *s2 = new Sphere(Vector3(407, 290, 0), 100.0);
|
|
|
|
Sphere *s3 = new Sphere(Vector3(320, 140, 0), 100.0);
|
|
|
|
scene.add_shape(s1);
|
|
|
|
scene.add_shape(s2);
|
|
|
|
scene.add_shape(s3);
|
2013-09-08 20:46:22 -07:00
|
|
|
|
2013-09-11 08:38:39 -07:00
|
|
|
Light *l1 = new Light(Vector3(0.0, 240.0, -100.0), 1.0);
|
|
|
|
Light *l2 = new Light(Vector3(640.0, 240.0, -10000.0), 0.6);
|
|
|
|
scene.add_light(l1);
|
|
|
|
scene.add_light(l2);
|
|
|
|
|
2013-09-10 21:02:40 -07:00
|
|
|
// Render.
|
|
|
|
scene.render();
|
2013-09-08 20:46:22 -07:00
|
|
|
|
2013-09-10 21:02:40 -07:00
|
|
|
Writer *writer = new PNGWriter();
|
|
|
|
scene.write(*writer, OUT_FILE);
|
2013-09-07 16:10:42 -07:00
|
|
|
|
2013-09-05 21:58:58 -07:00
|
|
|
return 0;
|
|
|
|
}
|