update documentation
This commit is contained in:
parent
3e602fd6a2
commit
a68ffe12d0
11
make
11
make
|
@ -66,11 +66,12 @@ build_js(){
|
|||
cat dist/xrfragment.js > dist/xrfragment.module.js
|
||||
echo "export default xrfragment;" >> dist/xrfragment.module.js
|
||||
# add THREE
|
||||
cat dist/xrfragment.js \
|
||||
src/3rd/js/*.js \
|
||||
src/3rd/js/three/*.js \
|
||||
src/3rd/js/three/xrmacro/*.js \
|
||||
src/3rd/js/three/xrf/*.js \
|
||||
cat dist/xrfragment.js \
|
||||
src/3rd/js/*.js \
|
||||
src/3rd/js/three/*.js \
|
||||
src/3rd/js/three/xrmacro/*.js \
|
||||
src/3rd/js/three/xrf/*.js \
|
||||
src/3rd/js/three/xrf/dynamic/*.js \
|
||||
src/3rd/js/three/xrf/src/*.js > dist/xrfragment.three.js
|
||||
# add THREE module
|
||||
cat dist/xrfragment.three.js > dist/xrfragment.three.module.js
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
# nativeBuildInputs is usually what you want -- tools you need to run
|
||||
nativeBuildInputs = with pkgs.buildPackages; [
|
||||
|
||||
haxe
|
||||
mmark
|
||||
xml2rfc
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
|
||||
const drawLineToMesh = (frag,scene,mesh) => {
|
||||
let id = frag.string
|
||||
const drawLineToMesh = (opts) => {
|
||||
let {scene,mesh,frag,id} = opts
|
||||
let oldSelection
|
||||
if(!id) return id // important: ignore empty strings
|
||||
// Selection of Interest if predefined_view matches object name
|
||||
if( mesh.visible && mesh.material){
|
||||
xrf.emit('focus',{...opts,frag})
|
||||
|
@ -12,12 +11,12 @@ const drawLineToMesh = (frag,scene,mesh) => {
|
|||
let from = new THREE.Vector3()
|
||||
|
||||
let getCenterPoint = (mesh) => {
|
||||
var geometry = mesh.geometry;
|
||||
geometry.computeBoundingBox();
|
||||
var center = new THREE.Vector3();
|
||||
geometry.boundingBox.getCenter( center );
|
||||
mesh.localToWorld( center );
|
||||
return center;
|
||||
var geometry = mesh.geometry;
|
||||
geometry.computeBoundingBox();
|
||||
var center = new THREE.Vector3();
|
||||
geometry.boundingBox.getCenter( center );
|
||||
mesh.localToWorld( center );
|
||||
return center;
|
||||
}
|
||||
|
||||
xrf.camera.updateMatrixWorld(true); // always keeps me diving into the docs :]
|
||||
|
@ -37,7 +36,6 @@ const drawLineToMesh = (frag,scene,mesh) => {
|
|||
}
|
||||
|
||||
xrf.addEventListener('dynamicKey', (opts) => {
|
||||
console.dir(opts)
|
||||
let {scene,id,match,v} = opts
|
||||
if( !scene ) return
|
||||
let remove = []
|
||||
|
@ -50,7 +48,7 @@ xrf.addEventListener('dynamicKey', (opts) => {
|
|||
remove.map( (n) => scene.remove(n.selection) )
|
||||
// drawlines
|
||||
match.map( (w) => {
|
||||
w.nodes.map( (mesh) => drawLineToMesh( v, scene, mesh ) )
|
||||
w.nodes.map( (mesh) => drawLineToMesh({ ...opts, mesh}) )
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -66,4 +64,3 @@ xrf.addEventListener('render', (opts) => {
|
|||
if( xrf.focusLine.opacity > 0.0 ) xrf.focusLine.opacity -= time*0.2
|
||||
if( xrf.focusLine.opacity < 0.0 ) xrf.focusLine.opacity = 0
|
||||
})
|
||||
|
||||
|
|
|
@ -14,10 +14,11 @@ xrf.frag.updatePredefinedView = (opts) => {
|
|||
for ( let i in frag ) {
|
||||
let v = frag[i]
|
||||
let id = v.string || v.fragment
|
||||
if( id == '#' ) return
|
||||
if( id == '#' || !id ) return
|
||||
let match = xrf.XRWG.match(id)
|
||||
|
||||
if( v.is( xrf.XRF.PV_EXECUTE ) ){
|
||||
console.log("pv_execute")
|
||||
scene.XRF_PV_ORIGIN = v.string
|
||||
// evaluate aliases
|
||||
match.map( (w) => {
|
||||
|
@ -29,6 +30,9 @@ xrf.frag.updatePredefinedView = (opts) => {
|
|||
}
|
||||
})
|
||||
xrf.emit('dynamicKey',{ ...opts,v,frag,id,match,scene })
|
||||
}else{
|
||||
console.log("non pv_execute")
|
||||
xrf.emit('dynamicKeyValue',{ ...opts,v,frag,id,match,scene })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +40,7 @@ xrf.frag.updatePredefinedView = (opts) => {
|
|||
|
||||
// react to enduser typing url
|
||||
xrf.addEventListener('hash', (opts) => {
|
||||
let frag = xrf.URI.parse( opts.hash, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA )
|
||||
let frag = xrf.URI.parse( opts.hash )
|
||||
xrf.frag.updatePredefinedView({frag,scene:xrf.scene})
|
||||
})
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
xrf.addEventListener('dynamicKeyValue', (opts) => {
|
||||
let {scene,match,v} = opts
|
||||
let materialName = v.fragment
|
||||
scene.traverse( (mesh) => {
|
||||
if( mesh.material){
|
||||
if( mesh.material.map && mesh.material.name == materialName ){
|
||||
let mat = mesh.material
|
||||
if( v.x != undefined ){
|
||||
mat.map.offset.x = v.x
|
||||
mat.map.offset.y = v.y
|
||||
mat.map.rotation = v.z
|
||||
}else{
|
||||
let driver = xrf.scene.getObjectByName(v.string)
|
||||
if( !driver ) return
|
||||
xrf.addEventListener('render', (opts) => {
|
||||
let model = xrf.model
|
||||
if( !model || !model.clock ) return
|
||||
mat.map.offset.x = driver.position.x
|
||||
mat.map.offset.y = driver.position.y
|
||||
mat.map.rotation = driver.position.z
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
|
@ -71,10 +71,6 @@ class Parser {
|
|||
store.set(key, v );
|
||||
return true;
|
||||
}
|
||||
if( key.split(".").length > 1 && value.split(".").length > 1 ){
|
||||
store.set(key, new XRF(key, XRF.ASSET | XRF.PV_OVERRIDE | XRF.T_STRING | XRF.PROP_BIND ) );
|
||||
return true;
|
||||
}
|
||||
|
||||
// regular fragments:
|
||||
var v:XRF = new XRF(key, Frag.get(key));
|
||||
|
|
|
@ -359,19 +359,15 @@ xrfragment_Parser.parse = function(key,value,store) {
|
|||
store[key] = v;
|
||||
return true;
|
||||
}
|
||||
if(key.split(".").length > 1 && value.split(".").length > 1) {
|
||||
store[key] = new xrfragment_XRF(key,xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.PROP_BIND);
|
||||
return true;
|
||||
}
|
||||
var v = new xrfragment_XRF(key,Frag_h[key]);
|
||||
if(Object.prototype.hasOwnProperty.call(Frag_h,key)) {
|
||||
if(!v.validate(value)) {
|
||||
console.log("src/xrfragment/Parser.hx:83:","⚠ fragment '" + key + "' has incompatible value (" + value + ")");
|
||||
console.log("src/xrfragment/Parser.hx:79:","⚠ fragment '" + key + "' has incompatible value (" + value + ")");
|
||||
return false;
|
||||
}
|
||||
store[key] = v;
|
||||
if(xrfragment_Parser.debug) {
|
||||
console.log("src/xrfragment/Parser.hx:87:","✔ " + key + ": " + v.string);
|
||||
console.log("src/xrfragment/Parser.hx:83:","✔ " + key + ": " + v.string);
|
||||
}
|
||||
} else {
|
||||
if(typeof(value) == "string") {
|
||||
|
|
|
@ -1436,10 +1436,6 @@ class xrfragment_Parser:
|
|||
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)
|
||||
return True
|
||||
if ((len(key.split(".")) > 1) and ((len(value.split(".")) > 1))):
|
||||
value1 = xrfragment_XRF(key,(((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_STRING) | xrfragment_XRF.PROP_BIND))
|
||||
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)),value1)
|
||||
return True
|
||||
v = xrfragment_XRF(key,Frag.h.get(key,None))
|
||||
if (key in Frag.h):
|
||||
if (not v.validate(value)):
|
||||
|
|
Loading…
Reference in New Issue