ccdemos/realtime_bunny.cc
author Radek Brich <radek.brich@devl.cz>
Thu, 10 Apr 2008 23:20:36 +0200
branchpyrit
changeset 65 242839c6d27d
parent 62 07c2f8084719
child 69 303583d2fb97
permissions -rw-r--r--
basic detection of compiler (GCC or ICC) and CPU capabilities try to detect Python path in Windows and allow direct specification through build option plus other build system fixes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29
574c34441a1c new C++ demo: realtime_bunny
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     1
#include "raytracer.h"
35
fb170fccb19f new space partitioning structure: octree
Radek Brich <radek.brich@devl.cz>
parents: 29
diff changeset
     2
#include "octree.h"
29
574c34441a1c new C++ demo: realtime_bunny
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     3
39
7079dcc3bd74 ccdemos: put the common code to header files, common_ply.h and common_sdl.h
Radek Brich <radek.brich@devl.cz>
parents: 38
diff changeset
     4
#include "common_sdl.h"
7079dcc3bd74 ccdemos: put the common code to header files, common_ply.h and common_sdl.h
Radek Brich <radek.brich@devl.cz>
parents: 38
diff changeset
     5
#include "common_ply.h"
37
5f954c0d34fc octree traversal rewritten to avoid recursion
Radek Brich <radek.brich@devl.cz>
parents: 36
diff changeset
     6
40
929aad02c5f2 Makefile: added help and distclean target, plus small fixes
Radek Brich <radek.brich@devl.cz>
parents: 39
diff changeset
     7
int main(int argc, char **argv)
29
574c34441a1c new C++ demo: realtime_bunny
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     8
{
39
7079dcc3bd74 ccdemos: put the common code to header files, common_ply.h and common_sdl.h
Radek Brich <radek.brich@devl.cz>
parents: 38
diff changeset
     9
	Raytracer rt;
7079dcc3bd74 ccdemos: put the common code to header files, common_ply.h and common_sdl.h
Radek Brich <radek.brich@devl.cz>
parents: 38
diff changeset
    10
	Octree top;
7079dcc3bd74 ccdemos: put the common code to header files, common_ply.h and common_sdl.h
Radek Brich <radek.brich@devl.cz>
parents: 38
diff changeset
    11
	Camera cam;
29
574c34441a1c new C++ demo: realtime_bunny
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    12
36
b490093b0ac3 new virtual Shape::intersect_bbox
Radek Brich <radek.brich@devl.cz>
parents: 35
diff changeset
    13
	rt.setMaxDepth(0);
29
574c34441a1c new C++ demo: realtime_bunny
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    14
	rt.setTop(&top);
574c34441a1c new C++ demo: realtime_bunny
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    15
574c34441a1c new C++ demo: realtime_bunny
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    16
	Light light1(Vector3(-5.0, 2.0, 8.0), Colour(0.9, 0.3, 0.6));
574c34441a1c new C++ demo: realtime_bunny
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    17
	light1.castShadows(false);
574c34441a1c new C++ demo: realtime_bunny
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    18
	rt.addlight(&light1);
574c34441a1c new C++ demo: realtime_bunny
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    19
574c34441a1c new C++ demo: realtime_bunny
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    20
	//Light light2(Vector3(-2.0, 10.0, 2.0), Colour(0.4, 0.6, 0.3));
574c34441a1c new C++ demo: realtime_bunny
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    21
	//light2.castShadows(false);
574c34441a1c new C++ demo: realtime_bunny
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    22
	//rt.addlight(&light2);
574c34441a1c new C++ demo: realtime_bunny
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    23
574c34441a1c new C++ demo: realtime_bunny
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    24
	Material mat(Colour(0.9, 0.9, 0.9));
62
07c2f8084719 more SConscript tweaking, make model preparation work again
Radek Brich <radek.brich@devl.cz>
parents: 40
diff changeset
    25
	load_ply(rt, "../models/ply/bunny/bun_zipper.ply", &mat, Vector3(-29,29,29), Vector3(-1,-3,0));
29
574c34441a1c new C++ demo: realtime_bunny
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    26
574c34441a1c new C++ demo: realtime_bunny
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    27
	rt.setCamera(&cam);
574c34441a1c new C++ demo: realtime_bunny
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    28
	cam.setEye(Vector3(0,0,10));
574c34441a1c new C++ demo: realtime_bunny
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    29
574c34441a1c new C++ demo: realtime_bunny
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    30
	top.optimize();
574c34441a1c new C++ demo: realtime_bunny
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    31
39
7079dcc3bd74 ccdemos: put the common code to header files, common_ply.h and common_sdl.h
Radek Brich <radek.brich@devl.cz>
parents: 38
diff changeset
    32
	loop_sdl(rt, cam);
29
574c34441a1c new C++ demo: realtime_bunny
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    33
}