xrforge-v2/src/page/janusxr.html

76 lines
3.3 KiB
HTML
Raw Normal View History

2026-08-04 12:17:33 +02:00
<fireboxroom>
<assets>
<assetshader id="xrforgeportal" src="${opts.baseurl}shader/xrforgeportal.shadertoy.frag" shadertype="shadertoy"></assetshader>
{if items and #items > 0 then
for i,v in pairs(items) do
print('\t<assetimage src="' .. v.thumbnail .. '" id="img' .. i .. '"/>')
end
end}
{for i=1,5 do
local urls = app.opts[ 'plugin_federation_url_' .. i]
if #urls > 0 then
local fediurl = urls:gsub(' .*','')
local thumburl = urls:gsub('.* ','')
print('\t<assetimage src="' .. thumburl .. '" id="federated' .. i .. '"/>')
end
end}
</assets>
{if item then
print([[
<room pos="0 0 0" skybox="true" showavatar="false">
<object id="${url}"/>
]])
else
local room = app.opts.plugin_janusxr_portalroom
if room == 'random' then room = app.plugin.janusxr.getRandomRoom() end
print('<room skybox="true" showavatar="false" use_local_asset="' .. room .. '">')
end}
<light js_id="dan9-janus:light/light_cone_angle=0-6" pos="0 3 2" collision_trigger="false" />
{if true then
function addPortal(id,x,v,url,i,z,thumbprefix,rotation,scale)
print('\t\t<object js_id="' .. id .. '_' .. i .. '" pos="' .. x .. ' 0 ' .. z .. '" rotation="' .. rotation .. '">')
print('\t\t <link url="' .. url .. '" thumb_id="' .. thumbprefix .. i .. '" title_col="0.4 0.37 0.4" pos="0 0 0.001" draw_glow="true" scale="3 3 0.1" />')
print('\t\t <link url="' .. url .. '" shader_id="xrforgeportal" pos="0 0 0.003" draw_glow="false" scale="3 3 0.1" />')
print('\t\t <text text="' .. v.title .. '" pos="0 3.4 0" col="1 1 1" font_scale="false" scale="' .. scale .. '" />')
print('\t\t</object>')
end
end}
<text js_id="location" pos="0 6 -5" billboard="y" col="#BBFFFF" scale="10 10 1" text="${url}" emissive="0 0 0" roughness="0.3" metalness="0" />
{if not item and items and #items > 0 then
2026-08-04 12:17:33 +02:00
local portals = {}
for i,v in pairs(items) do table.insert(portals, v) end
if parent then table.insert(portals, p) end
for i,v in pairs(items) do
local width = 3.2
local center = -((#items*width)/1.3) + (i*width)
local url = v.url
if v.dir then url = url .. "/" end
if v.redirect then url = v.redirect end -- dont wrap standalone glb's in janusxr
2026-08-04 12:17:33 +02:00
addPortal('dir',center, v, url,i, -4, 'img', '0 0 0', '0.2 0.2 0.2')
end
end}
{if not item then
2026-08-04 12:17:33 +02:00
local portals = {}
for i=1,5 do
local urls = app.opts[ 'plugin_federation_url_' .. i]
if #urls > 0 then
local fediurl = urls:gsub(' .*','')
table.insert(portals, fediurl )
end
end
if #portals > 0 then
print([[
<text js_id="location" pos="0 6 5" billboard="y" col="#BBFFFF" scale="10 10 1" text="${opts.plugin_federation_title}" emissive="0 0 0" roughness="0.3" metalness="0" />
]])
end
for i,fediurl in pairs(portals) do
local width = 3.2
local center = -((#portals*width)/1.3) + (i*width)
addPortal('federated',center, {title=fediurl}, fediurl,i, 4, 'federated', '0 180 0', '0.1 0.1 0.1')
end
end}
<object id="cube" rotation="0 0 0" position="0 0 0" scale="2 0.1 2"/> <!-- something to stand on -->
${opts.plugin_janusxr_jml}
2026-08-04 12:17:33 +02:00
</room>
</fireboxroom>