added clip, fov & fog fragments
This commit is contained in:
parent
ec5f44324f
commit
47db45d93a
|
@ -233,7 +233,8 @@ xrfragment_Parser.parse = function(key,value,store) {
|
|||
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["fog"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
|
||||
Frag_h["bg"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | 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;
|
||||
|
@ -254,12 +255,12 @@ xrfragment_Parser.parse = function(key,value,store) {
|
|||
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:82:","⚠ fragment '" + key + "' has incompatible value (" + value + ")");
|
||||
console.log("src/xrfragment/Parser.hx:83:","⚠ fragment '" + key + "' has incompatible value (" + value + ")");
|
||||
return false;
|
||||
}
|
||||
store[key] = v;
|
||||
if(xrfragment_Parser.debug) {
|
||||
console.log("src/xrfragment/Parser.hx:86:","✔ " + key + ": " + v.string);
|
||||
console.log("src/xrfragment/Parser.hx:87:","✔ " + key + ": " + v.string);
|
||||
}
|
||||
} else {
|
||||
if(typeof(value) == "string") {
|
||||
|
@ -1024,6 +1025,23 @@ xrf.navigator.pushState = (file,hash) => {
|
|||
if( file == document.location.search.substr(1) ) return // page is in its default state
|
||||
window.history.pushState({},`${file}#${hash}`, document.location.pathname + `?${file}#${hash}` )
|
||||
}
|
||||
xrf.frag.bg = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
console.log("└ bg "+v.x+","+v.y+","+v.z);
|
||||
if( scene.background ) delete scene.background
|
||||
scene.background = new THREE.Color( v.x, v.y, v.z )
|
||||
}
|
||||
xrf.frag.clip = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
if( v.x == 0 ) v.x = 1; // THREE.js .near restriction
|
||||
console.log("└ clip "+v.x+","+v.y);
|
||||
|
||||
camera.near = v.x
|
||||
camera.far = v.y
|
||||
camera.updateProjectionMatrix();
|
||||
}
|
||||
xrf.frag.env = function(v, opts){
|
||||
let { mesh, model, camera, scene, renderer, THREE} = opts
|
||||
let env = mesh.getObjectByName(v.string)
|
||||
|
@ -1035,6 +1053,22 @@ xrf.frag.env = function(v, opts){
|
|||
renderer.toneMappingExposure = 2;
|
||||
console.log(` └ applied image '${v.string}' as environment map`)
|
||||
}
|
||||
xrf.frag.fog = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
console.log("└ fog "+v.x+","+v.y);
|
||||
if( v.x == 0 && v.y == 0 ){
|
||||
if( scene.fog ) delete scene.fog
|
||||
scene.fog = null;
|
||||
}else scene.fog = new THREE.Fog( scene.background, v.x, v.y );
|
||||
}
|
||||
xrf.frag.fov = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
console.log("└ fov "+v.int);
|
||||
camera.fov = v.int;
|
||||
camera.updateProjectionMatrix();
|
||||
}
|
||||
/**
|
||||
*
|
||||
* navigation, portals & mutations
|
||||
|
|
|
@ -233,7 +233,8 @@ xrfragment_Parser.parse = function(key,value,store) {
|
|||
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["fog"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
|
||||
Frag_h["bg"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | 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;
|
||||
|
@ -254,12 +255,12 @@ xrfragment_Parser.parse = function(key,value,store) {
|
|||
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:82:","⚠ fragment '" + key + "' has incompatible value (" + value + ")");
|
||||
console.log("src/xrfragment/Parser.hx:83:","⚠ fragment '" + key + "' has incompatible value (" + value + ")");
|
||||
return false;
|
||||
}
|
||||
store[key] = v;
|
||||
if(xrfragment_Parser.debug) {
|
||||
console.log("src/xrfragment/Parser.hx:86:","✔ " + key + ": " + v.string);
|
||||
console.log("src/xrfragment/Parser.hx:87:","✔ " + key + ": " + v.string);
|
||||
}
|
||||
} else {
|
||||
if(typeof(value) == "string") {
|
||||
|
|
|
@ -1510,12 +1510,18 @@ __xrfragment_Parser.parse = function(key,value,store)
|
|||
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.METADATA);
|
||||
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.fog = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.fog = 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_VECTOR3),__xrfragment_XRF.NAVIGATOR),__xrfragment_XRF.METADATA);
|
||||
if (value1 == nil) then
|
||||
Frag_h.bg = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.bg = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_STRING);
|
||||
if (value1 == nil) then
|
||||
Frag_h.namespace = __haxe_ds_StringMap.tnull;
|
||||
|
@ -1616,12 +1622,12 @@ __xrfragment_Parser.parse = function(key,value,store)
|
|||
local v = __xrfragment_XRF.new(key, ret);
|
||||
if (Frag_h[key] ~= nil) then
|
||||
if (not v:validate(value)) then
|
||||
__haxe_Log.trace(Std.string(Std.string(Std.string(Std.string("⚠ fragment '") .. Std.string(key)) .. Std.string("' has incompatible value (")) .. Std.string(value)) .. Std.string(")"), _hx_o({__fields__={fileName=true,lineNumber=true,className=true,methodName=true},fileName="src/xrfragment/Parser.hx",lineNumber=82,className="xrfragment.Parser",methodName="parse"}));
|
||||
__haxe_Log.trace(Std.string(Std.string(Std.string(Std.string("⚠ fragment '") .. Std.string(key)) .. Std.string("' has incompatible value (")) .. Std.string(value)) .. Std.string(")"), _hx_o({__fields__={fileName=true,lineNumber=true,className=true,methodName=true},fileName="src/xrfragment/Parser.hx",lineNumber=83,className="xrfragment.Parser",methodName="parse"}));
|
||||
do return false end;
|
||||
end;
|
||||
store[key] = v;
|
||||
if (__xrfragment_Parser.debug) then
|
||||
__haxe_Log.trace(Std.string(Std.string(Std.string("✔ ") .. Std.string(key)) .. Std.string(": ")) .. Std.string(v.string), _hx_o({__fields__={fileName=true,lineNumber=true,className=true,methodName=true},fileName="src/xrfragment/Parser.hx",lineNumber=86,className="xrfragment.Parser",methodName="parse"}));
|
||||
__haxe_Log.trace(Std.string(Std.string(Std.string("✔ ") .. Std.string(key)) .. Std.string(": ")) .. Std.string(v.string), _hx_o({__fields__={fileName=true,lineNumber=true,className=true,methodName=true},fileName="src/xrfragment/Parser.hx",lineNumber=87,className="xrfragment.Parser",methodName="parse"}));
|
||||
end;
|
||||
else
|
||||
if (__lua_Boot.__instanceof(value, String)) then
|
||||
|
|
|
@ -233,7 +233,8 @@ xrfragment_Parser.parse = function(key,value,store) {
|
|||
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["fog"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
|
||||
Frag_h["bg"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | 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;
|
||||
|
@ -254,12 +255,12 @@ xrfragment_Parser.parse = function(key,value,store) {
|
|||
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:82:","⚠ fragment '" + key + "' has incompatible value (" + value + ")");
|
||||
console.log("src/xrfragment/Parser.hx:83:","⚠ fragment '" + key + "' has incompatible value (" + value + ")");
|
||||
return false;
|
||||
}
|
||||
store[key] = v;
|
||||
if(xrfragment_Parser.debug) {
|
||||
console.log("src/xrfragment/Parser.hx:86:","✔ " + key + ": " + v.string);
|
||||
console.log("src/xrfragment/Parser.hx:87:","✔ " + key + ": " + v.string);
|
||||
}
|
||||
} else {
|
||||
if(typeof(value) == "string") {
|
||||
|
|
|
@ -1310,7 +1310,8 @@ class xrfragment_Parser:
|
|||
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["fog"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.METADATA)
|
||||
Frag.h["bg"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3) | 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)
|
||||
|
|
|
@ -233,7 +233,8 @@ xrfragment_Parser.parse = function(key,value,store) {
|
|||
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["fog"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
|
||||
Frag_h["bg"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | 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;
|
||||
|
@ -254,12 +255,12 @@ xrfragment_Parser.parse = function(key,value,store) {
|
|||
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:82:","⚠ fragment '" + key + "' has incompatible value (" + value + ")");
|
||||
console.log("src/xrfragment/Parser.hx:83:","⚠ fragment '" + key + "' has incompatible value (" + value + ")");
|
||||
return false;
|
||||
}
|
||||
store[key] = v;
|
||||
if(xrfragment_Parser.debug) {
|
||||
console.log("src/xrfragment/Parser.hx:86:","✔ " + key + ": " + v.string);
|
||||
console.log("src/xrfragment/Parser.hx:87:","✔ " + key + ": " + v.string);
|
||||
}
|
||||
} else {
|
||||
if(typeof(value) == "string") {
|
||||
|
@ -1024,6 +1025,23 @@ xrf.navigator.pushState = (file,hash) => {
|
|||
if( file == document.location.search.substr(1) ) return // page is in its default state
|
||||
window.history.pushState({},`${file}#${hash}`, document.location.pathname + `?${file}#${hash}` )
|
||||
}
|
||||
xrf.frag.bg = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
console.log("└ bg "+v.x+","+v.y+","+v.z);
|
||||
if( scene.background ) delete scene.background
|
||||
scene.background = new THREE.Color( v.x, v.y, v.z )
|
||||
}
|
||||
xrf.frag.clip = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
if( v.x == 0 ) v.x = 1; // THREE.js .near restriction
|
||||
console.log("└ clip "+v.x+","+v.y);
|
||||
|
||||
camera.near = v.x
|
||||
camera.far = v.y
|
||||
camera.updateProjectionMatrix();
|
||||
}
|
||||
xrf.frag.env = function(v, opts){
|
||||
let { mesh, model, camera, scene, renderer, THREE} = opts
|
||||
let env = mesh.getObjectByName(v.string)
|
||||
|
@ -1035,6 +1053,22 @@ xrf.frag.env = function(v, opts){
|
|||
renderer.toneMappingExposure = 2;
|
||||
console.log(` └ applied image '${v.string}' as environment map`)
|
||||
}
|
||||
xrf.frag.fog = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
console.log("└ fog "+v.x+","+v.y);
|
||||
if( v.x == 0 && v.y == 0 ){
|
||||
if( scene.fog ) delete scene.fog
|
||||
scene.fog = null;
|
||||
}else scene.fog = new THREE.Fog( scene.background, v.x, v.y );
|
||||
}
|
||||
xrf.frag.fov = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
console.log("└ fov "+v.int);
|
||||
camera.fov = v.int;
|
||||
camera.updateProjectionMatrix();
|
||||
}
|
||||
/**
|
||||
*
|
||||
* navigation, portals & mutations
|
||||
|
|
|
@ -233,7 +233,8 @@ xrfragment_Parser.parse = function(key,value,store) {
|
|||
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["fog"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
|
||||
Frag_h["bg"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | 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;
|
||||
|
@ -254,12 +255,12 @@ xrfragment_Parser.parse = function(key,value,store) {
|
|||
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:82:","⚠ fragment '" + key + "' has incompatible value (" + value + ")");
|
||||
console.log("src/xrfragment/Parser.hx:83:","⚠ fragment '" + key + "' has incompatible value (" + value + ")");
|
||||
return false;
|
||||
}
|
||||
store[key] = v;
|
||||
if(xrfragment_Parser.debug) {
|
||||
console.log("src/xrfragment/Parser.hx:86:","✔ " + key + ": " + v.string);
|
||||
console.log("src/xrfragment/Parser.hx:87:","✔ " + key + ": " + v.string);
|
||||
}
|
||||
} else {
|
||||
if(typeof(value) == "string") {
|
||||
|
@ -1024,6 +1025,23 @@ xrf.navigator.pushState = (file,hash) => {
|
|||
if( file == document.location.search.substr(1) ) return // page is in its default state
|
||||
window.history.pushState({},`${file}#${hash}`, document.location.pathname + `?${file}#${hash}` )
|
||||
}
|
||||
xrf.frag.bg = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
console.log("└ bg "+v.x+","+v.y+","+v.z);
|
||||
if( scene.background ) delete scene.background
|
||||
scene.background = new THREE.Color( v.x, v.y, v.z )
|
||||
}
|
||||
xrf.frag.clip = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
if( v.x == 0 ) v.x = 1; // THREE.js .near restriction
|
||||
console.log("└ clip "+v.x+","+v.y);
|
||||
|
||||
camera.near = v.x
|
||||
camera.far = v.y
|
||||
camera.updateProjectionMatrix();
|
||||
}
|
||||
xrf.frag.env = function(v, opts){
|
||||
let { mesh, model, camera, scene, renderer, THREE} = opts
|
||||
let env = mesh.getObjectByName(v.string)
|
||||
|
@ -1035,6 +1053,22 @@ xrf.frag.env = function(v, opts){
|
|||
renderer.toneMappingExposure = 2;
|
||||
console.log(` └ applied image '${v.string}' as environment map`)
|
||||
}
|
||||
xrf.frag.fog = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
console.log("└ fog "+v.x+","+v.y);
|
||||
if( v.x == 0 && v.y == 0 ){
|
||||
if( scene.fog ) delete scene.fog
|
||||
scene.fog = null;
|
||||
}else scene.fog = new THREE.Fog( scene.background, v.x, v.y );
|
||||
}
|
||||
xrf.frag.fov = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
console.log("└ fov "+v.int);
|
||||
camera.fov = v.int;
|
||||
camera.updateProjectionMatrix();
|
||||
}
|
||||
/**
|
||||
*
|
||||
* navigation, portals & mutations
|
||||
|
|
File diff suppressed because one or more lines are too long
10
index.html
10
index.html
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,7 @@
|
|||
xrf.frag.bg = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
console.log("└ bg "+v.x+","+v.y+","+v.z);
|
||||
if( scene.background ) delete scene.background
|
||||
scene.background = new THREE.Color( v.x, v.y, v.z )
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
xrf.frag.clip = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
if( v.x == 0 ) v.x = 1; // THREE.js .near restriction
|
||||
console.log("└ clip "+v.x+","+v.y);
|
||||
|
||||
camera.near = v.x
|
||||
camera.far = v.y
|
||||
camera.updateProjectionMatrix();
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
xrf.frag.fog = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
console.log("└ fog "+v.x+","+v.y);
|
||||
if( v.x == 0 && v.y == 0 ){
|
||||
if( scene.fog ) delete scene.fog
|
||||
scene.fog = null;
|
||||
}else scene.fog = new THREE.Fog( scene.background, v.x, v.y );
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
xrf.frag.fov = function(v, opts){
|
||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||
|
||||
console.log("└ fov "+v.int);
|
||||
camera.fov = v.int;
|
||||
camera.updateProjectionMatrix();
|
||||
}
|
|
@ -40,7 +40,8 @@ class Parser {
|
|||
// category: device / viewport settings
|
||||
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 );
|
||||
Frag.set("fog", XRF.ASSET | XRF.PV_OVERRIDE | XRF.T_VECTOR2 | XRF.NAVIGATOR | XRF.METADATA );
|
||||
Frag.set("bg", XRF.ASSET | XRF.PV_OVERRIDE | XRF.T_VECTOR3 | XRF.NAVIGATOR | XRF.METADATA );
|
||||
|
||||
// category: author / metadata
|
||||
Frag.set("namespace", XRF.ASSET | XRF.T_STRING );
|
||||
|
|
|
@ -347,7 +347,8 @@ xrfragment_Parser.parse = function(key,value,store) {
|
|||
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["fog"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
|
||||
Frag_h["bg"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | 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;
|
||||
|
@ -368,12 +369,12 @@ xrfragment_Parser.parse = function(key,value,store) {
|
|||
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:82:","⚠ fragment '" + key + "' has incompatible value (" + value + ")");
|
||||
console.log("src/xrfragment/Parser.hx:83:","⚠ fragment '" + key + "' has incompatible value (" + value + ")");
|
||||
return false;
|
||||
}
|
||||
store[key] = v;
|
||||
if(xrfragment_Parser.debug) {
|
||||
console.log("src/xrfragment/Parser.hx:86:","✔ " + key + ": " + v.string);
|
||||
console.log("src/xrfragment/Parser.hx:87:","✔ " + key + ": " + v.string);
|
||||
}
|
||||
} else {
|
||||
if(typeof(value) == "string") {
|
||||
|
|
|
@ -1427,7 +1427,8 @@ class xrfragment_Parser:
|
|||
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["fog"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.METADATA)
|
||||
Frag.h["bg"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3) | 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)
|
||||
|
@ -1610,8 +1611,8 @@ class xrfragment_Query:
|
|||
fails = 0
|
||||
qualify = 0
|
||||
def _hx_local_2(expr):
|
||||
nonlocal fails
|
||||
nonlocal conds
|
||||
nonlocal fails
|
||||
conds = (conds + 1)
|
||||
fails = (fails + (0 if expr else 1))
|
||||
return expr
|
||||
|
|
Loading…
Reference in New Issue