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