ccdemos/realtime.cc
author Radek Brich <radek.brich@devl.cz>
Tue, 06 May 2008 09:39:58 +0200
branchpyrit
changeset 93 96d65f841791
parent 92 9af5c039b678
child 100 c005054bf4c1
permissions -rw-r--r--
more build script tuning make all float constants single precision solve many warnings from msvc and gcc with various -W... flags add common.cc file for dbgmsg() function witch apparently cannot be inlined fix python module building with msvc, add manifest file handling remove forgotten RenderrowData class add stanford models download script for windows (.bat)

#include <stdlib.h>

#include "raytracer.h"
#include "kdtree.h"

#include "common_sdl.h"

int main(int argc, char **argv)
{
	Raytracer rt;
	KdTree top;
	Camera cam;

	rt.setMaxDepth(2);
	rt.setTop(&top);

	Light light1(Vector(2.0f, -5.0f, -5.0f), Colour(0.2f, 0.3f, 0.8f));
	light1.castShadows(false);
	rt.addLight(&light1);

	Light light2(Vector(-2.0f, 10.0f, 2.0f), Colour(0.5f, 0.6f, 0.3f));
	light2.castShadows(false);
	rt.addLight(&light2);

	Material mat_sph(Colour(1.0f, 1.0f, 1.0f));
	mat_sph.setPhong(0.2f, 0.9f, 0.0f, 1.0f);
	mat_sph.setReflectivity(0.3f);
	for (int y=0; y<10; y++)
		for (int x=0; x<10; x++)
			rt.addShape(new Sphere(Vector((Float)x*2-10, (Float)rand()/RAND_MAX*5.0f, (Float)y*2-10), 0.45f, &mat_sph));

	rt.setCamera(&cam);
	cam.setEye(Vector(0,0,10));

	top.optimize();

	loop_sdl(rt, cam);

	return 0;
}