diff --git a/dist/xrfragment.three.js b/dist/xrfragment.three.js
index 744f5ba..cd6a83f 100644
--- a/dist/xrfragment.three.js
+++ b/dist/xrfragment.three.js
@@ -597,9 +597,11 @@ xrfragment.three = {}
xrfragment.init = function(opts){
opts = opts || {}
- for ( let i in opts ) xrfragment[i] = opts[i]
+ for ( let i in opts ) xrfragment[i] = opts[i]
+ for ( let i in xrfragment.XRF ) xrfragment[i] = xrfragment.XRF[i] // shortcuts to constants (BROWSER_OVERRIDE e.g.)
xrfragment.Parser.debug = xrfragment.debug
if( opts.loaders ) opts.loaders.map( xrfragment.patchLoader )
+ return xrfragment
}
xrfragment.patchLoader = function(loader){
@@ -620,13 +622,15 @@ xrfragment.parseModel = function(model){
xrfragment.Parser.parse( k, mesh.userData[k], frag )
// call native function (xrf/env.js e.g.), or pass it to user decorator
let func = xrfragment.three[k] || function(){}
- if( xrfragment[k] ) xrfragment[k]( func, frag[k], mesh, model, xrfragment.scene, xrfragment.renderer, xrfragment.THREE )
- else func( frag[k], mesh, model, xrfragment.scene, xrfragment.renderer, xrfragment.THREE )
+ let opts = {mesh, model, camera:xrfragment.camera, scene: xrfragment.scene, renderer: xrfragment.renderer, THREE: xrfragment.THREE }
+ if( xrfragment[k] ) xrfragment[k]( func, frag[k], opts)
+ else func( frag[k], opts)
}
}
})
}
-xrfragment.three.env = function(v, mesh, model, scene, renderer, THREE){
+xrfragment.three.env = function(v, opts){
+ let { mesh, model, camera, scene, renderer, THREE} = opts
let env = mesh.getObjectByName(v.string)
env.material.map.mapping = THREE.EquirectangularReflectionMapping;
scene.environment = env.material.map
@@ -634,4 +638,10 @@ xrfragment.three.env = function(v, mesh, model, scene, renderer, THREE){
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1;
}
+xrfragment.three.pos = function(v, opts){
+ let { mesh, model, camera, scene, renderer, THREE} = opts
+ camera.position.x = v.x
+ camera.position.y = v.y
+ camera.position.z = v.z
+}
export default xrfragment;
diff --git a/example/assets/style.css b/example/assets/style.css
index 841881c..b866b90 100644
--- a/example/assets/style.css
+++ b/example/assets/style.css
@@ -92,5 +92,13 @@ a#source{
.lil-gui.autoPlace{
right:0px !important;
- top:49px !important;
+ top:auto !important;
+ bottom:0;
+}
+
+@media (max-width: 640px) {
+ .lil-gui.root{
+ top:auto !important;
+ left:auto !important;
+ }
}
diff --git a/example/threejs/sandbox/index.html b/example/threejs/sandbox/index.html
index d8356ae..e881bf3 100644
--- a/example/threejs/sandbox/index.html
+++ b/example/threejs/sandbox/index.html
@@ -12,8 +12,8 @@
-
-