author | Radek Brich <radek.brich@devl.cz> |
Fri, 23 Nov 2007 16:14:38 +0100 | |
branch | pyrit |
changeset 11 | 4d192e13ee84 |
parent 7 | bf17f9f84c91 |
child 12 | f4fcabf05785 |
permissions | -rw-r--r-- |
11
4d192e13ee84
move nearest_intersection() to Container, add dummy KdTree.load(), plus small fixes
Radek Brich <radek.brich@devl.cz>
parents:
7
diff
changeset
|
1 |
* kd-tree: |
4d192e13ee84
move nearest_intersection() to Container, add dummy KdTree.load(), plus small fixes
Radek Brich <radek.brich@devl.cz>
parents:
7
diff
changeset
|
2 |
- optimize structures |
4d192e13ee84
move nearest_intersection() to Container, add dummy KdTree.load(), plus small fixes
Radek Brich <radek.brich@devl.cz>
parents:
7
diff
changeset
|
3 |
- optimize construction: do not use bounding boxes of shapes, instead implement box-shape intersection |
7
bf17f9f84c91
kd-tree: build algorithm - searching for all posible splits
Radek Brich <radek.brich@devl.cz>
parents:
6
diff
changeset
|
4 |
* transforms, camera |
11
4d192e13ee84
move nearest_intersection() to Container, add dummy KdTree.load(), plus small fixes
Radek Brich <radek.brich@devl.cz>
parents:
7
diff
changeset
|
5 |
* update Python binding, new classes |
4d192e13ee84
move nearest_intersection() to Container, add dummy KdTree.load(), plus small fixes
Radek Brich <radek.brich@devl.cz>
parents:
7
diff
changeset
|
6 |
* C++ demos |
3 | 7 |
|
7
bf17f9f84c91
kd-tree: build algorithm - searching for all posible splits
Radek Brich <radek.brich@devl.cz>
parents:
6
diff
changeset
|
8 |
New Classes? |
bf17f9f84c91
kd-tree: build algorithm - searching for all posible splits
Radek Brich <radek.brich@devl.cz>
parents:
6
diff
changeset
|
9 |
============ |
3 | 10 |
|
11 |
container.h -- Container |
|
12 |
kdtree.h -- KdTree |
|
13 |
shapes.h -- Triangle, Sphere |
|
14 |
scene.h -- Ray, Light, Camera, Scene |
|
15 |
material.h -- Material, Texture |
|
16 |
matrix.h -- Matrix |
|
17 |
vector.h -- Vector3 |
|
18 |
reader.h -- Reader, WavefrontReader |
|
19 |
||
7
bf17f9f84c91
kd-tree: build algorithm - searching for all posible splits
Radek Brich <radek.brich@devl.cz>
parents:
6
diff
changeset
|
20 |
KdTree top |
3 | 21 |
wf = new WavefrontReader() |
7
bf17f9f84c91
kd-tree: build algorithm - searching for all posible splits
Radek Brich <radek.brich@devl.cz>
parents:
6
diff
changeset
|
22 |
wf.setContainer(top) |
bf17f9f84c91
kd-tree: build algorithm - searching for all posible splits
Radek Brich <radek.brich@devl.cz>
parents:
6
diff
changeset
|
23 |
wf.setTransform(monkey_pos_matrix) |
3 | 24 |
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
|
25 |
// more transform&reads |
3 | 26 |
destroy wf |
27 |
||
7
bf17f9f84c91
kd-tree: build algorithm - searching for all posible splits
Radek Brich <radek.brich@devl.cz>
parents:
6
diff
changeset
|
28 |
top.optimize() -- i.e. build tree |
3 | 29 |
|
30 |
Scene scene -- container with shapes, a camera and lights |
|
31 |
scene = new Scene() |
|
7
bf17f9f84c91
kd-tree: build algorithm - searching for all posible splits
Radek Brich <radek.brich@devl.cz>
parents:
6
diff
changeset
|
32 |
scene.setTop(top) -- top object in hierarchy |
3 | 33 |
scene.setCamera(new Camera(pos, dir, angle)) |
34 |
scene.addLight(new PointLight(pos, color)) |
|
35 |
rt.setScene(scene) |
|
36 |
rt.render(w,h) |
|
37 |
||
38 |
||
39 |
constructors have zero or one parameter by default -- the object to copy data from |
|
40 |
more parameters -- the data (ray origin and direction) |