2
|
1 |
* pthreads (pro Windows http://sources.redhat.com/pthreads-win32/)
|
|
2 |
* kd-tree
|
3
|
3 |
|
|
4 |
|
|
5 |
container.h -- Container
|
|
6 |
kdtree.h -- KdTree
|
|
7 |
shapes.h -- Triangle, Sphere
|
|
8 |
scene.h -- Ray, Light, Camera, Scene
|
|
9 |
material.h -- Material, Texture
|
|
10 |
matrix.h -- Matrix
|
|
11 |
vector.h -- Vector3
|
|
12 |
reader.h -- Reader, WavefrontReader
|
|
13 |
|
|
14 |
KdTree monkey
|
|
15 |
wf = new WavefrontReader()
|
|
16 |
wf.setContainer(monkey)
|
|
17 |
wf.read("monkey.obj")
|
|
18 |
destroy wf
|
|
19 |
|
|
20 |
monkey.optimize() -- i.e. build tree
|
|
21 |
|
|
22 |
Scene scene -- container with shapes, a camera and lights
|
|
23 |
scene = new Scene()
|
|
24 |
scene.setTop(monkey) -- top object in hierarchy
|
|
25 |
scene.setCamera(new Camera(pos, dir, angle))
|
|
26 |
scene.addLight(new PointLight(pos, color))
|
|
27 |
rt.setScene(scene)
|
|
28 |
rt.render(w,h)
|
|
29 |
|
|
30 |
|
|
31 |
constructors have zero or one parameter by default -- the object to copy data from
|
|
32 |
more parameters -- the data (ray origin and direction)
|