TODO
branchpyrit
changeset 7 bf17f9f84c91
parent 6 d8d596d26f25
child 11 4d192e13ee84
equal deleted inserted replaced
6:d8d596d26f25 7:bf17f9f84c91
     1  * kd-tree
     1  * kd-tree
       
     2  * transforms, camera
     2 
     3 
       
     4 New Classes?
       
     5 ============
     3 
     6 
     4 container.h  -- Container
     7 container.h  -- Container
     5 kdtree.h  -- KdTree
     8 kdtree.h  -- KdTree
     6 shapes.h  -- Triangle, Sphere
     9 shapes.h  -- Triangle, Sphere
     7 scene.h   -- Ray, Light, Camera, Scene
    10 scene.h   -- Ray, Light, Camera, Scene
     8 material.h -- Material, Texture
    11 material.h -- Material, Texture
     9 matrix.h  -- Matrix
    12 matrix.h  -- Matrix
    10 vector.h  -- Vector3
    13 vector.h  -- Vector3
    11 reader.h  -- Reader, WavefrontReader
    14 reader.h  -- Reader, WavefrontReader
    12 
    15 
    13 KdTree monkey
    16 KdTree top
    14 wf = new WavefrontReader()
    17 wf = new WavefrontReader()
    15 wf.setContainer(monkey)
    18 wf.setContainer(top)
       
    19 wf.setTransform(monkey_pos_matrix)
    16 wf.read("monkey.obj")
    20 wf.read("monkey.obj")
       
    21 // more transform&reads
    17 destroy wf
    22 destroy wf
    18 
    23 
    19 monkey.optimize()  -- i.e. build tree
    24 top.optimize()  -- i.e. build tree
    20 
    25 
    21 Scene scene -- container with shapes, a camera and lights
    26 Scene scene -- container with shapes, a camera and lights
    22 scene = new Scene()
    27 scene = new Scene()
    23 scene.setTop(monkey) -- top object in hierarchy
    28 scene.setTop(top) -- top object in hierarchy
    24 scene.setCamera(new Camera(pos, dir, angle))
    29 scene.setCamera(new Camera(pos, dir, angle))
    25 scene.addLight(new PointLight(pos, color))
    30 scene.addLight(new PointLight(pos, color))
    26 rt.setScene(scene)
    31 rt.setScene(scene)
    27 rt.render(w,h)
    32 rt.render(w,h)
    28 
    33