-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample.lua
47 lines (35 loc) · 1.39 KB
/
sample.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
-- THIS CODE IS COPIED FROM nonhier.lua AS IT ADEQUATELY DEMONSTRATES
-- THE EXTENSION (REFLECTION)
mat1 = gr.material({0.7, 1.0, 0.7}, {0.5, 0.7, 0.5}, 25)
mat2 = gr.material({0.5, 0.5, 0.5}, {0.5, 0.7, 0.5}, 25)
mat3 = gr.material({1.0, 0.6, 0.1}, {0.5, 0.7, 0.5}, 25)
mat4 = gr.material({0.7, 0.6, 1.0}, {0.5, 0.4, 0.8}, 25)
scene_root = gr.node('root')
s1 = gr.nh_sphere('s1', {0, 0, -400}, 100)
scene_root:add_child(s1)
s1:set_material(mat1)
s2 = gr.nh_sphere('s2', {200, 50, -100}, 150)
scene_root:add_child(s2)
s2:set_material(mat1)
s3 = gr.nh_sphere('s3', {0, -1200, -500}, 1000)
scene_root:add_child(s3)
s3:set_material(mat2)
b1 = gr.nh_box('b1', {-200, -225, 100}, 100)
scene_root:add_child(b1)
b1:set_material(mat4)
-- s4 = gr.nh_sphere('s4', {-100, 25, -300}, 50)
s4 = gr.nh_sphere('s4', {-150, -085, 150}, 30)
scene_root:add_child(s4)
s4:set_material(mat3)
s5 = gr.nh_sphere('s5', {0, 100, -250}, 25)
scene_root:add_child(s5)
s5:set_material(mat1)
-- A small stellated dodecahedron.
steldodec = gr.mesh( 'dodec', 'smstdodeca.obj' )
steldodec:set_material(mat3)
scene_root:add_child(steldodec)
wintersecte_light = gr.light({-100.0, 150.0, 400.0}, {0.9, 0.9, 0.9}, {1, 0, 0})
magenta_light = gr.light({400.0, 100.0, 150.0}, {0.7, 0.0, 0.7}, {1, 0, 0})
gr.render(scene_root, 'sample.png', 512, 512,
{0, 0, 800}, {0, 0, -1}, {0, 1, 0}, 50,
{0.3, 0.3, 0.3}, {wintersecte_light, magenta_light})