author | Radek Brich <radek.brich@devl.cz> |
Tue, 26 Jul 2016 17:41:36 +0200 | |
branch | pyrit |
changeset 103 | 3b3257a410fe |
parent 100 | c005054bf4c1 |
permissions | -rw-r--r-- |
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
|
1 |
#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
|
2 |
#include "common_ply.h" |
100
c005054bf4c1
new build target 'vcproj' - generate Visual C++ Studio project files; fix GCC warnings in intersect_packet()
Radek Brich <radek.brich@devl.cz>
parents:
92
diff
changeset
|
3 |
#include "kdtree.h" |
37
5f954c0d34fc
octree traversal rewritten to avoid recursion
Radek Brich <radek.brich@devl.cz>
parents:
36
diff
changeset
|
4 |
|
40
929aad02c5f2
Makefile: added help and distclean target, plus small fixes
Radek Brich <radek.brich@devl.cz>
parents:
39
diff
changeset
|
5 |
int main(int argc, char **argv) |
29 | 6 |
{ |
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
|
7 |
Raytracer rt; |
85
907a634e5c02
implement triangle packet intersection
Radek Brich <radek.brich@devl.cz>
parents:
72
diff
changeset
|
8 |
KdTree top; |
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 |
Camera cam; |
29 | 10 |
|
36
b490093b0ac3
new virtual Shape::intersect_bbox
Radek Brich <radek.brich@devl.cz>
parents:
35
diff
changeset
|
11 |
rt.setMaxDepth(0); |
29 | 12 |
rt.setTop(&top); |
13 |
||
91 | 14 |
Light light1(Vector(-5.0, 2.0, 8.0), Colour(0.9, 0.3, 0.6)); |
29 | 15 |
light1.castShadows(false); |
72
7c3f38dff082
kd-tree building - check all axes for best split, add additional shape-bbox check
Radek Brich <radek.brich@devl.cz>
parents:
69
diff
changeset
|
16 |
rt.addLight(&light1); |
29 | 17 |
|
91 | 18 |
//Light light2(Vector(-2.0, 10.0, 2.0), Colour(0.4, 0.6, 0.3)); |
29 | 19 |
//light2.castShadows(false); |
72
7c3f38dff082
kd-tree building - check all axes for best split, add additional shape-bbox check
Radek Brich <radek.brich@devl.cz>
parents:
69
diff
changeset
|
20 |
//rt.addLight(&light2); |
29 | 21 |
|
22 |
Material mat(Colour(0.9, 0.9, 0.9)); |
|
69
303583d2fb97
move "smooth" attribute from Triangle to Material
Radek Brich <radek.brich@devl.cz>
parents:
62
diff
changeset
|
23 |
mat.setSmooth(true); |
91 | 24 |
load_ply(rt, "../models/ply/bunny/bun_zipper.ply", &mat, Vector(-29,29,29), Vector(-1,-3,0)); |
29 | 25 |
|
26 |
rt.setCamera(&cam); |
|
91 | 27 |
cam.setEye(Vector(0,0,10)); |
29 | 28 |
|
29 |
top.optimize(); |
|
30 |
||
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
|
31 |
loop_sdl(rt, cam); |
92
9af5c039b678
add MSVC compiler support, make it default for Windows
Radek Brich <radek.brich@devl.cz>
parents:
91
diff
changeset
|
32 |
|
9af5c039b678
add MSVC compiler support, make it default for Windows
Radek Brich <radek.brich@devl.cz>
parents:
91
diff
changeset
|
33 |
return 0; |
29 | 34 |
} |