THREEjs wip
This commit is contained in:
parent
38623685ef
commit
7f991c6d26
|
@ -216,16 +216,12 @@ var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { };
|
|||
xrfragment_Parser.__name__ = true;
|
||||
xrfragment_Parser.parse = function(key,value,resultMap) {
|
||||
var Frag_h = Object.create(null);
|
||||
Frag_h["prio"] = xrfragment_XRF.ASSET_OBJ | xrfragment_XRF.T_INT;
|
||||
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_OBJ | xrfragment_XRF.T_STRING;
|
||||
Frag_h["src"] = xrfragment_XRF.ASSET_OBJ | xrfragment_XRF.T_URL;
|
||||
Frag_h["src_audio"] = xrfragment_XRF.ASSET_OBJ | xrfragment_XRF.T_URL;
|
||||
Frag_h["src_shader"] = xrfragment_XRF.ASSET_OBJ | xrfragment_XRF.T_URL;
|
||||
Frag_h["src_env"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL;
|
||||
Frag_h["src_env_audio"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL;
|
||||
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;
|
||||
Frag_h["href"] = xrfragment_XRF.ASSET_OBJ | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW;
|
||||
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;
|
||||
Frag_h["scale"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_INT;
|
||||
Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3;
|
||||
|
@ -235,7 +231,6 @@ xrfragment_Parser.parse = function(key,value,resultMap) {
|
|||
Frag_h["gravity"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3;
|
||||
Frag_h["physics"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3;
|
||||
Frag_h["scroll"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING;
|
||||
Frag_h["."] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING;
|
||||
Frag_h["fov"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_INT | xrfragment_XRF.BROWSER_OVERRIDE;
|
||||
Frag_h["clip"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.BROWSER_OVERRIDE;
|
||||
Frag_h["fog"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.BROWSER_OVERRIDE;
|
||||
|
@ -248,15 +243,19 @@ xrfragment_Parser.parse = function(key,value,resultMap) {
|
|||
resultMap[key] = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.BROWSER_OVERRIDE);
|
||||
return true;
|
||||
}
|
||||
if(key.split(".").length > 1 && value.split(".").length > 1) {
|
||||
resultMap[key] = new xrfragment_XRF(key,xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.PROP_BIND);
|
||||
return true;
|
||||
}
|
||||
if(Object.prototype.hasOwnProperty.call(Frag_h,key)) {
|
||||
var v = new xrfragment_XRF(key,Frag_h[key]);
|
||||
if(!v.validate(value)) {
|
||||
console.log("src/xrfragment/Parser.hx:79:","[ i ] fragment '" + key + "' has incompatible value (" + value + ")");
|
||||
console.log("src/xrfragment/Parser.hx:74:","[ i ] fragment '" + key + "' has incompatible value (" + value + ")");
|
||||
return false;
|
||||
}
|
||||
resultMap[key] = v;
|
||||
} else {
|
||||
console.log("src/xrfragment/Parser.hx:83:","[ i ] fragment '" + key + "' does not exist or has no type typed (yet)");
|
||||
console.log("src/xrfragment/Parser.hx:78:","[ i ] fragment '" + key + "' does not exist or has no type typed (yet)");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -557,7 +556,7 @@ Array.__name__ = true;
|
|||
js_Boot.__toStr = ({ }).toString;
|
||||
xrfragment_Parser.error = "";
|
||||
xrfragment_XRF.ASSET = 1;
|
||||
xrfragment_XRF.ASSET_OBJ = 2;
|
||||
xrfragment_XRF.PROP_BIND = 2;
|
||||
xrfragment_XRF.QUERY_OPERATOR = 4;
|
||||
xrfragment_XRF.PROMPT = 8;
|
||||
xrfragment_XRF.ROUNDROBIN = 16;
|
||||
|
|
|
@ -1408,7 +1408,7 @@ _hx_exports["xrfragment"]["Parser"] = __xrfragment_Parser
|
|||
__xrfragment_Parser.__name__ = true
|
||||
__xrfragment_Parser.parse = function(key,value,resultMap)
|
||||
local Frag_h = ({});
|
||||
local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET_OBJ,__xrfragment_XRF.T_INT);
|
||||
local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_INT);
|
||||
if (value1 == nil) then
|
||||
Frag_h.prio = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
|
@ -1420,49 +1420,25 @@ __xrfragment_Parser.parse = function(key,value,resultMap)
|
|||
else
|
||||
Frag_h["#"] = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET_OBJ,__xrfragment_XRF.T_STRING);
|
||||
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(__xrfragment_XRF.ASSET_OBJ,__xrfragment_XRF.T_URL);
|
||||
local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_URL);
|
||||
if (value1 == nil) then
|
||||
Frag_h.src = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.src = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET_OBJ,__xrfragment_XRF.T_URL);
|
||||
if (value1 == nil) then
|
||||
Frag_h.src_audio = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.src_audio = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET_OBJ,__xrfragment_XRF.T_URL);
|
||||
if (value1 == nil) then
|
||||
Frag_h.src_shader = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.src_shader = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_URL);
|
||||
if (value1 == nil) then
|
||||
Frag_h.src_env = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.src_env = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_URL);
|
||||
if (value1 == nil) then
|
||||
Frag_h.src_env_audio = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.src_env_audio = value1;
|
||||
end;
|
||||
local value1 = _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);
|
||||
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_OBJ,__xrfragment_XRF.T_URL),__xrfragment_XRF.T_PREDEFINED_VIEW);
|
||||
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
|
||||
|
@ -1522,12 +1498,6 @@ __xrfragment_Parser.parse = function(key,value,resultMap)
|
|||
else
|
||||
Frag_h.scroll = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_STRING);
|
||||
if (value1 == nil) then
|
||||
Frag_h["."] = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h["."] = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_INT),__xrfragment_XRF.BROWSER_OVERRIDE);
|
||||
if (value1 == nil) then
|
||||
Frag_h.fov = __haxe_ds_StringMap.tnull;
|
||||
|
@ -1581,6 +1551,61 @@ __xrfragment_Parser.parse = function(key,value,resultMap)
|
|||
resultMap[key] = value;
|
||||
do return true end;
|
||||
end;
|
||||
local tmp;
|
||||
local idx = 1;
|
||||
local ret = _hx_tab_array({}, 0);
|
||||
while (idx ~= nil) do
|
||||
local newidx = 0;
|
||||
if (__lua_lib_luautf8_Utf8.len(".") > 0) then
|
||||
newidx = __lua_lib_luautf8_Utf8.find(key, ".", idx, true);
|
||||
else
|
||||
if (idx >= __lua_lib_luautf8_Utf8.len(key)) then
|
||||
newidx = nil;
|
||||
else
|
||||
newidx = idx + 1;
|
||||
end;
|
||||
end;
|
||||
if (newidx ~= nil) then
|
||||
local match = __lua_lib_luautf8_Utf8.sub(key, idx, newidx - 1);
|
||||
ret:push(match);
|
||||
idx = newidx + __lua_lib_luautf8_Utf8.len(".");
|
||||
else
|
||||
ret:push(__lua_lib_luautf8_Utf8.sub(key, idx, __lua_lib_luautf8_Utf8.len(key)));
|
||||
idx = nil;
|
||||
end;
|
||||
end;
|
||||
if (ret.length > 1) then
|
||||
local idx = 1;
|
||||
local ret = _hx_tab_array({}, 0);
|
||||
while (idx ~= nil) do
|
||||
local newidx = 0;
|
||||
if (__lua_lib_luautf8_Utf8.len(".") > 0) then
|
||||
newidx = __lua_lib_luautf8_Utf8.find(value, ".", idx, true);
|
||||
else
|
||||
if (idx >= __lua_lib_luautf8_Utf8.len(value)) then
|
||||
newidx = nil;
|
||||
else
|
||||
newidx = idx + 1;
|
||||
end;
|
||||
end;
|
||||
if (newidx ~= nil) then
|
||||
local match = __lua_lib_luautf8_Utf8.sub(value, idx, newidx - 1);
|
||||
ret:push(match);
|
||||
idx = newidx + __lua_lib_luautf8_Utf8.len(".");
|
||||
else
|
||||
ret:push(__lua_lib_luautf8_Utf8.sub(value, idx, __lua_lib_luautf8_Utf8.len(value)));
|
||||
idx = nil;
|
||||
end;
|
||||
end;
|
||||
tmp = ret.length > 1;
|
||||
else
|
||||
tmp = false;
|
||||
end;
|
||||
if (tmp) then
|
||||
local value = __xrfragment_XRF.new(key, _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_STRING),__xrfragment_XRF.PROP_BIND));
|
||||
resultMap[key] = value;
|
||||
do return true end;
|
||||
end;
|
||||
if (Frag_h[key] ~= nil) then
|
||||
local ret = Frag_h[key];
|
||||
if (ret == __haxe_ds_StringMap.tnull) then
|
||||
|
@ -1588,12 +1613,12 @@ __xrfragment_Parser.parse = function(key,value,resultMap)
|
|||
end;
|
||||
local v = __xrfragment_XRF.new(key, ret);
|
||||
if (not v:validate(value)) then
|
||||
__haxe_Log.trace(Std.string(Std.string(Std.string(Std.string("[ i ] 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=79,className="xrfragment.Parser",methodName="parse"}));
|
||||
__haxe_Log.trace(Std.string(Std.string(Std.string(Std.string("[ i ] 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=74,className="xrfragment.Parser",methodName="parse"}));
|
||||
do return false end;
|
||||
end;
|
||||
resultMap[key] = v;
|
||||
else
|
||||
__haxe_Log.trace(Std.string(Std.string("[ i ] fragment '") .. Std.string(key)) .. Std.string("' does not exist or has no type typed (yet)"), _hx_o({__fields__={fileName=true,lineNumber=true,className=true,methodName=true},fileName="src/xrfragment/Parser.hx",lineNumber=83,className="xrfragment.Parser",methodName="parse"}));
|
||||
__haxe_Log.trace(Std.string(Std.string("[ i ] fragment '") .. Std.string(key)) .. Std.string("' does not exist or has no type typed (yet)"), _hx_o({__fields__={fileName=true,lineNumber=true,className=true,methodName=true},fileName="src/xrfragment/Parser.hx",lineNumber=78,className="xrfragment.Parser",methodName="parse"}));
|
||||
do return false end;
|
||||
end;
|
||||
do return true end;
|
||||
|
@ -2323,7 +2348,7 @@ local _hx_static_init = function()
|
|||
|
||||
__xrfragment_XRF.ASSET = 1;
|
||||
|
||||
__xrfragment_XRF.ASSET_OBJ = 2;
|
||||
__xrfragment_XRF.PROP_BIND = 2;
|
||||
|
||||
__xrfragment_XRF.QUERY_OPERATOR = 4;
|
||||
|
||||
|
|
|
@ -1293,16 +1293,12 @@ class xrfragment_Parser:
|
|||
@staticmethod
|
||||
def parse(key,value,resultMap):
|
||||
Frag = haxe_ds_StringMap()
|
||||
Frag.h["prio"] = (xrfragment_XRF.ASSET_OBJ | xrfragment_XRF.T_INT)
|
||||
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_OBJ | xrfragment_XRF.T_STRING)
|
||||
Frag.h["src"] = (xrfragment_XRF.ASSET_OBJ | xrfragment_XRF.T_URL)
|
||||
Frag.h["src_audio"] = (xrfragment_XRF.ASSET_OBJ | xrfragment_XRF.T_URL)
|
||||
Frag.h["src_shader"] = (xrfragment_XRF.ASSET_OBJ | xrfragment_XRF.T_URL)
|
||||
Frag.h["src_env"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_URL)
|
||||
Frag.h["src_env_audio"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_URL)
|
||||
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)
|
||||
Frag.h["href"] = ((xrfragment_XRF.ASSET_OBJ | xrfragment_XRF.T_URL) | xrfragment_XRF.T_PREDEFINED_VIEW)
|
||||
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)
|
||||
Frag.h["scale"] = (((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_INT)
|
||||
Frag.h["rot"] = (((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3)
|
||||
|
@ -1312,7 +1308,6 @@ class xrfragment_Parser:
|
|||
Frag.h["gravity"] = ((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3)
|
||||
Frag.h["physics"] = ((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3)
|
||||
Frag.h["scroll"] = ((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_STRING)
|
||||
Frag.h["."] = ((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_STRING)
|
||||
Frag.h["fov"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_INT) | xrfragment_XRF.BROWSER_OVERRIDE)
|
||||
Frag.h["clip"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.BROWSER_OVERRIDE)
|
||||
Frag.h["fog"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_STRING) | xrfragment_XRF.BROWSER_OVERRIDE)
|
||||
|
@ -1325,6 +1320,10 @@ class xrfragment_Parser:
|
|||
value1 = xrfragment_XRF(key,(xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.BROWSER_OVERRIDE))
|
||||
setattr(resultMap,(("_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
|
||||
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(resultMap,(("_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
|
||||
if (key in Frag.h):
|
||||
v = xrfragment_XRF(key,Frag.h.get(key,None))
|
||||
if (not v.validate(value)):
|
||||
|
@ -1564,7 +1563,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", "ASSET_OBJ", "QUERY_OPERATOR", "PROMPT", "ROUNDROBIN", "BROWSER_OVERRIDE", "PV_OVERRIDE", "PV_EXECUTE", "T_INT", "T_VECTOR2", "T_VECTOR3", "T_URL", "T_PREDEFINED_VIEW", "T_STRING", "T_STRING_OBJ", "isColor", "isInt", "isFloat"]
|
||||
_hx_statics = ["ASSET", "PROP_BIND", "QUERY_OPERATOR", "PROMPT", "ROUNDROBIN", "BROWSER_OVERRIDE", "PV_OVERRIDE", "PV_EXECUTE", "T_INT", "T_VECTOR2", "T_VECTOR3", "T_URL", "T_PREDEFINED_VIEW", "T_STRING", "T_STRING_OBJ", "isColor", "isInt", "isFloat"]
|
||||
|
||||
def __init__(self,_fragment,_flags):
|
||||
self.query = None
|
||||
|
@ -1641,7 +1640,7 @@ python_Boot.keywords = set(["and", "del", "from", "not", "with", "as", "elif", "
|
|||
python_Boot.prefixLength = len("_hx_")
|
||||
xrfragment_Parser.error = ""
|
||||
xrfragment_XRF.ASSET = 1
|
||||
xrfragment_XRF.ASSET_OBJ = 2
|
||||
xrfragment_XRF.PROP_BIND = 2
|
||||
xrfragment_XRF.QUERY_OPERATOR = 4
|
||||
xrfragment_XRF.PROMPT = 8
|
||||
xrfragment_XRF.ROUNDROBIN = 16
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,233 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>three.js vr - sandbox</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
|
||||
<link type="text/css" rel="stylesheet" href="main.css">
|
||||
<script src="./../../dist/xrfragment.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Import maps polyfill -->
|
||||
<!-- Remove this when import maps will be widely supported -->
|
||||
<script async src="https://unpkg.com/es-module-shims@1.6.3/dist/es-module-shims.js"></script>
|
||||
<script type="importmap">
|
||||
{
|
||||
"imports": {
|
||||
"three": "https://unpkg.com/three@0.151.3/build/three.module.js",
|
||||
"three/addons/": "https://unpkg.com/three@0.151.3/examples/jsm/"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<script type="module">
|
||||
import * as THREE from 'three';
|
||||
|
||||
import { RGBELoader } from 'three/addons/loaders/RGBELoader.js';
|
||||
import { Lensflare, LensflareElement } from 'three/addons/objects/Lensflare.js';
|
||||
import { BoxLineGeometry } from 'three/addons/geometries/BoxLineGeometry.js';
|
||||
import { Reflector } from 'three/addons/objects/Reflector.js';
|
||||
import { VRButton } from 'three/addons/webxr/VRButton.js';
|
||||
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
|
||||
import { HTMLMesh } from 'three/addons/interactive/HTMLMesh.js';
|
||||
import { InteractiveGroup } from 'three/addons/interactive/InteractiveGroup.js';
|
||||
import { XRControllerModelFactory } from 'three/addons/webxr/XRControllerModelFactory.js';
|
||||
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
|
||||
import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
|
||||
import Stats from 'three/addons/libs/stats.module.js';
|
||||
|
||||
let camera, scene, renderer, controls;
|
||||
let reflector;
|
||||
let stats, statsMesh;
|
||||
|
||||
const parameters = {
|
||||
scale: 0.3,
|
||||
};
|
||||
|
||||
init();
|
||||
animate();
|
||||
|
||||
function init() {
|
||||
|
||||
scene = new THREE.Scene();
|
||||
|
||||
camera = new THREE.PerspectiveCamera( 50, window.innerWidth / window.innerHeight, 0.1, 10 );
|
||||
|
||||
let room = new THREE.LineSegments(
|
||||
new BoxLineGeometry( 6, 6, 6, 10, 10, 10 ).translate( 0, 3, 0 ),
|
||||
new THREE.LineBasicMaterial( { color: 0x202020 } )
|
||||
);
|
||||
scene.add( room );
|
||||
|
||||
let floor = new THREE.Mesh(
|
||||
new THREE.PlaneGeometry( 4.8, 4.8, 2, 2 ).rotateX( - Math.PI / 2 ),
|
||||
new THREE.MeshBasicMaterial( { color: 0x404040, transparent: true, opacity: 0.25 } )
|
||||
);
|
||||
scene.add( floor );
|
||||
|
||||
let model;
|
||||
const loader = new GLTFLoader().setPath( './../assets/')
|
||||
loader.load( 'example1.gltf', function ( gltf ) {
|
||||
gltf.scene.position.y = 1.5
|
||||
gltf.scene.position.z = -1
|
||||
gltf.scene.scale.x = gltf.scene.scale.y = gltf.scene.scale.z = parameters.scale
|
||||
|
||||
const maxAnisotropy = renderer.capabilities.getMaxAnisotropy();
|
||||
function recursivelySetChildrenUnlit(mesh,cb) {
|
||||
cb(mesh)
|
||||
if (mesh.children) {
|
||||
for (var i = 0; i < mesh.children.length; i++) {
|
||||
recursivelySetChildrenUnlit(mesh.children[i],cb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let XRF = xrfragment;
|
||||
// turn unlit
|
||||
gltf.scene.traverse( (mesh) => {
|
||||
if( mesh.userData ){
|
||||
let frag = {}
|
||||
for( let k in mesh.userData ) XRF.Parser.parse( k, mesh.userData[k], frag )
|
||||
if( Object.keys(frag).length > 0 ) console.dir(frag)
|
||||
}
|
||||
if (mesh instanceof THREE.Mesh) {
|
||||
if (mesh.material && mesh.material.map) {
|
||||
mesh.material = new THREE.MeshBasicMaterial({ map: mesh.material.map });
|
||||
mesh.material.dithering = true
|
||||
mesh.material.map.anisotropy = maxAnisotropy;
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
scene.add( model = gltf.scene );
|
||||
|
||||
render();
|
||||
|
||||
});
|
||||
|
||||
//const torusGeometry = new THREE.TorusKnotGeometry( ...Object.values( parameters ) );
|
||||
|
||||
renderer = new THREE.WebGLRenderer( { antialias: true } );
|
||||
renderer.autoClear = false;
|
||||
renderer.setPixelRatio( window.devicePixelRatio );
|
||||
renderer.setSize( window.innerWidth, window.innerHeight );
|
||||
renderer.xr.enabled = true;
|
||||
document.body.appendChild( renderer.domElement );
|
||||
|
||||
document.body.appendChild( VRButton.createButton( renderer ) );
|
||||
|
||||
window.addEventListener( 'resize', onWindowResize );
|
||||
|
||||
// setup mouse controls
|
||||
controls = new OrbitControls( camera, renderer.domElement );
|
||||
controls.listenToKeyEvents( window ); // optional
|
||||
controls.enableDamping = true; // an animation loop is required when either damping or auto-rotation are enabled
|
||||
controls.dampingFactor = 0.1;
|
||||
|
||||
controls.screenSpacePanning = false;
|
||||
|
||||
controls.minDistance = 1;
|
||||
controls.maxDistance = 5000;
|
||||
controls.maxPolarAngle = Math.PI / 2;
|
||||
controls.target = new THREE.Vector3(0,1.6,0)
|
||||
|
||||
camera.position.set( 0, 1.6, 1.5 );
|
||||
controls.update()
|
||||
|
||||
const geometry = new THREE.BufferGeometry();
|
||||
geometry.setFromPoints( [ new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 0, 0, - 5 ) ] );
|
||||
|
||||
const controller1 = renderer.xr.getController( 0 );
|
||||
controller1.add( new THREE.Line( geometry ) );
|
||||
scene.add( controller1 );
|
||||
|
||||
const controller2 = renderer.xr.getController( 1 );
|
||||
controller2.add( new THREE.Line( geometry ) );
|
||||
scene.add( controller2 );
|
||||
|
||||
|
||||
const controllerModelFactory = new XRControllerModelFactory();
|
||||
|
||||
const controllerGrip1 = renderer.xr.getControllerGrip( 0 );
|
||||
controllerGrip1.add( controllerModelFactory.createControllerModel( controllerGrip1 ) );
|
||||
scene.add( controllerGrip1 );
|
||||
|
||||
const controllerGrip2 = renderer.xr.getControllerGrip( 1 );
|
||||
controllerGrip2.add( controllerModelFactory.createControllerModel( controllerGrip2 ) );
|
||||
scene.add( controllerGrip2 );
|
||||
|
||||
// GUI
|
||||
|
||||
function onChange() {
|
||||
model.scale.x = model.scale.y = model.scale.z = parameters.scale;
|
||||
}
|
||||
|
||||
function onThicknessChange() {
|
||||
}
|
||||
|
||||
const gui = new GUI( { width: 300 } );
|
||||
gui.add( parameters, 'scale', 0.0, 1.0, parameters.scale ).onChange( onChange );
|
||||
gui.domElement.style.visibility = 'hidden';
|
||||
|
||||
const group = new InteractiveGroup( renderer, camera );
|
||||
scene.add( group );
|
||||
|
||||
const mesh = new HTMLMesh( gui.domElement );
|
||||
mesh.position.x = - 0.75;
|
||||
mesh.position.y = 1.5;
|
||||
mesh.position.z = - 0.5;
|
||||
mesh.rotation.y = Math.PI / 4;
|
||||
mesh.scale.setScalar( 2 );
|
||||
group.add( mesh );
|
||||
|
||||
|
||||
// Add stats.js
|
||||
stats = new Stats();
|
||||
stats.dom.style.width = '80px';
|
||||
stats.dom.style.height = '48px';
|
||||
document.body.appendChild( stats.dom );
|
||||
|
||||
statsMesh = new HTMLMesh( stats.dom );
|
||||
statsMesh.position.x = - 0.75;
|
||||
statsMesh.position.y = 2;
|
||||
statsMesh.position.z = - 0.6;
|
||||
statsMesh.rotation.y = Math.PI / 4;
|
||||
statsMesh.scale.setScalar( 2.5 );
|
||||
group.add( statsMesh );
|
||||
|
||||
}
|
||||
|
||||
function onWindowResize() {
|
||||
|
||||
camera.aspect = window.innerWidth / window.innerHeight;
|
||||
camera.updateProjectionMatrix();
|
||||
|
||||
renderer.setSize( window.innerWidth, window.innerHeight );
|
||||
|
||||
}
|
||||
|
||||
function animate() {
|
||||
|
||||
renderer.setAnimationLoop( render );
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
const time = performance.now() * 0.0002;
|
||||
//const torus = scene.getObjectByName( 'torus' );
|
||||
//torus.rotation.x = time * 0.4;
|
||||
//torus.rotation.y = time;
|
||||
|
||||
controls.update()
|
||||
renderer.render( scene, camera );
|
||||
stats.update();
|
||||
|
||||
// Canvas elements doesn't trigger DOM updates, so we have to update the texture
|
||||
statsMesh.material.map.update();
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,91 @@
|
|||
body {
|
||||
margin: 0;
|
||||
background-color: #000;
|
||||
color: #fff;
|
||||
font-family: Monospace;
|
||||
font-size: 13px;
|
||||
line-height: 24px;
|
||||
overscroll-behavior: none;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #ff0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
button {
|
||||
cursor: pointer;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
#info {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
box-sizing: border-box;
|
||||
text-align: center;
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
pointer-events: none;
|
||||
z-index: 1; /* TODO Solve this in HTML */
|
||||
}
|
||||
|
||||
a, button, input, select {
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.lil-gui {
|
||||
z-index: 2 !important; /* TODO Solve this in HTML */
|
||||
}
|
||||
|
||||
@media all and ( max-width: 640px ) {
|
||||
.lil-gui.root {
|
||||
right: auto;
|
||||
top: auto;
|
||||
max-height: 50%;
|
||||
max-width: 80%;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
#overlay {
|
||||
position: absolute;
|
||||
font-size: 16px;
|
||||
z-index: 2;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
background: rgba(0,0,0,0.7);
|
||||
}
|
||||
|
||||
#overlay button {
|
||||
background: transparent;
|
||||
border: 0;
|
||||
border: 1px solid rgb(255, 255, 255);
|
||||
border-radius: 4px;
|
||||
color: #ffffff;
|
||||
padding: 12px 18px;
|
||||
text-transform: uppercase;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#notSupported {
|
||||
width: 50%;
|
||||
margin: auto;
|
||||
background-color: #f00;
|
||||
margin-top: 20px;
|
||||
padding: 10px;
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
[[ ! -f cert.pem ]] && openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem
|
||||
http-server -c-1 -S -C cert.pem .
|
|
@ -37,6 +37,8 @@ class Test {
|
|||
if( item.expect.fn == "testParsed" ) valid = item.expect.out == res.exists(item.expect.input);
|
||||
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 == "testBrowserOverride" ) valid = item.expect.out == (URI.parse(item.data,true)).exists(item.expect.input);
|
||||
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,true)).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);
|
||||
|
|
|
@ -8,5 +8,7 @@
|
|||
{"fn":"url","data":"http://foo.com?foo=1#q=-bar", "expect":{ "fn":"testBrowserOverride", "input":"q","out":false},"label":"browser URI cannot override q (defined in asset)"},
|
||||
{"fn":"url","data":"http://foo.com?foo=1#mypredefinedview", "expect":{ "fn":"testPredefinedView", "input":"mypredefinedview","out":true},"label":"test predefined view executed"},
|
||||
{"fn":"url","data":"http://foo.com?foo=1#mypredefinedview&another", "expect":{ "fn":"testPredefinedView", "input":"another","out":true},"label":"test predefined view executed (multiple)"},
|
||||
{"fn":"url","data":"http://foo.com?foo=1#mypredefinedview&another", "expect":{ "fn":"testPredefinedView", "input":"mypredefinedview","out":true},"label":"test predefined view executed (multiple)"}
|
||||
{"fn":"url","data":"http://foo.com?foo=1#mypredefinedview&another", "expect":{ "fn":"testPredefinedView", "input":"mypredefinedview","out":true},"label":"test predefined view executed (multiple)"},
|
||||
{"fn":"url","data":"#cube.position.x=music.position.x", "expect":{ "fn":"testPropertyAssign", "input":"cube.position.x","out":true},"label":"test data assign"},
|
||||
{"fn":"url","data":"#cube.position.x=@music.position.x", "expect":{ "fn":"testPropertyAssign", "input":"cube.position.x","out":true},"label":"test one-way data bind"}
|
||||
]
|
||||
|
|
|
@ -14,18 +14,14 @@ class Parser {
|
|||
var Frag:Map<String, Int> = new Map<String, Int>();
|
||||
|
||||
// category: asset loading linking
|
||||
Frag.set("prio", XRF.ASSET_OBJ | XRF.T_INT );
|
||||
Frag.set("prio", XRF.ASSET | XRF.T_INT );
|
||||
Frag.set("#", XRF.ASSET | XRF.T_PREDEFINED_VIEW );
|
||||
Frag.set("class", XRF.ASSET_OBJ | XRF.T_STRING );
|
||||
Frag.set("src", XRF.ASSET_OBJ | XRF.T_URL );
|
||||
Frag.set("src_audio", XRF.ASSET_OBJ | XRF.T_URL );
|
||||
Frag.set("src_shader", XRF.ASSET_OBJ | XRF.T_URL );
|
||||
Frag.set("src_env", XRF.ASSET | XRF.T_URL );
|
||||
Frag.set("src_env_audio", XRF.ASSET | XRF.T_URL );
|
||||
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 );
|
||||
Frag.set("href", XRF.ASSET_OBJ | XRF.T_URL | XRF.T_PREDEFINED_VIEW );
|
||||
Frag.set("href", XRF.ASSET | XRF.T_URL | XRF.T_PREDEFINED_VIEW );
|
||||
|
||||
// category: query selector | object manipulation
|
||||
Frag.set("q", XRF.PV_OVERRIDE | XRF.T_STRING );
|
||||
|
@ -39,7 +35,6 @@ class Parser {
|
|||
Frag.set("gravity", XRF.ASSET | XRF.PV_OVERRIDE | XRF.T_VECTOR3 );
|
||||
Frag.set("physics", XRF.ASSET | XRF.PV_OVERRIDE | XRF.T_VECTOR3 );
|
||||
Frag.set("scroll", XRF.ASSET | XRF.PV_OVERRIDE | XRF.T_STRING );
|
||||
Frag.set(".", XRF.ASSET | XRF.PV_OVERRIDE | XRF.T_STRING );
|
||||
|
||||
// category: device / viewport settings
|
||||
Frag.set("fov", XRF.ASSET | XRF.PV_OVERRIDE | XRF.T_INT | XRF.BROWSER_OVERRIDE );
|
||||
|
@ -62,15 +57,15 @@ class Parser {
|
|||
* the gist of it:
|
||||
*/
|
||||
|
||||
// special cases: predefined views & assign/binds
|
||||
// dynamic fragments cases: predefined views & assign/binds
|
||||
if( value.length == 0 && !Frag.exists(key) ){
|
||||
resultMap.set(key, new XRF(key, XRF.PV_EXECUTE | XRF.BROWSER_OVERRIDE ) );
|
||||
return true;
|
||||
}
|
||||
//if( key.split(".").length > 1 && value.split(".").length > 1 ){
|
||||
// resultMap.set(key, new XRF(key, T_STRING_OBJ_PROP ) );
|
||||
// return true;
|
||||
//}
|
||||
if( key.split(".").length > 1 && value.split(".").length > 1 ){
|
||||
resultMap.set(key, new XRF(key, XRF.ASSET | XRF.PV_OVERRIDE | XRF.T_STRING | XRF.PROP_BIND ) );
|
||||
return true;
|
||||
}
|
||||
|
||||
// regular fragments:
|
||||
if( Frag.exists(key) ){ // 1. check if param exist
|
||||
|
|
|
@ -9,8 +9,8 @@ class XRF {
|
|||
// public static inline readonly ASSET
|
||||
|
||||
// scope types (powers of 2)
|
||||
public static var ASSET:Int = 1; // fragment is immutable (typed in asset) globally
|
||||
public static var ASSET_OBJ:Int = 2; // fragment is immutable (typed in object in asset)
|
||||
public static var ASSET:Int = 1; // fragment is immutable
|
||||
public static var PROP_BIND:Int = 2; // fragment binds/controls one property with another
|
||||
public static var QUERY_OPERATOR:Int = 4; // fragment will be applied to result of queryselecto
|
||||
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
|
||||
|
|
|
@ -136,7 +136,7 @@ StringTools.replace = function(s,sub,by) {
|
|||
var Test = function() { };
|
||||
Test.__name__ = true;
|
||||
Test.main = function() {
|
||||
Test.test([{ fn : "url", expect : { fn : "equal.xyz", input : "pos", out : false}, label : "equal.xyz: should trigger incompatible type)", data : "http://foo.com?foo=1#pos=1.2,2.2"},{ fn : "url", expect : { fn : "equal.xyz", input : "pos", out : "1.2,2.2,3"}, label : "equal.xyz", data : "http://foo.com?foo=1#pos=1.2,2.2,3"},{ fn : "url", expect : { fn : "equal.xy", input : "t", out : "1,100"}, label : "a equal.xy", data : "http://foo.com?foo=1#t=1,100"},{ fn : "url", expect : { fn : "testParsed", input : "prio", out : false}, label : "should trigger incompatible type", data : "http://foo.com?foo=1#prio=foo"},{ fn : "url", expect : { fn : "equal.multi", input : "pos", out : "c|d|1,2,3"}, label : "b equal.multi", data : "http://foo.com?foo=1#pos=c|d|1,2,3"},{ fn : "url", expect : { fn : "testBrowserOverride", input : "t", out : true}, label : "browser URI can override t (defined in asset)", data : "http://foo.com?foo=1#t=2,500"},{ fn : "url", expect : { fn : "testBrowserOverride", input : "q", out : false}, label : "browser URI cannot override q (defined in asset)", data : "http://foo.com?foo=1#q=-bar"},{ fn : "url", expect : { fn : "testPredefinedView", input : "mypredefinedview", out : true}, label : "test predefined view executed", data : "http://foo.com?foo=1#mypredefinedview"},{ fn : "url", expect : { fn : "testPredefinedView", input : "another", out : true}, label : "test predefined view executed (multiple)", data : "http://foo.com?foo=1#mypredefinedview&another"},{ fn : "url", expect : { fn : "testPredefinedView", input : "mypredefinedview", out : true}, label : "test predefined view executed (multiple)", data : "http://foo.com?foo=1#mypredefinedview&another"}]);
|
||||
Test.test([{ fn : "url", expect : { fn : "equal.xyz", input : "pos", out : false}, label : "equal.xyz: should trigger incompatible type)", data : "http://foo.com?foo=1#pos=1.2,2.2"},{ fn : "url", expect : { fn : "equal.xyz", input : "pos", out : "1.2,2.2,3"}, label : "equal.xyz", data : "http://foo.com?foo=1#pos=1.2,2.2,3"},{ fn : "url", expect : { fn : "equal.xy", input : "t", out : "1,100"}, label : "a equal.xy", data : "http://foo.com?foo=1#t=1,100"},{ fn : "url", expect : { fn : "testParsed", input : "prio", out : false}, label : "should trigger incompatible type", data : "http://foo.com?foo=1#prio=foo"},{ fn : "url", expect : { fn : "equal.multi", input : "pos", out : "c|d|1,2,3"}, label : "b equal.multi", data : "http://foo.com?foo=1#pos=c|d|1,2,3"},{ fn : "url", expect : { fn : "testBrowserOverride", input : "t", out : true}, label : "browser URI can override t (defined in asset)", data : "http://foo.com?foo=1#t=2,500"},{ fn : "url", expect : { fn : "testBrowserOverride", input : "q", out : false}, label : "browser URI cannot override q (defined in asset)", data : "http://foo.com?foo=1#q=-bar"},{ fn : "url", expect : { fn : "testPredefinedView", input : "mypredefinedview", out : true}, label : "test predefined view executed", data : "http://foo.com?foo=1#mypredefinedview"},{ fn : "url", expect : { fn : "testPredefinedView", input : "another", out : true}, label : "test predefined view executed (multiple)", data : "http://foo.com?foo=1#mypredefinedview&another"},{ fn : "url", expect : { fn : "testPredefinedView", input : "mypredefinedview", out : true}, label : "test predefined view executed (multiple)", data : "http://foo.com?foo=1#mypredefinedview&another"},{ fn : "url", expect : { fn : "testPropertyAssign", input : "cube.position.x", out : true}, label : "test data assign", data : "#cube.position.x=music.position.x"},{ fn : "url", expect : { fn : "testPropertyAssign", input : "cube.position.x", out : true}, label : "test one-way data bind", data : "#cube.position.x=@music.position.x"}]);
|
||||
Test.test([{ fn : "query", expect : { fn : "testProperty", input : ["class","bar"], out : true}, data : "class:bar"},{ fn : "query", expect : { fn : "testProperty", input : ["class","bar"], out : true}, label : ".bar shorthand", data : ".bar"},{ fn : "query", expect : { fn : "testProperty", input : ["class","foo"], out : false}, data : ".bar -.foo"},{ fn : "query", expect : { fn : "testProperty", input : ["class","foo"], out : true}, data : ".bar -.foo .foo"},{ fn : "query", expect : { fn : "testProperty", input : ["class","bar"], out : true}, data : ".bar -.bar .bar"},{ fn : "query", expect : { fn : "testProperty", input : ["class","foo"], out : true}, label : "class:foo", data : ".foo -.foo .foo"},{ fn : "query", expect : { fn : "testProperty", input : ["class","foo"], out : true}, label : "class:foo", data : ".foo -.foo bar:5 .foo"},{ fn : "query", expect : { fn : "testProperty", input : ["class","foo"], out : true}, label : "class:foo", data : ".foo -.foo bar:>5 .foo"},{ fn : "query", expect : { fn : "testProperty", input : ["class","foo"], out : true}, label : "class:foo", data : ".foo -.foo bar:>5 .foo"},{ fn : "query", expect : { fn : "testProperty", input : ["class","foo"], out : true}, label : "class:foo", data : ".foo -.foo .foo"},{ fn : "query", expect : { fn : "testProperty", input : ["id","foo"], out : false}, label : "!id:foo", data : ".foo -.foo .foo"},{ fn : "query", expect : { fn : "testProperty", input : ["id","foo"], out : true}, label : "id:foo?", data : "foo -foo foo"}]);
|
||||
Test.test([{ fn : "query", expect : { fn : "testProperty", input : ["price","10"], out : true}, data : "price:>=5"},{ fn : "query", expect : { fn : "testProperty", input : ["price","10"], out : false}, data : "price:>=15"},{ fn : "query", expect : { fn : "testProperty", input : ["price","4"], out : false}, data : "price:>=5"},{ fn : "query", expect : { fn : "testProperty", input : ["price","0"], out : false}, data : "price:>=5"},{ fn : "query", expect : { fn : "testProperty", input : ["price","1"], out : false}, label : "price=1", data : "price:>=5 price:0"},{ fn : "query", expect : { fn : "testProperty", input : ["price","0"], out : true}, label : "price=0", data : "price:>=5 price:0"},{ fn : "query", expect : { fn : "testProperty", input : ["price","6"], out : true}, label : "price=6", data : "price:>=5 price:0"},{ fn : "query", expect : { fn : "testProperty", input : ["tag","foo"], out : true}, data : "tag:foo"},{ fn : "query", expect : { fn : "testProperty", input : ["tag","foo"], out : false}, data : "-tag:foo"},{ fn : "query", expect : { fn : "testPropertyExclude", input : ["tag","foo"], out : true}, label : "testExclude", data : "-tag:foo"},{ fn : "query", expect : { fn : "test", input : [{ price : 5}], out : true}, data : ".foo price:5 -tag:foo"},{ fn : "query", expect : { fn : "test", input : [{ tag : "foo", price : 5}], out : false}, data : ".foo price:5 -tag:foo"}]);
|
||||
if(Test.errors > 1) {
|
||||
|
@ -179,6 +179,14 @@ Test.test = function(spec) {
|
|||
var this1 = xrfragment_URI.parse(item.data,true);
|
||||
valid = item1 == Object.prototype.hasOwnProperty.call(this1,item.expect.input);
|
||||
}
|
||||
if(item.expect.fn == "testPropertyAssign") {
|
||||
valid = Object.prototype.hasOwnProperty.call(res,item.expect.input) && item.expect.out == res[item.expect.input].is(xrfragment_XRF.PROP_BIND);
|
||||
}
|
||||
if(item.expect.fn == "testBrowserOverride") {
|
||||
var item2 = item.expect.out;
|
||||
var this2 = xrfragment_URI.parse(item.data,true);
|
||||
valid = item2 == Object.prototype.hasOwnProperty.call(this2,item.expect.input);
|
||||
}
|
||||
if(item.expect.fn == "equal.string") {
|
||||
valid = res[item.expect.input] && item.expect.out == res[item.expect.input].string;
|
||||
}
|
||||
|
@ -192,7 +200,7 @@ Test.test = function(spec) {
|
|||
valid = Test.equalMulti(res,item);
|
||||
}
|
||||
var ok = valid ? "[ ✔ ] " : "[ ❌] ";
|
||||
console.log("src/Test.hx:45:",ok + Std.string(item.fn) + ": '" + Std.string(item.data) + "'" + (item.label ? " (" + (item.label ? item.label : item.expect.fn) + ")" : ""));
|
||||
console.log("src/Test.hx:47:",ok + Std.string(item.fn) + ": '" + Std.string(item.data) + "'" + (item.label ? " (" + (item.label ? item.label : item.expect.fn) + ")" : ""));
|
||||
if(!valid) {
|
||||
Test.errors += 1;
|
||||
}
|
||||
|
@ -318,16 +326,12 @@ var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { };
|
|||
xrfragment_Parser.__name__ = true;
|
||||
xrfragment_Parser.parse = function(key,value,resultMap) {
|
||||
var Frag_h = Object.create(null);
|
||||
Frag_h["prio"] = xrfragment_XRF.ASSET_OBJ | xrfragment_XRF.T_INT;
|
||||
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_OBJ | xrfragment_XRF.T_STRING;
|
||||
Frag_h["src"] = xrfragment_XRF.ASSET_OBJ | xrfragment_XRF.T_URL;
|
||||
Frag_h["src_audio"] = xrfragment_XRF.ASSET_OBJ | xrfragment_XRF.T_URL;
|
||||
Frag_h["src_shader"] = xrfragment_XRF.ASSET_OBJ | xrfragment_XRF.T_URL;
|
||||
Frag_h["src_env"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL;
|
||||
Frag_h["src_env_audio"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL;
|
||||
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;
|
||||
Frag_h["href"] = xrfragment_XRF.ASSET_OBJ | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW;
|
||||
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;
|
||||
Frag_h["scale"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_INT;
|
||||
Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3;
|
||||
|
@ -337,7 +341,6 @@ xrfragment_Parser.parse = function(key,value,resultMap) {
|
|||
Frag_h["gravity"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3;
|
||||
Frag_h["physics"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3;
|
||||
Frag_h["scroll"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING;
|
||||
Frag_h["."] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING;
|
||||
Frag_h["fov"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_INT | xrfragment_XRF.BROWSER_OVERRIDE;
|
||||
Frag_h["clip"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.BROWSER_OVERRIDE;
|
||||
Frag_h["fog"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.BROWSER_OVERRIDE;
|
||||
|
@ -350,15 +353,19 @@ xrfragment_Parser.parse = function(key,value,resultMap) {
|
|||
resultMap[key] = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.BROWSER_OVERRIDE);
|
||||
return true;
|
||||
}
|
||||
if(key.split(".").length > 1 && value.split(".").length > 1) {
|
||||
resultMap[key] = new xrfragment_XRF(key,xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.PROP_BIND);
|
||||
return true;
|
||||
}
|
||||
if(Object.prototype.hasOwnProperty.call(Frag_h,key)) {
|
||||
var v = new xrfragment_XRF(key,Frag_h[key]);
|
||||
if(!v.validate(value)) {
|
||||
console.log("src/xrfragment/Parser.hx:79:","[ i ] fragment '" + key + "' has incompatible value (" + value + ")");
|
||||
console.log("src/xrfragment/Parser.hx:74:","[ i ] fragment '" + key + "' has incompatible value (" + value + ")");
|
||||
return false;
|
||||
}
|
||||
resultMap[key] = v;
|
||||
} else {
|
||||
console.log("src/xrfragment/Parser.hx:83:","[ i ] fragment '" + key + "' does not exist or has no type typed (yet)");
|
||||
console.log("src/xrfragment/Parser.hx:78:","[ i ] fragment '" + key + "' does not exist or has no type typed (yet)");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -660,7 +667,7 @@ js_Boot.__toStr = ({ }).toString;
|
|||
Test.errors = 0;
|
||||
xrfragment_Parser.error = "";
|
||||
xrfragment_XRF.ASSET = 1;
|
||||
xrfragment_XRF.ASSET_OBJ = 2;
|
||||
xrfragment_XRF.PROP_BIND = 2;
|
||||
xrfragment_XRF.QUERY_OPERATOR = 4;
|
||||
xrfragment_XRF.PROMPT = 8;
|
||||
xrfragment_XRF.ROUNDROBIN = 16;
|
||||
|
|
|
@ -390,7 +390,7 @@ class Test:
|
|||
|
||||
@staticmethod
|
||||
def main():
|
||||
Test.test([_hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "equal.xyz", 'input': "pos", 'out': False}), 'label': "equal.xyz: should trigger incompatible type)", 'data': "http://foo.com?foo=1#pos=1.2,2.2"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "equal.xyz", 'input': "pos", 'out': "1.2,2.2,3"}), 'label': "equal.xyz", 'data': "http://foo.com?foo=1#pos=1.2,2.2,3"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "equal.xy", 'input': "t", 'out': "1,100"}), 'label': "a equal.xy", 'data': "http://foo.com?foo=1#t=1,100"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testParsed", 'input': "prio", 'out': False}), 'label': "should trigger incompatible type", 'data': "http://foo.com?foo=1#prio=foo"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "equal.multi", 'input': "pos", 'out': "c|d|1,2,3"}), 'label': "b equal.multi", 'data': "http://foo.com?foo=1#pos=c|d|1,2,3"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testBrowserOverride", 'input': "t", 'out': True}), 'label': "browser URI can override t (defined in asset)", 'data': "http://foo.com?foo=1#t=2,500"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testBrowserOverride", 'input': "q", 'out': False}), 'label': "browser URI cannot override q (defined in asset)", 'data': "http://foo.com?foo=1#q=-bar"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testPredefinedView", 'input': "mypredefinedview", 'out': True}), 'label': "test predefined view executed", 'data': "http://foo.com?foo=1#mypredefinedview"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testPredefinedView", 'input': "another", 'out': True}), 'label': "test predefined view executed (multiple)", 'data': "http://foo.com?foo=1#mypredefinedview&another"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testPredefinedView", 'input': "mypredefinedview", 'out': True}), 'label': "test predefined view executed (multiple)", 'data': "http://foo.com?foo=1#mypredefinedview&another"})])
|
||||
Test.test([_hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "equal.xyz", 'input': "pos", 'out': False}), 'label': "equal.xyz: should trigger incompatible type)", 'data': "http://foo.com?foo=1#pos=1.2,2.2"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "equal.xyz", 'input': "pos", 'out': "1.2,2.2,3"}), 'label': "equal.xyz", 'data': "http://foo.com?foo=1#pos=1.2,2.2,3"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "equal.xy", 'input': "t", 'out': "1,100"}), 'label': "a equal.xy", 'data': "http://foo.com?foo=1#t=1,100"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testParsed", 'input': "prio", 'out': False}), 'label': "should trigger incompatible type", 'data': "http://foo.com?foo=1#prio=foo"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "equal.multi", 'input': "pos", 'out': "c|d|1,2,3"}), 'label': "b equal.multi", 'data': "http://foo.com?foo=1#pos=c|d|1,2,3"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testBrowserOverride", 'input': "t", 'out': True}), 'label': "browser URI can override t (defined in asset)", 'data': "http://foo.com?foo=1#t=2,500"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testBrowserOverride", 'input': "q", 'out': False}), 'label': "browser URI cannot override q (defined in asset)", 'data': "http://foo.com?foo=1#q=-bar"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testPredefinedView", 'input': "mypredefinedview", 'out': True}), 'label': "test predefined view executed", 'data': "http://foo.com?foo=1#mypredefinedview"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testPredefinedView", 'input': "another", 'out': True}), 'label': "test predefined view executed (multiple)", 'data': "http://foo.com?foo=1#mypredefinedview&another"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testPredefinedView", 'input': "mypredefinedview", 'out': True}), 'label': "test predefined view executed (multiple)", 'data': "http://foo.com?foo=1#mypredefinedview&another"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testPropertyAssign", 'input': "cube.position.x", 'out': True}), 'label': "test data assign", 'data': "#cube.position.x=music.position.x"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testPropertyAssign", 'input': "cube.position.x", 'out': True}), 'label': "test one-way data bind", 'data': "#cube.position.x=@music.position.x"})])
|
||||
Test.test([_hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["class", "bar"], 'out': True}), 'data': "class:bar"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["class", "bar"], 'out': True}), 'label': ".bar shorthand", 'data': ".bar"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["class", "foo"], 'out': False}), 'data': ".bar -.foo"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["class", "foo"], 'out': True}), 'data': ".bar -.foo .foo"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["class", "bar"], 'out': True}), 'data': ".bar -.bar .bar"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["class", "foo"], 'out': True}), 'label': "class:foo", 'data': ".foo -.foo .foo"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["class", "foo"], 'out': True}), 'label': "class:foo", 'data': ".foo -.foo bar:5 .foo"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["class", "foo"], 'out': True}), 'label': "class:foo", 'data': ".foo -.foo bar:>5 .foo"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["class", "foo"], 'out': True}), 'label': "class:foo", 'data': ".foo -.foo bar:>5 .foo"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["class", "foo"], 'out': True}), 'label': "class:foo", 'data': ".foo -.foo .foo"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["id", "foo"], 'out': False}), 'label': "!id:foo", 'data': ".foo -.foo .foo"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["id", "foo"], 'out': True}), 'label': "id:foo?", 'data': "foo -foo foo"})])
|
||||
Test.test([_hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["price", "10"], 'out': True}), 'data': "price:>=5"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["price", "10"], 'out': False}), 'data': "price:>=15"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["price", "4"], 'out': False}), 'data': "price:>=5"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["price", "0"], 'out': False}), 'data': "price:>=5"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["price", "1"], 'out': False}), 'label': "price=1", 'data': "price:>=5 price:0"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["price", "0"], 'out': True}), 'label': "price=0", 'data': "price:>=5 price:0"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["price", "6"], 'out': True}), 'label': "price=6", 'data': "price:>=5 price:0"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["tag", "foo"], 'out': True}), 'data': "tag:foo"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["tag", "foo"], 'out': False}), 'data': "-tag:foo"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testPropertyExclude", 'input': ["tag", "foo"], 'out': True}), 'label': "testExclude", 'data': "-tag:foo"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "test", 'input': [_hx_AnonObject({'price': 5})], 'out': True}), 'data': ".foo price:5 -tag:foo"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "test", 'input': [_hx_AnonObject({'tag': "foo", 'price': 5})], 'out': False}), 'data': ".foo price:5 -tag:foo"})])
|
||||
if (Test.errors > 1):
|
||||
|
@ -424,6 +424,10 @@ class Test:
|
|||
valid = (python_Boot.hasField(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")),"is")(xrfragment_XRF.PV_EXECUTE))))
|
||||
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"),True),Reflect.field(Reflect.field(item,"expect"),"input")))
|
||||
if (Reflect.field(Reflect.field(item,"expect"),"fn") == "testPropertyAssign"):
|
||||
valid = (python_Boot.hasField(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")),"is")(xrfragment_XRF.PROP_BIND))))
|
||||
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"),True),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"):
|
||||
|
@ -1403,16 +1407,12 @@ class xrfragment_Parser:
|
|||
@staticmethod
|
||||
def parse(key,value,resultMap):
|
||||
Frag = haxe_ds_StringMap()
|
||||
Frag.h["prio"] = (xrfragment_XRF.ASSET_OBJ | xrfragment_XRF.T_INT)
|
||||
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_OBJ | xrfragment_XRF.T_STRING)
|
||||
Frag.h["src"] = (xrfragment_XRF.ASSET_OBJ | xrfragment_XRF.T_URL)
|
||||
Frag.h["src_audio"] = (xrfragment_XRF.ASSET_OBJ | xrfragment_XRF.T_URL)
|
||||
Frag.h["src_shader"] = (xrfragment_XRF.ASSET_OBJ | xrfragment_XRF.T_URL)
|
||||
Frag.h["src_env"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_URL)
|
||||
Frag.h["src_env_audio"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_URL)
|
||||
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)
|
||||
Frag.h["href"] = ((xrfragment_XRF.ASSET_OBJ | xrfragment_XRF.T_URL) | xrfragment_XRF.T_PREDEFINED_VIEW)
|
||||
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)
|
||||
Frag.h["scale"] = (((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_INT)
|
||||
Frag.h["rot"] = (((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3)
|
||||
|
@ -1422,7 +1422,6 @@ class xrfragment_Parser:
|
|||
Frag.h["gravity"] = ((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3)
|
||||
Frag.h["physics"] = ((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3)
|
||||
Frag.h["scroll"] = ((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_STRING)
|
||||
Frag.h["."] = ((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_STRING)
|
||||
Frag.h["fov"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_INT) | xrfragment_XRF.BROWSER_OVERRIDE)
|
||||
Frag.h["clip"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.BROWSER_OVERRIDE)
|
||||
Frag.h["fog"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_STRING) | xrfragment_XRF.BROWSER_OVERRIDE)
|
||||
|
@ -1435,6 +1434,10 @@ class xrfragment_Parser:
|
|||
value1 = xrfragment_XRF(key,(xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.BROWSER_OVERRIDE))
|
||||
setattr(resultMap,(("_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
|
||||
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(resultMap,(("_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
|
||||
if (key in Frag.h):
|
||||
v = xrfragment_XRF(key,Frag.h.get(key,None))
|
||||
if (not v.validate(value)):
|
||||
|
@ -1589,8 +1592,8 @@ class xrfragment_Query:
|
|||
fails = 0
|
||||
qualify = 0
|
||||
def _hx_local_2(expr):
|
||||
nonlocal conds
|
||||
nonlocal fails
|
||||
nonlocal conds
|
||||
conds = (conds + 1)
|
||||
fails = (fails + (0 if expr else 1))
|
||||
return expr
|
||||
|
@ -1674,7 +1677,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", "ASSET_OBJ", "QUERY_OPERATOR", "PROMPT", "ROUNDROBIN", "BROWSER_OVERRIDE", "PV_OVERRIDE", "PV_EXECUTE", "T_INT", "T_VECTOR2", "T_VECTOR3", "T_URL", "T_PREDEFINED_VIEW", "T_STRING", "T_STRING_OBJ", "isColor", "isInt", "isFloat"]
|
||||
_hx_statics = ["ASSET", "PROP_BIND", "QUERY_OPERATOR", "PROMPT", "ROUNDROBIN", "BROWSER_OVERRIDE", "PV_OVERRIDE", "PV_EXECUTE", "T_INT", "T_VECTOR2", "T_VECTOR3", "T_URL", "T_PREDEFINED_VIEW", "T_STRING", "T_STRING_OBJ", "isColor", "isInt", "isFloat"]
|
||||
|
||||
def __init__(self,_fragment,_flags):
|
||||
self.query = None
|
||||
|
@ -1752,7 +1755,7 @@ python_Boot.keywords = set(["and", "del", "from", "not", "with", "as", "elif", "
|
|||
python_Boot.prefixLength = len("_hx_")
|
||||
xrfragment_Parser.error = ""
|
||||
xrfragment_XRF.ASSET = 1
|
||||
xrfragment_XRF.ASSET_OBJ = 2
|
||||
xrfragment_XRF.PROP_BIND = 2
|
||||
xrfragment_XRF.QUERY_OPERATOR = 4
|
||||
xrfragment_XRF.PROMPT = 8
|
||||
xrfragment_XRF.ROUNDROBIN = 16
|
||||
|
|
Loading…
Reference in New Issue