diff --git a/xurfer/conf.lua b/xurfer/conf.lua index f8bfa01..f772356 100644 --- a/xurfer/conf.lua +++ b/xurfer/conf.lua @@ -1,3 +1,6 @@ +-- default argument +arg[1] = "https://snips.sh/f/_U5-XctEVE?r=1" + -- sync lovr/love positional cli arguments if arg[0] == nil and arg[1] ~= nil then arg[0] = arg[1] end diff --git a/xurfer/ecs.lua b/xurfer/ecs.lua index b3a538c..131318d 100644 --- a/xurfer/ecs.lua +++ b/xurfer/ecs.lua @@ -1,4 +1,4 @@ -local ecs = require("tiny-ecs") +local ecs = require("lib/tiny-ecs") ecs.init = function(api) print("[i] loading ecs") diff --git a/xurfer/ext/gazecontrol/main.lua b/xurfer/ext/gazecontrol/main.lua index 4931473..feb4955 100644 --- a/xurfer/ext/gazecontrol/main.lua +++ b/xurfer/ext/gazecontrol/main.lua @@ -6,7 +6,7 @@ local gctl gctl = { name = "gctl", - enabled = true, + enabled = false, dtmax = 1, dt = 0, diff --git a/xurfer/ext/janusxr/main.lua b/xurfer/ext/janusxr/main.lua index e3996e7..47103b5 100644 --- a/xurfer/ext/janusxr/main.lua +++ b/xurfer/ext/janusxr/main.lua @@ -18,7 +18,6 @@ return { if res.data:lower():match("") or res.data:lower():match("]") then local JML0 local JML - print_r(api.parser) res.xml = api.parser.xml.newParser() local xmlstr = res.data -- cleanup JML0 @@ -27,7 +26,8 @@ return { api.ext.janusxr.loadXML( JML0, res, obj ) end else - print("[janusxr] error: could not load " .. obj.URI.url .. ": " .. (obj.URLResponse.data or '') ) + print("[janusxr] error: could not load " .. obj.URI.url .. ": ") + print_r(obj.URLResponse) end end end, diff --git a/xurfer/ext/unixy/main.lua b/xurfer/ext/unixy/main.lua index 68d7895..08e8bb1 100644 --- a/xurfer/ext/unixy/main.lua +++ b/xurfer/ext/unixy/main.lua @@ -84,7 +84,7 @@ unixy = { stderr_file = stderr_file, callback = callback }) - trace("[unixy] start job with pid " .. pid .. " => 1> " .. stdout_file .. " 2> " .. stderr_file) + trace("[unixy] start job with pid " .. pid .. ": " .. cmd) end, check_jobs = function() diff --git a/xurfer/main.lua b/xurfer/main.lua index cd0c66d..72b2871 100755 --- a/xurfer/main.lua +++ b/xurfer/main.lua @@ -9,16 +9,16 @@ -- ./lovr xurfer https://janusxr.org/index.html' -- ./lovr xurfer https://snips.sh/f/rHFLg-cewi?r=1' -- cube -- ./lovr xurfer https://snips.sh/f/_U5-XctEVE?r=1' -- cube, monkey, scene - +-- print("\n X U R F Ξ R") print(" ⠭ ⠥ ⠗ ⠋ ⠑ ⠗\n") -package.path = package.path .. ';' .. '?.lua;' +package.path = package.path .. ';' .. '?.lua' require('conf') local runtime = require("runtime/detect") local util = require("util") -local ecs = require("ecs") +local ecs = require("ecs") api = { runtime = runtime, diff --git a/xurfer/runtime/lovr/conf.lua b/xurfer/runtime/lovr/conf.lua index db04940..7bc41fe 100644 --- a/xurfer/runtime/lovr/conf.lua +++ b/xurfer/runtime/lovr/conf.lua @@ -6,14 +6,23 @@ local runtime = require("runtime/detect") -- setup path print("!!!!!!!") -package.path = package.path .. ';' .. - './runtime/lovr/?.lua;' .. - './runtime/lovr/?/init.lua;' .. - './lib/?.lua;' .. - './?.lua' +package.path = package.path .. + 'runtime/lovr/?.lua;' .. + 'runtime/lovr/?/init.lua;' .. + 'lib/?.lua;' .. + '?.lua' --arg[0] .. 'runtime/lovr/?.lua;' .. --arg[0] .. 'runtime/lovr/?/init.lua;' .. --arg[0] .. 'lib/?.lua;' .. +lovr.filesystem.setRequirePath( + lovr.filesystem.getRequirePath() .. ";" .. + 'runtime/lovr/?.lua;' .. + 'runtime/lovr/?/init.lua;' .. + 'lib/?.lua;' .. + '?.lua' +) + +print(lovr.filesystem.getRequirePath()) local util = require("util") local launch = require "runtime/lovr/launch" diff --git a/xurfer/runtime/lovr/main.lua b/xurfer/runtime/lovr/main.lua index 4b336fa..01d187a 100644 --- a/xurfer/runtime/lovr/main.lua +++ b/xurfer/runtime/lovr/main.lua @@ -117,7 +117,7 @@ function lovr.draw(pass) end function lovr.recenter() - if iui.idiom == "vr" then + if iui.idiom == "vr" and lovr.headset.isActive() then mainWindow:recenter() end end @@ -178,19 +178,23 @@ function initInteractions(ecs) ecs.worldPhysics:update(dt) local ox, oy, oz = lovr.headset.getPosition('hand/left/point') - local dx, dy, dz = quat(lovr.headset.getOrientation('hand/left/point')):direction():mul(50):unpack() - local collider, shape, x, y, z = ecs.worldPhysics:raycast(ox, oy, oz, ox + dx, oy + dy, oz + dz) - if collider then - for i, hand in ipairs(lovr.headset.getHands()) do - if lovr.headset.isDown(hand, 'trigger') then - print("buttondown") - end - if lovr.headset.wasReleased(hand, 'trigger') or interactionsUpdater['mouse']['released'] then - local node = collider:getUserData() - interactionsUpdater.selectedBox = collider - interactionsUpdater.hitpoint:set(x, y, z) - if node.onclick ~= nil then node.onclick(node,collider) end + local direction = quat(lovr.headset.getOrientation('hand/left/point')):direction() + if direction ~= nil then + local dx, dy, dz = direction:mul(50):unpack() + local collider, shape, x, y, z = ecs.worldPhysics:raycast(ox, oy, oz, ox + dx, oy + dy, oz + dz) + + if collider then + for i, hand in ipairs(lovr.headset.getHands()) do + if lovr.headset.isDown(hand, 'trigger') then + print("buttondown") + end + if lovr.headset.wasReleased(hand, 'trigger') or interactionsUpdater['mouse']['released'] then + local node = collider:getUserData() + interactionsUpdater.selectedBox = collider + interactionsUpdater.hitpoint:set(x, y, z) + if node.onclick ~= nil then node.onclick(node,collider) end + end end end end diff --git a/xurfer/runtime/lua/main.lua b/xurfer/runtime/lua/main.lua index 4acd8c2..8364e36 100644 --- a/xurfer/runtime/lua/main.lua +++ b/xurfer/runtime/lua/main.lua @@ -11,13 +11,6 @@ api.ext.lua = { api.ecs.filterUpdate = api.ecs.requireAll('updatethread') api.ecs.filterDraw = api.ecs.requireAll('drawthread') - api.protocol.http.request( "https://2wa.isvery.ninja", {}, function(status,data,headers) - print("request done") - --print_r(status) - --print_r(headers) - --print_r(data) - end) - while true do local current_time = os.clock() local dt = current_time - last_time @@ -38,11 +31,11 @@ api.ext.lua = { -- via wget api.protocol.http.request = api.ext.unixy.proxyCLI( "wget", - function(url,opts, cb) return string.format( "out=$(mktemp); wget -O $out https://2wa.isvery.ninja; cat $out; rm $out", url ) end, + function(url,opts, cb) return string.format( "out=$(mktemp); wget -O $out %s; cat $out; rm $out", url ) end, function( stdout, stderr, retcode, url, opts, cb) local status = 200 - if retcode ~= 0 then status = retcode end - cb( retcode, stdout, {string = stderr}) -- todo: parse string into key/values + if retcode ~= 'exit' then status = 500 end + cb( status, stdout, {string = stderr, retcode = retcode}) end ) @@ -52,8 +45,8 @@ api.ext.lua = { function(url,opts, cb) return string.format( "curl -v -s %s", url ) end, function( stdout, stderr, retcode, url, opts, cb) local status = 200 - if retcode ~= 0 then status = retcode end - cb( retcode, stdout, {string = stderr}) -- todo: parse string into key/values + if retcode ~= 'exit' then status = 500 end + cb( status, stdout, {string = stderr, retcode = retcode}) end ) diff --git a/xurfer/test.localhost.jml0 b/xurfer/test.localhost.jml0 new file mode 120000 index 0000000..ee5f570 --- /dev/null +++ b/xurfer/test.localhost.jml0 @@ -0,0 +1 @@ +../test.localhost.jml0 \ No newline at end of file