updated sidecar-logic for thumbnails
This commit is contained in:
parent
e34a87d475
commit
4516de9e58
6 changed files with 44 additions and 29 deletions
|
|
@ -90,6 +90,9 @@ util.template = function(content,data)
|
|||
mdata.title = mdata.title or app.opts.subtitle
|
||||
mdata.header_include = mdata.header_include or ''
|
||||
mdata.header = app.tpl( LoadAsset('page/header.html'), mdata )
|
||||
if not mdata.footer_janusxr then
|
||||
mdata.footer_janusxr = app.tpl( LoadAsset('page/footer.janusxr.html'), mdata )
|
||||
end
|
||||
mdata.footer = app.tpl( LoadAsset('page/footer.html'), mdata )
|
||||
return app.tpl( content, mdata )
|
||||
end
|
||||
|
|
|
|||
|
|
@ -59,9 +59,14 @@ return {
|
|||
if v.view3D then
|
||||
data.item = v
|
||||
data.title = data.item.title
|
||||
data.parent = v.parent
|
||||
local port = ':' .. GetPort()
|
||||
if port == 80 then port = '' end
|
||||
data.url = GetScheme() .. '://' .. GetHost() .. port .. v.url
|
||||
if v.janusxr then
|
||||
-- what to do here? no generated portals?
|
||||
data.footer_janusxr = app.tpl( util.readfile(v.path), data )
|
||||
end
|
||||
end
|
||||
end)
|
||||
if data.item then
|
||||
|
|
|
|||
|
|
@ -38,34 +38,7 @@
|
|||
</html>
|
||||
|
||||
<!-- JanusXR portalroom, see https://janusxr.org for markup -->
|
||||
<fireboxroom>
|
||||
<assets>
|
||||
<assetshader id="xrforgeportal" src="${opts.baseurl}shader/xrforgeportal.shadertoy.frag" shadertype="shadertoy"></assetshader>
|
||||
{if items and #items > 1 then
|
||||
for i,v in pairs(items) do
|
||||
print('\t<assetimage src="' .. v.thumbnail .. '" id="img' .. i .. '"/>')
|
||||
end
|
||||
end}
|
||||
</assets>
|
||||
<room pos="0 0 -4" skybox="true" showavatar="false" use_local_asset="room_plane">
|
||||
<light js_id="dan9-janus:light/light_cone_angle=0-6" pos="0 3 2" collision_trigger="false" />
|
||||
<text js_id="location" pos="0 6 -5" billboard="y" col="#BBFFFF" scale="10 10 1" text="${url}" rotation="-180 0 -180" emissive="0 0 0" roughness="0.3" metalness="0" />
|
||||
{if item then
|
||||
print('\t<object id="${url}"/>')
|
||||
end}
|
||||
{if items and #items > 1 then
|
||||
for i,v in pairs(items) do
|
||||
local width = 3.2
|
||||
local center = -((#items*width)/1.3) + (i*width)
|
||||
print('\t\t<object js_id="portal_' .. i .. '" pos="' .. center .. ' 0 0" rotation="0 180 0">')
|
||||
print('\t\t <link url="' .. v.url .. '" thumb_id="img' .. 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="' .. v.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="0.2 0.2 0.2" />')
|
||||
print('\t\t</object>')
|
||||
end
|
||||
end}
|
||||
</room>
|
||||
</fireboxroom>
|
||||
${footer_janusxr}
|
||||
|
||||
<!-- C-code
|
||||
|
||||
|
|
|
|||
33
src/page/footer.janusxr.html
Normal file
33
src/page/footer.janusxr.html
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<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}
|
||||
</assets>
|
||||
<room pos="0 0 -4" skybox="true" showavatar="false" use_local_asset="room_plane">
|
||||
<light js_id="dan9-janus:light/light_cone_angle=0-6" pos="0 3 2" collision_trigger="false" />
|
||||
<text js_id="location" pos="0 6 -5" billboard="y" col="#BBFFFF" scale="10 10 1" text="${url}" rotation="-180 0 -180" emissive="0 0 0" roughness="0.3" metalness="0" />
|
||||
{if item then
|
||||
print('\t<object id="${url}"/>')
|
||||
end}
|
||||
{if items and #items > 0 then
|
||||
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
|
||||
print('\t\t<object js_id="portal_' .. i .. '" pos="' .. center .. ' 0 0" rotation="0 180 0">')
|
||||
print('\t\t <link url="' .. url .. '" thumb_id="img' .. 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="0.2 0.2 0.2" />')
|
||||
print('\t\t</object>')
|
||||
end
|
||||
end}
|
||||
</room>
|
||||
</fireboxroom>
|
||||
|
|
@ -21,6 +21,7 @@ app.on('scan_experience_file', function(exp)
|
|||
app.pub("scan_experience_janusxr", nil, {exp=exp, item=item}) -- be nice to other plugins
|
||||
app.cache.items[ exp.file.ino ] = exp
|
||||
exp.view3D = true
|
||||
exp.janusxr = true
|
||||
print("✅ └─ plugin/janusxr: " .. exp.file.name)
|
||||
end
|
||||
else
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ local plugin = {
|
|||
key='app.opts.plugin_markdown_strategy',
|
||||
title='Markdown strategy',
|
||||
info='',
|
||||
default="README.md",
|
||||
default="headerparagraph",
|
||||
values={headerparagraph='title is first header + 1st paragraph is description',disabled='disabled'}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue