Compare commits

...

2 commits

Author SHA1 Message Date
72baae1d37 accept URL from cli for lovr/love 2026-06-12 11:46:14 +02:00
c2c326f5a5 xrfragment href clickable 2026-06-12 11:27:12 +02:00
136 changed files with 106 additions and 80 deletions

View file

@ -4,10 +4,13 @@ Download/run the binaries for your platform in the releases section.<br>
Developers can run it via [LÖVR](https://lovr.org) or [LÖVE2D](https://love2d.org)
```
$ love src # if you have LÖVE2D installed (>v12)
$ lovr src # if you have LÖVR installed
-- ./lovr xurfer https://snips.sh/f/_U5-XctEVE?r=1' -- cube, monkey, scene
$ love xurfer <url> # if you have LÖVE2D installed (>v12)
$ lovr xurfer <url> # if you have LÖVR installed
```
**Example**: lovr xurfer <a href="https://snips.sh/f/_U5-XctEVE?r=1">https://snips.sh/f/_U5-XctEVE?r=1</a>
## Multiplatform Multimodal XR Browser
The aim of this project is providing **one [XR Hypermedia browser](https://xrhf.isvery.ninja) codebase** which gracefully degrades to handheld/embedded/braille devices:
@ -28,9 +31,9 @@ The aim of this project is providing **one [XR Hypermedia browser](https://xrhf.
So you can strip/bloat however you want, or build one yourself:
```
$ cp src/ext/skeleton src/ext/myextension
$ sed 's|skeleton|myextension|g' src/ext/myextension/*
$ ./lovr src
$ cp xurfer/ext/skeleton xurfer/ext/myextension
$ sed 's|skeleton|myextension|g' xurfer/ext/myextension/*
$ ./lovr xurfer
[i] loading 'myextension'
...
```

6
api.md
View file

@ -2,10 +2,10 @@
<pre>
<a href="">api</a>
<a href="src/lib/json.lua">api.parser.json</a>
<a href="xurfer/lib/json.lua">api.parser.json</a>
<a href="#api-parser-xml">api.parser.xml</a>
<a href="src/lib/url.lua">api.url</a>
<a href="src/util.lua">api.util</a>
<a href="xurfer/lib/url.lua">api.url</a>
<a href="xurfer/util.lua">api.util</a>
<a href="">api.protocol</a>
<a href="#api-ext">api.ext.*</a>
<a href="#api-ext-exec">api.ext.exec(fn, ,..)</a>

View file

@ -1,45 +0,0 @@
local util = require("util")
local ecs = require("ecs")
api = {
parser = {
json = require("json"),
xml = require("xmlSimple"),
},
url = require("url"),
util = require("util"),
ecs = ecs,
world = ecs.world(),
protocol = {},
ext = { -- all extensions are loaded here from disk at runtime
exec = function(...) util.exec(api.ext,...) end -- util function to call func on each extension
}
}
local runtime
local runtimepath
if lovr ~= nil then runtime = { path = "lovr", api = lovr } end
if love ~= nil then runtime = { path = "love", api = love } end
api = util.merge( api, runtime.api )
require( runtime.path .. "/main")
util.loaddir( "ext", api, api.ext )
util.loaddir( "media", api, api.media )
ecs.init()
api.ext.exec('init')
-- GLB URLS
--local url='https://coderofsalvation.codeberg.page/xrfragment-haxe/example/assets/example.glb?bar=1&f=2#foo'
--local url = 'https://codeberg.org/coderofsalvation/xrfragment/raw/branch/main/assets/template/website/website.glb'
--local url = 'https://codeberg.org/coderofsalvation/xrfragment/raw/branch/main/assets/simple-a.glb'
--local url = 'https://xrforge.isvery.ninja/models/zzswz4qlqw8w/model_files/test.xrf.glb'
--
-- JANUS JML URLS
--local url = 'https://janusxr.org/index.html'
--local url = 'https://snips.sh/f/rHFLg-cewi?r=1' -- cube
local url = 'https://snips.sh/f/_U5-XctEVE?r=1' -- cube, monkey, scene
api.ecs.add( api.world, { URI = { url = url, method = 'GET', target = '_top' } })

View file

@ -1,12 +1,14 @@
local api = ...
local sample = require "sample"
local sample
return {
name = "kitchensink",
enabled = false,
enabled = (lover ~= nil),
init = function() end,
init = function()
sample = require "sample"
end,
update = function()
local iui = api.iui

View file

Before

Width:  |  Height:  |  Size: 638 KiB

After

Width:  |  Height:  |  Size: 638 KiB

View file

Before

Width:  |  Height:  |  Size: 310 KiB

After

Width:  |  Height:  |  Size: 310 KiB

View file

Before

Width:  |  Height:  |  Size: 684 KiB

After

Width:  |  Height:  |  Size: 684 KiB

View file

Before

Width:  |  Height:  |  Size: 663 KiB

After

Width:  |  Height:  |  Size: 663 KiB

View file

Before

Width:  |  Height:  |  Size: 782 KiB

After

Width:  |  Height:  |  Size: 782 KiB

View file

Before

Width:  |  Height:  |  Size: 708 KiB

After

Width:  |  Height:  |  Size: 708 KiB

View file

@ -39,7 +39,7 @@ xrf.traverseNodesContaining = function(key,obj,cb)
xrf.traverse( tree, function(node)
if node['extras'] ~= nil then
if node['extras'][key] ~= nil then
cb(node,obj['model'], i, metadata)
cb(node,obj, i, metadata)
end
end
i = i + 1
@ -82,7 +82,8 @@ xrf.calcScale = function(node)
end
xrf.makeClickable = function( physicsWorld, cb)
return function(node_or_mesh,model, i, metadata)
return function(node_or_mesh, obj, i, metadata)
local model = obj['model']
local node = node_or_mesh
if node['mesh'] == nil then node = xrf.getNodeFromMesh(node_or_mesh, metadata, i) end
print("making node " .. node['name'] .. " clickable")
@ -95,7 +96,9 @@ xrf.makeClickable = function( physicsWorld, cb)
local scale = xrf.calcScale(node)
-- we cannot use newMeshCollider because storage type of modelmesh is not cpu
local collider = physicsWorld:newBoxCollider(
x, y, z,
x + (obj.x or 0),
y + (obj.y or 0),
z + (obj.z or 0),
scale[1] * (w + 0.01), -- add 0.01 to avoid 0
scale[2] * (h + 0.01), -- in case of
scale[3] * (d + 0.01) -- planes e.g.

View file

@ -13,8 +13,8 @@ return {
xrf.traverseNodesContaining('href', obj,
xrf.makeClickable( api.ecs.worldPhysics,
function(obj, collider)
print(obj['name'] .. ".href => " .. obj['extras']['href'] )
api.world.add({collider = collider})
print("\nhref was clicked: " .. obj.node.extras.href)
print_r(obj)
end
)
)

View file

@ -1,3 +1,9 @@
api.protocol.http = {
request = function(url,opts)
print("[!] todo: love2D/lua api.protocol.http needs curl/wget fallback")
end
}
-- Load some default values for our rectangle.
function love.load()
x, y, w, h = 20, 20, 60, 20

View file

Before

Width:  |  Height:  |  Size: 175 KiB

After

Width:  |  Height:  |  Size: 175 KiB

View file

Before

Width:  |  Height:  |  Size: 599 B

After

Width:  |  Height:  |  Size: 599 B

View file

Before

Width:  |  Height:  |  Size: 232 B

After

Width:  |  Height:  |  Size: 232 B

View file

Before

Width:  |  Height:  |  Size: 405 B

After

Width:  |  Height:  |  Size: 405 B

View file

Before

Width:  |  Height:  |  Size: 628 B

After

Width:  |  Height:  |  Size: 628 B

View file

Before

Width:  |  Height:  |  Size: 617 B

After

Width:  |  Height:  |  Size: 617 B

View file

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Some files were not shown because too many files have changed in this diff Show more