author | Radek Brich <radek.brich@devl.cz> |
Thu, 22 Nov 2007 18:10:10 +0100 | |
branch | pyrit |
changeset 8 | e6567b740c5e |
parent 7 | bf17f9f84c91 |
child 11 | 4d192e13ee84 |
permissions | -rw-r--r-- |
2 | 1 |
* kd-tree |
7
bf17f9f84c91
kd-tree: build algorithm - searching for all posible splits
Radek Brich <radek.brich@devl.cz>
parents:
6
diff
changeset
|
2 |
* transforms, camera |
3 | 3 |
|
7
bf17f9f84c91
kd-tree: build algorithm - searching for all posible splits
Radek Brich <radek.brich@devl.cz>
parents:
6
diff
changeset
|
4 |
New Classes? |
bf17f9f84c91
kd-tree: build algorithm - searching for all posible splits
Radek Brich <radek.brich@devl.cz>
parents:
6
diff
changeset
|
5 |
============ |
3 | 6 |
|
7 |
container.h -- Container |
|
8 |
kdtree.h -- KdTree |
|
9 |
shapes.h -- Triangle, Sphere |
|
10 |
scene.h -- Ray, Light, Camera, Scene |
|
11 |
material.h -- Material, Texture |
|
12 |
matrix.h -- Matrix |
|
13 |
vector.h -- Vector3 |
|
14 |
reader.h -- Reader, WavefrontReader |
|
15 |
||
7
bf17f9f84c91
kd-tree: build algorithm - searching for all posible splits
Radek Brich <radek.brich@devl.cz>
parents:
6
diff
changeset
|
16 |
KdTree top |
3 | 17 |
wf = new WavefrontReader() |
7
bf17f9f84c91
kd-tree: build algorithm - searching for all posible splits
Radek Brich <radek.brich@devl.cz>
parents:
6
diff
changeset
|
18 |
wf.setContainer(top) |
bf17f9f84c91
kd-tree: build algorithm - searching for all posible splits
Radek Brich <radek.brich@devl.cz>
parents:
6
diff
changeset
|
19 |
wf.setTransform(monkey_pos_matrix) |
3 | 20 |
wf.read("monkey.obj") |
7
bf17f9f84c91
kd-tree: build algorithm - searching for all posible splits
Radek Brich <radek.brich@devl.cz>
parents:
6
diff
changeset
|
21 |
// more transform&reads |
3 | 22 |
destroy wf |
23 |
||
7
bf17f9f84c91
kd-tree: build algorithm - searching for all posible splits
Radek Brich <radek.brich@devl.cz>
parents:
6
diff
changeset
|
24 |
top.optimize() -- i.e. build tree |
3 | 25 |
|
26 |
Scene scene -- container with shapes, a camera and lights |
|
27 |
scene = new Scene() |
|
7
bf17f9f84c91
kd-tree: build algorithm - searching for all posible splits
Radek Brich <radek.brich@devl.cz>
parents:
6
diff
changeset
|
28 |
scene.setTop(top) -- top object in hierarchy |
3 | 29 |
scene.setCamera(new Camera(pos, dir, angle)) |
30 |
scene.addLight(new PointLight(pos, color)) |
|
31 |
rt.setScene(scene) |
|
32 |
rt.render(w,h) |
|
33 |
||
34 |
||
35 |
constructors have zero or one parameter by default -- the object to copy data from |
|
36 |
more parameters -- the data (ray origin and direction) |