]> Dogcows Code - chaz/rasterize/blobdiff - rotate.lua
add scene lighting constructs; real stdin support
[chaz/rasterize] / rotate.lua
diff --git a/rotate.lua b/rotate.lua
deleted file mode 100755 (executable)
index 4334dd8..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/usr/bin/env lua
-
---
--- CS5600 University of Utah
--- Charles McGarvey
--- mcgarvey@eng.utah.edu
---
-
--- Render a scene multiple times from different angles, like a camera
--- rotating around the object of a scene.
-
-local size = {w = 640, h = 480}
-local slices = 512
-
-local center = {x = 0, y = 1, z = 0}
-local look = {x = -2, y = -1, z = -2}
-local distance = 4
-local start = math.pi
-
-local scene = [[
-g teapot2.raw
-c 1.0 1.0 0.0 1.0 1.0 0.0 1.0 1.0 0.0
-t 0.0 0.0 0.0
-s 0.6 0.6 0.6
-g triangle.raw
-c 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1
-t 2.0 0.0 -2.0
-s 1.0 1.0 1.0
-g dragon.raw
-c 0.7 0.3 0.2 0.8 0.2 0.1 0.9 0.2 0.2
-t -2.0 -1.0 -2.0
-s 2.0 2.0 2.0
-g budda.raw
-c 0.1 0.2 0.7 0.1 0.3 0.9 0.2 0.1 0.8
-t 2.0 -1.5 2.0
-s 10.0 10.0 10.0
-g bunny.raw
-c 0.9 0.8 0.9 0.8 0.7 0.9 0.9 0.8 0.7
-t -2.0 -1.0 2.0
-s 10.0 10.0 10.0
-]]
-
-function vec_add(a, b)
-    return {x = a.x + b.x, y = a.y + b.y, z = a.z + b.z}
-end
-
-function vec_scale(v, s)
-    return {x = v.x * s, y = v.y * s, z = v.z * s}
-end
-
-function render(i, v)
-    while true do
-        local out = io.popen("./project2 -", "w")
-        out:write(string.format([[
-U3
-%d %d
-%f %f %f
-%f %f %f
-0.0 1.0 0.0
-1.57 %f 0.1 1000.0
-%s
-]], size.w, size.h, v.x, v.y, v.z, look.x, look.y, look.z, size.w/size.h, scene))
-        local a, b = coroutine.yield()
-        out:close()
-        os.rename("stdin.bmp", string.format("anim%04d.bmp", i))
-        if a == null then
-            break
-        else
-            i = a
-            v = b
-        end
-    end
-end
-
-local threads = {}
-local jobs = 3
-for i = 1,jobs do
-    table.insert(threads, coroutine.wrap(render))
-end
-
-for i = 0,(slices-1) do
-    local t = start + 2 * i * math.pi / slices
-    local v = {
-        x = math.cos(t),
-        y = 0,
-        z = math.sin(t),
-    }
-    v = vec_add(vec_scale(v, distance), center)
-    threads[(i % jobs) + 1](i, v)
-end
-
-for k,v in ipairs(threads) do
-    v(null)     -- clear up any leftover work
-end
-
This page took 0.017805 seconds and 4 git commands to generate.