Inital commit

This commit is contained in:
uvos 2025-04-18 21:42:38 +02:00
commit a1d223ed29
3 changed files with 83 additions and 0 deletions

28
inwardlines/main.lua Normal file
View File

@ -0,0 +1,28 @@
local width = 1
local distance = 10
local init = false
local x = 0
local y = 0
local z = 0
function drawGrid(pass, y)
pass:setColor(0, 1, 0)
for i=-0.5,0.5,0.05 do
pass:line(x+width*i, y-0.1, z, x, y-0.1, z-distance)
end
end
function lovr.draw(pass)
if not init and lovr.headset.isTracked('head') then
x, y, z = lovr.headset.getPosition('head')
init = true
end
drawGrid(pass, y)
pass:circle(x, y-0.1, z-distance, 0.05, 0, 0, 0, 1, 'fill')
end

33
static/main.lua Normal file
View File

@ -0,0 +1,33 @@
-- Set the units of the default font to pixels instead of meters
local font = lovr.graphics.getDefaultFont()
font:setPixelDensity(1)
-- Set up a 2D orthographic projection, where (0, 0) is the upper
-- left of the window and the units are in pixels
local width, height = lovr.system.getWindowDimensions()
local projection = Mat4():orthographic(0, width, 0, height, -10, 10)
function drawGrid(pass)
pass:setColor(0, 1, 0)
for i=0,1,0.025 do
pass:line(0, height*i, 0, width, height*i, 0)
end
for i=0,1,0.025 do
pass:line(width*i, 0, 0, width*i, height, 0)
end
end
function lovr.draw(pass)
pass:setViewPose(1, mat4():identity())
pass:setProjection(1, projection)
pass:setDepthTest()
drawGrid(pass)
pass:circle(width/2, height/2, 0, 2, 0, 0, 0, 1, 'fill')
pass:setViewPose(2, mat4():identity())
pass:setProjection(2, projection)
drawGrid(pass)
pass:circle(width/2, height/2, 0, 2, 0, 0, 0, 1, 'fill')
end

22
tracking/main.lua Normal file
View File

@ -0,0 +1,22 @@
local width = 20
local height = 20
local distance = 10
function drawGrid(pass)
pass:setColor(0, 1, 0)
for i=-0.5,0.5,0.05 do
pass:line(width*-0.5, height*i, -distance, width*0.5, height*i, -distance)
end
for i=-0.5,0.5,0.05 do
pass:line(width*i, height*-0.5, -distance, width*i, height*0.5, -distance)
end
end
function lovr.draw(pass)
drawGrid(pass)
pass:circle(0, 0, -distance, 0.05, 0, 0, 0, 1, 'fill')
end