2013-09-05 21:58:58 -07:00
|
|
|
/* charles.c
|
|
|
|
*
|
|
|
|
* Entry point for Charles, including main().
|
|
|
|
*
|
|
|
|
* Eryn Wells <eryn@erynwells.me>
|
|
|
|
*/
|
|
|
|
|
2013-09-07 16:10:42 -07:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <png.h>
|
|
|
|
|
2013-09-08 08:45:32 -07:00
|
|
|
#include "basics.h"
|
|
|
|
#include "object.h"
|
2013-09-07 16:10:42 -07:00
|
|
|
#include "scene.h"
|
2013-09-08 08:45:32 -07:00
|
|
|
#include "texture.h"
|
2013-09-07 16:10:42 -07:00
|
|
|
#include "writer_png.h"
|
|
|
|
|
|
|
|
char *OUT_FILE = "charles_out.png";
|
|
|
|
|
2013-09-05 21:58:58 -07:00
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc,
|
|
|
|
const char *argv[])
|
|
|
|
{
|
2013-09-07 16:10:42 -07:00
|
|
|
FILE *out_file = fopen(OUT_FILE, "wb");
|
|
|
|
if (!out_file) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
Scene *scene = scene_init();
|
2013-09-08 08:45:32 -07:00
|
|
|
Object *obj = object_init(ObjectTypeSphere);
|
|
|
|
Texture *tex = texture_init();
|
|
|
|
Color color = {255, 0, 0, 255};
|
|
|
|
texture_set_color(tex, color);
|
2013-09-08 12:09:19 -07:00
|
|
|
Vector3 loc = {233, 290, 0};
|
|
|
|
object_set_location(obj, loc);
|
2013-09-08 08:45:32 -07:00
|
|
|
object_set_texture(obj, tex);
|
2013-09-08 12:09:19 -07:00
|
|
|
object_sphere_set_radius(obj, 100);
|
2013-09-08 08:45:32 -07:00
|
|
|
scene_add_object(scene, obj);
|
2013-09-07 16:10:42 -07:00
|
|
|
|
|
|
|
scene_render(scene);
|
|
|
|
write_scene_png(scene, out_file);
|
|
|
|
|
|
|
|
scene_destroy(scene);
|
|
|
|
fclose(out_file);
|
|
|
|
|
2013-09-05 21:58:58 -07:00
|
|
|
return 0;
|
|
|
|
}
|