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