bugfix: relative urls work now

This commit is contained in:
Leon van Kammen 2024-07-11 13:54:44 +00:00
parent c102562736
commit d07e1f9feb
3 changed files with 10 additions and 0 deletions

Binary file not shown.

View File

@ -6,8 +6,17 @@ xrf.frag.src = function(v, opts){
if( mesh.isSRC ) return // only embed src once
// correct for relative urls
if( v.string.charAt(0) != '#' && xrf.URI.isRelative( xrf.URI.parse( v.string ) ) ){
console.log("-"+v.string.charAt(0)+"-")
console.log(v.string)
v.string = xrf.navigator.URI.URN + v.string
console.log(v.string)
}
let url = xrf.frag.src.expandURI( mesh, v.string )
let srcFrag = opts.srcFrag = xrfragment.URI.parse(url).XRF
opts.isLocal = v.string[0] == '#'
opts.isPortal = xrf.frag.src.renderAsPortal(mesh)
opts.isSRC = mesh.isSRC = true

View File

@ -19,6 +19,7 @@ xrf.frag.src.type['x-shader/x-fragment'] = function(url,opts){
}
var onShaderLoaded = ((args) => (type, status, code) => {
if( !code ) return console.error('could not load shader')
shader[type].status = status
shader[type].code = code
if( shader.fragment.code && shader.vertex.code ){