xrforge-v2/src/page/janusxr.html

93 lines
3.8 KiB
HTML
Raw Normal View History

2026-08-06 16:43:17 +02:00
{if true then
showfediportals = app.opts.plugin_federation_strategy == 'always' or
(app.opts.plugin_federation_strategy == 'homepage' and urlpath == '/')
end}
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
if #v.thumbnail > 0 then
print('\t<assetimage src="' .. v.thumbnail .. '" id="img' .. i .. '"/>')
end
2026-08-04 12:17:33 +02:00
end
end}
2026-08-06 16:43:17 +02:00
{if showfediportals then
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
2026-08-04 12:17:33 +02:00
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 item and item.janusxr and item.janusxr.room then
room = item.janusxr.room
end
2026-08-04 12:17:33 +02:00
if room == 'random' then room = app.plugin.janusxr.getRandomRoom() end
print(' <room skybox="true" showavatar="false" use_local_asset="' .. room .. '">')
2026-08-04 12:17:33 +02:00
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,thumb,rotation,scale)
print('\t<object js_id="' .. id .. '_' .. i .. '" pos="' .. x .. ' 0 ' .. z .. '" rotation="' .. rotation .. '">')
print('\t <link url="' .. url .. '" ' .. thumb .. ' title_col="0.4 0.37 0.4" pos="0 0 0.001" draw_glow="true" scale="3 3 0.1" />')
print('\t <text text="' .. v.title .. '" pos="0 3.4 0" col="1 1 1" font_scale="false" scale="' .. scale .. '" />')
print('\t</object>')
2026-08-04 12:17:33 +02:00
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
local thumb = ' shader_id="defaultportal"'
if #v.thumbnail > 0 then
thumb = ' thumb_id="img' .. i .. '" '
end
2026-08-04 12:17:33 +02:00
if v.dir then url = url .. "/" end
if v.redirect then url = v.redirect end -- dont wrap standalone glb's in janusxr
addPortal('dir',center, v, url,i, -4, thumb, '0 0 0', '0.2 0.2 0.2')
2026-08-04 12:17:33 +02:00
end
end}
2026-08-06 16:43:17 +02:00
{if showfediportals and 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)
local thumb = ' image_id="federated' .. i .. '"'
addPortal('federated',center, {title=fediurl}, fediurl,i, 4, thumb, '0 180 0', '0.1 0.1 0.1')
2026-08-04 12:17:33 +02:00
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>