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