temp: replace roulette with cube3d test, roulette code commented out
This commit is contained in:
@@ -1,3 +1,69 @@
|
|||||||
|
-- 3D rotating cube (temporary test - roulette code commented out below)
|
||||||
|
local tris = {
|
||||||
|
-- SOUTH
|
||||||
|
{ 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0 },
|
||||||
|
{ 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0 },
|
||||||
|
-- NORTH
|
||||||
|
{ 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0, 1.0 },
|
||||||
|
{ 1.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0 },
|
||||||
|
-- EAST
|
||||||
|
{ 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0, 1.0 },
|
||||||
|
{ 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0 },
|
||||||
|
-- WEST
|
||||||
|
{ 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0 },
|
||||||
|
{ 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0 },
|
||||||
|
-- TOP
|
||||||
|
{ 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0 },
|
||||||
|
{ 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0 },
|
||||||
|
-- BOTTOM
|
||||||
|
{ 1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0 },
|
||||||
|
{ 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0 },
|
||||||
|
}
|
||||||
|
|
||||||
|
local gpu = peripheral.wrap("tm_gpu_0")
|
||||||
|
gpu.refreshSize()
|
||||||
|
gpu.setSize(64)
|
||||||
|
local pw, ph, bx, by, sb = gpu.getSize()
|
||||||
|
print(("GPU pixel size: %sx%s blocks: %sx%s per-block: %s"):format(tostring(pw), tostring(ph), tostring(bx), tostring(by), tostring(sb)))
|
||||||
|
local gl = gpu.createWindow3D(1, 1, pw, ph)
|
||||||
|
gl.glFrustum(90, 0.1, 1000)
|
||||||
|
gl.glDirLight(0, 0, -1)
|
||||||
|
local rot = 0
|
||||||
|
while true do
|
||||||
|
gl.clear()
|
||||||
|
gl.glDisable(0xDE1)
|
||||||
|
gl.glTranslate(0, 1, 3)
|
||||||
|
gl.glRotate(rot, 0, 1, 0)
|
||||||
|
gl.glRotate(rot, 0, 0, 1)
|
||||||
|
rot = rot + 3
|
||||||
|
gl.glBegin()
|
||||||
|
for k, v in pairs(tris) do
|
||||||
|
local ci = math.floor((k - 1) / 2)
|
||||||
|
gl.glVertex(v[1], v[2], v[3])
|
||||||
|
local cv = 255
|
||||||
|
if ci % 2 == 0 then cv = 127 end
|
||||||
|
if math.floor(ci / 2) == 0 then
|
||||||
|
gl.glColor(cv, 0, 0)
|
||||||
|
elseif math.floor(ci / 2) == 1 then
|
||||||
|
gl.glColor(0, cv, 0)
|
||||||
|
else
|
||||||
|
gl.glColor(0, 0, cv)
|
||||||
|
end
|
||||||
|
gl.glVertex(v[4], v[5], v[6])
|
||||||
|
gl.glVertex(v[7], v[8], v[9])
|
||||||
|
end
|
||||||
|
gl.glEnd()
|
||||||
|
gl.render()
|
||||||
|
gl.sync()
|
||||||
|
gpu.sync()
|
||||||
|
sleep(0.01)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- =============================================================================
|
||||||
|
-- ROULETTE CODE (commented out)
|
||||||
|
-- =============================================================================
|
||||||
|
--[[
|
||||||
|
|
||||||
-- Roulette Machine
|
-- Roulette Machine
|
||||||
-- Designed for Tom's Peripherals GPU + screen blocks (multi-screen wall).
|
-- Designed for Tom's Peripherals GPU + screen blocks (multi-screen wall).
|
||||||
-- Falls back to vanilla CC:Tweaked monitor if no GPU is attached.
|
-- Falls back to vanilla CC:Tweaked monitor if no GPU is attached.
|
||||||
@@ -321,3 +387,5 @@ local function main()
|
|||||||
end
|
end
|
||||||
|
|
||||||
return { start = start, stop = stop, main = main }
|
return { start = start, stop = stop, main = main }
|
||||||
|
|
||||||
|
--]]
|
||||||
|
|||||||
Reference in New Issue
Block a user