Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- scene_info = SceneInfo() {
- image_width = 320,
- image_height = 240,
- frames = 30
- }
- function scene(clock)
- local s = Scene() {
- background_color = Color(0, 0, 0),
- camera = Perspective(90) { transform = Rotate(y, clock * 360)
- * Translate(6*y - 6*z)
- * Rotate(x, 30)
- }
- }
- s:add_lights({
- Light() {
- color = white,
- transform = Translate(8*y + -6*z + 4*x),
- area = true,
- rows = 8,
- cols = 8
- }
- })
- local teapot_texture = Texture() {
- pigment = ColorPigment() { color = Color(1.0, 0.2, 0.2) },
- finish = Finish() {
- ambient = Color(0.1, 0.1, 0.1),
- diffuse = 0.5,
- specular = 0.9,
- exponent = 170,
- reflection = 0.8
- }
- }
- local ball_texture = Texture() {
- pigment = ColorPigment() { color = Color(0.7, 0.7, 0.8) },
- finish = Finish() {
- ambient = Color(0.1, 0.1, 0.1),
- diffuse = 0.8,
- specular = 0.9,
- exponent = 64
- }
- }
- m = mesh_from_obj("C:\\temp\\bunny.obj") {
- transform = Scale(.5,.5,.5) * Rotate(y, 180),
- texture = teapot_texture,
- smooth = true
- }
- s:add_mesh(m)
- for i = 1,15 do
- local v = Vector(3 * math.sin((i/15)*2*math.pi), 1, 3 * math.cos((i/15)*2*math.pi))
- local tf = Translate(v) * Scale(.3, .3, .3)
- s:add_entity(Sphere(tf) { texture = ball_texture })
- end
- floor = Mesh() {
- vertices = {
- {-100.0, 0.0, -100.0},
- {100.0, 0.0, -100.0},
- {100.0, 0.0, 100.0},
- {-100.0, 0.0, 100.0},
- },
- indices = {
- { 1, 4, 2 },
- { 2, 4, 3 }
- }
- }
- s:add_mesh(floor)
- return s
- end
Add Comment
Please, Sign In to add comment