{if true then wrapperfile = (parent and parent.path or '') .. '/' .. app.opts.plugin_janusxr_wrap_custom hasWrapperfile = util.fileExist(wrapperfile) and true or false showfediportals = app.opts.plugin_federation_strategy == 'always' or (app.opts.plugin_federation_strategy == 'homepage' and urlpath == '/') -- optimize janus resource URLs for archive.org app.plugin.archive.flush() function URL(url) url = util.baseURLify(url) app.plugin.archive.add(url) return url end end} {if defined(items) and #items > 0 then for i,v in pairs(items) do if #v.thumbnail > 0 then print('\t') end end end} {if defined(itemsremote) and #itemsremote > 0 then for i,v in pairs(itemsremote) do if #v.thumbnail > 0 then print('\t') end end end} {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') end end end} {if true then local room = '' pos = '0 0 0' if not defined(item) and defined(items) then room = app.opts.plugin_janusxr_portalroom end function initRoom(r) if r.janusxr and r.janusxr.room then pos = '0 0 2' -- todo make startup location configurable room = r.janusxr.room end end initRoom(item or {}) initRoom(itemdir or {}) if (hasWrapperfile == true) or (defined(item) and item.tag.xrfragments and item.tag.xrfragments.href) then room = '' -- xrfragments 3D files dont need to be wrapped with room end print(' ') if room == 'empty_floor' then print(' ') print(' ') end if defined(item) then print(' ') end end} {if not defined(item) and defined(items) and #items > 0 then local layout = itemdir.layout or '' if #layout > 0 and app.plugin.janusxr.layout[ layout ] then print( app.plugin.janusxr.layout[ layout ].render(items) ) else print( app.plugin.janusxr.layout.portals.render(items) ) end end} {if not defined(item) and defined(itemsremote) and #itemsremote > 0 then for i,v in pairs(itemsremote) do local width = v.portal_width or tonumber( app.opts.plugin_global_portal_width ) local center = -((#itemsremote*width)/1.3) + (i*width) local url = v.url local thumb = ' shader_id="defaultportal" round="true"' if #v.thumbnail > 0 then thumb = ' thumb_id="imgremote' .. i .. '" ' end if v.dir then url = url .. "/" end if v.redirect then url = v.redirect end -- dont wrap standalone glb's in janusxr print( app.plugin.janusxr.addPortal('remote',center, v, url,i, 4, thumb, '0 180 0', '0.2 0.2 0.2') ) end print([[ ]]) end} {if #referrer > 0 then -- hardcoded reciprocal portal local v = { url = referrer, title = app.opts.plugin_janusxr_portal_up, } print( app.plugin.janusxr.addPortal('parent',5, v, v.url, 0, 0, ' shader_id="defaultportal" round="true"', '0 -90 0', '0.2 0.2 0.2') ) end} {if os.getenv('DEBUG') then local plugins = {} foreach(app.plugin, function(name,p) if not tostring(name):match("[0-9]") then table.insert(plugins,name) end end) local embedsrc = EscapeFragment( "config\n======\n" .. util.dump({ plugins = plugins, host = app.host, protocol = app.scheme, convert_assimp_filetypes_in = app.opts.plugin_convert_assimp_filetypes_in, convert_assimp_filetypes_out = app.opts.plugin_convert_assimp_filetypes_out, janusxr_portalroom = app.opts.plugin_janusxr_wrap_video, janusxr_wrap_3dfile = app.opts.plugin_janusxr_wrap_3dfile, janusxr_wrap_video = app.opts.plugin_janusxr_wrap_video, janusxr_wrap_aframe = app.opts.plugin_janusxr_wrap_aframe, janusxr_janusweb_corsproxies = util.split("https://p.janusxr.org https://cors.xrforge.org"," ") }) ) print([[ ]]) end} {if not defined(item) and hasWrapperfile == false then print('${janusxr_jml_deco}') end} {if hasWrapperfile == true then local wrapperURL = util.stripPath( parent.path .. '/' .. app.opts.plugin_janusxr_wrap_custom) print(' ') print(' ') end} {if #opts.plugin_janusxr_jml > 0 then print(' ') print(' ' .. app.opts.plugin_janusxr_jml) end} {if #app.plugin.archive.url > 0 then print('') print("
") for k,url in pairs(app.plugin.archive.url) do print(' ') end print("
") end}