added mov+show to query manipulations + roundrobin support + recursive predefined views
This commit is contained in:
parent
01e80e85cc
commit
295b36a784
|
@ -216,30 +216,32 @@ var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { };
|
|||
xrfragment_Parser.__name__ = true;
|
||||
xrfragment_Parser.parse = function(key,value,store) {
|
||||
var Frag_h = Object.create(null);
|
||||
Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE;
|
||||
Frag_h["prio"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_INT;
|
||||
Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW;
|
||||
Frag_h["class"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL;
|
||||
Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.EMBEDDED | xrfragment_XRF.NAVIGATOR;
|
||||
Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW;
|
||||
Frag_h["q"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["scale"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED | xrfragment_XRF.NAVIGATOR;
|
||||
Frag_h["translate"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["visible"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_INT | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["env"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["gravity"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["physics"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["fov"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_INT | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["clip"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["fog"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["class"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR;
|
||||
Frag_h["q"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA;
|
||||
Frag_h["scale"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA;
|
||||
Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR;
|
||||
Frag_h["mov"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA;
|
||||
Frag_h["show"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_INT | xrfragment_XRF.METADATA;
|
||||
Frag_h["env"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA;
|
||||
Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
|
||||
Frag_h["gravity"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA;
|
||||
Frag_h["physics"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA;
|
||||
Frag_h["fov"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_INT | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
|
||||
Frag_h["clip"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
|
||||
Frag_h["fog"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
|
||||
Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED | xrfragment_XRF.PROMPT;
|
||||
if(value.length == 0 && key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key)) {
|
||||
Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT;
|
||||
var isPVDynamic = value.length == 0 && key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key);
|
||||
var isPVDefault = value.length == 0 && key.length > 0 && key == "#";
|
||||
if(isPVDynamic) {
|
||||
var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR);
|
||||
v.validate(key);
|
||||
store[key] = v;
|
||||
|
@ -582,7 +584,7 @@ xrfragment_XRF.QUERY_OPERATOR = 4;
|
|||
xrfragment_XRF.PROMPT = 8;
|
||||
xrfragment_XRF.ROUNDROBIN = 16;
|
||||
xrfragment_XRF.NAVIGATOR = 32;
|
||||
xrfragment_XRF.EMBEDDED = 64;
|
||||
xrfragment_XRF.METADATA = 64;
|
||||
xrfragment_XRF.PV_OVERRIDE = 128;
|
||||
xrfragment_XRF.PV_EXECUTE = 256;
|
||||
xrfragment_XRF.T_COLOR = 8192;
|
||||
|
@ -753,7 +755,6 @@ xrf.parseModel = function(model,url){
|
|||
xrf.getLastModel = () => xrf.model.last
|
||||
|
||||
xrf.eval = function( url, model, flags ){ // evaluate fragments in url
|
||||
let notice = false
|
||||
model = model || xrf.model
|
||||
let { THREE, camera } = xrf
|
||||
let frag = xrf.URI.parse( url, flags || xrf.XRF.NAVIGATOR )
|
||||
|
@ -780,10 +781,11 @@ xrf.eval.mesh = (mesh,model) => { // evaluate embedded fragments (metadata)
|
|||
}
|
||||
|
||||
xrf.eval.fragment = (k, opts ) => { // evaluate one fragment
|
||||
let frag = opts.frag[k];
|
||||
// call native function (xrf/env.js e.g.), or pass it to user decorator
|
||||
let func = xrf.frag[k] || function(){}
|
||||
if( xrf[k] ) xrf[k]( func, opts.frag[k], opts)
|
||||
else func( opts.frag[k], opts)
|
||||
if( xrf[k] ) xrf[k]( func, frag, opts)
|
||||
else func( frag, opts)
|
||||
}
|
||||
|
||||
xrf.reset = () => {
|
||||
|
@ -982,12 +984,14 @@ xrf.navigator.to = (url,flags,loader,data) => {
|
|||
const onLoad = (model) => {
|
||||
xrf.reset() // clear xrf objects from scene
|
||||
model.file = file
|
||||
xrf.add( model.scene )
|
||||
// only change url when loading *another* file
|
||||
if( xrf.model ) xrf.navigator.pushState( `${dir}${file}`, hash )
|
||||
xrf.model = model
|
||||
xrf.eval( '#', model ) // execute the default projection '#' (if exist)
|
||||
xrf.eval( url, model ) // and eval URI XR fragments
|
||||
// spec: 1. execute the default predefined view '#' (if exist) (https://xrfragment.org/#predefined_view)
|
||||
xrf.frag.defaultPredefinedView({model,scene:model.scene})
|
||||
// spec: 2. execute predefined view(s) from URL (https://xrfragment.org/#predefined_view)
|
||||
xrf.eval( url, model ) // and eval URI XR fragments
|
||||
xrf.add( model.scene )
|
||||
if( !hash.match(/pos=/) )
|
||||
xrf.eval( '#pos=0,0,0' ) // set default position if not specified
|
||||
resolve(model)
|
||||
|
@ -1162,7 +1166,7 @@ xrf.frag.href = function(v, opts){
|
|||
mesh.scale.copy(world.scale)
|
||||
mesh.setRotationFromQuaternion(world.quat);
|
||||
xrf.interactive.add(mesh)
|
||||
}, 20, mesh )
|
||||
}, 10, mesh )
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1176,16 +1180,46 @@ xrf.frag.href = function(v, opts){
|
|||
*
|
||||
* > capture of <a href="./example/aframe/sandbox" target="_blank">aframe/sandbox</a>
|
||||
*/
|
||||
xrf.frag.pos = function(v, opts){
|
||||
xrf.frag.mov = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
if( !frag.q ){
|
||||
if( frag.q ){ // only operate on queried object(s)
|
||||
frag.q.getObjects().map( (o) => {
|
||||
o.position.add( new THREE.Vector3( v.x, v.y, v.z ) )
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
xrf.frag.pos = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
if( frag.q ){ // only operate on queried object(s)
|
||||
|
||||
// apply roundrobin (if any)
|
||||
if( v.args ) v = v.args[ xrf.roundrobin(v,model) ]
|
||||
|
||||
frag.q.getObjects().map( (o) => {
|
||||
console.dir(o)
|
||||
// if object has no parent (name == 'Scene') use absolute positioning, otherwise relative to parent
|
||||
o.position.x = o.parent.name == 'Scene' ? v.x : o.positionOriginal.x + v.x
|
||||
o.position.y = o.parent.name == 'Scene' ? v.z : o.positionOriginal.y + v.z
|
||||
o.position.z = o.parent.name == 'Scene' ? v.y : o.positionOriginal.z + v.y
|
||||
})
|
||||
}else{
|
||||
camera.position.x = v.x
|
||||
camera.position.y = v.y
|
||||
camera.position.z = v.z
|
||||
}
|
||||
|
||||
}
|
||||
const updatePredefinedView = (opts) => {
|
||||
xrf.frag.defaultPredefinedView = (opts) => {
|
||||
let {scene,model} = opts;
|
||||
let frag = {}
|
||||
xrf.Parser.parse("#","",frag)
|
||||
xrf.frag.updatePredefinedView({frag,model,scene})
|
||||
}
|
||||
|
||||
xrf.frag.updatePredefinedView = (opts) => {
|
||||
let {frag,scene,model} = opts
|
||||
|
||||
// spec: https://xrfragment.org/#Selection%20of%20interest
|
||||
|
@ -1213,15 +1247,19 @@ const updatePredefinedView = (opts) => {
|
|||
|
||||
// spec: https://xrfragment.org/#predefined_view
|
||||
const predefinedView = (frag,scene,mesh) => {
|
||||
let id = frag.string
|
||||
if( !id ) return // prevent empty matches
|
||||
if( mesh.userData[`#${id}`] ){ // get alias
|
||||
frag = xrf.URI.parse( mesh.userData[`#${id}`], xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.EMBEDDED )
|
||||
let id = frag.string || frag.fragment
|
||||
id = `#${id}`
|
||||
if( id == '##' ) id = '#'; // default predefined view
|
||||
if( !id ) return // prevent empty matches
|
||||
if( mesh.userData[id] ){ // get alias
|
||||
frag = xrf.URI.parse( mesh.userData[id], xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA )
|
||||
xrf.emit('predefinedView',{...opts,frag})
|
||||
.then( () => {
|
||||
for ( let k in frag ){
|
||||
let opts = {frag, model, camera: xrf.camera, scene: xrf.scene, renderer: xrf.renderer, THREE: xrf.THREE }
|
||||
xrf.eval.fragment(k,opts)
|
||||
if( frag[k].is( xrf.XRF.PV_EXECUTE ) && scene.XRF_PV_ORIGIN != k ){ // cyclic detection
|
||||
traverseScene(frag[k],scene) // recurse predefined views
|
||||
}else xrf.eval.fragment(k,opts)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -1243,9 +1281,10 @@ const updatePredefinedView = (opts) => {
|
|||
for ( let i in frag ) {
|
||||
let v = frag[i]
|
||||
if( v.is( xrf.XRF.PV_EXECUTE ) ){
|
||||
scene.XRF_PV_ORIGIN = v.string
|
||||
if( v.args ) v = v.args[ xrf.roundrobin(v,xrf.model) ]
|
||||
// wait for nested instances to arrive at the scene
|
||||
setTimeout( () => traverseScene(v,scene), 100 )
|
||||
// wait for nested instances to arrive at the scene ?
|
||||
traverseScene(v,scene)
|
||||
if( v.string ) pviews.push(v.string)
|
||||
}else if( v.is( xrf.XRF.NAVIGATOR ) ) pviews.push(`${i}=${v.string}`)
|
||||
}
|
||||
|
@ -1253,13 +1292,16 @@ const updatePredefinedView = (opts) => {
|
|||
}
|
||||
|
||||
// when predefined view occurs in url changes
|
||||
xrf.addEventListener('eval', updatePredefinedView )
|
||||
//xrf.addEventListener('updateHash', (opts) => {
|
||||
// let frag = xrf.URI.parse( opts.xrf.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA )
|
||||
// xrf.frag.updatePredefinedView({frag,scene:xrf.scene,href:opts.xrf})
|
||||
//})
|
||||
|
||||
// clicking href url with predefined view
|
||||
xrf.addEventListener('href', (opts) => {
|
||||
if( !opts.click || opts.xrf.string[0] != '#' ) return
|
||||
let frag = xrf.URI.parse( opts.xrf.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.EMBEDDED )
|
||||
updatePredefinedView({frag,scene:xrf.scene,href:opts.xrf})
|
||||
let frag = xrf.URI.parse( opts.xrf.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA )
|
||||
xrf.frag.updatePredefinedView({frag,scene:xrf.scene,href:opts.xrf})
|
||||
})
|
||||
|
||||
//let updateUrl = (opts) => {
|
||||
|
@ -1275,6 +1317,23 @@ xrf.frag.q = function(v, opts){
|
|||
console.log(" └ running query ")
|
||||
let qobjs = Object.keys(v.query)
|
||||
|
||||
// convience function for other fragments (which apply to the query)
|
||||
frag.q.getObjects = () => {
|
||||
let objs = []
|
||||
scene.traverse( (o) => {
|
||||
for ( let name in v.query ) {
|
||||
let qobj = v.query[name];
|
||||
if( qobj.class && o.userData.class && o.userData.class == name ) objs.push(o)
|
||||
else if( qobj.id && o.name == name ) objs.push(o)
|
||||
}
|
||||
})
|
||||
return objs.filter( (o) => o ) // return and filter out empty
|
||||
.map( (o) => {
|
||||
if( !o.positionOriginal ) o.positionOriginal = o.position.clone()
|
||||
return o
|
||||
})
|
||||
}
|
||||
|
||||
// spec: https://xrfragment.org/#src
|
||||
const instanceScene = () => {
|
||||
v.scene = new THREE.Group()
|
||||
|
@ -1329,14 +1388,56 @@ xrf.frag.q = function(v, opts){
|
|||
else showHide() // spec : https://xrfragment.org/#queries
|
||||
}
|
||||
xrf.frag.rot = function(v, opts){
|
||||
let { mesh, model, camera, scene, renderer, THREE} = opts
|
||||
console.log(" └ setting camera rotation to "+v.string)
|
||||
camera.rotation.set(
|
||||
v.x * Math.PI / 180,
|
||||
v.y * Math.PI / 180,
|
||||
v.z * Math.PI / 180
|
||||
)
|
||||
camera.updateMatrixWorld()
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
// apply roundrobin (if any)
|
||||
if( v.args ) v = v.args[ xrf.roundrobin(v,model) ]
|
||||
|
||||
if( frag.q ){ // only operate on queried object(s)
|
||||
frag.q.getObjects().map( (o) => {
|
||||
o.rotation.set(
|
||||
v.x * Math.PI / 180,
|
||||
v.y * Math.PI / 180,
|
||||
v.z * Math.PI / 180
|
||||
)
|
||||
})
|
||||
}else{
|
||||
console.log(" └ setting camera rotation to "+v.string)
|
||||
camera.rotation.set(
|
||||
v.x * Math.PI / 180,
|
||||
v.y * Math.PI / 180,
|
||||
v.z * Math.PI / 180
|
||||
)
|
||||
camera.updateMatrixWorld()
|
||||
}
|
||||
}
|
||||
xrf.frag.scale = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
// apply roundrobin (if any)
|
||||
if( v.args ) v = v.args[ xrf.roundrobin(v,model) ]
|
||||
|
||||
if( frag.q ){ // only operate on queried object(s)
|
||||
frag.q.getObjects().map( (o) => {
|
||||
o.scale.x = v.x
|
||||
o.scale.y = v.y
|
||||
o.scale.z = v.z
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
xrf.frag.show = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
// apply roundrobin (if any)
|
||||
if( v.args ) v = v.args[ xrf.roundrobin(v,model) ]
|
||||
|
||||
if( frag.q ){ // only operate on queried object(s)
|
||||
frag.q.getObjects().map( (o) => {
|
||||
o.visible = v.int == 1;
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
// *TODO* use webgl instancing
|
||||
|
||||
|
@ -1559,7 +1660,8 @@ window.AFRAME.registerComponent('xrf', {
|
|||
// in order to set the rotation programmatically
|
||||
// we need to disable look-controls
|
||||
xrf.rot = (xrf,v,opts) => {
|
||||
let {renderer} = opts;
|
||||
let {frag,renderer} = opts;
|
||||
if( frag.q ) return // camera was not targeted for rotation
|
||||
let look = document.querySelector('[look-controls]')
|
||||
if( look ) look.removeAttribute("look-controls")
|
||||
camOverride(xrf,v,opts)
|
||||
|
|
|
@ -216,30 +216,32 @@ var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { };
|
|||
xrfragment_Parser.__name__ = true;
|
||||
xrfragment_Parser.parse = function(key,value,store) {
|
||||
var Frag_h = Object.create(null);
|
||||
Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE;
|
||||
Frag_h["prio"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_INT;
|
||||
Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW;
|
||||
Frag_h["class"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL;
|
||||
Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.EMBEDDED | xrfragment_XRF.NAVIGATOR;
|
||||
Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW;
|
||||
Frag_h["q"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["scale"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED | xrfragment_XRF.NAVIGATOR;
|
||||
Frag_h["translate"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["visible"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_INT | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["env"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["gravity"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["physics"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["fov"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_INT | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["clip"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["fog"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["class"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR;
|
||||
Frag_h["q"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA;
|
||||
Frag_h["scale"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA;
|
||||
Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR;
|
||||
Frag_h["mov"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA;
|
||||
Frag_h["show"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_INT | xrfragment_XRF.METADATA;
|
||||
Frag_h["env"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA;
|
||||
Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
|
||||
Frag_h["gravity"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA;
|
||||
Frag_h["physics"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA;
|
||||
Frag_h["fov"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_INT | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
|
||||
Frag_h["clip"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
|
||||
Frag_h["fog"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
|
||||
Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED | xrfragment_XRF.PROMPT;
|
||||
if(value.length == 0 && key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key)) {
|
||||
Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT;
|
||||
var isPVDynamic = value.length == 0 && key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key);
|
||||
var isPVDefault = value.length == 0 && key.length > 0 && key == "#";
|
||||
if(isPVDynamic) {
|
||||
var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR);
|
||||
v.validate(key);
|
||||
store[key] = v;
|
||||
|
@ -582,7 +584,7 @@ xrfragment_XRF.QUERY_OPERATOR = 4;
|
|||
xrfragment_XRF.PROMPT = 8;
|
||||
xrfragment_XRF.ROUNDROBIN = 16;
|
||||
xrfragment_XRF.NAVIGATOR = 32;
|
||||
xrfragment_XRF.EMBEDDED = 64;
|
||||
xrfragment_XRF.METADATA = 64;
|
||||
xrfragment_XRF.PV_OVERRIDE = 128;
|
||||
xrfragment_XRF.PV_EXECUTE = 256;
|
||||
xrfragment_XRF.T_COLOR = 8192;
|
||||
|
|
|
@ -1408,23 +1408,17 @@ _hx_exports["xrfragment"]["Parser"] = __xrfragment_Parser
|
|||
__xrfragment_Parser.__name__ = true
|
||||
__xrfragment_Parser.parse = function(key,value,store)
|
||||
local Frag_h = ({});
|
||||
local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_INT);
|
||||
if (value1 == nil) then
|
||||
Frag_h.prio = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.prio = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_PREDEFINED_VIEW);
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_PREDEFINED_VIEW),__xrfragment_XRF.PV_EXECUTE);
|
||||
if (value1 == nil) then
|
||||
Frag_h["#"] = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h["#"] = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_STRING);
|
||||
local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_INT);
|
||||
if (value1 == nil) then
|
||||
Frag_h.class = __haxe_ds_StringMap.tnull;
|
||||
Frag_h.prio = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.class = value1;
|
||||
Frag_h.prio = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_URL);
|
||||
if (value1 == nil) then
|
||||
|
@ -1432,85 +1426,91 @@ __xrfragment_Parser.parse = function(key,value,store)
|
|||
else
|
||||
Frag_h.src = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.PV_OVERRIDE,__xrfragment_XRF.ROUNDROBIN),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.T_STRING_OBJ),__xrfragment_XRF.EMBEDDED),__xrfragment_XRF.NAVIGATOR);
|
||||
if (value1 == nil) then
|
||||
Frag_h.pos = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.pos = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_URL),__xrfragment_XRF.T_PREDEFINED_VIEW);
|
||||
if (value1 == nil) then
|
||||
Frag_h.href = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.href = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.PV_OVERRIDE,__xrfragment_XRF.T_STRING),__xrfragment_XRF.EMBEDDED);
|
||||
local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_STRING);
|
||||
if (value1 == nil) then
|
||||
Frag_h.class = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.class = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.PV_OVERRIDE,__xrfragment_XRF.ROUNDROBIN),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.T_STRING_OBJ),__xrfragment_XRF.METADATA),__xrfragment_XRF.NAVIGATOR);
|
||||
if (value1 == nil) then
|
||||
Frag_h.pos = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.pos = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.PV_OVERRIDE,__xrfragment_XRF.T_STRING),__xrfragment_XRF.METADATA);
|
||||
if (value1 == nil) then
|
||||
Frag_h.q = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.q = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.QUERY_OPERATOR,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.ROUNDROBIN),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.EMBEDDED);
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.QUERY_OPERATOR,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.ROUNDROBIN),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.METADATA);
|
||||
if (value1 == nil) then
|
||||
Frag_h.scale = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.scale = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.QUERY_OPERATOR,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.ROUNDROBIN),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.EMBEDDED),__xrfragment_XRF.NAVIGATOR);
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.QUERY_OPERATOR,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.ROUNDROBIN),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.METADATA),__xrfragment_XRF.NAVIGATOR);
|
||||
if (value1 == nil) then
|
||||
Frag_h.rot = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.rot = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.QUERY_OPERATOR,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.ROUNDROBIN),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.EMBEDDED);
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.QUERY_OPERATOR,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.ROUNDROBIN),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.METADATA);
|
||||
if (value1 == nil) then
|
||||
Frag_h.translate = __haxe_ds_StringMap.tnull;
|
||||
Frag_h.mov = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.translate = value1;
|
||||
Frag_h.mov = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.QUERY_OPERATOR,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.ROUNDROBIN),__xrfragment_XRF.T_INT),__xrfragment_XRF.EMBEDDED);
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.QUERY_OPERATOR,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.ROUNDROBIN),__xrfragment_XRF.T_INT),__xrfragment_XRF.METADATA);
|
||||
if (value1 == nil) then
|
||||
Frag_h.visible = __haxe_ds_StringMap.tnull;
|
||||
Frag_h.show = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.visible = value1;
|
||||
Frag_h.show = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_STRING),__xrfragment_XRF.EMBEDDED);
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_STRING),__xrfragment_XRF.METADATA);
|
||||
if (value1 == nil) then
|
||||
Frag_h.env = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.env = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.ROUNDROBIN),__xrfragment_XRF.T_VECTOR2),__xrfragment_XRF.NAVIGATOR),__xrfragment_XRF.EMBEDDED);
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.ROUNDROBIN),__xrfragment_XRF.T_VECTOR2),__xrfragment_XRF.NAVIGATOR),__xrfragment_XRF.METADATA);
|
||||
if (value1 == nil) then
|
||||
Frag_h.t = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.t = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.EMBEDDED);
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.METADATA);
|
||||
if (value1 == nil) then
|
||||
Frag_h.gravity = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.gravity = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.EMBEDDED);
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.METADATA);
|
||||
if (value1 == nil) then
|
||||
Frag_h.physics = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.physics = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_INT),__xrfragment_XRF.NAVIGATOR),__xrfragment_XRF.EMBEDDED);
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_INT),__xrfragment_XRF.NAVIGATOR),__xrfragment_XRF.METADATA);
|
||||
if (value1 == nil) then
|
||||
Frag_h.fov = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.fov = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_VECTOR2),__xrfragment_XRF.NAVIGATOR),__xrfragment_XRF.EMBEDDED);
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_VECTOR2),__xrfragment_XRF.NAVIGATOR),__xrfragment_XRF.METADATA);
|
||||
if (value1 == nil) then
|
||||
Frag_h.clip = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.clip = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_STRING),__xrfragment_XRF.NAVIGATOR),__xrfragment_XRF.EMBEDDED);
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_STRING),__xrfragment_XRF.NAVIGATOR),__xrfragment_XRF.METADATA);
|
||||
if (value1 == nil) then
|
||||
Frag_h.fog = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
|
@ -1540,13 +1540,15 @@ __xrfragment_Parser.parse = function(key,value,store)
|
|||
else
|
||||
Frag_h.description = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_URL),__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.NAVIGATOR),__xrfragment_XRF.EMBEDDED),__xrfragment_XRF.PROMPT);
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_URL),__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.NAVIGATOR),__xrfragment_XRF.METADATA),__xrfragment_XRF.PROMPT);
|
||||
if (value1 == nil) then
|
||||
Frag_h.session = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.session = value1;
|
||||
end;
|
||||
if (((__lua_lib_luautf8_Utf8.len(value) == 0) and (__lua_lib_luautf8_Utf8.len(key) > 0)) and (Frag_h[key] == nil)) then
|
||||
local isPVDynamic = ((__lua_lib_luautf8_Utf8.len(value) == 0) and (__lua_lib_luautf8_Utf8.len(key) > 0)) and (Frag_h[key] == nil);
|
||||
local isPVDefault = ((__lua_lib_luautf8_Utf8.len(value) == 0) and (__lua_lib_luautf8_Utf8.len(key) > 0)) and (key == "#");
|
||||
if (isPVDynamic) then
|
||||
local v = __xrfragment_XRF.new(key, _hx_bit.bor(__xrfragment_XRF.PV_EXECUTE,__xrfragment_XRF.NAVIGATOR));
|
||||
v:validate(key);
|
||||
store[key] = v;
|
||||
|
@ -2410,7 +2412,7 @@ local _hx_static_init = function()
|
|||
|
||||
__xrfragment_XRF.NAVIGATOR = 32;
|
||||
|
||||
__xrfragment_XRF.EMBEDDED = 64;
|
||||
__xrfragment_XRF.METADATA = 64;
|
||||
|
||||
__xrfragment_XRF.PV_OVERRIDE = 128;
|
||||
|
||||
|
|
|
@ -216,30 +216,32 @@ var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { };
|
|||
xrfragment_Parser.__name__ = true;
|
||||
xrfragment_Parser.parse = function(key,value,store) {
|
||||
var Frag_h = Object.create(null);
|
||||
Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE;
|
||||
Frag_h["prio"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_INT;
|
||||
Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW;
|
||||
Frag_h["class"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL;
|
||||
Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.EMBEDDED | xrfragment_XRF.NAVIGATOR;
|
||||
Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW;
|
||||
Frag_h["q"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["scale"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED | xrfragment_XRF.NAVIGATOR;
|
||||
Frag_h["translate"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["visible"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_INT | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["env"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["gravity"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["physics"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["fov"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_INT | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["clip"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["fog"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["class"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR;
|
||||
Frag_h["q"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA;
|
||||
Frag_h["scale"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA;
|
||||
Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR;
|
||||
Frag_h["mov"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA;
|
||||
Frag_h["show"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_INT | xrfragment_XRF.METADATA;
|
||||
Frag_h["env"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA;
|
||||
Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
|
||||
Frag_h["gravity"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA;
|
||||
Frag_h["physics"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA;
|
||||
Frag_h["fov"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_INT | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
|
||||
Frag_h["clip"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
|
||||
Frag_h["fog"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
|
||||
Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED | xrfragment_XRF.PROMPT;
|
||||
if(value.length == 0 && key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key)) {
|
||||
Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT;
|
||||
var isPVDynamic = value.length == 0 && key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key);
|
||||
var isPVDefault = value.length == 0 && key.length > 0 && key == "#";
|
||||
if(isPVDynamic) {
|
||||
var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR);
|
||||
v.validate(key);
|
||||
store[key] = v;
|
||||
|
@ -582,7 +584,7 @@ xrfragment_XRF.QUERY_OPERATOR = 4;
|
|||
xrfragment_XRF.PROMPT = 8;
|
||||
xrfragment_XRF.ROUNDROBIN = 16;
|
||||
xrfragment_XRF.NAVIGATOR = 32;
|
||||
xrfragment_XRF.EMBEDDED = 64;
|
||||
xrfragment_XRF.METADATA = 64;
|
||||
xrfragment_XRF.PV_OVERRIDE = 128;
|
||||
xrfragment_XRF.PV_EXECUTE = 256;
|
||||
xrfragment_XRF.T_COLOR = 8192;
|
||||
|
|
|
@ -1293,30 +1293,32 @@ class xrfragment_Parser:
|
|||
@staticmethod
|
||||
def parse(key,value,store):
|
||||
Frag = haxe_ds_StringMap()
|
||||
Frag.h["#"] = ((xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW) | xrfragment_XRF.PV_EXECUTE)
|
||||
Frag.h["prio"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_INT)
|
||||
Frag.h["#"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW)
|
||||
Frag.h["class"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING)
|
||||
Frag.h["src"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_URL)
|
||||
Frag.h["pos"] = (((((xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.T_STRING_OBJ) | xrfragment_XRF.EMBEDDED) | xrfragment_XRF.NAVIGATOR)
|
||||
Frag.h["href"] = ((xrfragment_XRF.ASSET | xrfragment_XRF.T_URL) | xrfragment_XRF.T_PREDEFINED_VIEW)
|
||||
Frag.h["q"] = ((xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING) | xrfragment_XRF.EMBEDDED)
|
||||
Frag.h["scale"] = ((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.EMBEDDED)
|
||||
Frag.h["rot"] = (((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.EMBEDDED) | xrfragment_XRF.NAVIGATOR)
|
||||
Frag.h["translate"] = ((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.EMBEDDED)
|
||||
Frag.h["visible"] = ((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_INT) | xrfragment_XRF.EMBEDDED)
|
||||
Frag.h["env"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_STRING) | xrfragment_XRF.EMBEDDED)
|
||||
Frag.h["t"] = (((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.EMBEDDED)
|
||||
Frag.h["gravity"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.EMBEDDED)
|
||||
Frag.h["physics"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.EMBEDDED)
|
||||
Frag.h["fov"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_INT) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.EMBEDDED)
|
||||
Frag.h["clip"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.EMBEDDED)
|
||||
Frag.h["fog"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_STRING) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.EMBEDDED)
|
||||
Frag.h["class"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING)
|
||||
Frag.h["pos"] = (((((xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.T_STRING_OBJ) | xrfragment_XRF.METADATA) | xrfragment_XRF.NAVIGATOR)
|
||||
Frag.h["q"] = ((xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING) | xrfragment_XRF.METADATA)
|
||||
Frag.h["scale"] = ((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.METADATA)
|
||||
Frag.h["rot"] = (((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.METADATA) | xrfragment_XRF.NAVIGATOR)
|
||||
Frag.h["mov"] = ((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.METADATA)
|
||||
Frag.h["show"] = ((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_INT) | xrfragment_XRF.METADATA)
|
||||
Frag.h["env"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_STRING) | xrfragment_XRF.METADATA)
|
||||
Frag.h["t"] = (((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.METADATA)
|
||||
Frag.h["gravity"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.METADATA)
|
||||
Frag.h["physics"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.METADATA)
|
||||
Frag.h["fov"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_INT) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.METADATA)
|
||||
Frag.h["clip"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.METADATA)
|
||||
Frag.h["fog"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_STRING) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.METADATA)
|
||||
Frag.h["namespace"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING)
|
||||
Frag.h["SPDX"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING)
|
||||
Frag.h["unit"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING)
|
||||
Frag.h["description"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING)
|
||||
Frag.h["session"] = (((((xrfragment_XRF.ASSET | xrfragment_XRF.T_URL) | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.EMBEDDED) | xrfragment_XRF.PROMPT)
|
||||
if (((len(value) == 0) and ((len(key) > 0))) and (not (key in Frag.h))):
|
||||
Frag.h["session"] = (((((xrfragment_XRF.ASSET | xrfragment_XRF.T_URL) | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.METADATA) | xrfragment_XRF.PROMPT)
|
||||
isPVDynamic = (((len(value) == 0) and ((len(key) > 0))) and (not (key in Frag.h)))
|
||||
isPVDefault = (((len(value) == 0) and ((len(key) > 0))) and ((key == "#")))
|
||||
if isPVDynamic:
|
||||
v = xrfragment_XRF(key,(xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR))
|
||||
v.validate(key)
|
||||
setattr(store,(("_hx_" + key) if ((key in python_Boot.keywords)) else (("_hx_" + key) if (((((len(key) > 2) and ((ord(key[0]) == 95))) and ((ord(key[1]) == 95))) and ((ord(key[(len(key) - 1)]) != 95)))) else key)),v)
|
||||
|
@ -1584,7 +1586,7 @@ class xrfragment_XRF:
|
|||
__slots__ = ("fragment", "flags", "x", "y", "z", "color", "string", "int", "float", "args", "query")
|
||||
_hx_fields = ["fragment", "flags", "x", "y", "z", "color", "string", "int", "float", "args", "query"]
|
||||
_hx_methods = ["is", "validate", "guessType"]
|
||||
_hx_statics = ["ASSET", "PROP_BIND", "QUERY_OPERATOR", "PROMPT", "ROUNDROBIN", "NAVIGATOR", "EMBEDDED", "PV_OVERRIDE", "PV_EXECUTE", "T_COLOR", "T_INT", "T_FLOAT", "T_VECTOR2", "T_VECTOR3", "T_URL", "T_PREDEFINED_VIEW", "T_STRING", "T_STRING_OBJ", "T_STRING_OBJ_PROP", "isColor", "isInt", "isFloat", "isVector", "isUrl", "isUrlOrPretypedView", "isString", "set", "unset"]
|
||||
_hx_statics = ["ASSET", "PROP_BIND", "QUERY_OPERATOR", "PROMPT", "ROUNDROBIN", "NAVIGATOR", "METADATA", "PV_OVERRIDE", "PV_EXECUTE", "T_COLOR", "T_INT", "T_FLOAT", "T_VECTOR2", "T_VECTOR3", "T_URL", "T_PREDEFINED_VIEW", "T_STRING", "T_STRING_OBJ", "T_STRING_OBJ_PROP", "isColor", "isInt", "isFloat", "isVector", "isUrl", "isUrlOrPretypedView", "isString", "set", "unset"]
|
||||
|
||||
def __init__(self,_fragment,_flags):
|
||||
self.query = None
|
||||
|
@ -1675,7 +1677,7 @@ xrfragment_XRF.QUERY_OPERATOR = 4
|
|||
xrfragment_XRF.PROMPT = 8
|
||||
xrfragment_XRF.ROUNDROBIN = 16
|
||||
xrfragment_XRF.NAVIGATOR = 32
|
||||
xrfragment_XRF.EMBEDDED = 64
|
||||
xrfragment_XRF.METADATA = 64
|
||||
xrfragment_XRF.PV_OVERRIDE = 128
|
||||
xrfragment_XRF.PV_EXECUTE = 256
|
||||
xrfragment_XRF.T_COLOR = 8192
|
||||
|
|
|
@ -216,30 +216,32 @@ var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { };
|
|||
xrfragment_Parser.__name__ = true;
|
||||
xrfragment_Parser.parse = function(key,value,store) {
|
||||
var Frag_h = Object.create(null);
|
||||
Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE;
|
||||
Frag_h["prio"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_INT;
|
||||
Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW;
|
||||
Frag_h["class"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL;
|
||||
Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.EMBEDDED | xrfragment_XRF.NAVIGATOR;
|
||||
Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW;
|
||||
Frag_h["q"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["scale"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED | xrfragment_XRF.NAVIGATOR;
|
||||
Frag_h["translate"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["visible"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_INT | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["env"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["gravity"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["physics"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["fov"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_INT | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["clip"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["fog"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["class"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR;
|
||||
Frag_h["q"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA;
|
||||
Frag_h["scale"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA;
|
||||
Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR;
|
||||
Frag_h["mov"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA;
|
||||
Frag_h["show"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_INT | xrfragment_XRF.METADATA;
|
||||
Frag_h["env"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA;
|
||||
Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
|
||||
Frag_h["gravity"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA;
|
||||
Frag_h["physics"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA;
|
||||
Frag_h["fov"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_INT | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
|
||||
Frag_h["clip"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
|
||||
Frag_h["fog"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
|
||||
Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED | xrfragment_XRF.PROMPT;
|
||||
if(value.length == 0 && key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key)) {
|
||||
Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT;
|
||||
var isPVDynamic = value.length == 0 && key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key);
|
||||
var isPVDefault = value.length == 0 && key.length > 0 && key == "#";
|
||||
if(isPVDynamic) {
|
||||
var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR);
|
||||
v.validate(key);
|
||||
store[key] = v;
|
||||
|
@ -582,7 +584,7 @@ xrfragment_XRF.QUERY_OPERATOR = 4;
|
|||
xrfragment_XRF.PROMPT = 8;
|
||||
xrfragment_XRF.ROUNDROBIN = 16;
|
||||
xrfragment_XRF.NAVIGATOR = 32;
|
||||
xrfragment_XRF.EMBEDDED = 64;
|
||||
xrfragment_XRF.METADATA = 64;
|
||||
xrfragment_XRF.PV_OVERRIDE = 128;
|
||||
xrfragment_XRF.PV_EXECUTE = 256;
|
||||
xrfragment_XRF.T_COLOR = 8192;
|
||||
|
@ -753,7 +755,6 @@ xrf.parseModel = function(model,url){
|
|||
xrf.getLastModel = () => xrf.model.last
|
||||
|
||||
xrf.eval = function( url, model, flags ){ // evaluate fragments in url
|
||||
let notice = false
|
||||
model = model || xrf.model
|
||||
let { THREE, camera } = xrf
|
||||
let frag = xrf.URI.parse( url, flags || xrf.XRF.NAVIGATOR )
|
||||
|
@ -780,10 +781,11 @@ xrf.eval.mesh = (mesh,model) => { // evaluate embedded fragments (metadata)
|
|||
}
|
||||
|
||||
xrf.eval.fragment = (k, opts ) => { // evaluate one fragment
|
||||
let frag = opts.frag[k];
|
||||
// call native function (xrf/env.js e.g.), or pass it to user decorator
|
||||
let func = xrf.frag[k] || function(){}
|
||||
if( xrf[k] ) xrf[k]( func, opts.frag[k], opts)
|
||||
else func( opts.frag[k], opts)
|
||||
if( xrf[k] ) xrf[k]( func, frag, opts)
|
||||
else func( frag, opts)
|
||||
}
|
||||
|
||||
xrf.reset = () => {
|
||||
|
@ -982,12 +984,14 @@ xrf.navigator.to = (url,flags,loader,data) => {
|
|||
const onLoad = (model) => {
|
||||
xrf.reset() // clear xrf objects from scene
|
||||
model.file = file
|
||||
xrf.add( model.scene )
|
||||
// only change url when loading *another* file
|
||||
if( xrf.model ) xrf.navigator.pushState( `${dir}${file}`, hash )
|
||||
xrf.model = model
|
||||
xrf.eval( '#', model ) // execute the default projection '#' (if exist)
|
||||
xrf.eval( url, model ) // and eval URI XR fragments
|
||||
// spec: 1. execute the default predefined view '#' (if exist) (https://xrfragment.org/#predefined_view)
|
||||
xrf.frag.defaultPredefinedView({model,scene:model.scene})
|
||||
// spec: 2. execute predefined view(s) from URL (https://xrfragment.org/#predefined_view)
|
||||
xrf.eval( url, model ) // and eval URI XR fragments
|
||||
xrf.add( model.scene )
|
||||
if( !hash.match(/pos=/) )
|
||||
xrf.eval( '#pos=0,0,0' ) // set default position if not specified
|
||||
resolve(model)
|
||||
|
@ -1162,7 +1166,7 @@ xrf.frag.href = function(v, opts){
|
|||
mesh.scale.copy(world.scale)
|
||||
mesh.setRotationFromQuaternion(world.quat);
|
||||
xrf.interactive.add(mesh)
|
||||
}, 20, mesh )
|
||||
}, 10, mesh )
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1176,16 +1180,46 @@ xrf.frag.href = function(v, opts){
|
|||
*
|
||||
* > capture of <a href="./example/aframe/sandbox" target="_blank">aframe/sandbox</a>
|
||||
*/
|
||||
xrf.frag.pos = function(v, opts){
|
||||
xrf.frag.mov = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
if( !frag.q ){
|
||||
if( frag.q ){ // only operate on queried object(s)
|
||||
frag.q.getObjects().map( (o) => {
|
||||
o.position.add( new THREE.Vector3( v.x, v.y, v.z ) )
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
xrf.frag.pos = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
if( frag.q ){ // only operate on queried object(s)
|
||||
|
||||
// apply roundrobin (if any)
|
||||
if( v.args ) v = v.args[ xrf.roundrobin(v,model) ]
|
||||
|
||||
frag.q.getObjects().map( (o) => {
|
||||
console.dir(o)
|
||||
// if object has no parent (name == 'Scene') use absolute positioning, otherwise relative to parent
|
||||
o.position.x = o.parent.name == 'Scene' ? v.x : o.positionOriginal.x + v.x
|
||||
o.position.y = o.parent.name == 'Scene' ? v.z : o.positionOriginal.y + v.z
|
||||
o.position.z = o.parent.name == 'Scene' ? v.y : o.positionOriginal.z + v.y
|
||||
})
|
||||
}else{
|
||||
camera.position.x = v.x
|
||||
camera.position.y = v.y
|
||||
camera.position.z = v.z
|
||||
}
|
||||
|
||||
}
|
||||
const updatePredefinedView = (opts) => {
|
||||
xrf.frag.defaultPredefinedView = (opts) => {
|
||||
let {scene,model} = opts;
|
||||
let frag = {}
|
||||
xrf.Parser.parse("#","",frag)
|
||||
xrf.frag.updatePredefinedView({frag,model,scene})
|
||||
}
|
||||
|
||||
xrf.frag.updatePredefinedView = (opts) => {
|
||||
let {frag,scene,model} = opts
|
||||
|
||||
// spec: https://xrfragment.org/#Selection%20of%20interest
|
||||
|
@ -1213,15 +1247,19 @@ const updatePredefinedView = (opts) => {
|
|||
|
||||
// spec: https://xrfragment.org/#predefined_view
|
||||
const predefinedView = (frag,scene,mesh) => {
|
||||
let id = frag.string
|
||||
if( !id ) return // prevent empty matches
|
||||
if( mesh.userData[`#${id}`] ){ // get alias
|
||||
frag = xrf.URI.parse( mesh.userData[`#${id}`], xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.EMBEDDED )
|
||||
let id = frag.string || frag.fragment
|
||||
id = `#${id}`
|
||||
if( id == '##' ) id = '#'; // default predefined view
|
||||
if( !id ) return // prevent empty matches
|
||||
if( mesh.userData[id] ){ // get alias
|
||||
frag = xrf.URI.parse( mesh.userData[id], xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA )
|
||||
xrf.emit('predefinedView',{...opts,frag})
|
||||
.then( () => {
|
||||
for ( let k in frag ){
|
||||
let opts = {frag, model, camera: xrf.camera, scene: xrf.scene, renderer: xrf.renderer, THREE: xrf.THREE }
|
||||
xrf.eval.fragment(k,opts)
|
||||
if( frag[k].is( xrf.XRF.PV_EXECUTE ) && scene.XRF_PV_ORIGIN != k ){ // cyclic detection
|
||||
traverseScene(frag[k],scene) // recurse predefined views
|
||||
}else xrf.eval.fragment(k,opts)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -1243,9 +1281,10 @@ const updatePredefinedView = (opts) => {
|
|||
for ( let i in frag ) {
|
||||
let v = frag[i]
|
||||
if( v.is( xrf.XRF.PV_EXECUTE ) ){
|
||||
scene.XRF_PV_ORIGIN = v.string
|
||||
if( v.args ) v = v.args[ xrf.roundrobin(v,xrf.model) ]
|
||||
// wait for nested instances to arrive at the scene
|
||||
setTimeout( () => traverseScene(v,scene), 100 )
|
||||
// wait for nested instances to arrive at the scene ?
|
||||
traverseScene(v,scene)
|
||||
if( v.string ) pviews.push(v.string)
|
||||
}else if( v.is( xrf.XRF.NAVIGATOR ) ) pviews.push(`${i}=${v.string}`)
|
||||
}
|
||||
|
@ -1253,13 +1292,16 @@ const updatePredefinedView = (opts) => {
|
|||
}
|
||||
|
||||
// when predefined view occurs in url changes
|
||||
xrf.addEventListener('eval', updatePredefinedView )
|
||||
//xrf.addEventListener('updateHash', (opts) => {
|
||||
// let frag = xrf.URI.parse( opts.xrf.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA )
|
||||
// xrf.frag.updatePredefinedView({frag,scene:xrf.scene,href:opts.xrf})
|
||||
//})
|
||||
|
||||
// clicking href url with predefined view
|
||||
xrf.addEventListener('href', (opts) => {
|
||||
if( !opts.click || opts.xrf.string[0] != '#' ) return
|
||||
let frag = xrf.URI.parse( opts.xrf.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.EMBEDDED )
|
||||
updatePredefinedView({frag,scene:xrf.scene,href:opts.xrf})
|
||||
let frag = xrf.URI.parse( opts.xrf.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA )
|
||||
xrf.frag.updatePredefinedView({frag,scene:xrf.scene,href:opts.xrf})
|
||||
})
|
||||
|
||||
//let updateUrl = (opts) => {
|
||||
|
@ -1275,6 +1317,23 @@ xrf.frag.q = function(v, opts){
|
|||
console.log(" └ running query ")
|
||||
let qobjs = Object.keys(v.query)
|
||||
|
||||
// convience function for other fragments (which apply to the query)
|
||||
frag.q.getObjects = () => {
|
||||
let objs = []
|
||||
scene.traverse( (o) => {
|
||||
for ( let name in v.query ) {
|
||||
let qobj = v.query[name];
|
||||
if( qobj.class && o.userData.class && o.userData.class == name ) objs.push(o)
|
||||
else if( qobj.id && o.name == name ) objs.push(o)
|
||||
}
|
||||
})
|
||||
return objs.filter( (o) => o ) // return and filter out empty
|
||||
.map( (o) => {
|
||||
if( !o.positionOriginal ) o.positionOriginal = o.position.clone()
|
||||
return o
|
||||
})
|
||||
}
|
||||
|
||||
// spec: https://xrfragment.org/#src
|
||||
const instanceScene = () => {
|
||||
v.scene = new THREE.Group()
|
||||
|
@ -1329,14 +1388,56 @@ xrf.frag.q = function(v, opts){
|
|||
else showHide() // spec : https://xrfragment.org/#queries
|
||||
}
|
||||
xrf.frag.rot = function(v, opts){
|
||||
let { mesh, model, camera, scene, renderer, THREE} = opts
|
||||
console.log(" └ setting camera rotation to "+v.string)
|
||||
camera.rotation.set(
|
||||
v.x * Math.PI / 180,
|
||||
v.y * Math.PI / 180,
|
||||
v.z * Math.PI / 180
|
||||
)
|
||||
camera.updateMatrixWorld()
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
// apply roundrobin (if any)
|
||||
if( v.args ) v = v.args[ xrf.roundrobin(v,model) ]
|
||||
|
||||
if( frag.q ){ // only operate on queried object(s)
|
||||
frag.q.getObjects().map( (o) => {
|
||||
o.rotation.set(
|
||||
v.x * Math.PI / 180,
|
||||
v.y * Math.PI / 180,
|
||||
v.z * Math.PI / 180
|
||||
)
|
||||
})
|
||||
}else{
|
||||
console.log(" └ setting camera rotation to "+v.string)
|
||||
camera.rotation.set(
|
||||
v.x * Math.PI / 180,
|
||||
v.y * Math.PI / 180,
|
||||
v.z * Math.PI / 180
|
||||
)
|
||||
camera.updateMatrixWorld()
|
||||
}
|
||||
}
|
||||
xrf.frag.scale = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
// apply roundrobin (if any)
|
||||
if( v.args ) v = v.args[ xrf.roundrobin(v,model) ]
|
||||
|
||||
if( frag.q ){ // only operate on queried object(s)
|
||||
frag.q.getObjects().map( (o) => {
|
||||
o.scale.x = v.x
|
||||
o.scale.y = v.y
|
||||
o.scale.z = v.z
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
xrf.frag.show = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
// apply roundrobin (if any)
|
||||
if( v.args ) v = v.args[ xrf.roundrobin(v,model) ]
|
||||
|
||||
if( frag.q ){ // only operate on queried object(s)
|
||||
frag.q.getObjects().map( (o) => {
|
||||
o.visible = v.int == 1;
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
// *TODO* use webgl instancing
|
||||
|
||||
|
|
|
@ -216,30 +216,32 @@ var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { };
|
|||
xrfragment_Parser.__name__ = true;
|
||||
xrfragment_Parser.parse = function(key,value,store) {
|
||||
var Frag_h = Object.create(null);
|
||||
Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE;
|
||||
Frag_h["prio"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_INT;
|
||||
Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW;
|
||||
Frag_h["class"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL;
|
||||
Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.EMBEDDED | xrfragment_XRF.NAVIGATOR;
|
||||
Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW;
|
||||
Frag_h["q"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["scale"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED | xrfragment_XRF.NAVIGATOR;
|
||||
Frag_h["translate"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["visible"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_INT | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["env"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["gravity"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["physics"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["fov"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_INT | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["clip"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["fog"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["class"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR;
|
||||
Frag_h["q"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA;
|
||||
Frag_h["scale"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA;
|
||||
Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR;
|
||||
Frag_h["mov"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA;
|
||||
Frag_h["show"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_INT | xrfragment_XRF.METADATA;
|
||||
Frag_h["env"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA;
|
||||
Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
|
||||
Frag_h["gravity"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA;
|
||||
Frag_h["physics"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA;
|
||||
Frag_h["fov"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_INT | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
|
||||
Frag_h["clip"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
|
||||
Frag_h["fog"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
|
||||
Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED | xrfragment_XRF.PROMPT;
|
||||
if(value.length == 0 && key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key)) {
|
||||
Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT;
|
||||
var isPVDynamic = value.length == 0 && key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key);
|
||||
var isPVDefault = value.length == 0 && key.length > 0 && key == "#";
|
||||
if(isPVDynamic) {
|
||||
var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR);
|
||||
v.validate(key);
|
||||
store[key] = v;
|
||||
|
@ -582,7 +584,7 @@ xrfragment_XRF.QUERY_OPERATOR = 4;
|
|||
xrfragment_XRF.PROMPT = 8;
|
||||
xrfragment_XRF.ROUNDROBIN = 16;
|
||||
xrfragment_XRF.NAVIGATOR = 32;
|
||||
xrfragment_XRF.EMBEDDED = 64;
|
||||
xrfragment_XRF.METADATA = 64;
|
||||
xrfragment_XRF.PV_OVERRIDE = 128;
|
||||
xrfragment_XRF.PV_EXECUTE = 256;
|
||||
xrfragment_XRF.T_COLOR = 8192;
|
||||
|
@ -753,7 +755,6 @@ xrf.parseModel = function(model,url){
|
|||
xrf.getLastModel = () => xrf.model.last
|
||||
|
||||
xrf.eval = function( url, model, flags ){ // evaluate fragments in url
|
||||
let notice = false
|
||||
model = model || xrf.model
|
||||
let { THREE, camera } = xrf
|
||||
let frag = xrf.URI.parse( url, flags || xrf.XRF.NAVIGATOR )
|
||||
|
@ -780,10 +781,11 @@ xrf.eval.mesh = (mesh,model) => { // evaluate embedded fragments (metadata)
|
|||
}
|
||||
|
||||
xrf.eval.fragment = (k, opts ) => { // evaluate one fragment
|
||||
let frag = opts.frag[k];
|
||||
// call native function (xrf/env.js e.g.), or pass it to user decorator
|
||||
let func = xrf.frag[k] || function(){}
|
||||
if( xrf[k] ) xrf[k]( func, opts.frag[k], opts)
|
||||
else func( opts.frag[k], opts)
|
||||
if( xrf[k] ) xrf[k]( func, frag, opts)
|
||||
else func( frag, opts)
|
||||
}
|
||||
|
||||
xrf.reset = () => {
|
||||
|
@ -982,12 +984,14 @@ xrf.navigator.to = (url,flags,loader,data) => {
|
|||
const onLoad = (model) => {
|
||||
xrf.reset() // clear xrf objects from scene
|
||||
model.file = file
|
||||
xrf.add( model.scene )
|
||||
// only change url when loading *another* file
|
||||
if( xrf.model ) xrf.navigator.pushState( `${dir}${file}`, hash )
|
||||
xrf.model = model
|
||||
xrf.eval( '#', model ) // execute the default projection '#' (if exist)
|
||||
xrf.eval( url, model ) // and eval URI XR fragments
|
||||
// spec: 1. execute the default predefined view '#' (if exist) (https://xrfragment.org/#predefined_view)
|
||||
xrf.frag.defaultPredefinedView({model,scene:model.scene})
|
||||
// spec: 2. execute predefined view(s) from URL (https://xrfragment.org/#predefined_view)
|
||||
xrf.eval( url, model ) // and eval URI XR fragments
|
||||
xrf.add( model.scene )
|
||||
if( !hash.match(/pos=/) )
|
||||
xrf.eval( '#pos=0,0,0' ) // set default position if not specified
|
||||
resolve(model)
|
||||
|
@ -1162,7 +1166,7 @@ xrf.frag.href = function(v, opts){
|
|||
mesh.scale.copy(world.scale)
|
||||
mesh.setRotationFromQuaternion(world.quat);
|
||||
xrf.interactive.add(mesh)
|
||||
}, 20, mesh )
|
||||
}, 10, mesh )
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1176,16 +1180,46 @@ xrf.frag.href = function(v, opts){
|
|||
*
|
||||
* > capture of <a href="./example/aframe/sandbox" target="_blank">aframe/sandbox</a>
|
||||
*/
|
||||
xrf.frag.pos = function(v, opts){
|
||||
xrf.frag.mov = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
if( !frag.q ){
|
||||
if( frag.q ){ // only operate on queried object(s)
|
||||
frag.q.getObjects().map( (o) => {
|
||||
o.position.add( new THREE.Vector3( v.x, v.y, v.z ) )
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
xrf.frag.pos = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
if( frag.q ){ // only operate on queried object(s)
|
||||
|
||||
// apply roundrobin (if any)
|
||||
if( v.args ) v = v.args[ xrf.roundrobin(v,model) ]
|
||||
|
||||
frag.q.getObjects().map( (o) => {
|
||||
console.dir(o)
|
||||
// if object has no parent (name == 'Scene') use absolute positioning, otherwise relative to parent
|
||||
o.position.x = o.parent.name == 'Scene' ? v.x : o.positionOriginal.x + v.x
|
||||
o.position.y = o.parent.name == 'Scene' ? v.z : o.positionOriginal.y + v.z
|
||||
o.position.z = o.parent.name == 'Scene' ? v.y : o.positionOriginal.z + v.y
|
||||
})
|
||||
}else{
|
||||
camera.position.x = v.x
|
||||
camera.position.y = v.y
|
||||
camera.position.z = v.z
|
||||
}
|
||||
|
||||
}
|
||||
const updatePredefinedView = (opts) => {
|
||||
xrf.frag.defaultPredefinedView = (opts) => {
|
||||
let {scene,model} = opts;
|
||||
let frag = {}
|
||||
xrf.Parser.parse("#","",frag)
|
||||
xrf.frag.updatePredefinedView({frag,model,scene})
|
||||
}
|
||||
|
||||
xrf.frag.updatePredefinedView = (opts) => {
|
||||
let {frag,scene,model} = opts
|
||||
|
||||
// spec: https://xrfragment.org/#Selection%20of%20interest
|
||||
|
@ -1213,15 +1247,19 @@ const updatePredefinedView = (opts) => {
|
|||
|
||||
// spec: https://xrfragment.org/#predefined_view
|
||||
const predefinedView = (frag,scene,mesh) => {
|
||||
let id = frag.string
|
||||
if( !id ) return // prevent empty matches
|
||||
if( mesh.userData[`#${id}`] ){ // get alias
|
||||
frag = xrf.URI.parse( mesh.userData[`#${id}`], xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.EMBEDDED )
|
||||
let id = frag.string || frag.fragment
|
||||
id = `#${id}`
|
||||
if( id == '##' ) id = '#'; // default predefined view
|
||||
if( !id ) return // prevent empty matches
|
||||
if( mesh.userData[id] ){ // get alias
|
||||
frag = xrf.URI.parse( mesh.userData[id], xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA )
|
||||
xrf.emit('predefinedView',{...opts,frag})
|
||||
.then( () => {
|
||||
for ( let k in frag ){
|
||||
let opts = {frag, model, camera: xrf.camera, scene: xrf.scene, renderer: xrf.renderer, THREE: xrf.THREE }
|
||||
xrf.eval.fragment(k,opts)
|
||||
if( frag[k].is( xrf.XRF.PV_EXECUTE ) && scene.XRF_PV_ORIGIN != k ){ // cyclic detection
|
||||
traverseScene(frag[k],scene) // recurse predefined views
|
||||
}else xrf.eval.fragment(k,opts)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -1243,9 +1281,10 @@ const updatePredefinedView = (opts) => {
|
|||
for ( let i in frag ) {
|
||||
let v = frag[i]
|
||||
if( v.is( xrf.XRF.PV_EXECUTE ) ){
|
||||
scene.XRF_PV_ORIGIN = v.string
|
||||
if( v.args ) v = v.args[ xrf.roundrobin(v,xrf.model) ]
|
||||
// wait for nested instances to arrive at the scene
|
||||
setTimeout( () => traverseScene(v,scene), 100 )
|
||||
// wait for nested instances to arrive at the scene ?
|
||||
traverseScene(v,scene)
|
||||
if( v.string ) pviews.push(v.string)
|
||||
}else if( v.is( xrf.XRF.NAVIGATOR ) ) pviews.push(`${i}=${v.string}`)
|
||||
}
|
||||
|
@ -1253,13 +1292,16 @@ const updatePredefinedView = (opts) => {
|
|||
}
|
||||
|
||||
// when predefined view occurs in url changes
|
||||
xrf.addEventListener('eval', updatePredefinedView )
|
||||
//xrf.addEventListener('updateHash', (opts) => {
|
||||
// let frag = xrf.URI.parse( opts.xrf.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA )
|
||||
// xrf.frag.updatePredefinedView({frag,scene:xrf.scene,href:opts.xrf})
|
||||
//})
|
||||
|
||||
// clicking href url with predefined view
|
||||
xrf.addEventListener('href', (opts) => {
|
||||
if( !opts.click || opts.xrf.string[0] != '#' ) return
|
||||
let frag = xrf.URI.parse( opts.xrf.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.EMBEDDED )
|
||||
updatePredefinedView({frag,scene:xrf.scene,href:opts.xrf})
|
||||
let frag = xrf.URI.parse( opts.xrf.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA )
|
||||
xrf.frag.updatePredefinedView({frag,scene:xrf.scene,href:opts.xrf})
|
||||
})
|
||||
|
||||
//let updateUrl = (opts) => {
|
||||
|
@ -1275,6 +1317,23 @@ xrf.frag.q = function(v, opts){
|
|||
console.log(" └ running query ")
|
||||
let qobjs = Object.keys(v.query)
|
||||
|
||||
// convience function for other fragments (which apply to the query)
|
||||
frag.q.getObjects = () => {
|
||||
let objs = []
|
||||
scene.traverse( (o) => {
|
||||
for ( let name in v.query ) {
|
||||
let qobj = v.query[name];
|
||||
if( qobj.class && o.userData.class && o.userData.class == name ) objs.push(o)
|
||||
else if( qobj.id && o.name == name ) objs.push(o)
|
||||
}
|
||||
})
|
||||
return objs.filter( (o) => o ) // return and filter out empty
|
||||
.map( (o) => {
|
||||
if( !o.positionOriginal ) o.positionOriginal = o.position.clone()
|
||||
return o
|
||||
})
|
||||
}
|
||||
|
||||
// spec: https://xrfragment.org/#src
|
||||
const instanceScene = () => {
|
||||
v.scene = new THREE.Group()
|
||||
|
@ -1329,14 +1388,56 @@ xrf.frag.q = function(v, opts){
|
|||
else showHide() // spec : https://xrfragment.org/#queries
|
||||
}
|
||||
xrf.frag.rot = function(v, opts){
|
||||
let { mesh, model, camera, scene, renderer, THREE} = opts
|
||||
console.log(" └ setting camera rotation to "+v.string)
|
||||
camera.rotation.set(
|
||||
v.x * Math.PI / 180,
|
||||
v.y * Math.PI / 180,
|
||||
v.z * Math.PI / 180
|
||||
)
|
||||
camera.updateMatrixWorld()
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
// apply roundrobin (if any)
|
||||
if( v.args ) v = v.args[ xrf.roundrobin(v,model) ]
|
||||
|
||||
if( frag.q ){ // only operate on queried object(s)
|
||||
frag.q.getObjects().map( (o) => {
|
||||
o.rotation.set(
|
||||
v.x * Math.PI / 180,
|
||||
v.y * Math.PI / 180,
|
||||
v.z * Math.PI / 180
|
||||
)
|
||||
})
|
||||
}else{
|
||||
console.log(" └ setting camera rotation to "+v.string)
|
||||
camera.rotation.set(
|
||||
v.x * Math.PI / 180,
|
||||
v.y * Math.PI / 180,
|
||||
v.z * Math.PI / 180
|
||||
)
|
||||
camera.updateMatrixWorld()
|
||||
}
|
||||
}
|
||||
xrf.frag.scale = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
// apply roundrobin (if any)
|
||||
if( v.args ) v = v.args[ xrf.roundrobin(v,model) ]
|
||||
|
||||
if( frag.q ){ // only operate on queried object(s)
|
||||
frag.q.getObjects().map( (o) => {
|
||||
o.scale.x = v.x
|
||||
o.scale.y = v.y
|
||||
o.scale.z = v.z
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
xrf.frag.show = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
// apply roundrobin (if any)
|
||||
if( v.args ) v = v.args[ xrf.roundrobin(v,model) ]
|
||||
|
||||
if( frag.q ){ // only operate on queried object(s)
|
||||
frag.q.getObjects().map( (o) => {
|
||||
o.visible = v.int == 1;
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
// *TODO* use webgl instancing
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
12
index.html
12
index.html
File diff suppressed because one or more lines are too long
|
@ -46,7 +46,8 @@ window.AFRAME.registerComponent('xrf', {
|
|||
// in order to set the rotation programmatically
|
||||
// we need to disable look-controls
|
||||
xrf.rot = (xrf,v,opts) => {
|
||||
let {renderer} = opts;
|
||||
let {frag,renderer} = opts;
|
||||
if( frag.q ) return // camera was not targeted for rotation
|
||||
let look = document.querySelector('[look-controls]')
|
||||
if( look ) look.removeAttribute("look-controls")
|
||||
camOverride(xrf,v,opts)
|
||||
|
|
|
@ -57,7 +57,6 @@ xrf.parseModel = function(model,url){
|
|||
xrf.getLastModel = () => xrf.model.last
|
||||
|
||||
xrf.eval = function( url, model, flags ){ // evaluate fragments in url
|
||||
let notice = false
|
||||
model = model || xrf.model
|
||||
let { THREE, camera } = xrf
|
||||
let frag = xrf.URI.parse( url, flags || xrf.XRF.NAVIGATOR )
|
||||
|
@ -84,10 +83,11 @@ xrf.eval.mesh = (mesh,model) => { // evaluate embedded fragments (metadata)
|
|||
}
|
||||
|
||||
xrf.eval.fragment = (k, opts ) => { // evaluate one fragment
|
||||
let frag = opts.frag[k];
|
||||
// call native function (xrf/env.js e.g.), or pass it to user decorator
|
||||
let func = xrf.frag[k] || function(){}
|
||||
if( xrf[k] ) xrf[k]( func, opts.frag[k], opts)
|
||||
else func( opts.frag[k], opts)
|
||||
if( xrf[k] ) xrf[k]( func, frag, opts)
|
||||
else func( frag, opts)
|
||||
}
|
||||
|
||||
xrf.reset = () => {
|
||||
|
|
|
@ -25,12 +25,14 @@ xrf.navigator.to = (url,flags,loader,data) => {
|
|||
const onLoad = (model) => {
|
||||
xrf.reset() // clear xrf objects from scene
|
||||
model.file = file
|
||||
xrf.add( model.scene )
|
||||
// only change url when loading *another* file
|
||||
if( xrf.model ) xrf.navigator.pushState( `${dir}${file}`, hash )
|
||||
xrf.model = model
|
||||
xrf.eval( '#', model ) // execute the default projection '#' (if exist)
|
||||
xrf.eval( url, model ) // and eval URI XR fragments
|
||||
// spec: 1. execute the default predefined view '#' (if exist) (https://xrfragment.org/#predefined_view)
|
||||
xrf.frag.defaultPredefinedView({model,scene:model.scene})
|
||||
// spec: 2. execute predefined view(s) from URL (https://xrfragment.org/#predefined_view)
|
||||
xrf.eval( url, model ) // and eval URI XR fragments
|
||||
xrf.add( model.scene )
|
||||
if( !hash.match(/pos=/) )
|
||||
xrf.eval( '#pos=0,0,0' ) // set default position if not specified
|
||||
resolve(model)
|
||||
|
|
|
@ -129,7 +129,7 @@ xrf.frag.href = function(v, opts){
|
|||
mesh.scale.copy(world.scale)
|
||||
mesh.setRotationFromQuaternion(world.quat);
|
||||
xrf.interactive.add(mesh)
|
||||
}, 20, mesh )
|
||||
}, 10, mesh )
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
xrf.frag.mov = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
if( frag.q ){ // only operate on queried object(s)
|
||||
frag.q.getObjects().map( (o) => {
|
||||
o.position.add( new THREE.Vector3( v.x, v.y, v.z ) )
|
||||
})
|
||||
}
|
||||
|
||||
}
|
|
@ -1,9 +1,22 @@
|
|||
xrf.frag.pos = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
if( frag.q ){ // only operate on queried object(s)
|
||||
|
||||
if( !frag.q ){
|
||||
// apply roundrobin (if any)
|
||||
if( v.args ) v = v.args[ xrf.roundrobin(v,model) ]
|
||||
|
||||
frag.q.getObjects().map( (o) => {
|
||||
console.dir(o)
|
||||
// if object has no parent (name == 'Scene') use absolute positioning, otherwise relative to parent
|
||||
o.position.x = o.parent.name == 'Scene' ? v.x : o.positionOriginal.x + v.x
|
||||
o.position.y = o.parent.name == 'Scene' ? v.z : o.positionOriginal.y + v.z
|
||||
o.position.z = o.parent.name == 'Scene' ? v.y : o.positionOriginal.z + v.y
|
||||
})
|
||||
}else{
|
||||
camera.position.x = v.x
|
||||
camera.position.y = v.y
|
||||
camera.position.z = v.z
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
const updatePredefinedView = (opts) => {
|
||||
xrf.frag.defaultPredefinedView = (opts) => {
|
||||
let {scene,model} = opts;
|
||||
let frag = {}
|
||||
xrf.Parser.parse("#","",frag)
|
||||
xrf.frag.updatePredefinedView({frag,model,scene})
|
||||
}
|
||||
|
||||
xrf.frag.updatePredefinedView = (opts) => {
|
||||
let {frag,scene,model} = opts
|
||||
|
||||
// spec: https://xrfragment.org/#Selection%20of%20interest
|
||||
|
@ -26,15 +33,19 @@ const updatePredefinedView = (opts) => {
|
|||
|
||||
// spec: https://xrfragment.org/#predefined_view
|
||||
const predefinedView = (frag,scene,mesh) => {
|
||||
let id = frag.string
|
||||
if( !id ) return // prevent empty matches
|
||||
if( mesh.userData[`#${id}`] ){ // get alias
|
||||
frag = xrf.URI.parse( mesh.userData[`#${id}`], xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.EMBEDDED )
|
||||
let id = frag.string || frag.fragment
|
||||
id = `#${id}`
|
||||
if( id == '##' ) id = '#'; // default predefined view
|
||||
if( !id ) return // prevent empty matches
|
||||
if( mesh.userData[id] ){ // get alias
|
||||
frag = xrf.URI.parse( mesh.userData[id], xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA )
|
||||
xrf.emit('predefinedView',{...opts,frag})
|
||||
.then( () => {
|
||||
for ( let k in frag ){
|
||||
let opts = {frag, model, camera: xrf.camera, scene: xrf.scene, renderer: xrf.renderer, THREE: xrf.THREE }
|
||||
xrf.eval.fragment(k,opts)
|
||||
if( frag[k].is( xrf.XRF.PV_EXECUTE ) && scene.XRF_PV_ORIGIN != k ){ // cyclic detection
|
||||
traverseScene(frag[k],scene) // recurse predefined views
|
||||
}else xrf.eval.fragment(k,opts)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -56,9 +67,10 @@ const updatePredefinedView = (opts) => {
|
|||
for ( let i in frag ) {
|
||||
let v = frag[i]
|
||||
if( v.is( xrf.XRF.PV_EXECUTE ) ){
|
||||
scene.XRF_PV_ORIGIN = v.string
|
||||
if( v.args ) v = v.args[ xrf.roundrobin(v,xrf.model) ]
|
||||
// wait for nested instances to arrive at the scene
|
||||
setTimeout( () => traverseScene(v,scene), 100 )
|
||||
// wait for nested instances to arrive at the scene ?
|
||||
traverseScene(v,scene)
|
||||
if( v.string ) pviews.push(v.string)
|
||||
}else if( v.is( xrf.XRF.NAVIGATOR ) ) pviews.push(`${i}=${v.string}`)
|
||||
}
|
||||
|
@ -66,13 +78,16 @@ const updatePredefinedView = (opts) => {
|
|||
}
|
||||
|
||||
// when predefined view occurs in url changes
|
||||
xrf.addEventListener('eval', updatePredefinedView )
|
||||
//xrf.addEventListener('updateHash', (opts) => {
|
||||
// let frag = xrf.URI.parse( opts.xrf.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA )
|
||||
// xrf.frag.updatePredefinedView({frag,scene:xrf.scene,href:opts.xrf})
|
||||
//})
|
||||
|
||||
// clicking href url with predefined view
|
||||
xrf.addEventListener('href', (opts) => {
|
||||
if( !opts.click || opts.xrf.string[0] != '#' ) return
|
||||
let frag = xrf.URI.parse( opts.xrf.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.EMBEDDED )
|
||||
updatePredefinedView({frag,scene:xrf.scene,href:opts.xrf})
|
||||
let frag = xrf.URI.parse( opts.xrf.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA )
|
||||
xrf.frag.updatePredefinedView({frag,scene:xrf.scene,href:opts.xrf})
|
||||
})
|
||||
|
||||
//let updateUrl = (opts) => {
|
||||
|
|
|
@ -5,6 +5,23 @@ xrf.frag.q = function(v, opts){
|
|||
console.log(" └ running query ")
|
||||
let qobjs = Object.keys(v.query)
|
||||
|
||||
// convience function for other fragments (which apply to the query)
|
||||
frag.q.getObjects = () => {
|
||||
let objs = []
|
||||
scene.traverse( (o) => {
|
||||
for ( let name in v.query ) {
|
||||
let qobj = v.query[name];
|
||||
if( qobj.class && o.userData.class && o.userData.class == name ) objs.push(o)
|
||||
else if( qobj.id && o.name == name ) objs.push(o)
|
||||
}
|
||||
})
|
||||
return objs.filter( (o) => o ) // return and filter out empty
|
||||
.map( (o) => {
|
||||
if( !o.positionOriginal ) o.positionOriginal = o.position.clone()
|
||||
return o
|
||||
})
|
||||
}
|
||||
|
||||
// spec: https://xrfragment.org/#src
|
||||
const instanceScene = () => {
|
||||
v.scene = new THREE.Group()
|
||||
|
|
|
@ -1,10 +1,24 @@
|
|||
xrf.frag.rot = function(v, opts){
|
||||
let { mesh, model, camera, scene, renderer, THREE} = opts
|
||||
console.log(" └ setting camera rotation to "+v.string)
|
||||
camera.rotation.set(
|
||||
v.x * Math.PI / 180,
|
||||
v.y * Math.PI / 180,
|
||||
v.z * Math.PI / 180
|
||||
)
|
||||
camera.updateMatrixWorld()
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
// apply roundrobin (if any)
|
||||
if( v.args ) v = v.args[ xrf.roundrobin(v,model) ]
|
||||
|
||||
if( frag.q ){ // only operate on queried object(s)
|
||||
frag.q.getObjects().map( (o) => {
|
||||
o.rotation.set(
|
||||
v.x * Math.PI / 180,
|
||||
v.y * Math.PI / 180,
|
||||
v.z * Math.PI / 180
|
||||
)
|
||||
})
|
||||
}else{
|
||||
console.log(" └ setting camera rotation to "+v.string)
|
||||
camera.rotation.set(
|
||||
v.x * Math.PI / 180,
|
||||
v.y * Math.PI / 180,
|
||||
v.z * Math.PI / 180
|
||||
)
|
||||
camera.updateMatrixWorld()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
xrf.frag.scale = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
// apply roundrobin (if any)
|
||||
if( v.args ) v = v.args[ xrf.roundrobin(v,model) ]
|
||||
|
||||
if( frag.q ){ // only operate on queried object(s)
|
||||
frag.q.getObjects().map( (o) => {
|
||||
o.scale.x = v.x
|
||||
o.scale.y = v.y
|
||||
o.scale.z = v.z
|
||||
})
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
xrf.frag.show = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
// apply roundrobin (if any)
|
||||
if( v.args ) v = v.args[ xrf.roundrobin(v,model) ]
|
||||
|
||||
if( frag.q ){ // only operate on queried object(s)
|
||||
frag.q.getObjects().map( (o) => {
|
||||
o.visible = v.int == 1;
|
||||
})
|
||||
}
|
||||
|
||||
}
|
|
@ -39,7 +39,7 @@ class Test {
|
|||
if( item.expect.fn == "testPredefinedView" ) valid = res.exists(item.expect.input) && item.expect.out == res.get(item.expect.input).is( XRF.PV_EXECUTE) ;
|
||||
if( item.expect.fn == "testPropertyAssign" ) valid = res.exists(item.expect.input) && item.expect.out == res.get(item.expect.input).is( XRF.PROP_BIND) ;
|
||||
if( item.expect.fn == "testBrowserOverride" ) valid = item.expect.out == (URI.parse(item.data,XRF.NAVIGATOR)).exists(item.expect.input);
|
||||
if( item.expect.fn == "testEmbedOverride" ) valid = item.expect.out == (URI.parse(item.data,XRF.EMBEDDED)).exists(item.expect.input);
|
||||
if( item.expect.fn == "testEmbedOverride" ) valid = item.expect.out == (URI.parse(item.data,XRF.METADATA)).exists(item.expect.input);
|
||||
if( item.expect.fn == "equal.string" ) valid = res.get(item.expect.input) && item.expect.out == res.get(item.expect.input).string;
|
||||
if( item.expect.fn == "equal.xy" ) valid = equalXY(res,item);
|
||||
if( item.expect.fn == "equal.xyz" ) valid = equalXYZ(res,item);
|
||||
|
|
|
@ -12,37 +12,35 @@ class Parser {
|
|||
|
||||
@:keep
|
||||
public static function parse(key:String,value:String,store:haxe.DynamicAccess<Dynamic>):Bool {
|
||||
|
||||
// here we define allowed characteristics & datatypes for each fragment (stored as bitmasked int for performance purposes)
|
||||
var Frag:Map<String, Int> = new Map<String, Int>();
|
||||
|
||||
// category: asset loading linking
|
||||
Frag.set("#", XRF.ASSET | XRF.T_PREDEFINED_VIEW | XRF.PV_EXECUTE );
|
||||
Frag.set("prio", XRF.ASSET | XRF.T_INT );
|
||||
Frag.set("#", XRF.ASSET | XRF.T_PREDEFINED_VIEW );
|
||||
Frag.set("class", XRF.ASSET | XRF.T_STRING );
|
||||
Frag.set("src", XRF.ASSET | XRF.T_URL );
|
||||
|
||||
// category: href navigation / portals / teleporting
|
||||
Frag.set("pos", XRF.PV_OVERRIDE | XRF.ROUNDROBIN | XRF.T_VECTOR3 | XRF.T_STRING_OBJ | XRF.EMBEDDED | XRF.NAVIGATOR );
|
||||
Frag.set("href", XRF.ASSET | XRF.T_URL | XRF.T_PREDEFINED_VIEW );
|
||||
Frag.set("class", XRF.ASSET | XRF.T_STRING );
|
||||
|
||||
// category: query selector / object manipulation
|
||||
Frag.set("q", XRF.PV_OVERRIDE | XRF.T_STRING | XRF.EMBEDDED );
|
||||
Frag.set("scale", XRF.QUERY_OPERATOR | XRF.PV_OVERRIDE | XRF.ROUNDROBIN | XRF.T_VECTOR3 | XRF.EMBEDDED );
|
||||
Frag.set("rot", XRF.QUERY_OPERATOR | XRF.PV_OVERRIDE | XRF.ROUNDROBIN | XRF.T_VECTOR3 | XRF.EMBEDDED | XRF.NAVIGATOR );
|
||||
Frag.set("translate", XRF.QUERY_OPERATOR | XRF.PV_OVERRIDE | XRF.ROUNDROBIN | XRF.T_VECTOR3 | XRF.EMBEDDED );
|
||||
Frag.set("visible", XRF.QUERY_OPERATOR | XRF.PV_OVERRIDE | XRF.ROUNDROBIN | XRF.T_INT | XRF.EMBEDDED );
|
||||
Frag.set("env", XRF.ASSET | XRF.PV_OVERRIDE | XRF.T_STRING | XRF.EMBEDDED );
|
||||
Frag.set("pos", XRF.PV_OVERRIDE | XRF.ROUNDROBIN | XRF.T_VECTOR3 | XRF.T_STRING_OBJ | XRF.METADATA | XRF.NAVIGATOR );
|
||||
Frag.set("q", XRF.PV_OVERRIDE | XRF.T_STRING | XRF.METADATA );
|
||||
Frag.set("scale", XRF.QUERY_OPERATOR | XRF.PV_OVERRIDE | XRF.ROUNDROBIN | XRF.T_VECTOR3 | XRF.METADATA );
|
||||
Frag.set("rot", XRF.QUERY_OPERATOR | XRF.PV_OVERRIDE | XRF.ROUNDROBIN | XRF.T_VECTOR3 | XRF.METADATA | XRF.NAVIGATOR );
|
||||
Frag.set("mov", XRF.QUERY_OPERATOR | XRF.PV_OVERRIDE | XRF.ROUNDROBIN | XRF.T_VECTOR3 | XRF.METADATA );
|
||||
Frag.set("show", XRF.QUERY_OPERATOR | XRF.PV_OVERRIDE | XRF.ROUNDROBIN | XRF.T_INT | XRF.METADATA );
|
||||
Frag.set("env", XRF.ASSET | XRF.PV_OVERRIDE | XRF.T_STRING | XRF.METADATA );
|
||||
|
||||
// category: animation
|
||||
Frag.set("t", XRF.ASSET | XRF.PV_OVERRIDE | XRF.ROUNDROBIN | XRF.T_VECTOR2 | XRF.NAVIGATOR | XRF.EMBEDDED);
|
||||
Frag.set("gravity", XRF.ASSET | XRF.PV_OVERRIDE | XRF.T_VECTOR3 | XRF.EMBEDDED );
|
||||
Frag.set("physics", XRF.ASSET | XRF.PV_OVERRIDE | XRF.T_VECTOR3 | XRF.EMBEDDED );
|
||||
Frag.set("t", XRF.ASSET | XRF.PV_OVERRIDE | XRF.ROUNDROBIN | XRF.T_VECTOR2 | XRF.NAVIGATOR | XRF.METADATA);
|
||||
Frag.set("gravity", XRF.ASSET | XRF.PV_OVERRIDE | XRF.T_VECTOR3 | XRF.METADATA );
|
||||
Frag.set("physics", XRF.ASSET | XRF.PV_OVERRIDE | XRF.T_VECTOR3 | XRF.METADATA );
|
||||
|
||||
// category: device / viewport settings
|
||||
Frag.set("fov", XRF.ASSET | XRF.PV_OVERRIDE | XRF.T_INT | XRF.NAVIGATOR | XRF.EMBEDDED );
|
||||
Frag.set("clip", XRF.ASSET | XRF.PV_OVERRIDE | XRF.T_VECTOR2 | XRF.NAVIGATOR | XRF.EMBEDDED );
|
||||
Frag.set("fog", XRF.ASSET | XRF.PV_OVERRIDE | XRF.T_STRING | XRF.NAVIGATOR | XRF.EMBEDDED );
|
||||
Frag.set("fov", XRF.ASSET | XRF.PV_OVERRIDE | XRF.T_INT | XRF.NAVIGATOR | XRF.METADATA );
|
||||
Frag.set("clip", XRF.ASSET | XRF.PV_OVERRIDE | XRF.T_VECTOR2 | XRF.NAVIGATOR | XRF.METADATA );
|
||||
Frag.set("fog", XRF.ASSET | XRF.PV_OVERRIDE | XRF.T_STRING | XRF.NAVIGATOR | XRF.METADATA );
|
||||
|
||||
// category: author / metadata
|
||||
Frag.set("namespace", XRF.ASSET | XRF.T_STRING );
|
||||
|
@ -51,7 +49,7 @@ class Parser {
|
|||
Frag.set("description", XRF.ASSET | XRF.T_STRING );
|
||||
|
||||
// category: multiparty
|
||||
Frag.set("session", XRF.ASSET | XRF.T_URL | XRF.PV_OVERRIDE | XRF.NAVIGATOR | XRF.EMBEDDED | XRF.PROMPT );
|
||||
Frag.set("session", XRF.ASSET | XRF.T_URL | XRF.PV_OVERRIDE | XRF.NAVIGATOR | XRF.METADATA | XRF.PROMPT );
|
||||
|
||||
/**
|
||||
* # Spec
|
||||
|
@ -64,7 +62,9 @@ class Parser {
|
|||
// 1. requirement: receive arguments: key (string), value (string), store (writable associative array/object)
|
||||
|
||||
// dynamic fragments cases: predefined views & assign/binds
|
||||
if( value.length == 0 && key.length > 0 && !Frag.exists(key) ){ // 1. add keys without values to store as [predefined view](predefined_view)
|
||||
var isPVDynamic:Bool = value.length == 0 && key.length > 0 && !Frag.exists(key);
|
||||
var isPVDefault:Bool = value.length == 0 && key.length > 0 && key == "#";
|
||||
if( isPVDynamic ){ //|| isPVDefault ){ // 1. add keys without values to store as [predefined view](predefined_view)
|
||||
var v:XRF = new XRF(key, XRF.PV_EXECUTE | XRF.NAVIGATOR );
|
||||
v.validate(key); // will fail but will parse multiple args for us (separated by |)
|
||||
store.set(key, v );
|
||||
|
|
|
@ -19,7 +19,7 @@ class XRF {
|
|||
public static var PROMPT:Int = 8; // ask user whether this fragment value can be changed
|
||||
public static var ROUNDROBIN:Int = 16; // evaluation of this (multi) value can be roundrobined
|
||||
public static var NAVIGATOR:Int = 32; // fragment can be overridden by (manual) browser URI change
|
||||
public static var EMBEDDED:Int = 64; // fragment can be overridden by an embedded URL
|
||||
public static var METADATA:Int = 64; // fragment can be overridden by an embedded URL
|
||||
public static var PV_OVERRIDE:Int = 128; // embedded fragment can be overridden when specified in predefined view value
|
||||
public static var PV_EXECUTE:Int = 256; // predefined view
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ Test.test = function(spec) {
|
|||
}
|
||||
if(item.expect.fn == "testEmbedOverride") {
|
||||
var item2 = item.expect.out;
|
||||
var this2 = xrfragment_URI.parse(item.data,xrfragment_XRF.EMBEDDED);
|
||||
var this2 = xrfragment_URI.parse(item.data,xrfragment_XRF.METADATA);
|
||||
valid = item2 == Object.prototype.hasOwnProperty.call(this2,item.expect.input);
|
||||
}
|
||||
if(item.expect.fn == "equal.string") {
|
||||
|
@ -330,30 +330,32 @@ var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { };
|
|||
xrfragment_Parser.__name__ = true;
|
||||
xrfragment_Parser.parse = function(key,value,store) {
|
||||
var Frag_h = Object.create(null);
|
||||
Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE;
|
||||
Frag_h["prio"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_INT;
|
||||
Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW;
|
||||
Frag_h["class"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL;
|
||||
Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.EMBEDDED | xrfragment_XRF.NAVIGATOR;
|
||||
Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW;
|
||||
Frag_h["q"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["scale"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED | xrfragment_XRF.NAVIGATOR;
|
||||
Frag_h["translate"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["visible"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_INT | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["env"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["gravity"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["physics"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["fov"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_INT | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["clip"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["fog"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED;
|
||||
Frag_h["class"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR;
|
||||
Frag_h["q"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA;
|
||||
Frag_h["scale"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA;
|
||||
Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR;
|
||||
Frag_h["mov"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA;
|
||||
Frag_h["show"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_INT | xrfragment_XRF.METADATA;
|
||||
Frag_h["env"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA;
|
||||
Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
|
||||
Frag_h["gravity"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA;
|
||||
Frag_h["physics"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA;
|
||||
Frag_h["fov"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_INT | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
|
||||
Frag_h["clip"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
|
||||
Frag_h["fog"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
|
||||
Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED | xrfragment_XRF.PROMPT;
|
||||
if(value.length == 0 && key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key)) {
|
||||
Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT;
|
||||
var isPVDynamic = value.length == 0 && key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key);
|
||||
var isPVDefault = value.length == 0 && key.length > 0 && key == "#";
|
||||
if(isPVDynamic) {
|
||||
var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR);
|
||||
v.validate(key);
|
||||
store[key] = v;
|
||||
|
@ -697,7 +699,7 @@ xrfragment_XRF.QUERY_OPERATOR = 4;
|
|||
xrfragment_XRF.PROMPT = 8;
|
||||
xrfragment_XRF.ROUNDROBIN = 16;
|
||||
xrfragment_XRF.NAVIGATOR = 32;
|
||||
xrfragment_XRF.EMBEDDED = 64;
|
||||
xrfragment_XRF.METADATA = 64;
|
||||
xrfragment_XRF.PV_OVERRIDE = 128;
|
||||
xrfragment_XRF.PV_EXECUTE = 256;
|
||||
xrfragment_XRF.T_COLOR = 8192;
|
||||
|
|
|
@ -428,7 +428,7 @@ class Test:
|
|||
if (Reflect.field(Reflect.field(item,"expect"),"fn") == "testBrowserOverride"):
|
||||
valid = (Reflect.field(Reflect.field(item,"expect"),"out") == python_Boot.hasField(xrfragment_URI.parse(Reflect.field(item,"data"),xrfragment_XRF.NAVIGATOR),Reflect.field(Reflect.field(item,"expect"),"input")))
|
||||
if (Reflect.field(Reflect.field(item,"expect"),"fn") == "testEmbedOverride"):
|
||||
valid = (Reflect.field(Reflect.field(item,"expect"),"out") == python_Boot.hasField(xrfragment_URI.parse(Reflect.field(item,"data"),xrfragment_XRF.EMBEDDED),Reflect.field(Reflect.field(item,"expect"),"input")))
|
||||
valid = (Reflect.field(Reflect.field(item,"expect"),"out") == python_Boot.hasField(xrfragment_URI.parse(Reflect.field(item,"data"),xrfragment_XRF.METADATA),Reflect.field(Reflect.field(item,"expect"),"input")))
|
||||
if (Reflect.field(Reflect.field(item,"expect"),"fn") == "equal.string"):
|
||||
valid = (Reflect.field(res,Reflect.field(Reflect.field(item,"expect"),"input")) and (HxOverrides.eq(Reflect.field(Reflect.field(item,"expect"),"out"),Reflect.field(Reflect.field(res,Reflect.field(Reflect.field(item,"expect"),"input")),"string"))))
|
||||
if (Reflect.field(Reflect.field(item,"expect"),"fn") == "equal.xy"):
|
||||
|
@ -1410,30 +1410,32 @@ class xrfragment_Parser:
|
|||
@staticmethod
|
||||
def parse(key,value,store):
|
||||
Frag = haxe_ds_StringMap()
|
||||
Frag.h["#"] = ((xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW) | xrfragment_XRF.PV_EXECUTE)
|
||||
Frag.h["prio"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_INT)
|
||||
Frag.h["#"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW)
|
||||
Frag.h["class"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING)
|
||||
Frag.h["src"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_URL)
|
||||
Frag.h["pos"] = (((((xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.T_STRING_OBJ) | xrfragment_XRF.EMBEDDED) | xrfragment_XRF.NAVIGATOR)
|
||||
Frag.h["href"] = ((xrfragment_XRF.ASSET | xrfragment_XRF.T_URL) | xrfragment_XRF.T_PREDEFINED_VIEW)
|
||||
Frag.h["q"] = ((xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING) | xrfragment_XRF.EMBEDDED)
|
||||
Frag.h["scale"] = ((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.EMBEDDED)
|
||||
Frag.h["rot"] = (((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.EMBEDDED) | xrfragment_XRF.NAVIGATOR)
|
||||
Frag.h["translate"] = ((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.EMBEDDED)
|
||||
Frag.h["visible"] = ((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_INT) | xrfragment_XRF.EMBEDDED)
|
||||
Frag.h["env"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_STRING) | xrfragment_XRF.EMBEDDED)
|
||||
Frag.h["t"] = (((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.EMBEDDED)
|
||||
Frag.h["gravity"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.EMBEDDED)
|
||||
Frag.h["physics"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.EMBEDDED)
|
||||
Frag.h["fov"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_INT) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.EMBEDDED)
|
||||
Frag.h["clip"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.EMBEDDED)
|
||||
Frag.h["fog"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_STRING) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.EMBEDDED)
|
||||
Frag.h["class"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING)
|
||||
Frag.h["pos"] = (((((xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.T_STRING_OBJ) | xrfragment_XRF.METADATA) | xrfragment_XRF.NAVIGATOR)
|
||||
Frag.h["q"] = ((xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING) | xrfragment_XRF.METADATA)
|
||||
Frag.h["scale"] = ((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.METADATA)
|
||||
Frag.h["rot"] = (((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.METADATA) | xrfragment_XRF.NAVIGATOR)
|
||||
Frag.h["mov"] = ((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.METADATA)
|
||||
Frag.h["show"] = ((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_INT) | xrfragment_XRF.METADATA)
|
||||
Frag.h["env"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_STRING) | xrfragment_XRF.METADATA)
|
||||
Frag.h["t"] = (((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.METADATA)
|
||||
Frag.h["gravity"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.METADATA)
|
||||
Frag.h["physics"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.METADATA)
|
||||
Frag.h["fov"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_INT) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.METADATA)
|
||||
Frag.h["clip"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.METADATA)
|
||||
Frag.h["fog"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_STRING) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.METADATA)
|
||||
Frag.h["namespace"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING)
|
||||
Frag.h["SPDX"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING)
|
||||
Frag.h["unit"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING)
|
||||
Frag.h["description"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING)
|
||||
Frag.h["session"] = (((((xrfragment_XRF.ASSET | xrfragment_XRF.T_URL) | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.EMBEDDED) | xrfragment_XRF.PROMPT)
|
||||
if (((len(value) == 0) and ((len(key) > 0))) and (not (key in Frag.h))):
|
||||
Frag.h["session"] = (((((xrfragment_XRF.ASSET | xrfragment_XRF.T_URL) | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.METADATA) | xrfragment_XRF.PROMPT)
|
||||
isPVDynamic = (((len(value) == 0) and ((len(key) > 0))) and (not (key in Frag.h)))
|
||||
isPVDefault = (((len(value) == 0) and ((len(key) > 0))) and ((key == "#")))
|
||||
if isPVDynamic:
|
||||
v = xrfragment_XRF(key,(xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR))
|
||||
v.validate(key)
|
||||
setattr(store,(("_hx_" + key) if ((key in python_Boot.keywords)) else (("_hx_" + key) if (((((len(key) > 2) and ((ord(key[0]) == 95))) and ((ord(key[1]) == 95))) and ((ord(key[(len(key) - 1)]) != 95)))) else key)),v)
|
||||
|
@ -1701,7 +1703,7 @@ class xrfragment_XRF:
|
|||
__slots__ = ("fragment", "flags", "x", "y", "z", "color", "string", "int", "float", "args", "query")
|
||||
_hx_fields = ["fragment", "flags", "x", "y", "z", "color", "string", "int", "float", "args", "query"]
|
||||
_hx_methods = ["is", "validate", "guessType"]
|
||||
_hx_statics = ["ASSET", "PROP_BIND", "QUERY_OPERATOR", "PROMPT", "ROUNDROBIN", "NAVIGATOR", "EMBEDDED", "PV_OVERRIDE", "PV_EXECUTE", "T_COLOR", "T_INT", "T_FLOAT", "T_VECTOR2", "T_VECTOR3", "T_URL", "T_PREDEFINED_VIEW", "T_STRING", "T_STRING_OBJ", "T_STRING_OBJ_PROP", "isColor", "isInt", "isFloat", "isVector", "isUrl", "isUrlOrPretypedView", "isString", "set", "unset"]
|
||||
_hx_statics = ["ASSET", "PROP_BIND", "QUERY_OPERATOR", "PROMPT", "ROUNDROBIN", "NAVIGATOR", "METADATA", "PV_OVERRIDE", "PV_EXECUTE", "T_COLOR", "T_INT", "T_FLOAT", "T_VECTOR2", "T_VECTOR3", "T_URL", "T_PREDEFINED_VIEW", "T_STRING", "T_STRING_OBJ", "T_STRING_OBJ_PROP", "isColor", "isInt", "isFloat", "isVector", "isUrl", "isUrlOrPretypedView", "isString", "set", "unset"]
|
||||
|
||||
def __init__(self,_fragment,_flags):
|
||||
self.query = None
|
||||
|
@ -1793,7 +1795,7 @@ xrfragment_XRF.QUERY_OPERATOR = 4
|
|||
xrfragment_XRF.PROMPT = 8
|
||||
xrfragment_XRF.ROUNDROBIN = 16
|
||||
xrfragment_XRF.NAVIGATOR = 32
|
||||
xrfragment_XRF.EMBEDDED = 64
|
||||
xrfragment_XRF.METADATA = 64
|
||||
xrfragment_XRF.PV_OVERRIDE = 128
|
||||
xrfragment_XRF.PV_EXECUTE = 256
|
||||
xrfragment_XRF.T_COLOR = 8192
|
||||
|
|
Loading…
Reference in New Issue