ccdemos/realtime_dragon.cc
author Radek Brich <radek.brich@devl.cz>
Sun, 20 Apr 2008 16:48:24 +0200
branchpyrit
changeset 72 7c3f38dff082
parent 71 4fedf7290929
child 80 907929fa9b59
permissions -rw-r--r--
kd-tree building - check all axes for best split, add additional shape-bbox check extent Container bounds by Eps to fix invisible triangles on borders new Camera constructor with more intuitive lookat/up vectors fix camera axes (mirrored images) better camera angle-of-view change capitalization of addShape and addLight

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

#include "common_sdl.h"
#include "common_ply.h"

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

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

	Light light1(Vector3(-5.0, 2.0, 8.0), Colour(0.9, 0.3, 0.6));
	light1.castShadows(false);
	rt.addLight(&light1);

	//Light light2(Vector3(-2.0, 10.0, 2.0), Colour(0.4, 0.6, 0.3));
	//light2.castShadows(false);
	//rt.addlight(&light2);

	Material mat(Colour(0.9, 0.9, 0.9));
	mat.setSmooth(true);
	load_ply(rt, "../models/ply/dragon/dragon_vrip.ply", &mat, Vector3(-29,29,-29), Vector3(0,-3.6,0));

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

	top.optimize();

	if (argc == 2 && strcmp(argv[1], "-buildonly") == 0)
		return 0;

	loop_sdl(rt, cam);
}