fix url paths to make JML rooms more portable
This commit is contained in:
parent
677dab8abd
commit
22554eac5c
4 changed files with 11 additions and 269 deletions
|
|
@ -112,7 +112,7 @@ begin
|
||||||
if ext.match(/(mp3|ogg)/i)
|
if ext.match(/(mp3|ogg)/i)
|
||||||
audiovisual = model_file ? false : true
|
audiovisual = model_file ? false : true
|
||||||
base = File.basename(resource['path'], ext)
|
base = File.basename(resource['path'], ext)
|
||||||
soundtrackUrl = addLink("model_files/#{resource["path"]}")
|
soundtrackUrl = addLink("#{resource["path"]}")
|
||||||
assets += " <assetsound id=\"soundtrack\" src=\"#{soundtrackUrl}\"/>\n"
|
assets += " <assetsound id=\"soundtrack\" src=\"#{soundtrackUrl}\"/>\n"
|
||||||
objects += "<sound id=\"soundtrack\" loop=\"true\"/>\n"
|
objects += "<sound id=\"soundtrack\" loop=\"true\"/>\n"
|
||||||
end
|
end
|
||||||
|
|
@ -124,7 +124,7 @@ begin
|
||||||
|
|
||||||
audiovisual = model_file ? false : true
|
audiovisual = model_file ? false : true
|
||||||
base = File.basename(resource['path'], ext)
|
base = File.basename(resource['path'], ext)
|
||||||
videoSrc = addLink("model_files/#{resource["path"]}")
|
videoSrc = addLink("#{resource["path"]}")
|
||||||
assets += "<assetimage id=\"image\" src=\"#{videoSrc}\" loop=\"true\" auto_play=\"true\"/>\n"
|
assets += "<assetimage id=\"image\" src=\"#{videoSrc}\" loop=\"true\" auto_play=\"true\"/>\n"
|
||||||
objects += " <Object cull_face=\"none\" id=\"rplane\" js_id=\"image\" lighting=\"false\" pos=\"0 6.5 5.5\" scale=\"4 4 1\" image_id=\"image\"/>\n"
|
objects += " <Object cull_face=\"none\" id=\"rplane\" js_id=\"image\" lighting=\"false\" pos=\"0 6.5 5.5\" scale=\"4 4 1\" image_id=\"image\"/>\n"
|
||||||
end
|
end
|
||||||
|
|
@ -133,7 +133,7 @@ begin
|
||||||
if ext.match(/mp4/i) || ext.match(/webm/i)
|
if ext.match(/mp4/i) || ext.match(/webm/i)
|
||||||
audiovisual = model_file ? false : true
|
audiovisual = model_file ? false : true
|
||||||
base = File.basename(resource['path'], ext)
|
base = File.basename(resource['path'], ext)
|
||||||
videoSrc = addLink("model_files/#{resource["path"]}")
|
videoSrc = addLink("#{resource["path"]}")
|
||||||
assets += "<assetvideo id=\"video\" src=\"#{videoSrc}\" loop=\"true\" auto_play=\"true\"/>\n"
|
assets += "<assetvideo id=\"video\" src=\"#{videoSrc}\" loop=\"true\" auto_play=\"true\"/>\n"
|
||||||
objects += " <Object cull_face=\"none\" id=\"rplane\" js_id=\"video\" lighting=\"false\" pos=\"0 6.5 5.5\" scale=\"4 4 1\" video_id=\"video\"/>\n"
|
objects += " <Object cull_face=\"none\" id=\"rplane\" js_id=\"video\" lighting=\"false\" pos=\"0 6.5 5.5\" scale=\"4 4 1\" video_id=\"video\"/>\n"
|
||||||
end
|
end
|
||||||
|
|
@ -143,7 +143,7 @@ begin
|
||||||
# TODO: copy files from a heuristic-based folder instead hardcoding it here
|
# TODO: copy files from a heuristic-based folder instead hardcoding it here
|
||||||
startpos = "pos=\"0 0 -10\""
|
startpos = "pos=\"0 0 -10\""
|
||||||
use_local_asset = "room5"
|
use_local_asset = "room5"
|
||||||
rplaneSrc = addLink("model_files/roundedplane.glb")
|
rplaneSrc = addLink("roundedplane.glb")
|
||||||
system("cp /root/templates/audiovisual/roundedplane.glb #{dir}/.")
|
system("cp /root/templates/audiovisual/roundedplane.glb #{dir}/.")
|
||||||
assets += " <assetobject id=\"rplane\" src=\"#{rplaneSrc}\"/>\n"
|
assets += " <assetobject id=\"rplane\" src=\"#{rplaneSrc}\"/>\n"
|
||||||
objects += " <Object cull_face=\"none\" id=\"rplane\" js_id=\"text_rplane\" lighting=\"false\" pos=\"2.69 1.84 -3.37\" rotation=\"0 45 0\" scale=\"1.6 1 1\"/>\n"
|
objects += " <Object cull_face=\"none\" id=\"rplane\" js_id=\"text_rplane\" lighting=\"false\" pos=\"2.69 1.84 -3.37\" rotation=\"0 45 0\" scale=\"1.6 1 1\"/>\n"
|
||||||
|
|
@ -168,7 +168,7 @@ begin
|
||||||
end
|
end
|
||||||
|
|
||||||
if model_file
|
if model_file
|
||||||
objectSrc = "model_files/#{model_file.gsub("#","%23")}"
|
objectSrc = "#{model_file.gsub("#","%23")}"
|
||||||
if ! $links.include?(objectSrc)
|
if ! $links.include?(objectSrc)
|
||||||
objectSrc = addLink(objectSrc)
|
objectSrc = addLink(objectSrc)
|
||||||
assets += " <assetobject id=\"experience\" src=\"#{objectSrc}\"/>\n"
|
assets += " <assetobject id=\"experience\" src=\"#{objectSrc}\"/>\n"
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
<% if ! @models.empty? %>
|
<% if ! @models.empty? %>
|
||||||
<fireboxroom>
|
<fireboxroom>
|
||||||
<assets>
|
<assets>
|
||||||
|
<assetscript src="/view/element/layout.js"/>
|
||||||
<assetobject src="/view/element/janus-script-peertube/asset/button.glb" id="button"/>
|
<assetobject src="/view/element/janus-script-peertube/asset/button.glb" id="button"/>
|
||||||
<assetobject src="/view/element/janus-script-peertube/asset/button.icon.glb" id="icon"/>
|
<assetobject src="/view/element/janus-script-peertube/asset/button.icon.glb" id="icon"/>
|
||||||
<assetsound src="/view/element/janus-script-peertube/asset/button.click.mp3" id="button-click"/>
|
<assetsound src="/view/element/janus-script-peertube/asset/button.click.mp3" id="button-click"/>
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ end
|
||||||
jml = ""
|
jml = ""
|
||||||
if File.exist?(jmlfile)
|
if File.exist?(jmlfile)
|
||||||
jml = File.read(jmlfile)
|
jml = File.read(jmlfile)
|
||||||
.gsub("model_files/",model_path(@model)+"/model_files/")
|
.gsub(/src=(["'])(?!(?:http|\/|\.\/))(.*?)/i, "src=\\1#{model_path(@model)}/model_files/\\2")
|
||||||
.gsub("-->","")
|
.gsub("-->","")
|
||||||
.gsub("--%3E","")
|
.gsub("--%3E","")
|
||||||
end
|
end
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 8.9 KiB |
Loading…
Add table
Reference in a new issue