Last active
September 11, 2020 22:31
-
-
Save maxyinger/85de047a09711cc924c774fa475c0a50 to your computer and use it in GitHub Desktop.
REGL Sinusoidal Vert Shader w/ Texture Deps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parcelRequire = (function (e, r, t, n) { | |
var i, | |
o = "function" == typeof parcelRequire && parcelRequire, | |
u = "function" == typeof require && require; | |
function f(t, n) { | |
if (!r[t]) { | |
if (!e[t]) { | |
var i = "function" == typeof parcelRequire && parcelRequire; | |
if (!n && i) return i(t, !0); | |
if (o) return o(t, !0); | |
if (u && "string" == typeof t) return u(t); | |
var c = new Error("Cannot find module '" + t + "'"); | |
throw ((c.code = "MODULE_NOT_FOUND"), c); | |
} | |
(p.resolve = function (r) { | |
return e[t][1][r] || r; | |
}), | |
(p.cache = {}); | |
var l = (r[t] = new f.Module(t)); | |
e[t][0].call(l.exports, p, l, l.exports, this); | |
} | |
return r[t].exports; | |
function p(e) { | |
return f(p.resolve(e)); | |
} | |
} | |
(f.isParcelRequire = !0), | |
(f.Module = function (e) { | |
(this.id = e), (this.bundle = f), (this.exports = {}); | |
}), | |
(f.modules = e), | |
(f.cache = r), | |
(f.parent = o), | |
(f.register = function (r, t) { | |
e[r] = [ | |
function (e, r) { | |
r.exports = t; | |
}, | |
{}, | |
]; | |
}); | |
for (var c = 0; c < t.length; c++) | |
try { | |
f(t[c]); | |
} catch (e) { | |
i || (i = e); | |
} | |
if (t.length) { | |
var l = f(t[t.length - 1]); | |
"object" == typeof exports && "undefined" != typeof module | |
? (module.exports = l) | |
: "function" == typeof define && define.amd | |
? define(function () { | |
return l; | |
}) | |
: n && (this[n] = l); | |
} | |
if (((parcelRequire = f), i)) throw i; | |
return f; | |
})( | |
{ | |
EBub: [ | |
function (require, module, exports) { | |
var define; | |
var global = arguments[3]; | |
var e, | |
t = arguments[3]; | |
!(function (t, r) { | |
"object" == typeof exports && "undefined" != typeof module | |
? (module.exports = r()) | |
: "function" == typeof e && e.amd | |
? e(r) | |
: (t.createREGL = r()); | |
})(this, function () { | |
"use strict"; | |
var e = function (e) { | |
return ( | |
e instanceof Uint8Array || | |
e instanceof Uint16Array || | |
e instanceof Uint32Array || | |
e instanceof Int8Array || | |
e instanceof Int16Array || | |
e instanceof Int32Array || | |
e instanceof Float32Array || | |
e instanceof Float64Array || | |
e instanceof Uint8ClampedArray | |
); | |
}, | |
t = function (e, t) { | |
for (var r = Object.keys(t), n = 0; n < r.length; ++n) | |
e[r[n]] = t[r[n]]; | |
return e; | |
}, | |
r = "\n"; | |
function n(e) { | |
var t = new Error("(regl) " + e); | |
throw (console.error(t), t); | |
} | |
function a(e, t) { | |
e || n(t); | |
} | |
function i(e) { | |
return e ? ": " + e : ""; | |
} | |
function o(e, t) { | |
switch (t) { | |
case "number": | |
return "number" == typeof e; | |
case "object": | |
return "object" == typeof e; | |
case "string": | |
return "string" == typeof e; | |
case "boolean": | |
return "boolean" == typeof e; | |
case "function": | |
return "function" == typeof e; | |
case "undefined": | |
return void 0 === e; | |
case "symbol": | |
return "symbol" == typeof e; | |
} | |
} | |
function f(e, t, r) { | |
t.indexOf(e) < 0 && | |
n("invalid value" + i(r) + ". must be one of: " + t); | |
} | |
var u = [ | |
"gl", | |
"canvas", | |
"container", | |
"attributes", | |
"pixelRatio", | |
"extensions", | |
"optionalExtensions", | |
"profile", | |
"onDone", | |
]; | |
function s(e, t) { | |
for (e += ""; e.length < t; ) e = " " + e; | |
return e; | |
} | |
function c() { | |
(this.name = "unknown"), | |
(this.lines = []), | |
(this.index = {}), | |
(this.hasErrors = !1); | |
} | |
function l(e, t) { | |
(this.number = e), (this.line = t), (this.errors = []); | |
} | |
function d(e, t, r) { | |
(this.file = e), (this.line = t), (this.message = r); | |
} | |
function m() { | |
var e = new Error(), | |
t = (e.stack || e).toString(), | |
r = /compileProcedure.*\n\s*at.*\((.*)\)/.exec(t); | |
if (r) return r[1]; | |
var n = /compileProcedure.*\n\s*at\s+(.*)(\n|$)/.exec(t); | |
return n ? n[1] : "unknown"; | |
} | |
function p() { | |
var e = new Error(), | |
t = (e.stack || e).toString(), | |
r = /at REGLCommand.*\n\s+at.*\((.*)\)/.exec(t); | |
if (r) return r[1]; | |
var n = /at REGLCommand.*\n\s+at\s+(.*)\n/.exec(t); | |
return n ? n[1] : "unknown"; | |
} | |
function h(e, t) { | |
var r, | |
n = e.split("\n"), | |
a = 1, | |
i = 0, | |
o = { unknown: new c(), 0: new c() }; | |
(o.unknown.name = o[0].name = t || m()), | |
o.unknown.lines.push(new l(0, "")); | |
for (var f = 0; f < n.length; ++f) { | |
var u = n[f], | |
s = /^\s*#\s*(\w+)\s+(.+)\s*$/.exec(u); | |
if (s) | |
switch (s[1]) { | |
case "line": | |
var d = /(\d+)(\s+\d+)?/.exec(s[2]); | |
d && | |
((a = 0 | d[1]), | |
d[2] && ((i = 0 | d[2]) in o || (o[i] = new c()))); | |
break; | |
case "define": | |
var p = /SHADER_NAME(_B64)?\s+(.*)$/.exec(s[2]); | |
p && | |
(o[i].name = p[1] | |
? ((r = p[2]), | |
"undefined" != typeof atob ? atob(r) : "base64:" + r) | |
: p[2]); | |
} | |
o[i].lines.push(new l(a++, u)); | |
} | |
return ( | |
Object.keys(o).forEach(function (e) { | |
var t = o[e]; | |
t.lines.forEach(function (e) { | |
t.index[e.number] = e; | |
}); | |
}), | |
o | |
); | |
} | |
function b(e) { | |
e._commandRef = m(); | |
} | |
function v(e, t) { | |
var r = p(); | |
n( | |
e + | |
" in command " + | |
(t || m()) + | |
("unknown" === r ? "" : " called from " + r) | |
); | |
} | |
function g(e, t, r, n) { | |
o(e, t) || | |
v( | |
"invalid parameter type" + | |
i(r) + | |
". expected " + | |
t + | |
", got " + | |
typeof e, | |
n || m() | |
); | |
} | |
var y = 33071, | |
x = 9728, | |
w = 9984, | |
A = 9985, | |
_ = 9986, | |
k = 9987, | |
S = 5126, | |
E = 32819, | |
O = 32820, | |
T = 33635, | |
j = 34042, | |
D = {}; | |
function C(e, t) { | |
return e === O || e === E || e === T ? 2 : e === j ? 4 : D[e] * t; | |
} | |
function z(e) { | |
return !(e & (e - 1) || !e); | |
} | |
(D[5120] = D[5121] = 1), | |
(D[5122] = D[5123] = D[36193] = D[T] = D[E] = D[O] = 2), | |
(D[5124] = D[5125] = D[S] = D[j] = 4); | |
var F = t(a, { | |
optional: function (e) { | |
e(); | |
}, | |
raise: n, | |
commandRaise: v, | |
command: function (e, t, r) { | |
e || v(t, r || m()); | |
}, | |
parameter: function (e, t, r) { | |
e in t || | |
n( | |
"unknown parameter (" + | |
e + | |
")" + | |
i(r) + | |
". possible values: " + | |
Object.keys(t).join() | |
); | |
}, | |
commandParameter: function (e, t, r, n) { | |
e in t || | |
v( | |
"unknown parameter (" + | |
e + | |
")" + | |
i(r) + | |
". possible values: " + | |
Object.keys(t).join(), | |
n || m() | |
); | |
}, | |
constructor: function (e) { | |
Object.keys(e).forEach(function (e) { | |
u.indexOf(e) < 0 && | |
n( | |
'invalid regl constructor argument "' + | |
e + | |
'". must be one of ' + | |
u | |
); | |
}); | |
}, | |
type: function (e, t, r) { | |
o(e, t) || | |
n( | |
"invalid parameter type" + | |
i(r) + | |
". expected " + | |
t + | |
", got " + | |
typeof e | |
); | |
}, | |
commandType: g, | |
isTypedArray: function (t, r) { | |
e(t) || | |
n( | |
"invalid parameter type" + i(r) + ". must be a typed array" | |
); | |
}, | |
nni: function (e, t) { | |
(e >= 0 && (0 | e) === e) || | |
n( | |
"invalid parameter type, (" + | |
e + | |
")" + | |
i(t) + | |
". must be a nonnegative integer" | |
); | |
}, | |
oneOf: f, | |
shaderError: function (e, t, n, i, o) { | |
if (!e.getShaderParameter(t, e.COMPILE_STATUS)) { | |
var f = e.getShaderInfoLog(t), | |
u = i === e.FRAGMENT_SHADER ? "fragment" : "vertex"; | |
g(n, "string", u + " shader source must be a string", o); | |
var c = h(n, o), | |
l = (function (e) { | |
var t = []; | |
return ( | |
e.split("\n").forEach(function (e) { | |
if (!(e.length < 5)) { | |
var r = /^ERROR:\s+(\d+):(\d+):\s*(.*)$/.exec(e); | |
r | |
? t.push(new d(0 | r[1], 0 | r[2], r[3].trim())) | |
: e.length > 0 && t.push(new d("unknown", 0, e)); | |
} | |
}), | |
t | |
); | |
})(f); | |
!(function (e, t) { | |
t.forEach(function (t) { | |
var r = e[t.file]; | |
if (r) { | |
var n = r.index[t.line]; | |
if (n) return n.errors.push(t), void (r.hasErrors = !0); | |
} | |
(e.unknown.hasErrors = !0), | |
e.unknown.lines[0].errors.push(t); | |
}); | |
})(c, l), | |
Object.keys(c).forEach(function (e) { | |
var t = c[e]; | |
if (t.hasErrors) { | |
var n = [""], | |
a = [""]; | |
i( | |
"file number " + e + ": " + t.name + "\n", | |
"color:red;text-decoration:underline;font-weight:bold" | |
), | |
t.lines.forEach(function (e) { | |
if (e.errors.length > 0) { | |
i( | |
s(e.number, 4) + "| ", | |
"background-color:yellow; font-weight:bold" | |
), | |
i( | |
e.line + r, | |
"color:red; background-color:yellow; font-weight:bold" | |
); | |
var t = 0; | |
e.errors.forEach(function (n) { | |
var a = n.message, | |
o = /^\s*'(.*)'\s*:\s*(.*)$/.exec(a); | |
if (o) { | |
var f = o[1]; | |
switch (((a = o[2]), f)) { | |
case "assign": | |
f = "="; | |
} | |
t = Math.max(e.line.indexOf(f, t), 0); | |
} else t = 0; | |
i(s("| ", 6)), | |
i(s("^^^", t + 3) + r, "font-weight:bold"), | |
i(s("| ", 6)), | |
i(a + r, "font-weight:bold"); | |
}), | |
i(s("| ", 6) + r); | |
} else i(s(e.number, 4) + "| "), i(e.line + r, "color:red"); | |
}), | |
"undefined" == typeof document || window.chrome | |
? console.log(n.join("")) | |
: ((a[0] = n.join("%c")), | |
console.log.apply(console, a)); | |
} | |
function i(e, t) { | |
n.push(e), a.push(t || ""); | |
} | |
}), | |
a.raise("Error compiling " + u + " shader, " + c[0].name); | |
} | |
}, | |
linkError: function (e, t, n, i, o) { | |
if (!e.getProgramParameter(t, e.LINK_STATUS)) { | |
var f = e.getProgramInfoLog(t), | |
u = h(n, o), | |
s = | |
'Error linking program with vertex shader, "' + | |
h(i, o)[0].name + | |
'", and fragment shader "' + | |
u[0].name + | |
'"'; | |
"undefined" != typeof document | |
? console.log( | |
"%c" + s + r + "%c" + f, | |
"color:red;text-decoration:underline;font-weight:bold", | |
"color:red" | |
) | |
: console.log(s + r + f), | |
a.raise(s); | |
} | |
}, | |
callSite: p, | |
saveCommandRef: b, | |
saveDrawInfo: function (e, t, r, n) { | |
function a(e) { | |
return e ? n.id(e) : 0; | |
} | |
function i(e, t) { | |
Object.keys(t).forEach(function (t) { | |
e[n.id(t)] = !0; | |
}); | |
} | |
b(e), | |
(e._fragId = a(e.static.frag)), | |
(e._vertId = a(e.static.vert)); | |
var o = (e._uniformSet = {}); | |
i(o, t.static), i(o, t.dynamic); | |
var f = (e._attributeSet = {}); | |
i(f, r.static), | |
i(f, r.dynamic), | |
(e._hasCount = | |
"count" in e.static || | |
"count" in e.dynamic || | |
"elements" in e.static || | |
"elements" in e.dynamic); | |
}, | |
framebufferFormat: function (e, t, r) { | |
e.texture | |
? f( | |
e.texture._texture.internalformat, | |
t, | |
"unsupported texture format for attachment" | |
) | |
: f( | |
e.renderbuffer._renderbuffer.format, | |
r, | |
"unsupported renderbuffer format for attachment" | |
); | |
}, | |
guessCommand: m, | |
texture2D: function (e, t, r) { | |
var n, | |
i = t.width, | |
o = t.height, | |
f = t.channels; | |
a( | |
i > 0 && | |
i <= r.maxTextureSize && | |
o > 0 && | |
o <= r.maxTextureSize, | |
"invalid texture shape" | |
), | |
(e.wrapS === y && e.wrapT === y) || | |
a( | |
z(i) && z(o), | |
"incompatible wrap mode for texture, both width and height must be power of 2" | |
), | |
1 === t.mipmask | |
? 1 !== i && | |
1 !== o && | |
a( | |
e.minFilter !== w && | |
e.minFilter !== _ && | |
e.minFilter !== A && | |
e.minFilter !== k, | |
"min filter requires mipmap" | |
) | |
: (a( | |
z(i) && z(o), | |
"texture must be a square power of 2 to support mipmapping" | |
), | |
a( | |
t.mipmask === (i << 1) - 1, | |
"missing or incomplete mipmap data" | |
)), | |
t.type === S && | |
(r.extensions.indexOf("oes_texture_float_linear") < 0 && | |
a( | |
e.minFilter === x && e.magFilter === x, | |
"filter not supported, must enable oes_texture_float_linear" | |
), | |
a( | |
!e.genMipmaps, | |
"mipmap generation not supported with float textures" | |
)); | |
var u = t.images; | |
for (n = 0; n < 16; ++n) | |
if (u[n]) { | |
var s = i >> n, | |
c = o >> n; | |
a(t.mipmask & (1 << n), "missing mipmap data"); | |
var l = u[n]; | |
if ( | |
(a( | |
l.width === s && l.height === c, | |
"invalid shape for mip images" | |
), | |
a( | |
l.format === t.format && | |
l.internalformat === t.internalformat && | |
l.type === t.type, | |
"incompatible type for mip image" | |
), | |
l.compressed) | |
); | |
else if (l.data) { | |
var d = | |
Math.ceil((C(l.type, f) * s) / l.unpackAlignment) * | |
l.unpackAlignment; | |
a( | |
l.data.byteLength === d * c, | |
"invalid data for image, buffer size is inconsistent with image format" | |
); | |
} else l.element || l.copy; | |
} else | |
e.genMipmaps || | |
a(0 == (t.mipmask & (1 << n)), "extra mipmap data"); | |
t.compressed && | |
a( | |
!e.genMipmaps, | |
"mipmap generation for compressed images not supported" | |
); | |
}, | |
textureCube: function (e, t, r, n) { | |
var i = e.width, | |
o = e.height, | |
f = e.channels; | |
a( | |
i > 0 && | |
i <= n.maxTextureSize && | |
o > 0 && | |
o <= n.maxTextureSize, | |
"invalid texture shape" | |
), | |
a(i === o, "cube map must be square"), | |
a( | |
t.wrapS === y && t.wrapT === y, | |
"wrap mode not supported by cube map" | |
); | |
for (var u = 0; u < r.length; ++u) { | |
var s = r[u]; | |
a( | |
s.width === i && s.height === o, | |
"inconsistent cube map face shape" | |
), | |
t.genMipmaps && | |
(a( | |
!s.compressed, | |
"can not generate mipmap for compressed textures" | |
), | |
a( | |
1 === s.mipmask, | |
"can not specify mipmaps and generate mipmaps" | |
)); | |
for (var c = s.images, l = 0; l < 16; ++l) { | |
var d = c[l]; | |
if (d) { | |
var m = i >> l, | |
p = o >> l; | |
a(s.mipmask & (1 << l), "missing mipmap data"), | |
a( | |
d.width === m && d.height === p, | |
"invalid shape for mip images" | |
), | |
a( | |
d.format === e.format && | |
d.internalformat === e.internalformat && | |
d.type === e.type, | |
"incompatible type for mip image" | |
), | |
d.compressed || | |
(d.data | |
? a( | |
d.data.byteLength === | |
m * | |
p * | |
Math.max(C(d.type, f), d.unpackAlignment), | |
"invalid data for image, buffer size is inconsistent with image format" | |
) | |
: d.element || d.copy); | |
} | |
} | |
} | |
}, | |
}), | |
B = 0, | |
V = 0; | |
function P(e, t) { | |
(this.id = B++), (this.type = e), (this.data = t); | |
} | |
function L(e) { | |
return e.replace(/\\/g, "\\\\").replace(/"/g, '\\"'); | |
} | |
function R(e) { | |
return ( | |
"[" + | |
(function e(t) { | |
if (0 === t.length) return []; | |
var r = t.charAt(0), | |
n = t.charAt(t.length - 1); | |
if (t.length > 1 && r === n && ('"' === r || "'" === r)) | |
return ['"' + L(t.substr(1, t.length - 2)) + '"']; | |
var a = /\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(t); | |
if (a) | |
return e(t.substr(0, a.index)) | |
.concat(e(a[1])) | |
.concat(e(t.substr(a.index + a[0].length))); | |
var i = t.split("."); | |
if (1 === i.length) return ['"' + L(t) + '"']; | |
for (var o = [], f = 0; f < i.length; ++f) | |
o = o.concat(e(i[f])); | |
return o; | |
})(e).join("][") + | |
"]" | |
); | |
} | |
var I = { | |
DynamicVariable: P, | |
define: function (e, t) { | |
return new P(e, R(t + "")); | |
}, | |
isDynamic: function (e) { | |
return ( | |
("function" == typeof e && !e._reglType) || e instanceof P | |
); | |
}, | |
unbox: function (e, t) { | |
return "function" == typeof e ? new P(V, e) : e; | |
}, | |
accessor: R, | |
}, | |
M = { | |
next: | |
"function" == typeof requestAnimationFrame | |
? function (e) { | |
return requestAnimationFrame(e); | |
} | |
: function (e) { | |
return setTimeout(e, 16); | |
}, | |
cancel: | |
"function" == typeof cancelAnimationFrame | |
? function (e) { | |
return cancelAnimationFrame(e); | |
} | |
: clearTimeout, | |
}, | |
W = | |
"undefined" != typeof performance && performance.now | |
? function () { | |
return performance.now(); | |
} | |
: function () { | |
return +new Date(); | |
}; | |
function U(e) { | |
return "string" == typeof e | |
? e.split() | |
: (F(Array.isArray(e), "invalid extension array"), e); | |
} | |
function G(e) { | |
return "string" == typeof e | |
? (F( | |
"undefined" != typeof document, | |
"not supported outside of DOM" | |
), | |
document.querySelector(e)) | |
: e; | |
} | |
function H(e) { | |
var r, | |
n, | |
a, | |
i, | |
o, | |
f = e || {}, | |
u = {}, | |
s = [], | |
c = [], | |
l = "undefined" == typeof window ? 1 : window.devicePixelRatio, | |
d = !1, | |
m = function (e) { | |
e && F.raise(e); | |
}, | |
p = function () {}; | |
if ( | |
("string" == typeof f | |
? (F( | |
"undefined" != typeof document, | |
"selector queries only supported in DOM enviroments" | |
), | |
(r = document.querySelector(f)), | |
F(r, "invalid query string for element")) | |
: "object" == typeof f | |
? "string" == typeof (o = f).nodeName && | |
"function" == typeof o.appendChild && | |
"function" == typeof o.getBoundingClientRect | |
? (r = f) | |
: !(function (e) { | |
return ( | |
"function" == typeof e.drawArrays || | |
"function" == typeof e.drawElements | |
); | |
})(f) | |
? (F.constructor(f), | |
"gl" in f | |
? (i = f.gl) | |
: "canvas" in f | |
? (a = G(f.canvas)) | |
: "container" in f && (n = G(f.container)), | |
"attributes" in f && | |
((u = f.attributes), | |
F.type(u, "object", "invalid context attributes")), | |
"extensions" in f && (s = U(f.extensions)), | |
"optionalExtensions" in f && (c = U(f.optionalExtensions)), | |
"onDone" in f && | |
(F.type( | |
f.onDone, | |
"function", | |
"invalid or missing onDone callback" | |
), | |
(m = f.onDone)), | |
"profile" in f && (d = !!f.profile), | |
"pixelRatio" in f && | |
((l = +f.pixelRatio), F(l > 0, "invalid pixel ratio"))) | |
: (a = (i = f).canvas) | |
: F.raise("invalid arguments to regl"), | |
r && ("canvas" === r.nodeName.toLowerCase() ? (a = r) : (n = r)), | |
!i) | |
) { | |
if (!a) { | |
F( | |
"undefined" != typeof document, | |
"must manually specify webgl context outside of DOM environments" | |
); | |
var h = (function (e, r, n) { | |
var a, | |
i = document.createElement("canvas"); | |
function o() { | |
var r = window.innerWidth, | |
a = window.innerHeight; | |
if (e !== document.body) { | |
var o = e.getBoundingClientRect(); | |
(r = o.right - o.left), (a = o.bottom - o.top); | |
} | |
(i.width = n * r), | |
(i.height = n * a), | |
t(i.style, { width: r + "px", height: a + "px" }); | |
} | |
return ( | |
t(i.style, { | |
border: 0, | |
margin: 0, | |
padding: 0, | |
top: 0, | |
left: 0, | |
}), | |
e.appendChild(i), | |
e === document.body && | |
((i.style.position = "absolute"), | |
t(e.style, { margin: 0, padding: 0 })), | |
e !== document.body && "function" == typeof ResizeObserver | |
? (a = new ResizeObserver(function () { | |
setTimeout(o); | |
})).observe(e) | |
: window.addEventListener("resize", o, !1), | |
o(), | |
{ | |
canvas: i, | |
onDestroy: function () { | |
a | |
? a.disconnect() | |
: window.removeEventListener("resize", o), | |
e.removeChild(i); | |
}, | |
} | |
); | |
})(n || document.body, 0, l); | |
if (!h) return null; | |
(a = h.canvas), (p = h.onDestroy); | |
} | |
void 0 === u.premultipliedAlpha && (u.premultipliedAlpha = !0), | |
(i = (function (e, t) { | |
function r(r) { | |
try { | |
return e.getContext(r, t); | |
} catch (n) { | |
return null; | |
} | |
} | |
return ( | |
r("webgl") || | |
r("experimental-webgl") || | |
r("webgl-experimental") | |
); | |
})(a, u)); | |
} | |
return i | |
? { | |
gl: i, | |
canvas: a, | |
container: n, | |
extensions: s, | |
optionalExtensions: c, | |
pixelRatio: l, | |
profile: d, | |
onDone: m, | |
onDestroy: p, | |
} | |
: (p(), | |
m( | |
"webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org" | |
), | |
null); | |
} | |
function N(e, t) { | |
for (var r = Array(e), n = 0; n < e; ++n) r[n] = t(n); | |
return r; | |
} | |
var q = 5120, | |
Q = 5121, | |
Y = 5122, | |
X = 5123, | |
$ = 5124, | |
K = 5125, | |
J = 5126; | |
function Z(e) { | |
var t, r; | |
return ( | |
(t = (e > 65535) << 4), | |
(t |= r = ((e >>>= t) > 255) << 3), | |
(t |= r = ((e >>>= r) > 15) << 2), | |
(t |= r = ((e >>>= r) > 3) << 1) | ((e >>>= r) >> 1) | |
); | |
} | |
function ee() { | |
var e = N(8, function () { | |
return []; | |
}); | |
function t(t) { | |
var r = (function (e) { | |
for (var t = 16; t <= 1 << 28; t *= 16) if (e <= t) return t; | |
return 0; | |
})(t), | |
n = e[Z(r) >> 2]; | |
return n.length > 0 ? n.pop() : new ArrayBuffer(r); | |
} | |
function r(t) { | |
e[Z(t.byteLength) >> 2].push(t); | |
} | |
return { | |
alloc: t, | |
free: r, | |
allocType: function (e, r) { | |
var n = null; | |
switch (e) { | |
case q: | |
n = new Int8Array(t(r), 0, r); | |
break; | |
case Q: | |
n = new Uint8Array(t(r), 0, r); | |
break; | |
case Y: | |
n = new Int16Array(t(2 * r), 0, r); | |
break; | |
case X: | |
n = new Uint16Array(t(2 * r), 0, r); | |
break; | |
case $: | |
n = new Int32Array(t(4 * r), 0, r); | |
break; | |
case K: | |
n = new Uint32Array(t(4 * r), 0, r); | |
break; | |
case J: | |
n = new Float32Array(t(4 * r), 0, r); | |
break; | |
default: | |
return null; | |
} | |
return n.length !== r ? n.subarray(0, r) : n; | |
}, | |
freeType: function (e) { | |
r(e.buffer); | |
}, | |
}; | |
} | |
var te = ee(); | |
te.zero = ee(); | |
var re = function (e, t) { | |
var r = 1; | |
t.ext_texture_filter_anisotropic && (r = e.getParameter(34047)); | |
var n = 1, | |
a = 1; | |
t.webgl_draw_buffers && | |
((n = e.getParameter(34852)), (a = e.getParameter(36063))); | |
var i = !!t.oes_texture_float; | |
if (i) { | |
var o = e.createTexture(); | |
e.bindTexture(3553, o), | |
e.texImage2D(3553, 0, 6408, 1, 1, 0, 6408, 5126, null); | |
var f = e.createFramebuffer(); | |
if ( | |
(e.bindFramebuffer(36160, f), | |
e.framebufferTexture2D(36160, 36064, 3553, o, 0), | |
e.bindTexture(3553, null), | |
36053 !== e.checkFramebufferStatus(36160)) | |
) | |
i = !1; | |
else { | |
e.viewport(0, 0, 1, 1), | |
e.clearColor(1, 0, 0, 1), | |
e.clear(16384); | |
var u = te.allocType(5126, 4); | |
e.readPixels(0, 0, 1, 1, 6408, 5126, u), | |
e.getError() | |
? (i = !1) | |
: (e.deleteFramebuffer(f), | |
e.deleteTexture(o), | |
(i = 1 === u[0])), | |
te.freeType(u); | |
} | |
} | |
var s = !0; | |
if ( | |
!( | |
"undefined" != typeof navigator && | |
(/MSIE/.test(navigator.userAgent) || | |
/Trident\//.test(navigator.appVersion) || | |
/Edge/.test(navigator.userAgent)) | |
) | |
) { | |
var c = e.createTexture(), | |
l = te.allocType(5121, 36); | |
e.activeTexture(33984), | |
e.bindTexture(34067, c), | |
e.texImage2D(34069, 0, 6408, 3, 3, 0, 6408, 5121, l), | |
te.freeType(l), | |
e.bindTexture(34067, null), | |
e.deleteTexture(c), | |
(s = !e.getError()); | |
} | |
return { | |
colorBits: [ | |
e.getParameter(3410), | |
e.getParameter(3411), | |
e.getParameter(3412), | |
e.getParameter(3413), | |
], | |
depthBits: e.getParameter(3414), | |
stencilBits: e.getParameter(3415), | |
subpixelBits: e.getParameter(3408), | |
extensions: Object.keys(t).filter(function (e) { | |
return !!t[e]; | |
}), | |
maxAnisotropic: r, | |
maxDrawbuffers: n, | |
maxColorAttachments: a, | |
pointSizeDims: e.getParameter(33901), | |
lineWidthDims: e.getParameter(33902), | |
maxViewportDims: e.getParameter(3386), | |
maxCombinedTextureUnits: e.getParameter(35661), | |
maxCubeMapSize: e.getParameter(34076), | |
maxRenderbufferSize: e.getParameter(34024), | |
maxTextureUnits: e.getParameter(34930), | |
maxTextureSize: e.getParameter(3379), | |
maxAttributes: e.getParameter(34921), | |
maxVertexUniforms: e.getParameter(36347), | |
maxVertexTextureUnits: e.getParameter(35660), | |
maxVaryingVectors: e.getParameter(36348), | |
maxFragmentUniforms: e.getParameter(36349), | |
glsl: e.getParameter(35724), | |
renderer: e.getParameter(7937), | |
vendor: e.getParameter(7936), | |
version: e.getParameter(7938), | |
readFloat: i, | |
npotTextureCube: s, | |
}; | |
}; | |
function ne(t) { | |
return ( | |
!!t && | |
"object" == typeof t && | |
Array.isArray(t.shape) && | |
Array.isArray(t.stride) && | |
"number" == typeof t.offset && | |
t.shape.length === t.stride.length && | |
(Array.isArray(t.data) || e(t.data)) | |
); | |
} | |
var ae = function (e) { | |
return Object.keys(e).map(function (t) { | |
return e[t]; | |
}); | |
}, | |
ie = { | |
shape: function (e) { | |
for (var t = [], r = e; r.length; r = r[0]) t.push(r.length); | |
return t; | |
}, | |
flatten: function (e, t, r, n) { | |
var a = 1; | |
if (t.length) for (var i = 0; i < t.length; ++i) a *= t[i]; | |
else a = 0; | |
var o = n || te.allocType(r, a); | |
switch (t.length) { | |
case 0: | |
break; | |
case 1: | |
!(function (e, t, r) { | |
for (var n = 0; n < t; ++n) r[n] = e[n]; | |
})(e, t[0], o); | |
break; | |
case 2: | |
!(function (e, t, r, n) { | |
for (var a = 0, i = 0; i < t; ++i) | |
for (var o = e[i], f = 0; f < r; ++f) n[a++] = o[f]; | |
})(e, t[0], t[1], o); | |
break; | |
case 3: | |
oe(e, t[0], t[1], t[2], o, 0); | |
break; | |
default: | |
!(function e(t, r, n, a, i) { | |
var o = 1; | |
for (var f = n + 1; f < r.length; ++f) o *= r[f]; | |
var u = r[n]; | |
if (r.length - n == 4) { | |
var s = r[n + 1], | |
c = r[n + 2], | |
l = r[n + 3]; | |
for (f = 0; f < u; ++f) | |
oe(t[f], s, c, l, a, i), (i += o); | |
} else | |
for (f = 0; f < u; ++f) | |
e(t[f], r, n + 1, a, i), (i += o); | |
})(e, t, 0, o, 0); | |
} | |
return o; | |
}, | |
}; | |
function oe(e, t, r, n, a, i) { | |
for (var o = i, f = 0; f < t; ++f) | |
for (var u = e[f], s = 0; s < r; ++s) | |
for (var c = u[s], l = 0; l < n; ++l) a[o++] = c[l]; | |
} | |
var fe = { | |
"[object Int8Array]": 5120, | |
"[object Int16Array]": 5122, | |
"[object Int32Array]": 5124, | |
"[object Uint8Array]": 5121, | |
"[object Uint8ClampedArray]": 5121, | |
"[object Uint16Array]": 5123, | |
"[object Uint32Array]": 5125, | |
"[object Float32Array]": 5126, | |
"[object Float64Array]": 5121, | |
"[object ArrayBuffer]": 5121, | |
}, | |
ue = { | |
int8: 5120, | |
int16: 5122, | |
int32: 5124, | |
uint8: 5121, | |
uint16: 5123, | |
uint32: 5125, | |
float: 5126, | |
float32: 5126, | |
}, | |
se = { dynamic: 35048, stream: 35040, static: 35044 }, | |
ce = ie.flatten, | |
le = ie.shape, | |
de = 35044, | |
me = 35040, | |
pe = 5121, | |
he = 5126, | |
be = []; | |
function ve(e) { | |
return 0 | fe[Object.prototype.toString.call(e)]; | |
} | |
function ge(e, t) { | |
for (var r = 0; r < t.length; ++r) e[r] = t[r]; | |
} | |
function ye(e, t, r, n, a, i, o) { | |
for (var f = 0, u = 0; u < r; ++u) | |
for (var s = 0; s < n; ++s) e[f++] = t[a * u + i * s + o]; | |
} | |
(be[5120] = 1), | |
(be[5122] = 2), | |
(be[5124] = 4), | |
(be[5121] = 1), | |
(be[5123] = 2), | |
(be[5125] = 4), | |
(be[5126] = 4); | |
var xe = { | |
points: 0, | |
point: 0, | |
lines: 1, | |
line: 1, | |
triangles: 4, | |
triangle: 4, | |
"line loop": 2, | |
"line strip": 3, | |
"triangle strip": 5, | |
"triangle fan": 6, | |
}, | |
we = 0, | |
Ae = 1, | |
_e = 4, | |
ke = 5120, | |
Se = 5121, | |
Ee = 5122, | |
Oe = 5123, | |
Te = 5124, | |
je = 5125, | |
De = 34963, | |
Ce = 35040, | |
ze = 35044; | |
var Fe = new Float32Array(1), | |
Be = new Uint32Array(Fe.buffer), | |
Ve = 5123; | |
function Pe(e) { | |
for (var t = te.allocType(Ve, e.length), r = 0; r < e.length; ++r) | |
if (isNaN(e[r])) t[r] = 65535; | |
else if (e[r] === 1 / 0) t[r] = 31744; | |
else if (e[r] === -1 / 0) t[r] = 64512; | |
else { | |
Fe[0] = e[r]; | |
var n = Be[0], | |
a = (n >>> 31) << 15, | |
i = ((n << 1) >>> 24) - 127, | |
o = (n >> 13) & 1023; | |
if (i < -24) t[r] = a; | |
else if (i < -14) { | |
var f = -14 - i; | |
t[r] = a + ((o + 1024) >> f); | |
} else t[r] = i > 15 ? a + 31744 : a + ((i + 15) << 10) + o; | |
} | |
return t; | |
} | |
function Le(t) { | |
return Array.isArray(t) || e(t); | |
} | |
var Re = function (e) { | |
return !(e & (e - 1) || !e); | |
}, | |
Ie = 34467, | |
Me = 3553, | |
We = 34067, | |
Ue = 34069, | |
Ge = 6408, | |
He = 6406, | |
Ne = 6407, | |
qe = 6409, | |
Qe = 6410, | |
Ye = 32854, | |
Xe = 32855, | |
$e = 36194, | |
Ke = 32819, | |
Je = 32820, | |
Ze = 33635, | |
et = 34042, | |
tt = 6402, | |
rt = 34041, | |
nt = 35904, | |
at = 35906, | |
it = 36193, | |
ot = 33776, | |
ft = 33777, | |
ut = 33778, | |
st = 33779, | |
ct = 35986, | |
lt = 35987, | |
dt = 34798, | |
mt = 35840, | |
pt = 35841, | |
ht = 35842, | |
bt = 35843, | |
vt = 36196, | |
gt = 5121, | |
yt = 5123, | |
xt = 5125, | |
wt = 5126, | |
At = 10242, | |
_t = 10243, | |
kt = 10497, | |
St = 33071, | |
Et = 33648, | |
Ot = 10240, | |
Tt = 10241, | |
jt = 9728, | |
Dt = 9729, | |
Ct = 9984, | |
zt = 9985, | |
Ft = 9986, | |
Bt = 9987, | |
Vt = 33170, | |
Pt = 4352, | |
Lt = 4353, | |
Rt = 4354, | |
It = 34046, | |
Mt = 3317, | |
Wt = 37440, | |
Ut = 37441, | |
Gt = 37443, | |
Ht = 37444, | |
Nt = 33984, | |
qt = [Ct, Ft, zt, Bt], | |
Qt = [0, qe, Qe, Ne, Ge], | |
Yt = {}; | |
function Xt(e) { | |
return "[object " + e + "]"; | |
} | |
(Yt[qe] = Yt[He] = Yt[tt] = 1), | |
(Yt[rt] = Yt[Qe] = 2), | |
(Yt[Ne] = Yt[nt] = 3), | |
(Yt[Ge] = Yt[at] = 4); | |
var $t = Xt("HTMLCanvasElement"), | |
Kt = Xt("OffscreenCanvas"), | |
Jt = Xt("CanvasRenderingContext2D"), | |
Zt = Xt("ImageBitmap"), | |
er = Xt("HTMLImageElement"), | |
tr = Xt("HTMLVideoElement"), | |
rr = Object.keys(fe).concat([$t, Kt, Jt, Zt, er, tr]), | |
nr = []; | |
(nr[gt] = 1), (nr[wt] = 4), (nr[it] = 2), (nr[yt] = 2), (nr[xt] = 4); | |
var ar = []; | |
function ir(e) { | |
return ( | |
Array.isArray(e) && (0 === e.length || "number" == typeof e[0]) | |
); | |
} | |
function or(e) { | |
return !!Array.isArray(e) && !(0 === e.length || !Le(e[0])); | |
} | |
function fr(e) { | |
return Object.prototype.toString.call(e); | |
} | |
function ur(e) { | |
return fr(e) === $t; | |
} | |
function sr(e) { | |
return fr(e) === Kt; | |
} | |
function cr(e) { | |
if (!e) return !1; | |
var t = fr(e); | |
return rr.indexOf(t) >= 0 || ir(e) || or(e) || ne(e); | |
} | |
function lr(e) { | |
return 0 | fe[Object.prototype.toString.call(e)]; | |
} | |
function dr(e, t) { | |
return te.allocType(e.type === it ? wt : e.type, t); | |
} | |
function mr(e, t) { | |
e.type === it ? ((e.data = Pe(t)), te.freeType(t)) : (e.data = t); | |
} | |
function pr(e, t, r, n, a, i) { | |
var o; | |
if ( | |
((o = void 0 !== ar[e] ? ar[e] : Yt[e] * nr[t]), i && (o *= 6), a) | |
) { | |
for (var f = 0, u = r; u >= 1; ) (f += o * u * u), (u /= 2); | |
return f; | |
} | |
return o * r * n; | |
} | |
function hr(r, n, a, i, o, f, u) { | |
var s = { "don't care": Pt, "dont care": Pt, nice: Rt, fast: Lt }, | |
c = { repeat: kt, clamp: St, mirror: Et }, | |
l = { nearest: jt, linear: Dt }, | |
d = t( | |
{ | |
mipmap: Bt, | |
"nearest mipmap nearest": Ct, | |
"linear mipmap nearest": zt, | |
"nearest mipmap linear": Ft, | |
"linear mipmap linear": Bt, | |
}, | |
l | |
), | |
m = { none: 0, browser: Ht }, | |
p = { uint8: gt, rgba4: Ke, rgb565: Ze, "rgb5 a1": Je }, | |
h = { | |
alpha: He, | |
luminance: qe, | |
"luminance alpha": Qe, | |
rgb: Ne, | |
rgba: Ge, | |
rgba4: Ye, | |
"rgb5 a1": Xe, | |
rgb565: $e, | |
}, | |
b = {}; | |
n.ext_srgb && ((h.srgb = nt), (h.srgba = at)), | |
n.oes_texture_float && (p.float32 = p.float = wt), | |
n.oes_texture_half_float && (p.float16 = p["half float"] = it), | |
n.webgl_depth_texture && | |
(t(h, { depth: tt, "depth stencil": rt }), | |
t(p, { uint16: yt, uint32: xt, "depth stencil": et })), | |
n.webgl_compressed_texture_s3tc && | |
t(b, { | |
"rgb s3tc dxt1": ot, | |
"rgba s3tc dxt1": ft, | |
"rgba s3tc dxt3": ut, | |
"rgba s3tc dxt5": st, | |
}), | |
n.webgl_compressed_texture_atc && | |
t(b, { | |
"rgb atc": ct, | |
"rgba atc explicit alpha": lt, | |
"rgba atc interpolated alpha": dt, | |
}), | |
n.webgl_compressed_texture_pvrtc && | |
t(b, { | |
"rgb pvrtc 4bppv1": mt, | |
"rgb pvrtc 2bppv1": pt, | |
"rgba pvrtc 4bppv1": ht, | |
"rgba pvrtc 2bppv1": bt, | |
}), | |
n.webgl_compressed_texture_etc1 && (b["rgb etc1"] = vt); | |
var v = Array.prototype.slice.call(r.getParameter(Ie)); | |
Object.keys(b).forEach(function (e) { | |
var t = b[e]; | |
v.indexOf(t) >= 0 && (h[e] = t); | |
}); | |
var g = Object.keys(h); | |
a.textureFormats = g; | |
var y = []; | |
Object.keys(h).forEach(function (e) { | |
var t = h[e]; | |
y[t] = e; | |
}); | |
var x = []; | |
Object.keys(p).forEach(function (e) { | |
var t = p[e]; | |
x[t] = e; | |
}); | |
var w = []; | |
Object.keys(l).forEach(function (e) { | |
var t = l[e]; | |
w[t] = e; | |
}); | |
var A = []; | |
Object.keys(d).forEach(function (e) { | |
var t = d[e]; | |
A[t] = e; | |
}); | |
var _ = []; | |
Object.keys(c).forEach(function (e) { | |
var t = c[e]; | |
_[t] = e; | |
}); | |
var k = g.reduce(function (e, t) { | |
var r = h[t]; | |
return ( | |
r === qe || | |
r === He || | |
r === qe || | |
r === Qe || | |
r === tt || | |
r === rt || | |
(n.ext_srgb && (r === nt || r === at)) | |
? (e[r] = r) | |
: r === Xe || t.indexOf("rgba") >= 0 | |
? (e[r] = Ge) | |
: (e[r] = Ne), | |
e | |
); | |
}, {}); | |
function S() { | |
(this.internalformat = Ge), | |
(this.format = Ge), | |
(this.type = gt), | |
(this.compressed = !1), | |
(this.premultiplyAlpha = !1), | |
(this.flipY = !1), | |
(this.unpackAlignment = 1), | |
(this.colorSpace = Ht), | |
(this.width = 0), | |
(this.height = 0), | |
(this.channels = 0); | |
} | |
function E(e, t) { | |
(e.internalformat = t.internalformat), | |
(e.format = t.format), | |
(e.type = t.type), | |
(e.compressed = t.compressed), | |
(e.premultiplyAlpha = t.premultiplyAlpha), | |
(e.flipY = t.flipY), | |
(e.unpackAlignment = t.unpackAlignment), | |
(e.colorSpace = t.colorSpace), | |
(e.width = t.width), | |
(e.height = t.height), | |
(e.channels = t.channels); | |
} | |
function O(e, t) { | |
if ("object" == typeof t && t) { | |
if ( | |
("premultiplyAlpha" in t && | |
(F.type( | |
t.premultiplyAlpha, | |
"boolean", | |
"invalid premultiplyAlpha" | |
), | |
(e.premultiplyAlpha = t.premultiplyAlpha)), | |
"flipY" in t && | |
(F.type(t.flipY, "boolean", "invalid texture flip"), | |
(e.flipY = t.flipY)), | |
"alignment" in t && | |
(F.oneOf( | |
t.alignment, | |
[1, 2, 4, 8], | |
"invalid texture unpack alignment" | |
), | |
(e.unpackAlignment = t.alignment)), | |
"colorSpace" in t && | |
(F.parameter(t.colorSpace, m, "invalid colorSpace"), | |
(e.colorSpace = m[t.colorSpace])), | |
"type" in t) | |
) { | |
var r = t.type; | |
F( | |
n.oes_texture_float || !("float" === r || "float32" === r), | |
"you must enable the OES_texture_float extension in order to use floating point textures." | |
), | |
F( | |
n.oes_texture_half_float || | |
!("half float" === r || "float16" === r), | |
"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures." | |
), | |
F( | |
n.webgl_depth_texture || | |
!( | |
"uint16" === r || | |
"uint32" === r || | |
"depth stencil" === r | |
), | |
"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures." | |
), | |
F.parameter(r, p, "invalid texture type"), | |
(e.type = p[r]); | |
} | |
var i = e.width, | |
o = e.height, | |
f = e.channels, | |
u = !1; | |
"shape" in t | |
? (F( | |
Array.isArray(t.shape) && t.shape.length >= 2, | |
"shape must be an array" | |
), | |
(i = t.shape[0]), | |
(o = t.shape[1]), | |
3 === t.shape.length && | |
((f = t.shape[2]), | |
F(f > 0 && f <= 4, "invalid number of channels"), | |
(u = !0)), | |
F(i >= 0 && i <= a.maxTextureSize, "invalid width"), | |
F(o >= 0 && o <= a.maxTextureSize, "invalid height")) | |
: ("radius" in t && | |
((i = o = t.radius), | |
F(i >= 0 && i <= a.maxTextureSize, "invalid radius")), | |
"width" in t && | |
((i = t.width), | |
F(i >= 0 && i <= a.maxTextureSize, "invalid width")), | |
"height" in t && | |
((o = t.height), | |
F(o >= 0 && o <= a.maxTextureSize, "invalid height")), | |
"channels" in t && | |
((f = t.channels), | |
F(f > 0 && f <= 4, "invalid number of channels"), | |
(u = !0))), | |
(e.width = 0 | i), | |
(e.height = 0 | o), | |
(e.channels = 0 | f); | |
var s = !1; | |
if ("format" in t) { | |
var c = t.format; | |
F( | |
n.webgl_depth_texture || | |
!("depth" === c || "depth stencil" === c), | |
"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures." | |
), | |
F.parameter(c, h, "invalid texture format"); | |
var l = (e.internalformat = h[c]); | |
(e.format = k[l]), | |
c in p && ("type" in t || (e.type = p[c])), | |
c in b && (e.compressed = !0), | |
(s = !0); | |
} | |
!u && s | |
? (e.channels = Yt[e.format]) | |
: u && !s | |
? e.channels !== Qt[e.format] && | |
(e.format = e.internalformat = Qt[e.channels]) | |
: s && | |
u && | |
F( | |
e.channels === Yt[e.format], | |
"number of channels inconsistent with specified format" | |
); | |
} | |
} | |
function T(e) { | |
r.pixelStorei(Wt, e.flipY), | |
r.pixelStorei(Ut, e.premultiplyAlpha), | |
r.pixelStorei(Gt, e.colorSpace), | |
r.pixelStorei(Mt, e.unpackAlignment); | |
} | |
function j() { | |
S.call(this), | |
(this.xOffset = 0), | |
(this.yOffset = 0), | |
(this.data = null), | |
(this.needsFree = !1), | |
(this.element = null), | |
(this.needsCopy = !1); | |
} | |
function D(t, r) { | |
var n = null; | |
if ( | |
(cr(r) | |
? (n = r) | |
: r && | |
(F.type(r, "object", "invalid pixel data type"), | |
O(t, r), | |
"x" in r && (t.xOffset = 0 | r.x), | |
"y" in r && (t.yOffset = 0 | r.y), | |
cr(r.data) && (n = r.data)), | |
F( | |
!t.compressed || n instanceof Uint8Array, | |
"compressed texture data must be stored in a uint8array" | |
), | |
r.copy) | |
) { | |
F( | |
!n, | |
"can not specify copy and data field for the same texture" | |
); | |
var i = o.viewportWidth, | |
f = o.viewportHeight; | |
(t.width = t.width || i - t.xOffset), | |
(t.height = t.height || f - t.yOffset), | |
(t.needsCopy = !0), | |
F( | |
t.xOffset >= 0 && | |
t.xOffset < i && | |
t.yOffset >= 0 && | |
t.yOffset < f && | |
t.width > 0 && | |
t.width <= i && | |
t.height > 0 && | |
t.height <= f, | |
"copy texture read out of bounds" | |
); | |
} else if (n) { | |
if (e(n)) | |
(t.channels = t.channels || 4), | |
(t.data = n), | |
"type" in r || t.type !== gt || (t.type = lr(n)); | |
else if (ir(n)) | |
(t.channels = t.channels || 4), | |
(function (e, t) { | |
var r = t.length; | |
switch (e.type) { | |
case gt: | |
case yt: | |
case xt: | |
case wt: | |
var n = te.allocType(e.type, r); | |
n.set(t), (e.data = n); | |
break; | |
case it: | |
e.data = Pe(t); | |
break; | |
default: | |
F.raise( | |
"unsupported texture type, must specify a typed array" | |
); | |
} | |
})(t, n), | |
(t.alignment = 1), | |
(t.needsFree = !0); | |
else if (ne(n)) { | |
var u = n.data; | |
Array.isArray(u) || t.type !== gt || (t.type = lr(u)); | |
var s, | |
c, | |
l, | |
d, | |
m, | |
p, | |
h = n.shape, | |
b = n.stride; | |
3 === h.length | |
? ((l = h[2]), (p = b[2])) | |
: (F( | |
2 === h.length, | |
"invalid ndarray pixel data, must be 2 or 3D" | |
), | |
(l = 1), | |
(p = 1)), | |
(s = h[0]), | |
(c = h[1]), | |
(d = b[0]), | |
(m = b[1]), | |
(t.alignment = 1), | |
(t.width = s), | |
(t.height = c), | |
(t.channels = l), | |
(t.format = t.internalformat = Qt[l]), | |
(t.needsFree = !0), | |
(function (e, t, r, n, a, i) { | |
for ( | |
var o = e.width, | |
f = e.height, | |
u = e.channels, | |
s = dr(e, o * f * u), | |
c = 0, | |
l = 0; | |
l < f; | |
++l | |
) | |
for (var d = 0; d < o; ++d) | |
for (var m = 0; m < u; ++m) | |
s[c++] = t[r * d + n * l + a * m + i]; | |
mr(e, s); | |
})(t, u, d, m, p, n.offset); | |
} else if (ur(n) || sr(n) || fr(n) === Jt) | |
ur(n) || sr(n) ? (t.element = n) : (t.element = n.canvas), | |
(t.width = t.element.width), | |
(t.height = t.element.height), | |
(t.channels = 4); | |
else if ( | |
(function (e) { | |
return fr(e) === Zt; | |
})(n) | |
) | |
(t.element = n), | |
(t.width = n.width), | |
(t.height = n.height), | |
(t.channels = 4); | |
else if ( | |
(function (e) { | |
return fr(e) === er; | |
})(n) | |
) | |
(t.element = n), | |
(t.width = n.naturalWidth), | |
(t.height = n.naturalHeight), | |
(t.channels = 4); | |
else if ( | |
(function (e) { | |
return fr(e) === tr; | |
})(n) | |
) | |
(t.element = n), | |
(t.width = n.videoWidth), | |
(t.height = n.videoHeight), | |
(t.channels = 4); | |
else if (or(n)) { | |
var v = t.width || n[0].length, | |
g = t.height || n.length, | |
y = t.channels; | |
y = Le(n[0][0]) ? y || n[0][0].length : y || 1; | |
for (var x = ie.shape(n), w = 1, A = 0; A < x.length; ++A) | |
w *= x[A]; | |
var _ = dr(t, w); | |
ie.flatten(n, x, "", _), | |
mr(t, _), | |
(t.alignment = 1), | |
(t.width = v), | |
(t.height = g), | |
(t.channels = y), | |
(t.format = t.internalformat = Qt[y]), | |
(t.needsFree = !0); | |
} | |
} else | |
(t.width = t.width || 1), | |
(t.height = t.height || 1), | |
(t.channels = t.channels || 4); | |
t.type === wt | |
? F( | |
a.extensions.indexOf("oes_texture_float") >= 0, | |
"oes_texture_float extension not enabled" | |
) | |
: t.type === it && | |
F( | |
a.extensions.indexOf("oes_texture_half_float") >= 0, | |
"oes_texture_half_float extension not enabled" | |
); | |
} | |
function C(e, t, n) { | |
var a = e.element, | |
o = e.data, | |
f = e.internalformat, | |
u = e.format, | |
s = e.type, | |
c = e.width, | |
l = e.height; | |
T(e), | |
a | |
? r.texImage2D(t, n, u, u, s, a) | |
: e.compressed | |
? r.compressedTexImage2D(t, n, f, c, l, 0, o) | |
: e.needsCopy | |
? (i(), | |
r.copyTexImage2D(t, n, u, e.xOffset, e.yOffset, c, l, 0)) | |
: r.texImage2D(t, n, u, c, l, 0, u, s, o || null); | |
} | |
function z(e, t, n, a, o) { | |
var f = e.element, | |
u = e.data, | |
s = e.internalformat, | |
c = e.format, | |
l = e.type, | |
d = e.width, | |
m = e.height; | |
T(e), | |
f | |
? r.texSubImage2D(t, o, n, a, c, l, f) | |
: e.compressed | |
? r.compressedTexSubImage2D(t, o, n, a, s, d, m, u) | |
: e.needsCopy | |
? (i(), | |
r.copyTexSubImage2D(t, o, n, a, e.xOffset, e.yOffset, d, m)) | |
: r.texSubImage2D(t, o, n, a, d, m, c, l, u); | |
} | |
var B = []; | |
function V() { | |
return B.pop() || new j(); | |
} | |
function P(e) { | |
e.needsFree && te.freeType(e.data), j.call(e), B.push(e); | |
} | |
function L() { | |
S.call(this), | |
(this.genMipmaps = !1), | |
(this.mipmapHint = Pt), | |
(this.mipmask = 0), | |
(this.images = Array(16)); | |
} | |
function R(e, t, r) { | |
var n = (e.images[0] = V()); | |
(e.mipmask = 1), | |
(n.width = e.width = t), | |
(n.height = e.height = r), | |
(n.channels = e.channels = 4); | |
} | |
function I(e, t) { | |
var r = null; | |
if (cr(t)) | |
E((r = e.images[0] = V()), e), D(r, t), (e.mipmask = 1); | |
else if ((O(e, t), Array.isArray(t.mipmap))) | |
for (var n = t.mipmap, a = 0; a < n.length; ++a) | |
E((r = e.images[a] = V()), e), | |
(r.width >>= a), | |
(r.height >>= a), | |
D(r, n[a]), | |
(e.mipmask |= 1 << a); | |
else E((r = e.images[0] = V()), e), D(r, t), (e.mipmask = 1); | |
E(e, e.images[0]), | |
!e.compressed || | |
(e.internalformat !== ot && | |
e.internalformat !== ft && | |
e.internalformat !== ut && | |
e.internalformat !== st) || | |
F( | |
e.width % 4 == 0 && e.height % 4 == 0, | |
"for compressed texture formats, mipmap level 0 must have width and height that are a multiple of 4" | |
); | |
} | |
function M(e, t) { | |
for (var r = e.images, n = 0; n < r.length; ++n) { | |
if (!r[n]) return; | |
C(r[n], t, n); | |
} | |
} | |
var W = []; | |
function U() { | |
var e = W.pop() || new L(); | |
S.call(e), (e.mipmask = 0); | |
for (var t = 0; t < 16; ++t) e.images[t] = null; | |
return e; | |
} | |
function G(e) { | |
for (var t = e.images, r = 0; r < t.length; ++r) | |
t[r] && P(t[r]), (t[r] = null); | |
W.push(e); | |
} | |
function H() { | |
(this.minFilter = jt), | |
(this.magFilter = jt), | |
(this.wrapS = St), | |
(this.wrapT = St), | |
(this.anisotropic = 1), | |
(this.genMipmaps = !1), | |
(this.mipmapHint = Pt); | |
} | |
function N(e, t) { | |
if ("min" in t) { | |
var r = t.min; | |
F.parameter(r, d), | |
(e.minFilter = d[r]), | |
qt.indexOf(e.minFilter) >= 0 && | |
!("faces" in t) && | |
(e.genMipmaps = !0); | |
} | |
if ("mag" in t) { | |
var n = t.mag; | |
F.parameter(n, l), (e.magFilter = l[n]); | |
} | |
var i = e.wrapS, | |
o = e.wrapT; | |
if ("wrap" in t) { | |
var f = t.wrap; | |
"string" == typeof f | |
? (F.parameter(f, c), (i = o = c[f])) | |
: Array.isArray(f) && | |
(F.parameter(f[0], c), | |
F.parameter(f[1], c), | |
(i = c[f[0]]), | |
(o = c[f[1]])); | |
} else { | |
if ("wrapS" in t) { | |
var u = t.wrapS; | |
F.parameter(u, c), (i = c[u]); | |
} | |
if ("wrapT" in t) { | |
var m = t.wrapT; | |
F.parameter(m, c), (o = c[m]); | |
} | |
} | |
if (((e.wrapS = i), (e.wrapT = o), "anisotropic" in t)) { | |
var p = t.anisotropic; | |
F( | |
"number" == typeof p && p >= 1 && p <= a.maxAnisotropic, | |
"aniso samples must be between 1 and " | |
), | |
(e.anisotropic = t.anisotropic); | |
} | |
if ("mipmap" in t) { | |
var h = !1; | |
switch (typeof t.mipmap) { | |
case "string": | |
F.parameter(t.mipmap, s, "invalid mipmap hint"), | |
(e.mipmapHint = s[t.mipmap]), | |
(e.genMipmaps = !0), | |
(h = !0); | |
break; | |
case "boolean": | |
h = e.genMipmaps = t.mipmap; | |
break; | |
case "object": | |
F(Array.isArray(t.mipmap), "invalid mipmap type"), | |
(e.genMipmaps = !1), | |
(h = !0); | |
break; | |
default: | |
F.raise("invalid mipmap type"); | |
} | |
!h || "min" in t || (e.minFilter = Ct); | |
} | |
} | |
function q(e, t) { | |
r.texParameteri(t, Tt, e.minFilter), | |
r.texParameteri(t, Ot, e.magFilter), | |
r.texParameteri(t, At, e.wrapS), | |
r.texParameteri(t, _t, e.wrapT), | |
n.ext_texture_filter_anisotropic && | |
r.texParameteri(t, It, e.anisotropic), | |
e.genMipmaps && (r.hint(Vt, e.mipmapHint), r.generateMipmap(t)); | |
} | |
var Q = 0, | |
Y = {}, | |
X = a.maxTextureUnits, | |
$ = Array(X).map(function () { | |
return null; | |
}); | |
function K(e) { | |
S.call(this), | |
(this.mipmask = 0), | |
(this.internalformat = Ge), | |
(this.id = Q++), | |
(this.refCount = 1), | |
(this.target = e), | |
(this.texture = r.createTexture()), | |
(this.unit = -1), | |
(this.bindCount = 0), | |
(this.texInfo = new H()), | |
u.profile && (this.stats = { size: 0 }); | |
} | |
function J(e) { | |
r.activeTexture(Nt), r.bindTexture(e.target, e.texture); | |
} | |
function Z() { | |
var e = $[0]; | |
e ? r.bindTexture(e.target, e.texture) : r.bindTexture(Me, null); | |
} | |
function ee(e) { | |
var t = e.texture; | |
F(t, "must not double destroy texture"); | |
var n = e.unit, | |
a = e.target; | |
n >= 0 && | |
(r.activeTexture(Nt + n), | |
r.bindTexture(a, null), | |
($[n] = null)), | |
r.deleteTexture(t), | |
(e.texture = null), | |
(e.params = null), | |
(e.pixels = null), | |
(e.refCount = 0), | |
delete Y[e.id], | |
f.textureCount--; | |
} | |
return ( | |
t(K.prototype, { | |
bind: function () { | |
this.bindCount += 1; | |
var e = this.unit; | |
if (e < 0) { | |
for (var t = 0; t < X; ++t) { | |
var n = $[t]; | |
if (n) { | |
if (n.bindCount > 0) continue; | |
n.unit = -1; | |
} | |
($[t] = this), (e = t); | |
break; | |
} | |
e >= X && F.raise("insufficient number of texture units"), | |
u.profile && | |
f.maxTextureUnits < e + 1 && | |
(f.maxTextureUnits = e + 1), | |
(this.unit = e), | |
r.activeTexture(Nt + e), | |
r.bindTexture(this.target, this.texture); | |
} | |
return e; | |
}, | |
unbind: function () { | |
this.bindCount -= 1; | |
}, | |
decRef: function () { | |
--this.refCount <= 0 && ee(this); | |
}, | |
}), | |
u.profile && | |
(f.getTotalTextureSize = function () { | |
var e = 0; | |
return ( | |
Object.keys(Y).forEach(function (t) { | |
e += Y[t].stats.size; | |
}), | |
e | |
); | |
}), | |
{ | |
create2D: function (e, t) { | |
var n = new K(Me); | |
function i(e, t) { | |
var r = n.texInfo; | |
H.call(r); | |
var o = U(); | |
return ( | |
"number" == typeof e | |
? R(o, 0 | e, "number" == typeof t ? 0 | t : 0 | e) | |
: e | |
? (F.type( | |
e, | |
"object", | |
"invalid arguments to regl.texture" | |
), | |
N(r, e), | |
I(o, e)) | |
: R(o, 1, 1), | |
r.genMipmaps && (o.mipmask = (o.width << 1) - 1), | |
(n.mipmask = o.mipmask), | |
E(n, o), | |
F.texture2D(r, o, a), | |
(n.internalformat = o.internalformat), | |
(i.width = o.width), | |
(i.height = o.height), | |
J(n), | |
M(o, Me), | |
q(r, Me), | |
Z(), | |
G(o), | |
u.profile && | |
(n.stats.size = pr( | |
n.internalformat, | |
n.type, | |
o.width, | |
o.height, | |
r.genMipmaps, | |
!1 | |
)), | |
(i.format = y[n.internalformat]), | |
(i.type = x[n.type]), | |
(i.mag = w[r.magFilter]), | |
(i.min = A[r.minFilter]), | |
(i.wrapS = _[r.wrapS]), | |
(i.wrapT = _[r.wrapT]), | |
i | |
); | |
} | |
return ( | |
(Y[n.id] = n), | |
f.textureCount++, | |
i(e, t), | |
(i.subimage = function (e, t, r, a) { | |
F(!!e, "must specify image data"); | |
var o = 0 | t, | |
f = 0 | r, | |
u = 0 | a, | |
s = V(); | |
return ( | |
E(s, n), | |
(s.width = 0), | |
(s.height = 0), | |
D(s, e), | |
(s.width = s.width || (n.width >> u) - o), | |
(s.height = s.height || (n.height >> u) - f), | |
F( | |
n.type === s.type && | |
n.format === s.format && | |
n.internalformat === s.internalformat, | |
"incompatible format for texture.subimage" | |
), | |
F( | |
o >= 0 && | |
f >= 0 && | |
o + s.width <= n.width && | |
f + s.height <= n.height, | |
"texture.subimage write out of bounds" | |
), | |
F(n.mipmask & (1 << u), "missing mipmap data"), | |
F( | |
s.data || s.element || s.needsCopy, | |
"missing image data" | |
), | |
J(n), | |
z(s, Me, o, f, u), | |
Z(), | |
P(s), | |
i | |
); | |
}), | |
(i.resize = function (e, t) { | |
var a = 0 | e, | |
o = 0 | t || a; | |
if (a === n.width && o === n.height) return i; | |
(i.width = n.width = a), (i.height = n.height = o), J(n); | |
for (var f = 0; n.mipmask >> f; ++f) { | |
var s = a >> f, | |
c = o >> f; | |
if (!s || !c) break; | |
r.texImage2D( | |
Me, | |
f, | |
n.format, | |
s, | |
c, | |
0, | |
n.format, | |
n.type, | |
null | |
); | |
} | |
return ( | |
Z(), | |
u.profile && | |
(n.stats.size = pr( | |
n.internalformat, | |
n.type, | |
a, | |
o, | |
!1, | |
!1 | |
)), | |
i | |
); | |
}), | |
(i._reglType = "texture2d"), | |
(i._texture = n), | |
u.profile && (i.stats = n.stats), | |
(i.destroy = function () { | |
n.decRef(); | |
}), | |
i | |
); | |
}, | |
createCube: function (e, t, n, i, o, s) { | |
var c = new K(We); | |
(Y[c.id] = c), f.cubeCount++; | |
var l = new Array(6); | |
function d(e, t, r, n, i, o) { | |
var f, | |
s = c.texInfo; | |
for (H.call(s), f = 0; f < 6; ++f) l[f] = U(); | |
if ("number" != typeof e && e) | |
if ("object" == typeof e) | |
if (t) | |
I(l[0], e), | |
I(l[1], t), | |
I(l[2], r), | |
I(l[3], n), | |
I(l[4], i), | |
I(l[5], o); | |
else if ((N(s, e), O(c, e), "faces" in e)) { | |
var m = e.faces; | |
for ( | |
F( | |
Array.isArray(m) && 6 === m.length, | |
"cube faces must be a length 6 array" | |
), | |
f = 0; | |
f < 6; | |
++f | |
) | |
F( | |
"object" == typeof m[f] && !!m[f], | |
"invalid input for cube map face" | |
), | |
E(l[f], c), | |
I(l[f], m[f]); | |
} else for (f = 0; f < 6; ++f) I(l[f], e); | |
else F.raise("invalid arguments to cube map"); | |
else { | |
var p = 0 | e || 1; | |
for (f = 0; f < 6; ++f) R(l[f], p, p); | |
} | |
for ( | |
E(c, l[0]), | |
a.npotTextureCube || | |
F( | |
Re(c.width) && Re(c.height), | |
"your browser does not support non power or two texture dimensions" | |
), | |
s.genMipmaps | |
? (c.mipmask = (l[0].width << 1) - 1) | |
: (c.mipmask = l[0].mipmask), | |
F.textureCube(c, s, l, a), | |
c.internalformat = l[0].internalformat, | |
d.width = l[0].width, | |
d.height = l[0].height, | |
J(c), | |
f = 0; | |
f < 6; | |
++f | |
) | |
M(l[f], Ue + f); | |
for ( | |
q(s, We), | |
Z(), | |
u.profile && | |
(c.stats.size = pr( | |
c.internalformat, | |
c.type, | |
d.width, | |
d.height, | |
s.genMipmaps, | |
!0 | |
)), | |
d.format = y[c.internalformat], | |
d.type = x[c.type], | |
d.mag = w[s.magFilter], | |
d.min = A[s.minFilter], | |
d.wrapS = _[s.wrapS], | |
d.wrapT = _[s.wrapT], | |
f = 0; | |
f < 6; | |
++f | |
) | |
G(l[f]); | |
return d; | |
} | |
return ( | |
d(e, t, n, i, o, s), | |
(d.subimage = function (e, t, r, n, a) { | |
F(!!t, "must specify image data"), | |
F( | |
"number" == typeof e && | |
e === (0 | e) && | |
e >= 0 && | |
e < 6, | |
"invalid face" | |
); | |
var i = 0 | r, | |
o = 0 | n, | |
f = 0 | a, | |
u = V(); | |
return ( | |
E(u, c), | |
(u.width = 0), | |
(u.height = 0), | |
D(u, t), | |
(u.width = u.width || (c.width >> f) - i), | |
(u.height = u.height || (c.height >> f) - o), | |
F( | |
c.type === u.type && | |
c.format === u.format && | |
c.internalformat === u.internalformat, | |
"incompatible format for texture.subimage" | |
), | |
F( | |
i >= 0 && | |
o >= 0 && | |
i + u.width <= c.width && | |
o + u.height <= c.height, | |
"texture.subimage write out of bounds" | |
), | |
F(c.mipmask & (1 << f), "missing mipmap data"), | |
F( | |
u.data || u.element || u.needsCopy, | |
"missing image data" | |
), | |
J(c), | |
z(u, Ue + e, i, o, f), | |
Z(), | |
P(u), | |
d | |
); | |
}), | |
(d.resize = function (e) { | |
var t = 0 | e; | |
if (t !== c.width) { | |
(d.width = c.width = t), | |
(d.height = c.height = t), | |
J(c); | |
for (var n = 0; n < 6; ++n) | |
for (var a = 0; c.mipmask >> a; ++a) | |
r.texImage2D( | |
Ue + n, | |
a, | |
c.format, | |
t >> a, | |
t >> a, | |
0, | |
c.format, | |
c.type, | |
null | |
); | |
return ( | |
Z(), | |
u.profile && | |
(c.stats.size = pr( | |
c.internalformat, | |
c.type, | |
d.width, | |
d.height, | |
!1, | |
!0 | |
)), | |
d | |
); | |
} | |
}), | |
(d._reglType = "textureCube"), | |
(d._texture = c), | |
u.profile && (d.stats = c.stats), | |
(d.destroy = function () { | |
c.decRef(); | |
}), | |
d | |
); | |
}, | |
clear: function () { | |
for (var e = 0; e < X; ++e) | |
r.activeTexture(Nt + e), | |
r.bindTexture(Me, null), | |
($[e] = null); | |
ae(Y).forEach(ee), (f.cubeCount = 0), (f.textureCount = 0); | |
}, | |
getTexture: function (e) { | |
return null; | |
}, | |
restore: function () { | |
for (var e = 0; e < X; ++e) { | |
var t = $[e]; | |
t && ((t.bindCount = 0), (t.unit = -1), ($[e] = null)); | |
} | |
ae(Y).forEach(function (e) { | |
(e.texture = r.createTexture()), | |
r.bindTexture(e.target, e.texture); | |
for (var t = 0; t < 32; ++t) | |
if (0 != (e.mipmask & (1 << t))) | |
if (e.target === Me) | |
r.texImage2D( | |
Me, | |
t, | |
e.internalformat, | |
e.width >> t, | |
e.height >> t, | |
0, | |
e.internalformat, | |
e.type, | |
null | |
); | |
else | |
for (var n = 0; n < 6; ++n) | |
r.texImage2D( | |
Ue + n, | |
t, | |
e.internalformat, | |
e.width >> t, | |
e.height >> t, | |
0, | |
e.internalformat, | |
e.type, | |
null | |
); | |
q(e.texInfo, e.target); | |
}); | |
}, | |
} | |
); | |
} | |
(ar[Ye] = 2), | |
(ar[Xe] = 2), | |
(ar[$e] = 2), | |
(ar[rt] = 4), | |
(ar[ot] = 0.5), | |
(ar[ft] = 0.5), | |
(ar[ut] = 1), | |
(ar[st] = 1), | |
(ar[ct] = 0.5), | |
(ar[lt] = 1), | |
(ar[dt] = 1), | |
(ar[mt] = 0.5), | |
(ar[pt] = 0.25), | |
(ar[ht] = 0.5), | |
(ar[bt] = 0.25), | |
(ar[vt] = 0.5); | |
var br = 36161, | |
vr = 32854, | |
gr = []; | |
function yr(e, t, r) { | |
return gr[e] * t * r; | |
} | |
(gr[vr] = 2), | |
(gr[32855] = 2), | |
(gr[36194] = 2), | |
(gr[33189] = 2), | |
(gr[36168] = 1), | |
(gr[34041] = 4), | |
(gr[35907] = 4), | |
(gr[34836] = 16), | |
(gr[34842] = 8), | |
(gr[34843] = 6); | |
var xr = function (e, t, r, n, a) { | |
var i = { | |
rgba4: vr, | |
rgb565: 36194, | |
"rgb5 a1": 32855, | |
depth: 33189, | |
stencil: 36168, | |
"depth stencil": 34041, | |
}; | |
t.ext_srgb && (i.srgba = 35907), | |
t.ext_color_buffer_half_float && | |
((i.rgba16f = 34842), (i.rgb16f = 34843)), | |
t.webgl_color_buffer_float && (i.rgba32f = 34836); | |
var o = []; | |
Object.keys(i).forEach(function (e) { | |
var t = i[e]; | |
o[t] = e; | |
}); | |
var f = 0, | |
u = {}; | |
function s(e) { | |
(this.id = f++), | |
(this.refCount = 1), | |
(this.renderbuffer = e), | |
(this.format = vr), | |
(this.width = 0), | |
(this.height = 0), | |
a.profile && (this.stats = { size: 0 }); | |
} | |
function c(t) { | |
var r = t.renderbuffer; | |
F(r, "must not double destroy renderbuffer"), | |
e.bindRenderbuffer(br, null), | |
e.deleteRenderbuffer(r), | |
(t.renderbuffer = null), | |
(t.refCount = 0), | |
delete u[t.id], | |
n.renderbufferCount--; | |
} | |
return ( | |
(s.prototype.decRef = function () { | |
--this.refCount <= 0 && c(this); | |
}), | |
a.profile && | |
(n.getTotalRenderbufferSize = function () { | |
var e = 0; | |
return ( | |
Object.keys(u).forEach(function (t) { | |
e += u[t].stats.size; | |
}), | |
e | |
); | |
}), | |
{ | |
create: function (t, f) { | |
var c = new s(e.createRenderbuffer()); | |
function l(t, n) { | |
var f = 0, | |
u = 0, | |
s = vr; | |
if ("object" == typeof t && t) { | |
var d = t; | |
if ("shape" in d) { | |
var m = d.shape; | |
F( | |
Array.isArray(m) && m.length >= 2, | |
"invalid renderbuffer shape" | |
), | |
(f = 0 | m[0]), | |
(u = 0 | m[1]); | |
} else | |
"radius" in d && (f = u = 0 | d.radius), | |
"width" in d && (f = 0 | d.width), | |
"height" in d && (u = 0 | d.height); | |
"format" in d && | |
(F.parameter( | |
d.format, | |
i, | |
"invalid renderbuffer format" | |
), | |
(s = i[d.format])); | |
} else | |
"number" == typeof t | |
? ((f = 0 | t), | |
(u = "number" == typeof n ? 0 | n : f)) | |
: t | |
? F.raise( | |
"invalid arguments to renderbuffer constructor" | |
) | |
: (f = u = 1); | |
if ( | |
(F( | |
f > 0 && | |
u > 0 && | |
f <= r.maxRenderbufferSize && | |
u <= r.maxRenderbufferSize, | |
"invalid renderbuffer size" | |
), | |
f !== c.width || u !== c.height || s !== c.format) | |
) | |
return ( | |
(l.width = c.width = f), | |
(l.height = c.height = u), | |
(c.format = s), | |
e.bindRenderbuffer(br, c.renderbuffer), | |
e.renderbufferStorage(br, s, f, u), | |
F(0 === e.getError(), "invalid render buffer format"), | |
a.profile && | |
(c.stats.size = yr(c.format, c.width, c.height)), | |
(l.format = o[c.format]), | |
l | |
); | |
} | |
return ( | |
(u[c.id] = c), | |
n.renderbufferCount++, | |
l(t, f), | |
(l.resize = function (t, n) { | |
var i = 0 | t, | |
o = 0 | n || i; | |
return i === c.width && o === c.height | |
? l | |
: (F( | |
i > 0 && | |
o > 0 && | |
i <= r.maxRenderbufferSize && | |
o <= r.maxRenderbufferSize, | |
"invalid renderbuffer size" | |
), | |
(l.width = c.width = i), | |
(l.height = c.height = o), | |
e.bindRenderbuffer(br, c.renderbuffer), | |
e.renderbufferStorage(br, c.format, i, o), | |
F( | |
0 === e.getError(), | |
"invalid render buffer format" | |
), | |
a.profile && | |
(c.stats.size = yr(c.format, c.width, c.height)), | |
l); | |
}), | |
(l._reglType = "renderbuffer"), | |
(l._renderbuffer = c), | |
a.profile && (l.stats = c.stats), | |
(l.destroy = function () { | |
c.decRef(); | |
}), | |
l | |
); | |
}, | |
clear: function () { | |
ae(u).forEach(c); | |
}, | |
restore: function () { | |
ae(u).forEach(function (t) { | |
(t.renderbuffer = e.createRenderbuffer()), | |
e.bindRenderbuffer(br, t.renderbuffer), | |
e.renderbufferStorage(br, t.format, t.width, t.height); | |
}), | |
e.bindRenderbuffer(br, null); | |
}, | |
} | |
); | |
}, | |
wr = 36160, | |
Ar = 36161, | |
_r = 3553, | |
kr = 34069, | |
Sr = 36064, | |
Er = 36096, | |
Or = 36128, | |
Tr = 33306, | |
jr = 36053, | |
Dr = 6402, | |
Cr = [6407, 6408], | |
zr = []; | |
(zr[6408] = 4), (zr[6407] = 3); | |
var Fr = []; | |
(Fr[5121] = 1), (Fr[5126] = 4), (Fr[36193] = 2); | |
var Br = 33189, | |
Vr = 36168, | |
Pr = 34041, | |
Lr = [32854, 32855, 36194, 35907, 34842, 34843, 34836], | |
Rr = {}; | |
(Rr[jr] = "complete"), | |
(Rr[36054] = "incomplete attachment"), | |
(Rr[36057] = "incomplete dimensions"), | |
(Rr[36055] = "incomplete, missing attachment"), | |
(Rr[36061] = "unsupported"); | |
var Ir = 5126, | |
Mr = 34962; | |
function Wr() { | |
(this.state = 0), | |
(this.x = 0), | |
(this.y = 0), | |
(this.z = 0), | |
(this.w = 0), | |
(this.buffer = null), | |
(this.size = 0), | |
(this.normalized = !1), | |
(this.type = Ir), | |
(this.offset = 0), | |
(this.stride = 0), | |
(this.divisor = 0); | |
} | |
var Ur = 35632, | |
Gr = 35633, | |
Hr = 35718, | |
Nr = 35721; | |
var qr = 6408, | |
Qr = 5121, | |
Yr = 3333, | |
Xr = 5126; | |
function $r(t, r, n, a, i, o, f) { | |
function u(u) { | |
var s; | |
null === r.next | |
? (F( | |
i.preserveDrawingBuffer, | |
'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer' | |
), | |
(s = Qr)) | |
: (F( | |
null !== r.next.colorAttachments[0].texture, | |
"You cannot read from a renderbuffer" | |
), | |
(s = r.next.colorAttachments[0].texture._texture.type), | |
o.oes_texture_float | |
? (F( | |
s === Qr || s === Xr, | |
"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'" | |
), | |
s === Xr && | |
F( | |
f.readFloat, | |
"Reading 'float' values is not permitted in your browser. For a fallback, please see: https://www.npmjs.com/package/glsl-read-float" | |
)) | |
: F( | |
s === Qr, | |
"Reading from a framebuffer is only allowed for the type 'uint8'" | |
)); | |
var c = 0, | |
l = 0, | |
d = a.framebufferWidth, | |
m = a.framebufferHeight, | |
p = null; | |
e(u) | |
? (p = u) | |
: u && | |
(F.type(u, "object", "invalid arguments to regl.read()"), | |
(c = 0 | u.x), | |
(l = 0 | u.y), | |
F( | |
c >= 0 && c < a.framebufferWidth, | |
"invalid x offset for regl.read" | |
), | |
F( | |
l >= 0 && l < a.framebufferHeight, | |
"invalid y offset for regl.read" | |
), | |
(d = 0 | (u.width || a.framebufferWidth - c)), | |
(m = 0 | (u.height || a.framebufferHeight - l)), | |
(p = u.data || null)), | |
p && | |
(s === Qr | |
? F( | |
p instanceof Uint8Array, | |
"buffer must be 'Uint8Array' when reading from a framebuffer of type 'uint8'" | |
) | |
: s === Xr && | |
F( | |
p instanceof Float32Array, | |
"buffer must be 'Float32Array' when reading from a framebuffer of type 'float'" | |
)), | |
F( | |
d > 0 && d + c <= a.framebufferWidth, | |
"invalid width for read pixels" | |
), | |
F( | |
m > 0 && m + l <= a.framebufferHeight, | |
"invalid height for read pixels" | |
), | |
n(); | |
var h = d * m * 4; | |
return ( | |
p || | |
(s === Qr | |
? (p = new Uint8Array(h)) | |
: s === Xr && (p = p || new Float32Array(h))), | |
F.isTypedArray( | |
p, | |
"data buffer for regl.read() must be a typedarray" | |
), | |
F(p.byteLength >= h, "data buffer for regl.read() too small"), | |
t.pixelStorei(Yr, 4), | |
t.readPixels(c, l, d, m, qr, s, p), | |
p | |
); | |
} | |
return function (e) { | |
return e && "framebuffer" in e | |
? (function (e) { | |
var t; | |
return ( | |
r.setFBO({ framebuffer: e.framebuffer }, function () { | |
t = u(e); | |
}), | |
t | |
); | |
})(e) | |
: u(e); | |
}; | |
} | |
function Kr(e) { | |
return Array.prototype.slice.call(e); | |
} | |
function Jr(e) { | |
return Kr(e).join(""); | |
} | |
var Zr = "xyzw".split(""), | |
en = 5121, | |
tn = 1, | |
rn = 2, | |
nn = 0, | |
an = 1, | |
on = 2, | |
fn = 3, | |
un = 4, | |
sn = "dither", | |
cn = "blend.enable", | |
ln = "blend.color", | |
dn = "blend.equation", | |
mn = "blend.func", | |
pn = "depth.enable", | |
hn = "depth.func", | |
bn = "depth.range", | |
vn = "depth.mask", | |
gn = "colorMask", | |
yn = "cull.enable", | |
xn = "cull.face", | |
wn = "frontFace", | |
An = "lineWidth", | |
_n = "polygonOffset.enable", | |
kn = "polygonOffset.offset", | |
Sn = "sample.alpha", | |
En = "sample.enable", | |
On = "sample.coverage", | |
Tn = "stencil.enable", | |
jn = "stencil.mask", | |
Dn = "stencil.func", | |
Cn = "stencil.opFront", | |
zn = "stencil.opBack", | |
Fn = "scissor.enable", | |
Bn = "scissor.box", | |
Vn = "viewport", | |
Pn = "profile", | |
Ln = "framebuffer", | |
Rn = "vert", | |
In = "frag", | |
Mn = "elements", | |
Wn = "primitive", | |
Un = "count", | |
Gn = "offset", | |
Hn = "instances", | |
Nn = "vao", | |
qn = Ln + "Width", | |
Qn = Ln + "Height", | |
Yn = Vn + "Width", | |
Xn = Vn + "Height", | |
$n = "drawingBufferWidth", | |
Kn = "drawingBufferHeight", | |
Jn = [mn, dn, Dn, Cn, zn, On, Vn, Bn, kn], | |
Zn = 34962, | |
ea = 34963, | |
ta = 3553, | |
ra = 34067, | |
na = 2884, | |
aa = 3042, | |
ia = 3024, | |
oa = 2960, | |
fa = 2929, | |
ua = 3089, | |
sa = 32823, | |
ca = 32926, | |
la = 32928, | |
da = 5126, | |
ma = 35664, | |
pa = 35665, | |
ha = 35666, | |
ba = 5124, | |
va = 35667, | |
ga = 35668, | |
ya = 35669, | |
xa = 35670, | |
wa = 35671, | |
Aa = 35672, | |
_a = 35673, | |
ka = 35674, | |
Sa = 35675, | |
Ea = 35676, | |
Oa = 35678, | |
Ta = 35680, | |
ja = 4, | |
Da = 1028, | |
Ca = 1029, | |
za = 2304, | |
Fa = 2305, | |
Ba = 32775, | |
Va = 32776, | |
Pa = 519, | |
La = 7680, | |
Ra = 0, | |
Ia = 1, | |
Ma = 32774, | |
Wa = 513, | |
Ua = 36160, | |
Ga = 36064, | |
Ha = { | |
0: 0, | |
1: 1, | |
zero: 0, | |
one: 1, | |
"src color": 768, | |
"one minus src color": 769, | |
"src alpha": 770, | |
"one minus src alpha": 771, | |
"dst color": 774, | |
"one minus dst color": 775, | |
"dst alpha": 772, | |
"one minus dst alpha": 773, | |
"constant color": 32769, | |
"one minus constant color": 32770, | |
"constant alpha": 32771, | |
"one minus constant alpha": 32772, | |
"src alpha saturate": 776, | |
}, | |
Na = [ | |
"constant color, constant alpha", | |
"one minus constant color, constant alpha", | |
"constant color, one minus constant alpha", | |
"one minus constant color, one minus constant alpha", | |
"constant alpha, constant color", | |
"constant alpha, one minus constant color", | |
"one minus constant alpha, constant color", | |
"one minus constant alpha, one minus constant color", | |
], | |
qa = { | |
never: 512, | |
less: 513, | |
"<": 513, | |
equal: 514, | |
"=": 514, | |
"==": 514, | |
"===": 514, | |
lequal: 515, | |
"<=": 515, | |
greater: 516, | |
">": 516, | |
notequal: 517, | |
"!=": 517, | |
"!==": 517, | |
gequal: 518, | |
">=": 518, | |
always: 519, | |
}, | |
Qa = { | |
0: 0, | |
zero: 0, | |
keep: 7680, | |
replace: 7681, | |
increment: 7682, | |
decrement: 7683, | |
"increment wrap": 34055, | |
"decrement wrap": 34056, | |
invert: 5386, | |
}, | |
Ya = { frag: 35632, vert: 35633 }, | |
Xa = { cw: za, ccw: Fa }; | |
function $a(t) { | |
return Array.isArray(t) || e(t) || ne(t); | |
} | |
function Ka(e) { | |
return e.sort(function (e, t) { | |
return e === Vn ? -1 : t === Vn ? 1 : e < t ? -1 : 1; | |
}); | |
} | |
function Ja(e, t, r, n) { | |
(this.thisDep = e), | |
(this.contextDep = t), | |
(this.propDep = r), | |
(this.append = n); | |
} | |
function Za(e) { | |
return e && !(e.thisDep || e.contextDep || e.propDep); | |
} | |
function ei(e) { | |
return new Ja(!1, !1, !1, e); | |
} | |
function ti(e, t) { | |
var r = e.type; | |
if (r === nn) { | |
var n = e.data.length; | |
return new Ja(!0, n >= 1, n >= 2, t); | |
} | |
if (r === un) { | |
var a = e.data; | |
return new Ja(a.thisDep, a.contextDep, a.propDep, t); | |
} | |
return new Ja(r === fn, r === on, r === an, t); | |
} | |
var ri = new Ja(!1, !1, !1, function () {}); | |
function ni(e, r, n, a, i, o, f, u, s, c, l, d, m, p, h) { | |
var b = c.Record, | |
v = { add: 32774, subtract: 32778, "reverse subtract": 32779 }; | |
n.ext_blend_minmax && ((v.min = Ba), (v.max = Va)); | |
var g = n.angle_instanced_arrays, | |
y = n.webgl_draw_buffers, | |
x = { dirty: !0, profile: h.profile }, | |
w = {}, | |
A = [], | |
_ = {}, | |
k = {}; | |
function S(e) { | |
return e.replace(".", "_"); | |
} | |
function E(e, t, r) { | |
var n = S(e); | |
A.push(e), (w[n] = x[n] = !!r), (_[n] = t); | |
} | |
function O(e, t, r) { | |
var n = S(e); | |
A.push(e), | |
Array.isArray(r) | |
? ((x[n] = r.slice()), (w[n] = r.slice())) | |
: (x[n] = w[n] = r), | |
(k[n] = t); | |
} | |
E(sn, ia), | |
E(cn, aa), | |
O(ln, "blendColor", [0, 0, 0, 0]), | |
O(dn, "blendEquationSeparate", [Ma, Ma]), | |
O(mn, "blendFuncSeparate", [Ia, Ra, Ia, Ra]), | |
E(pn, fa, !0), | |
O(hn, "depthFunc", Wa), | |
O(bn, "depthRange", [0, 1]), | |
O(vn, "depthMask", !0), | |
O(gn, gn, [!0, !0, !0, !0]), | |
E(yn, na), | |
O(xn, "cullFace", Ca), | |
O(wn, wn, Fa), | |
O(An, An, 1), | |
E(_n, sa), | |
O(kn, "polygonOffset", [0, 0]), | |
E(Sn, ca), | |
E(En, la), | |
O(On, "sampleCoverage", [1, !1]), | |
E(Tn, oa), | |
O(jn, "stencilMask", -1), | |
O(Dn, "stencilFunc", [Pa, 0, -1]), | |
O(Cn, "stencilOpSeparate", [Da, La, La, La]), | |
O(zn, "stencilOpSeparate", [Ca, La, La, La]), | |
E(Fn, ua), | |
O(Bn, "scissor", [ | |
0, | |
0, | |
e.drawingBufferWidth, | |
e.drawingBufferHeight, | |
]), | |
O(Vn, Vn, [0, 0, e.drawingBufferWidth, e.drawingBufferHeight]); | |
var T = { | |
gl: e, | |
context: m, | |
strings: r, | |
next: w, | |
current: x, | |
draw: d, | |
elements: o, | |
buffer: i, | |
shader: l, | |
attributes: c.state, | |
vao: c, | |
uniforms: s, | |
framebuffer: u, | |
extensions: n, | |
timer: p, | |
isBufferArgs: $a, | |
}, | |
j = { | |
primTypes: xe, | |
compareFuncs: qa, | |
blendFuncs: Ha, | |
blendEquations: v, | |
stencilOps: Qa, | |
glTypes: ue, | |
orientationType: Xa, | |
}; | |
F.optional(function () { | |
T.isArrayLike = Le; | |
}), | |
y && | |
((j.backBuffer = [Ca]), | |
(j.drawBuffer = N(a.maxDrawbuffers, function (e) { | |
return 0 === e | |
? [0] | |
: N(e, function (e) { | |
return Ga + e; | |
}); | |
}))); | |
var D = 0; | |
function C() { | |
var e = (function () { | |
var e = 0, | |
r = [], | |
n = []; | |
function a() { | |
var r = [], | |
n = []; | |
return t( | |
function () { | |
r.push.apply(r, Kr(arguments)); | |
}, | |
{ | |
def: function () { | |
var t = "v" + e++; | |
return ( | |
n.push(t), | |
arguments.length > 0 && | |
(r.push(t, "="), | |
r.push.apply(r, Kr(arguments)), | |
r.push(";")), | |
t | |
); | |
}, | |
toString: function () { | |
return Jr([ | |
n.length > 0 ? "var " + n.join(",") + ";" : "", | |
Jr(r), | |
]); | |
}, | |
} | |
); | |
} | |
function i() { | |
var e = a(), | |
r = a(), | |
n = e.toString, | |
i = r.toString; | |
function o(t, n) { | |
r(t, n, "=", e.def(t, n), ";"); | |
} | |
return t( | |
function () { | |
e.apply(e, Kr(arguments)); | |
}, | |
{ | |
def: e.def, | |
entry: e, | |
exit: r, | |
save: o, | |
set: function (t, r, n) { | |
o(t, r), e(t, r, "=", n, ";"); | |
}, | |
toString: function () { | |
return n() + i(); | |
}, | |
} | |
); | |
} | |
var o = a(), | |
f = {}; | |
return { | |
global: o, | |
link: function (t) { | |
for (var a = 0; a < n.length; ++a) | |
if (n[a] === t) return r[a]; | |
var i = "g" + e++; | |
return r.push(i), n.push(t), i; | |
}, | |
block: a, | |
proc: function (e, r) { | |
var n = []; | |
function a() { | |
var e = "a" + n.length; | |
return n.push(e), e; | |
} | |
r = r || 0; | |
for (var o = 0; o < r; ++o) a(); | |
var u = i(), | |
s = u.toString; | |
return (f[e] = t(u, { | |
arg: a, | |
toString: function () { | |
return Jr(["function(", n.join(), "){", s(), "}"]); | |
}, | |
})); | |
}, | |
scope: i, | |
cond: function () { | |
var e = Jr(arguments), | |
r = i(), | |
n = i(), | |
a = r.toString, | |
o = n.toString; | |
return t(r, { | |
then: function () { | |
return r.apply(r, Kr(arguments)), this; | |
}, | |
else: function () { | |
return n.apply(n, Kr(arguments)), this; | |
}, | |
toString: function () { | |
var t = o(); | |
return ( | |
t && (t = "else{" + t + "}"), | |
Jr(["if(", e, "){", a(), "}", t]) | |
); | |
}, | |
}); | |
}, | |
compile: function () { | |
var e = ['"use strict";', o, "return {"]; | |
Object.keys(f).forEach(function (t) { | |
e.push('"', t, '":', f[t].toString(), ","); | |
}), | |
e.push("}"); | |
var t = Jr(e) | |
.replace(/;/g, ";\n") | |
.replace(/}/g, "}\n") | |
.replace(/{/g, "{\n"); | |
return Function.apply(null, r.concat(t)).apply(null, n); | |
}, | |
}; | |
})(), | |
n = e.link, | |
a = e.global; | |
(e.id = D++), (e.batchId = "0"); | |
var i = n(T), | |
o = (e.shared = { props: "a0" }); | |
Object.keys(T).forEach(function (e) { | |
o[e] = a.def(i, ".", e); | |
}), | |
F.optional(function () { | |
(e.CHECK = n(F)), | |
(e.commandStr = F.guessCommand()), | |
(e.command = n(e.commandStr)), | |
(e.assert = function (e, t, r) { | |
e( | |
"if(!(", | |
t, | |
"))", | |
this.CHECK, | |
".commandRaise(", | |
n(r), | |
",", | |
this.command, | |
");" | |
); | |
}), | |
(j.invalidBlendCombinations = Na); | |
}); | |
var f = (e.next = {}), | |
u = (e.current = {}); | |
Object.keys(k).forEach(function (e) { | |
Array.isArray(x[e]) && | |
((f[e] = a.def(o.next, ".", e)), | |
(u[e] = a.def(o.current, ".", e))); | |
}); | |
var s = (e.constants = {}); | |
Object.keys(j).forEach(function (e) { | |
s[e] = a.def(JSON.stringify(j[e])); | |
}), | |
(e.invoke = function (t, r) { | |
switch (r.type) { | |
case nn: | |
var a = ["this", o.context, o.props, e.batchId]; | |
return t.def( | |
n(r.data), | |
".call(", | |
a.slice(0, Math.max(r.data.length + 1, 4)), | |
")" | |
); | |
case an: | |
return t.def(o.props, r.data); | |
case on: | |
return t.def(o.context, r.data); | |
case fn: | |
return t.def("this", r.data); | |
case un: | |
return r.data.append(e, t), r.data.ref; | |
} | |
}), | |
(e.attribCache = {}); | |
var l = {}; | |
return ( | |
(e.scopeAttrib = function (e) { | |
var t = r.id(e); | |
if (t in l) return l[t]; | |
var a = c.scope[t]; | |
return a || (a = c.scope[t] = new b()), (l[t] = n(a)); | |
}), | |
e | |
); | |
} | |
function z(e, t, f, s, d) { | |
var m = e.static, | |
p = e.dynamic; | |
F.optional(function () { | |
var e = [Ln, Rn, In, Mn, Wn, Gn, Un, Hn, Pn, Nn].concat(A); | |
function t(t) { | |
Object.keys(t).forEach(function (t) { | |
F.command( | |
e.indexOf(t) >= 0, | |
'unknown parameter "' + t + '"', | |
d.commandStr | |
); | |
}); | |
} | |
t(m), t(p); | |
}); | |
var h = (function (e, t) { | |
var r = e.static; | |
if ("string" == typeof r[In] && "string" == typeof r[Rn]) { | |
if (Object.keys(t.dynamic).length > 0) return null; | |
var n = t.static, | |
a = Object.keys(n); | |
if (a.length > 0 && "number" == typeof n[a[0]]) { | |
for (var i = [], o = 0; o < a.length; ++o) | |
F( | |
"number" == typeof n[a[o]], | |
"must specify all vertex attribute locations when using vaos" | |
), | |
i.push([0 | n[a[o]], a[o]]); | |
return i; | |
} | |
} | |
return null; | |
})(e, t), | |
y = (function (e, t) { | |
var r = e.static, | |
n = e.dynamic; | |
if (Ln in r) { | |
var a = r[Ln]; | |
return a | |
? ((a = u.getFramebuffer(a)), | |
F.command(a, "invalid framebuffer object"), | |
ei(function (e, t) { | |
var r = e.link(a), | |
n = e.shared; | |
t.set(n.framebuffer, ".next", r); | |
var i = n.context; | |
return ( | |
t.set(i, "." + qn, r + ".width"), | |
t.set(i, "." + Qn, r + ".height"), | |
r | |
); | |
})) | |
: ei(function (e, t) { | |
var r = e.shared; | |
t.set(r.framebuffer, ".next", "null"); | |
var n = r.context; | |
return ( | |
t.set(n, "." + qn, n + "." + $n), | |
t.set(n, "." + Qn, n + "." + Kn), | |
"null" | |
); | |
}); | |
} | |
if (Ln in n) { | |
var i = n[Ln]; | |
return ti(i, function (e, t) { | |
var r = e.invoke(t, i), | |
n = e.shared, | |
a = n.framebuffer, | |
o = t.def(a, ".getFramebuffer(", r, ")"); | |
F.optional(function () { | |
e.assert( | |
t, | |
"!" + r + "||" + o, | |
"invalid framebuffer object" | |
); | |
}), | |
t.set(a, ".next", o); | |
var f = n.context; | |
return ( | |
t.set( | |
f, | |
"." + qn, | |
o + "?" + o + ".width:" + f + "." + $n | |
), | |
t.set( | |
f, | |
"." + Qn, | |
o + "?" + o + ".height:" + f + "." + Kn | |
), | |
o | |
); | |
}); | |
} | |
return null; | |
})(e), | |
x = (function (e, t, r) { | |
var n = e.static, | |
a = e.dynamic; | |
function i(e) { | |
if (e in n) { | |
var i = n[e]; | |
F.commandType(i, "object", "invalid " + e, r.commandStr); | |
var o, | |
f, | |
u = !0, | |
s = 0 | i.x, | |
c = 0 | i.y; | |
return ( | |
"width" in i | |
? ((o = 0 | i.width), | |
F.command(o >= 0, "invalid " + e, r.commandStr)) | |
: (u = !1), | |
"height" in i | |
? ((f = 0 | i.height), | |
F.command(f >= 0, "invalid " + e, r.commandStr)) | |
: (u = !1), | |
new Ja( | |
!u && t && t.thisDep, | |
!u && t && t.contextDep, | |
!u && t && t.propDep, | |
function (e, t) { | |
var r = e.shared.context, | |
n = o; | |
"width" in i || (n = t.def(r, ".", qn, "-", s)); | |
var a = f; | |
return ( | |
"height" in i || (a = t.def(r, ".", Qn, "-", c)), | |
[s, c, n, a] | |
); | |
} | |
) | |
); | |
} | |
if (e in a) { | |
var l = a[e], | |
d = ti(l, function (t, r) { | |
var n = t.invoke(r, l); | |
F.optional(function () { | |
t.assert( | |
r, | |
n + "&&typeof " + n + '==="object"', | |
"invalid " + e | |
); | |
}); | |
var a = t.shared.context, | |
i = r.def(n, ".x|0"), | |
o = r.def(n, ".y|0"), | |
f = r.def( | |
'"width" in ', | |
n, | |
"?", | |
n, | |
".width|0:", | |
"(", | |
a, | |
".", | |
qn, | |
"-", | |
i, | |
")" | |
), | |
u = r.def( | |
'"height" in ', | |
n, | |
"?", | |
n, | |
".height|0:", | |
"(", | |
a, | |
".", | |
Qn, | |
"-", | |
o, | |
")" | |
); | |
return ( | |
F.optional(function () { | |
t.assert( | |
r, | |
f + ">=0&&" + u + ">=0", | |
"invalid " + e | |
); | |
}), | |
[i, o, f, u] | |
); | |
}); | |
return ( | |
t && | |
((d.thisDep = d.thisDep || t.thisDep), | |
(d.contextDep = d.contextDep || t.contextDep), | |
(d.propDep = d.propDep || t.propDep)), | |
d | |
); | |
} | |
return t | |
? new Ja(t.thisDep, t.contextDep, t.propDep, function ( | |
e, | |
t | |
) { | |
var r = e.shared.context; | |
return [0, 0, t.def(r, ".", qn), t.def(r, ".", Qn)]; | |
}) | |
: null; | |
} | |
var o = i(Vn); | |
if (o) { | |
var f = o; | |
o = new Ja(o.thisDep, o.contextDep, o.propDep, function ( | |
e, | |
t | |
) { | |
var r = f.append(e, t), | |
n = e.shared.context; | |
return ( | |
t.set(n, "." + Yn, r[2]), t.set(n, "." + Xn, r[3]), r | |
); | |
}); | |
} | |
return { viewport: o, scissor_box: i(Bn) }; | |
})(e, y, d), | |
w = (function (e, t) { | |
var r = e.static, | |
n = e.dynamic, | |
a = (function () { | |
if (Mn in r) { | |
var e = r[Mn]; | |
$a(e) | |
? (e = o.getElements(o.create(e, !0))) | |
: e && | |
((e = o.getElements(e)), | |
F.command(e, "invalid elements", t.commandStr)); | |
var a = ei(function (t, r) { | |
if (e) { | |
var n = t.link(e); | |
return (t.ELEMENTS = n), n; | |
} | |
return (t.ELEMENTS = null), null; | |
}); | |
return (a.value = e), a; | |
} | |
if (Mn in n) { | |
var i = n[Mn]; | |
return ti(i, function (e, t) { | |
var r = e.shared, | |
n = r.isBufferArgs, | |
a = r.elements, | |
o = e.invoke(t, i), | |
f = t.def("null"), | |
u = t.def(n, "(", o, ")"), | |
s = e | |
.cond(u) | |
.then(f, "=", a, ".createStream(", o, ");") | |
.else(f, "=", a, ".getElements(", o, ");"); | |
return ( | |
F.optional(function () { | |
e.assert( | |
s.else, | |
"!" + o + "||" + f, | |
"invalid elements" | |
); | |
}), | |
t.entry(s), | |
t.exit( | |
e.cond(u).then(a, ".destroyStream(", f, ");") | |
), | |
(e.ELEMENTS = f), | |
f | |
); | |
}); | |
} | |
return null; | |
})(); | |
function i(e, i) { | |
if (e in r) { | |
var o = 0 | r[e]; | |
return ( | |
F.command(!i || o >= 0, "invalid " + e, t.commandStr), | |
ei(function (e, t) { | |
return i && (e.OFFSET = o), o; | |
}) | |
); | |
} | |
if (e in n) { | |
var f = n[e]; | |
return ti(f, function (t, r) { | |
var n = t.invoke(r, f); | |
return ( | |
i && | |
((t.OFFSET = n), | |
F.optional(function () { | |
t.assert(r, n + ">=0", "invalid " + e); | |
})), | |
n | |
); | |
}); | |
} | |
return i && a | |
? ei(function (e, t) { | |
return (e.OFFSET = "0"), 0; | |
}) | |
: null; | |
} | |
var f = i(Gn, !0); | |
return { | |
elements: a, | |
primitive: (function () { | |
if (Wn in r) { | |
var e = r[Wn]; | |
return ( | |
F.commandParameter( | |
e, | |
xe, | |
"invalid primitve", | |
t.commandStr | |
), | |
ei(function (t, r) { | |
return xe[e]; | |
}) | |
); | |
} | |
if (Wn in n) { | |
var i = n[Wn]; | |
return ti(i, function (e, t) { | |
var r = e.constants.primTypes, | |
n = e.invoke(t, i); | |
return ( | |
F.optional(function () { | |
e.assert( | |
t, | |
n + " in " + r, | |
"invalid primitive, must be one of " + | |
Object.keys(xe) | |
); | |
}), | |
t.def(r, "[", n, "]") | |
); | |
}); | |
} | |
return a | |
? Za(a) | |
? a.value | |
? ei(function (e, t) { | |
return t.def(e.ELEMENTS, ".primType"); | |
}) | |
: ei(function () { | |
return ja; | |
}) | |
: new Ja( | |
a.thisDep, | |
a.contextDep, | |
a.propDep, | |
function (e, t) { | |
var r = e.ELEMENTS; | |
return t.def(r, "?", r, ".primType:", ja); | |
} | |
) | |
: null; | |
})(), | |
count: (function () { | |
if (Un in r) { | |
var e = 0 | r[Un]; | |
return ( | |
F.command( | |
"number" == typeof e && e >= 0, | |
"invalid vertex count", | |
t.commandStr | |
), | |
ei(function () { | |
return e; | |
}) | |
); | |
} | |
if (Un in n) { | |
var i = n[Un]; | |
return ti(i, function (e, t) { | |
var r = e.invoke(t, i); | |
return ( | |
F.optional(function () { | |
e.assert( | |
t, | |
"typeof " + | |
r + | |
'==="number"&&' + | |
r + | |
">=0&&" + | |
r + | |
"===(" + | |
r + | |
"|0)", | |
"invalid vertex count" | |
); | |
}), | |
r | |
); | |
}); | |
} | |
if (a) { | |
if (Za(a)) { | |
if (a) | |
return f | |
? new Ja( | |
f.thisDep, | |
f.contextDep, | |
f.propDep, | |
function (e, t) { | |
var r = t.def( | |
e.ELEMENTS, | |
".vertCount-", | |
e.OFFSET | |
); | |
return ( | |
F.optional(function () { | |
e.assert( | |
t, | |
r + ">=0", | |
"invalid vertex offset/element buffer too small" | |
); | |
}), | |
r | |
); | |
} | |
) | |
: ei(function (e, t) { | |
return t.def(e.ELEMENTS, ".vertCount"); | |
}); | |
var o = ei(function () { | |
return -1; | |
}); | |
return ( | |
F.optional(function () { | |
o.MISSING = !0; | |
}), | |
o | |
); | |
} | |
var u = new Ja( | |
a.thisDep || f.thisDep, | |
a.contextDep || f.contextDep, | |
a.propDep || f.propDep, | |
function (e, t) { | |
var r = e.ELEMENTS; | |
return e.OFFSET | |
? t.def(r, "?", r, ".vertCount-", e.OFFSET, ":-1") | |
: t.def(r, "?", r, ".vertCount:-1"); | |
} | |
); | |
return ( | |
F.optional(function () { | |
u.DYNAMIC = !0; | |
}), | |
u | |
); | |
} | |
return null; | |
})(), | |
instances: i(Hn, !1), | |
offset: f, | |
}; | |
})(e, d), | |
_ = (function (e, t) { | |
var r = e.static, | |
n = e.dynamic, | |
i = {}; | |
return ( | |
A.forEach(function (e) { | |
var o = S(e); | |
function f(t, a) { | |
if (e in r) { | |
var f = t(r[e]); | |
i[o] = ei(function () { | |
return f; | |
}); | |
} else if (e in n) { | |
var u = n[e]; | |
i[o] = ti(u, function (e, t) { | |
return a(e, t, e.invoke(t, u)); | |
}); | |
} | |
} | |
switch (e) { | |
case yn: | |
case cn: | |
case sn: | |
case Tn: | |
case pn: | |
case Fn: | |
case _n: | |
case Sn: | |
case En: | |
case vn: | |
return f( | |
function (r) { | |
return ( | |
F.commandType(r, "boolean", e, t.commandStr), r | |
); | |
}, | |
function (t, r, n) { | |
return ( | |
F.optional(function () { | |
t.assert( | |
r, | |
"typeof " + n + '==="boolean"', | |
"invalid flag " + e, | |
t.commandStr | |
); | |
}), | |
n | |
); | |
} | |
); | |
case hn: | |
return f( | |
function (r) { | |
return ( | |
F.commandParameter( | |
r, | |
qa, | |
"invalid " + e, | |
t.commandStr | |
), | |
qa[r] | |
); | |
}, | |
function (t, r, n) { | |
var a = t.constants.compareFuncs; | |
return ( | |
F.optional(function () { | |
t.assert( | |
r, | |
n + " in " + a, | |
"invalid " + | |
e + | |
", must be one of " + | |
Object.keys(qa) | |
); | |
}), | |
r.def(a, "[", n, "]") | |
); | |
} | |
); | |
case bn: | |
return f( | |
function (e) { | |
return ( | |
F.command( | |
Le(e) && | |
2 === e.length && | |
"number" == typeof e[0] && | |
"number" == typeof e[1] && | |
e[0] <= e[1], | |
"depth range is 2d array", | |
t.commandStr | |
), | |
e | |
); | |
}, | |
function (e, t, r) { | |
return ( | |
F.optional(function () { | |
e.assert( | |
t, | |
e.shared.isArrayLike + | |
"(" + | |
r + | |
")&&" + | |
r + | |
".length===2&&typeof " + | |
r + | |
'[0]==="number"&&typeof ' + | |
r + | |
'[1]==="number"&&' + | |
r + | |
"[0]<=" + | |
r + | |
"[1]", | |
"depth range must be a 2d array" | |
); | |
}), | |
[t.def("+", r, "[0]"), t.def("+", r, "[1]")] | |
); | |
} | |
); | |
case mn: | |
return f( | |
function (e) { | |
F.commandType( | |
e, | |
"object", | |
"blend.func", | |
t.commandStr | |
); | |
var r = "srcRGB" in e ? e.srcRGB : e.src, | |
n = "srcAlpha" in e ? e.srcAlpha : e.src, | |
a = "dstRGB" in e ? e.dstRGB : e.dst, | |
i = "dstAlpha" in e ? e.dstAlpha : e.dst; | |
return ( | |
F.commandParameter( | |
r, | |
Ha, | |
o + ".srcRGB", | |
t.commandStr | |
), | |
F.commandParameter( | |
n, | |
Ha, | |
o + ".srcAlpha", | |
t.commandStr | |
), | |
F.commandParameter( | |
a, | |
Ha, | |
o + ".dstRGB", | |
t.commandStr | |
), | |
F.commandParameter( | |
i, | |
Ha, | |
o + ".dstAlpha", | |
t.commandStr | |
), | |
F.command( | |
-1 === Na.indexOf(r + ", " + a), | |
"unallowed blending combination (srcRGB, dstRGB) = (" + | |
r + | |
", " + | |
a + | |
")", | |
t.commandStr | |
), | |
[Ha[r], Ha[a], Ha[n], Ha[i]] | |
); | |
}, | |
function (t, r, n) { | |
var a = t.constants.blendFuncs; | |
function i(i, o) { | |
var f = r.def( | |
'"', | |
i, | |
o, | |
'" in ', | |
n, | |
"?", | |
n, | |
".", | |
i, | |
o, | |
":", | |
n, | |
".", | |
i | |
); | |
return ( | |
F.optional(function () { | |
t.assert( | |
r, | |
f + " in " + a, | |
"invalid " + | |
e + | |
"." + | |
i + | |
o + | |
", must be one of " + | |
Object.keys(Ha) | |
); | |
}), | |
f | |
); | |
} | |
F.optional(function () { | |
t.assert( | |
r, | |
n + "&&typeof " + n + '==="object"', | |
"invalid blend func, must be an object" | |
); | |
}); | |
var o = i("src", "RGB"), | |
f = i("dst", "RGB"); | |
F.optional(function () { | |
var e = t.constants.invalidBlendCombinations; | |
t.assert( | |
r, | |
e + | |
".indexOf(" + | |
o + | |
'+", "+' + | |
f + | |
") === -1 ", | |
"unallowed blending combination for (srcRGB, dstRGB)" | |
); | |
}); | |
var u = r.def(a, "[", o, "]"), | |
s = r.def(a, "[", i("src", "Alpha"), "]"); | |
return [ | |
u, | |
r.def(a, "[", f, "]"), | |
s, | |
r.def(a, "[", i("dst", "Alpha"), "]"), | |
]; | |
} | |
); | |
case dn: | |
return f( | |
function (r) { | |
return "string" == typeof r | |
? (F.commandParameter( | |
r, | |
v, | |
"invalid " + e, | |
t.commandStr | |
), | |
[v[r], v[r]]) | |
: "object" == typeof r | |
? (F.commandParameter( | |
r.rgb, | |
v, | |
e + ".rgb", | |
t.commandStr | |
), | |
F.commandParameter( | |
r.alpha, | |
v, | |
e + ".alpha", | |
t.commandStr | |
), | |
[v[r.rgb], v[r.alpha]]) | |
: void F.commandRaise( | |
"invalid blend.equation", | |
t.commandStr | |
); | |
}, | |
function (t, r, n) { | |
var a = t.constants.blendEquations, | |
i = r.def(), | |
o = r.def(), | |
f = t.cond("typeof ", n, '==="string"'); | |
return ( | |
F.optional(function () { | |
function r(e, r, n) { | |
t.assert( | |
e, | |
n + " in " + a, | |
"invalid " + | |
r + | |
", must be one of " + | |
Object.keys(v) | |
); | |
} | |
r(f.then, e, n), | |
t.assert( | |
f.else, | |
n + "&&typeof " + n + '==="object"', | |
"invalid " + e | |
), | |
r(f.else, e + ".rgb", n + ".rgb"), | |
r(f.else, e + ".alpha", n + ".alpha"); | |
}), | |
f.then(i, "=", o, "=", a, "[", n, "];"), | |
f.else( | |
i, | |
"=", | |
a, | |
"[", | |
n, | |
".rgb];", | |
o, | |
"=", | |
a, | |
"[", | |
n, | |
".alpha];" | |
), | |
r(f), | |
[i, o] | |
); | |
} | |
); | |
case ln: | |
return f( | |
function (e) { | |
return ( | |
F.command( | |
Le(e) && 4 === e.length, | |
"blend.color must be a 4d array", | |
t.commandStr | |
), | |
N(4, function (t) { | |
return +e[t]; | |
}) | |
); | |
}, | |
function (e, t, r) { | |
return ( | |
F.optional(function () { | |
e.assert( | |
t, | |
e.shared.isArrayLike + | |
"(" + | |
r + | |
")&&" + | |
r + | |
".length===4", | |
"blend.color must be a 4d array" | |
); | |
}), | |
N(4, function (e) { | |
return t.def("+", r, "[", e, "]"); | |
}) | |
); | |
} | |
); | |
case jn: | |
return f( | |
function (e) { | |
return ( | |
F.commandType(e, "number", o, t.commandStr), | |
0 | e | |
); | |
}, | |
function (e, t, r) { | |
return ( | |
F.optional(function () { | |
e.assert( | |
t, | |
"typeof " + r + '==="number"', | |
"invalid stencil.mask" | |
); | |
}), | |
t.def(r, "|0") | |
); | |
} | |
); | |
case Dn: | |
return f( | |
function (r) { | |
F.commandType(r, "object", o, t.commandStr); | |
var n = r.cmp || "keep", | |
a = r.ref || 0, | |
i = "mask" in r ? r.mask : -1; | |
return ( | |
F.commandParameter( | |
n, | |
qa, | |
e + ".cmp", | |
t.commandStr | |
), | |
F.commandType( | |
a, | |
"number", | |
e + ".ref", | |
t.commandStr | |
), | |
F.commandType( | |
i, | |
"number", | |
e + ".mask", | |
t.commandStr | |
), | |
[qa[n], a, i] | |
); | |
}, | |
function (e, t, r) { | |
var n = e.constants.compareFuncs; | |
return ( | |
F.optional(function () { | |
function a() { | |
e.assert( | |
t, | |
Array.prototype.join.call(arguments, ""), | |
"invalid stencil.func" | |
); | |
} | |
a(r + "&&typeof ", r, '==="object"'), | |
a( | |
'!("cmp" in ', | |
r, | |
")||(", | |
r, | |
".cmp in ", | |
n, | |
")" | |
); | |
}), | |
[ | |
t.def( | |
'"cmp" in ', | |
r, | |
"?", | |
n, | |
"[", | |
r, | |
".cmp]", | |
":", | |
La | |
), | |
t.def(r, ".ref|0"), | |
t.def('"mask" in ', r, "?", r, ".mask|0:-1"), | |
] | |
); | |
} | |
); | |
case Cn: | |
case zn: | |
return f( | |
function (r) { | |
F.commandType(r, "object", o, t.commandStr); | |
var n = r.fail || "keep", | |
a = r.zfail || "keep", | |
i = r.zpass || "keep"; | |
return ( | |
F.commandParameter( | |
n, | |
Qa, | |
e + ".fail", | |
t.commandStr | |
), | |
F.commandParameter( | |
a, | |
Qa, | |
e + ".zfail", | |
t.commandStr | |
), | |
F.commandParameter( | |
i, | |
Qa, | |
e + ".zpass", | |
t.commandStr | |
), | |
[e === zn ? Ca : Da, Qa[n], Qa[a], Qa[i]] | |
); | |
}, | |
function (t, r, n) { | |
var a = t.constants.stencilOps; | |
function i(i) { | |
return ( | |
F.optional(function () { | |
t.assert( | |
r, | |
'!("' + | |
i + | |
'" in ' + | |
n + | |
")||(" + | |
n + | |
"." + | |
i + | |
" in " + | |
a + | |
")", | |
"invalid " + | |
e + | |
"." + | |
i + | |
", must be one of " + | |
Object.keys(Qa) | |
); | |
}), | |
r.def( | |
'"', | |
i, | |
'" in ', | |
n, | |
"?", | |
a, | |
"[", | |
n, | |
".", | |
i, | |
"]:", | |
La | |
) | |
); | |
} | |
return ( | |
F.optional(function () { | |
t.assert( | |
r, | |
n + "&&typeof " + n + '==="object"', | |
"invalid " + e | |
); | |
}), | |
[ | |
e === zn ? Ca : Da, | |
i("fail"), | |
i("zfail"), | |
i("zpass"), | |
] | |
); | |
} | |
); | |
case kn: | |
return f( | |
function (e) { | |
F.commandType(e, "object", o, t.commandStr); | |
var r = 0 | e.factor, | |
n = 0 | e.units; | |
return ( | |
F.commandType( | |
r, | |
"number", | |
o + ".factor", | |
t.commandStr | |
), | |
F.commandType( | |
n, | |
"number", | |
o + ".units", | |
t.commandStr | |
), | |
[r, n] | |
); | |
}, | |
function (t, r, n) { | |
return ( | |
F.optional(function () { | |
t.assert( | |
r, | |
n + "&&typeof " + n + '==="object"', | |
"invalid " + e | |
); | |
}), | |
[r.def(n, ".factor|0"), r.def(n, ".units|0")] | |
); | |
} | |
); | |
case xn: | |
return f( | |
function (e) { | |
var r = 0; | |
return ( | |
"front" === e | |
? (r = Da) | |
: "back" === e && (r = Ca), | |
F.command(!!r, o, t.commandStr), | |
r | |
); | |
}, | |
function (e, t, r) { | |
return ( | |
F.optional(function () { | |
e.assert( | |
t, | |
r + '==="front"||' + r + '==="back"', | |
"invalid cull.face" | |
); | |
}), | |
t.def(r, '==="front"?', Da, ":", Ca) | |
); | |
} | |
); | |
case An: | |
return f( | |
function (e) { | |
return ( | |
F.command( | |
"number" == typeof e && | |
e >= a.lineWidthDims[0] && | |
e <= a.lineWidthDims[1], | |
"invalid line width, must be a positive number between " + | |
a.lineWidthDims[0] + | |
" and " + | |
a.lineWidthDims[1], | |
t.commandStr | |
), | |
e | |
); | |
}, | |
function (e, t, r) { | |
return ( | |
F.optional(function () { | |
e.assert( | |
t, | |
"typeof " + | |
r + | |
'==="number"&&' + | |
r + | |
">=" + | |
a.lineWidthDims[0] + | |
"&&" + | |
r + | |
"<=" + | |
a.lineWidthDims[1], | |
"invalid line width" | |
); | |
}), | |
r | |
); | |
} | |
); | |
case wn: | |
return f( | |
function (e) { | |
return ( | |
F.commandParameter(e, Xa, o, t.commandStr), | |
Xa[e] | |
); | |
}, | |
function (e, t, r) { | |
return ( | |
F.optional(function () { | |
e.assert( | |
t, | |
r + '==="cw"||' + r + '==="ccw"', | |
"invalid frontFace, must be one of cw,ccw" | |
); | |
}), | |
t.def(r + '==="cw"?' + za + ":" + Fa) | |
); | |
} | |
); | |
case gn: | |
return f( | |
function (e) { | |
return ( | |
F.command( | |
Le(e) && 4 === e.length, | |
"color.mask must be length 4 array", | |
t.commandStr | |
), | |
e.map(function (e) { | |
return !!e; | |
}) | |
); | |
}, | |
function (e, t, r) { | |
return ( | |
F.optional(function () { | |
e.assert( | |
t, | |
e.shared.isArrayLike + | |
"(" + | |
r + | |
")&&" + | |
r + | |
".length===4", | |
"invalid color.mask" | |
); | |
}), | |
N(4, function (e) { | |
return "!!" + r + "[" + e + "]"; | |
}) | |
); | |
} | |
); | |
case On: | |
return f( | |
function (e) { | |
F.command( | |
"object" == typeof e && e, | |
o, | |
t.commandStr | |
); | |
var r = "value" in e ? e.value : 1, | |
n = !!e.invert; | |
return ( | |
F.command( | |
"number" == typeof r && r >= 0 && r <= 1, | |
"sample.coverage.value must be a number between 0 and 1", | |
t.commandStr | |
), | |
[r, n] | |
); | |
}, | |
function (e, t, r) { | |
return ( | |
F.optional(function () { | |
e.assert( | |
t, | |
r + "&&typeof " + r + '==="object"', | |
"invalid sample.coverage" | |
); | |
}), | |
[ | |
t.def('"value" in ', r, "?+", r, ".value:1"), | |
t.def("!!", r, ".invert"), | |
] | |
); | |
} | |
); | |
} | |
}), | |
i | |
); | |
})(e, d), | |
k = (function (e, t, n) { | |
var a = e.static, | |
i = e.dynamic; | |
function o(e) { | |
if (e in a) { | |
var t = r.id(a[e]); | |
F.optional(function () { | |
l.shader(Ya[e], t, F.guessCommand()); | |
}); | |
var n = ei(function () { | |
return t; | |
}); | |
return (n.id = t), n; | |
} | |
if (e in i) { | |
var o = i[e]; | |
return ti(o, function (t, r) { | |
var n = t.invoke(r, o), | |
a = r.def(t.shared.strings, ".id(", n, ")"); | |
return ( | |
F.optional(function () { | |
r( | |
t.shared.shader, | |
".shader(", | |
Ya[e], | |
",", | |
a, | |
",", | |
t.command, | |
");" | |
); | |
}), | |
a | |
); | |
}); | |
} | |
return null; | |
} | |
var f, | |
u = o(In), | |
s = o(Rn), | |
c = null; | |
return ( | |
Za(u) && Za(s) | |
? ((c = l.program(s.id, u.id, null, n)), | |
(f = ei(function (e, t) { | |
return e.link(c); | |
}))) | |
: (f = new Ja( | |
(u && u.thisDep) || (s && s.thisDep), | |
(u && u.contextDep) || (s && s.contextDep), | |
(u && u.propDep) || (s && s.propDep), | |
function (e, t) { | |
var r, | |
n = e.shared.shader; | |
r = u ? u.append(e, t) : t.def(n, ".", In); | |
var a = | |
n + | |
".program(" + | |
(s ? s.append(e, t) : t.def(n, ".", Rn)) + | |
"," + | |
r; | |
return ( | |
F.optional(function () { | |
a += "," + e.command; | |
}), | |
t.def(a + ")") | |
); | |
} | |
)), | |
{ frag: u, vert: s, progVar: f, program: c } | |
); | |
})(e, 0, h); | |
function E(e) { | |
var t = x[e]; | |
t && (_[e] = t); | |
} | |
E(Vn), E(S(Bn)); | |
var O = Object.keys(_).length > 0, | |
T = { | |
framebuffer: y, | |
draw: w, | |
shader: k, | |
state: _, | |
dirty: O, | |
scopeVAO: null, | |
drawVAO: null, | |
useVAO: !1, | |
attributes: {}, | |
}; | |
if ( | |
((T.profile = (function (e) { | |
var t, | |
r = e.static, | |
n = e.dynamic; | |
if (Pn in r) { | |
var a = !!r[Pn]; | |
(t = ei(function (e, t) { | |
return a; | |
})).enable = a; | |
} else if (Pn in n) { | |
var i = n[Pn]; | |
t = ti(i, function (e, t) { | |
return e.invoke(t, i); | |
}); | |
} | |
return t; | |
})(e)), | |
(T.uniforms = (function (e, t) { | |
var r = e.static, | |
n = e.dynamic, | |
a = {}; | |
return ( | |
Object.keys(r).forEach(function (e) { | |
var n, | |
i = r[e]; | |
if ("number" == typeof i || "boolean" == typeof i) | |
n = ei(function () { | |
return i; | |
}); | |
else if ("function" == typeof i) { | |
var o = i._reglType; | |
"texture2d" === o || "textureCube" === o | |
? (n = ei(function (e) { | |
return e.link(i); | |
})) | |
: "framebuffer" === o || "framebufferCube" === o | |
? (F.command( | |
i.color.length > 0, | |
'missing color attachment for framebuffer sent to uniform "' + | |
e + | |
'"', | |
t.commandStr | |
), | |
(n = ei(function (e) { | |
return e.link(i.color[0]); | |
}))) | |
: F.commandRaise( | |
'invalid data for uniform "' + e + '"', | |
t.commandStr | |
); | |
} else | |
Le(i) | |
? (n = ei(function (t) { | |
return t.global.def( | |
"[", | |
N(i.length, function (r) { | |
return ( | |
F.command( | |
"number" == typeof i[r] || | |
"boolean" == typeof i[r], | |
"invalid uniform " + e, | |
t.commandStr | |
), | |
i[r] | |
); | |
}), | |
"]" | |
); | |
})) | |
: F.commandRaise( | |
'invalid or missing data for uniform "' + e + '"', | |
t.commandStr | |
); | |
(n.value = i), (a[e] = n); | |
}), | |
Object.keys(n).forEach(function (e) { | |
var t = n[e]; | |
a[e] = ti(t, function (e, r) { | |
return e.invoke(r, t); | |
}); | |
}), | |
a | |
); | |
})(f, d)), | |
(T.drawVAO = T.scopeVAO = (function (e, t) { | |
var r = e.static, | |
n = e.dynamic; | |
if (Nn in r) { | |
var a = r[Nn]; | |
return ( | |
null !== a && | |
null === c.getVAO(a) && | |
(a = c.createVAO(a)), | |
ei(function (e) { | |
return e.link(c.getVAO(a)); | |
}) | |
); | |
} | |
if (Nn in n) { | |
var i = n[Nn]; | |
return ti(i, function (e, t) { | |
var r = e.invoke(t, i); | |
return t.def(e.shared.vao + ".getVAO(" + r + ")"); | |
}); | |
} | |
return null; | |
})(e)), | |
!T.drawVAO && k.program && !h && n.angle_instanced_arrays) | |
) { | |
var j = !0, | |
D = k.program.attributes.map(function (e) { | |
var r = t.static[e]; | |
return (j = j && !!r), r; | |
}); | |
if (j && D.length > 0) { | |
var C = c.getVAO(c.createVAO(D)); | |
(T.drawVAO = new Ja(null, null, null, function (e, t) { | |
return e.link(C); | |
})), | |
(T.useVAO = !0); | |
} | |
} | |
return ( | |
h | |
? (T.useVAO = !0) | |
: (T.attributes = (function (e, t) { | |
var n = e.static, | |
a = e.dynamic, | |
o = {}; | |
return ( | |
Object.keys(n).forEach(function (e) { | |
var a = n[e], | |
f = r.id(e), | |
u = new b(); | |
if ($a(a)) | |
(u.state = tn), | |
(u.buffer = i.getBuffer(i.create(a, Zn, !1, !0))), | |
(u.type = 0); | |
else { | |
var s = i.getBuffer(a); | |
if (s) (u.state = tn), (u.buffer = s), (u.type = 0); | |
else if ( | |
(F.command( | |
"object" == typeof a && a, | |
"invalid data for attribute " + e, | |
t.commandStr | |
), | |
"constant" in a) | |
) { | |
var c = a.constant; | |
(u.buffer = "null"), | |
(u.state = rn), | |
"number" == typeof c | |
? (u.x = c) | |
: (F.command( | |
Le(c) && c.length > 0 && c.length <= 4, | |
"invalid constant for attribute " + e, | |
t.commandStr | |
), | |
Zr.forEach(function (e, t) { | |
t < c.length && (u[e] = c[t]); | |
})); | |
} else { | |
(s = $a(a.buffer) | |
? i.getBuffer(i.create(a.buffer, Zn, !1, !0)) | |
: i.getBuffer(a.buffer)), | |
F.command( | |
!!s, | |
'missing buffer for attribute "' + e + '"', | |
t.commandStr | |
); | |
var l = 0 | a.offset; | |
F.command( | |
l >= 0, | |
'invalid offset for attribute "' + e + '"', | |
t.commandStr | |
); | |
var d = 0 | a.stride; | |
F.command( | |
d >= 0 && d < 256, | |
'invalid stride for attribute "' + | |
e + | |
'", must be integer betweeen [0, 255]', | |
t.commandStr | |
); | |
var m = 0 | a.size; | |
F.command( | |
!("size" in a) || (m > 0 && m <= 4), | |
'invalid size for attribute "' + | |
e + | |
'", must be 1,2,3,4', | |
t.commandStr | |
); | |
var p = !!a.normalized, | |
h = 0; | |
"type" in a && | |
(F.commandParameter( | |
a.type, | |
ue, | |
"invalid type for attribute " + e, | |
t.commandStr | |
), | |
(h = ue[a.type])); | |
var v = 0 | a.divisor; | |
"divisor" in a && | |
(F.command( | |
0 === v || g, | |
'cannot specify divisor for attribute "' + | |
e + | |
'", instancing not supported', | |
t.commandStr | |
), | |
F.command( | |
v >= 0, | |
'invalid divisor for attribute "' + e + '"', | |
t.commandStr | |
)), | |
F.optional(function () { | |
var r = t.commandStr, | |
n = [ | |
"buffer", | |
"offset", | |
"divisor", | |
"normalized", | |
"type", | |
"size", | |
"stride", | |
]; | |
Object.keys(a).forEach(function (t) { | |
F.command( | |
n.indexOf(t) >= 0, | |
'unknown parameter "' + | |
t + | |
'" for attribute pointer "' + | |
e + | |
'" (valid parameters are ' + | |
n + | |
")", | |
r | |
); | |
}); | |
}), | |
(u.buffer = s), | |
(u.state = tn), | |
(u.size = m), | |
(u.normalized = p), | |
(u.type = h || s.dtype), | |
(u.offset = l), | |
(u.stride = d), | |
(u.divisor = v); | |
} | |
} | |
o[e] = ei(function (e, t) { | |
var r = e.attribCache; | |
if (f in r) return r[f]; | |
var n = { isStream: !1 }; | |
return ( | |
Object.keys(u).forEach(function (e) { | |
n[e] = u[e]; | |
}), | |
u.buffer && | |
((n.buffer = e.link(u.buffer)), | |
(n.type = n.type || n.buffer + ".dtype")), | |
(r[f] = n), | |
n | |
); | |
}); | |
}), | |
Object.keys(a).forEach(function (e) { | |
var t = a[e]; | |
o[e] = ti(t, function (r, n) { | |
var a = r.invoke(n, t), | |
i = r.shared, | |
o = r.constants, | |
f = i.isBufferArgs, | |
u = i.buffer; | |
F.optional(function () { | |
r.assert( | |
n, | |
a + | |
"&&(typeof " + | |
a + | |
'==="object"||typeof ' + | |
a + | |
'==="function")&&(' + | |
f + | |
"(" + | |
a + | |
")||" + | |
u + | |
".getBuffer(" + | |
a + | |
")||" + | |
u + | |
".getBuffer(" + | |
a + | |
".buffer)||" + | |
f + | |
"(" + | |
a + | |
'.buffer)||("constant" in ' + | |
a + | |
"&&(typeof " + | |
a + | |
'.constant==="number"||' + | |
i.isArrayLike + | |
"(" + | |
a + | |
".constant))))", | |
'invalid dynamic attribute "' + e + '"' | |
); | |
}); | |
var s = { isStream: n.def(!1) }, | |
c = new b(); | |
(c.state = tn), | |
Object.keys(c).forEach(function (e) { | |
s[e] = n.def("" + c[e]); | |
}); | |
var l = s.buffer, | |
d = s.type; | |
function m(e) { | |
n(s[e], "=", a, ".", e, "|0;"); | |
} | |
return ( | |
n( | |
"if(", | |
f, | |
"(", | |
a, | |
")){", | |
s.isStream, | |
"=true;", | |
l, | |
"=", | |
u, | |
".createStream(", | |
Zn, | |
",", | |
a, | |
");", | |
d, | |
"=", | |
l, | |
".dtype;", | |
"}else{", | |
l, | |
"=", | |
u, | |
".getBuffer(", | |
a, | |
");", | |
"if(", | |
l, | |
"){", | |
d, | |
"=", | |
l, | |
".dtype;", | |
'}else if("constant" in ', | |
a, | |
"){", | |
s.state, | |
"=", | |
rn, | |
";", | |
"if(typeof " + a + '.constant === "number"){', | |
s[Zr[0]], | |
"=", | |
a, | |
".constant;", | |
Zr.slice(1) | |
.map(function (e) { | |
return s[e]; | |
}) | |
.join("="), | |
"=0;", | |
"}else{", | |
Zr.map(function (e, t) { | |
return ( | |
s[e] + | |
"=" + | |
a + | |
".constant.length>" + | |
t + | |
"?" + | |
a + | |
".constant[" + | |
t + | |
"]:0;" | |
); | |
}).join(""), | |
"}}else{", | |
"if(", | |
f, | |
"(", | |
a, | |
".buffer)){", | |
l, | |
"=", | |
u, | |
".createStream(", | |
Zn, | |
",", | |
a, | |
".buffer);", | |
"}else{", | |
l, | |
"=", | |
u, | |
".getBuffer(", | |
a, | |
".buffer);", | |
"}", | |
d, | |
'="type" in ', | |
a, | |
"?", | |
o.glTypes, | |
"[", | |
a, | |
".type]:", | |
l, | |
".dtype;", | |
s.normalized, | |
"=!!", | |
a, | |
".normalized;" | |
), | |
m("size"), | |
m("offset"), | |
m("stride"), | |
m("divisor"), | |
n("}}"), | |
n.exit( | |
"if(", | |
s.isStream, | |
"){", | |
u, | |
".destroyStream(", | |
l, | |
");", | |
"}" | |
), | |
s | |
); | |
}); | |
}), | |
o | |
); | |
})(t, d)), | |
(T.context = (function (e) { | |
var t = e.static, | |
r = e.dynamic, | |
n = {}; | |
return ( | |
Object.keys(t).forEach(function (e) { | |
var r = t[e]; | |
n[e] = ei(function (e, t) { | |
return "number" == typeof r || "boolean" == typeof r | |
? "" + r | |
: e.link(r); | |
}); | |
}), | |
Object.keys(r).forEach(function (e) { | |
var t = r[e]; | |
n[e] = ti(t, function (e, r) { | |
return e.invoke(r, t); | |
}); | |
}), | |
n | |
); | |
})(s)), | |
T | |
); | |
} | |
function B(e, t, r) { | |
var n = e.shared.context, | |
a = e.scope(); | |
Object.keys(r).forEach(function (i) { | |
t.save(n, "." + i); | |
var o = r[i]; | |
a(n, ".", i, "=", o.append(e, t), ";"); | |
}), | |
t(a); | |
} | |
function V(e, t, r, n) { | |
var a, | |
i = e.shared, | |
o = i.gl, | |
f = i.framebuffer; | |
y && (a = t.def(i.extensions, ".webgl_draw_buffers")); | |
var u, | |
s = e.constants, | |
c = s.drawBuffer, | |
l = s.backBuffer; | |
(u = r ? r.append(e, t) : t.def(f, ".next")), | |
n || t("if(", u, "!==", f, ".cur){"), | |
t( | |
"if(", | |
u, | |
"){", | |
o, | |
".bindFramebuffer(", | |
Ua, | |
",", | |
u, | |
".framebuffer);" | |
), | |
y && | |
t( | |
a, | |
".drawBuffersWEBGL(", | |
c, | |
"[", | |
u, | |
".colorAttachments.length]);" | |
), | |
t("}else{", o, ".bindFramebuffer(", Ua, ",null);"), | |
y && t(a, ".drawBuffersWEBGL(", l, ");"), | |
t("}", f, ".cur=", u, ";"), | |
n || t("}"); | |
} | |
function P(e, t, r) { | |
var n = e.shared, | |
a = n.gl, | |
i = e.current, | |
o = e.next, | |
f = n.current, | |
u = n.next, | |
s = e.cond(f, ".dirty"); | |
A.forEach(function (t) { | |
var n, | |
c, | |
l = S(t); | |
if (!(l in r.state)) | |
if (l in o) { | |
(n = o[l]), (c = i[l]); | |
var d = N(x[l].length, function (e) { | |
return s.def(n, "[", e, "]"); | |
}); | |
s( | |
e | |
.cond( | |
d | |
.map(function (e, t) { | |
return e + "!==" + c + "[" + t + "]"; | |
}) | |
.join("||") | |
) | |
.then( | |
a, | |
".", | |
k[l], | |
"(", | |
d, | |
");", | |
d | |
.map(function (e, t) { | |
return c + "[" + t + "]=" + e; | |
}) | |
.join(";"), | |
";" | |
) | |
); | |
} else { | |
n = s.def(u, ".", l); | |
var m = e.cond(n, "!==", f, ".", l); | |
s(m), | |
l in _ | |
? m( | |
e | |
.cond(n) | |
.then(a, ".enable(", _[l], ");") | |
.else(a, ".disable(", _[l], ");"), | |
f, | |
".", | |
l, | |
"=", | |
n, | |
";" | |
) | |
: m(a, ".", k[l], "(", n, ");", f, ".", l, "=", n, ";"); | |
} | |
}), | |
0 === Object.keys(r.state).length && s(f, ".dirty=false;"), | |
t(s); | |
} | |
function L(e, t, r, n) { | |
var a = e.shared, | |
i = e.current, | |
o = a.current, | |
f = a.gl; | |
Ka(Object.keys(r)).forEach(function (a) { | |
var u = r[a]; | |
if (!n || n(u)) { | |
var s = u.append(e, t); | |
if (_[a]) { | |
var c = _[a]; | |
Za(u) | |
? t(f, s ? ".enable(" : ".disable(", c, ");") | |
: t( | |
e | |
.cond(s) | |
.then(f, ".enable(", c, ");") | |
.else(f, ".disable(", c, ");") | |
), | |
t(o, ".", a, "=", s, ";"); | |
} else if (Le(s)) { | |
var l = i[a]; | |
t( | |
f, | |
".", | |
k[a], | |
"(", | |
s, | |
");", | |
s | |
.map(function (e, t) { | |
return l + "[" + t + "]=" + e; | |
}) | |
.join(";"), | |
";" | |
); | |
} else t(f, ".", k[a], "(", s, ");", o, ".", a, "=", s, ";"); | |
} | |
}); | |
} | |
function R(e, t) { | |
g && | |
(e.instancing = t.def( | |
e.shared.extensions, | |
".angle_instanced_arrays" | |
)); | |
} | |
function M(e, t, r, n, a) { | |
var i, | |
o, | |
f, | |
u = e.shared, | |
s = e.stats, | |
c = u.current, | |
l = u.timer, | |
d = r.profile; | |
function m() { | |
return "undefined" == typeof performance | |
? "Date.now()" | |
: "performance.now()"; | |
} | |
function h(e) { | |
e((i = t.def()), "=", m(), ";"), | |
"string" == typeof a | |
? e(s, ".count+=", a, ";") | |
: e(s, ".count++;"), | |
p && | |
(n | |
? e((o = t.def()), "=", l, ".getNumPendingQueries();") | |
: e(l, ".beginQuery(", s, ");")); | |
} | |
function b(e) { | |
e(s, ".cpuTime+=", m(), "-", i, ";"), | |
p && | |
(n | |
? e( | |
l, | |
".pushScopeStats(", | |
o, | |
",", | |
l, | |
".getNumPendingQueries(),", | |
s, | |
");" | |
) | |
: e(l, ".endQuery();")); | |
} | |
function v(e) { | |
var r = t.def(c, ".profile"); | |
t(c, ".profile=", e, ";"), t.exit(c, ".profile=", r, ";"); | |
} | |
if (d) { | |
if (Za(d)) | |
return void (d.enable | |
? (h(t), b(t.exit), v("true")) | |
: v("false")); | |
v((f = d.append(e, t))); | |
} else f = t.def(c, ".profile"); | |
var g = e.block(); | |
h(g), t("if(", f, "){", g, "}"); | |
var y = e.block(); | |
b(y), t.exit("if(", f, "){", y, "}"); | |
} | |
function W(e, t, r, n, a) { | |
var i = e.shared; | |
n.forEach(function (n) { | |
var o, | |
f = n.name, | |
u = r.attributes[f]; | |
if (u) { | |
if (!a(u)) return; | |
o = u.append(e, t); | |
} else { | |
if (!a(ri)) return; | |
var s = e.scopeAttrib(f); | |
F.optional(function () { | |
e.assert(t, s + ".state", "missing attribute " + f); | |
}), | |
(o = {}), | |
Object.keys(new b()).forEach(function (e) { | |
o[e] = t.def(s, ".", e); | |
}); | |
} | |
!(function (r, n, a) { | |
var o = i.gl, | |
f = t.def(r, ".location"), | |
u = t.def(i.attributes, "[", f, "]"), | |
s = a.state, | |
c = a.buffer, | |
l = [a.x, a.y, a.z, a.w], | |
d = ["buffer", "normalized", "offset", "stride"]; | |
function m() { | |
t( | |
"if(!", | |
u, | |
".buffer){", | |
o, | |
".enableVertexAttribArray(", | |
f, | |
");}" | |
); | |
var r, | |
i = a.type; | |
if ( | |
((r = a.size ? t.def(a.size, "||", n) : n), | |
t( | |
"if(", | |
u, | |
".type!==", | |
i, | |
"||", | |
u, | |
".size!==", | |
r, | |
"||", | |
d | |
.map(function (e) { | |
return u + "." + e + "!==" + a[e]; | |
}) | |
.join("||"), | |
"){", | |
o, | |
".bindBuffer(", | |
Zn, | |
",", | |
c, | |
".buffer);", | |
o, | |
".vertexAttribPointer(", | |
[f, r, i, a.normalized, a.stride, a.offset], | |
");", | |
u, | |
".type=", | |
i, | |
";", | |
u, | |
".size=", | |
r, | |
";", | |
d | |
.map(function (e) { | |
return u + "." + e + "=" + a[e] + ";"; | |
}) | |
.join(""), | |
"}" | |
), | |
g) | |
) { | |
var s = a.divisor; | |
t( | |
"if(", | |
u, | |
".divisor!==", | |
s, | |
"){", | |
e.instancing, | |
".vertexAttribDivisorANGLE(", | |
[f, s], | |
");", | |
u, | |
".divisor=", | |
s, | |
";}" | |
); | |
} | |
} | |
function p() { | |
t( | |
"if(", | |
u, | |
".buffer){", | |
o, | |
".disableVertexAttribArray(", | |
f, | |
");", | |
u, | |
".buffer=null;", | |
"}if(", | |
Zr.map(function (e, t) { | |
return u + "." + e + "!==" + l[t]; | |
}).join("||"), | |
"){", | |
o, | |
".vertexAttrib4f(", | |
f, | |
",", | |
l, | |
");", | |
Zr.map(function (e, t) { | |
return u + "." + e + "=" + l[t] + ";"; | |
}).join(""), | |
"}" | |
); | |
} | |
s === tn | |
? m() | |
: s === rn | |
? p() | |
: (t("if(", s, "===", tn, "){"), | |
m(), | |
t("}else{"), | |
p(), | |
t("}")); | |
})( | |
e.link(n), | |
(function (e) { | |
switch (e) { | |
case ma: | |
case va: | |
case wa: | |
return 2; | |
case pa: | |
case ga: | |
case Aa: | |
return 3; | |
case ha: | |
case ya: | |
case _a: | |
return 4; | |
default: | |
return 1; | |
} | |
})(n.info.type), | |
o | |
); | |
}); | |
} | |
function U(e, t, n, a, i) { | |
for (var o, f = e.shared, u = f.gl, s = 0; s < a.length; ++s) { | |
var c, | |
l = a[s], | |
d = l.name, | |
m = l.info.type, | |
p = n.uniforms[d], | |
h = e.link(l) + ".location"; | |
if (p) { | |
if (!i(p)) continue; | |
if (Za(p)) { | |
var b = p.value; | |
if ( | |
(F.command( | |
null != b, | |
'missing uniform "' + d + '"', | |
e.commandStr | |
), | |
m === Oa || m === Ta) | |
) { | |
F.command( | |
"function" == typeof b && | |
((m === Oa && | |
("texture2d" === b._reglType || | |
"framebuffer" === b._reglType)) || | |
(m === Ta && | |
("textureCube" === b._reglType || | |
"framebufferCube" === b._reglType))), | |
"invalid texture for uniform " + d, | |
e.commandStr | |
); | |
var v = e.link(b._texture || b.color[0]._texture); | |
t(u, ".uniform1i(", h, ",", v + ".bind());"), | |
t.exit(v, ".unbind();"); | |
} else if (m === ka || m === Sa || m === Ea) { | |
F.optional(function () { | |
F.command( | |
Le(b), | |
"invalid matrix for uniform " + d, | |
e.commandStr | |
), | |
F.command( | |
(m === ka && 4 === b.length) || | |
(m === Sa && 9 === b.length) || | |
(m === Ea && 16 === b.length), | |
"invalid length for matrix uniform " + d, | |
e.commandStr | |
); | |
}); | |
var g = e.global.def( | |
"new Float32Array([" + | |
Array.prototype.slice.call(b) + | |
"])" | |
), | |
y = 2; | |
m === Sa ? (y = 3) : m === Ea && (y = 4), | |
t(u, ".uniformMatrix", y, "fv(", h, ",false,", g, ");"); | |
} else { | |
switch (m) { | |
case da: | |
F.commandType( | |
b, | |
"number", | |
"uniform " + d, | |
e.commandStr | |
), | |
(o = "1f"); | |
break; | |
case ma: | |
F.command( | |
Le(b) && 2 === b.length, | |
"uniform " + d, | |
e.commandStr | |
), | |
(o = "2f"); | |
break; | |
case pa: | |
F.command( | |
Le(b) && 3 === b.length, | |
"uniform " + d, | |
e.commandStr | |
), | |
(o = "3f"); | |
break; | |
case ha: | |
F.command( | |
Le(b) && 4 === b.length, | |
"uniform " + d, | |
e.commandStr | |
), | |
(o = "4f"); | |
break; | |
case xa: | |
F.commandType( | |
b, | |
"boolean", | |
"uniform " + d, | |
e.commandStr | |
), | |
(o = "1i"); | |
break; | |
case ba: | |
F.commandType( | |
b, | |
"number", | |
"uniform " + d, | |
e.commandStr | |
), | |
(o = "1i"); | |
break; | |
case wa: | |
case va: | |
F.command( | |
Le(b) && 2 === b.length, | |
"uniform " + d, | |
e.commandStr | |
), | |
(o = "2i"); | |
break; | |
case Aa: | |
case ga: | |
F.command( | |
Le(b) && 3 === b.length, | |
"uniform " + d, | |
e.commandStr | |
), | |
(o = "3i"); | |
break; | |
case _a: | |
case ya: | |
F.command( | |
Le(b) && 4 === b.length, | |
"uniform " + d, | |
e.commandStr | |
), | |
(o = "4i"); | |
} | |
t( | |
u, | |
".uniform", | |
o, | |
"(", | |
h, | |
",", | |
Le(b) ? Array.prototype.slice.call(b) : b, | |
");" | |
); | |
} | |
continue; | |
} | |
c = p.append(e, t); | |
} else { | |
if (!i(ri)) continue; | |
c = t.def(f.uniforms, "[", r.id(d), "]"); | |
} | |
m === Oa | |
? t( | |
"if(", | |
c, | |
"&&", | |
c, | |
'._reglType==="framebuffer"){', | |
c, | |
"=", | |
c, | |
".color[0];", | |
"}" | |
) | |
: m === Ta && | |
t( | |
"if(", | |
c, | |
"&&", | |
c, | |
'._reglType==="framebufferCube"){', | |
c, | |
"=", | |
c, | |
".color[0];", | |
"}" | |
), | |
F.optional(function () { | |
function r(r, n) { | |
e.assert( | |
t, | |
r, | |
'bad data or missing for uniform "' + d + '". ' + n | |
); | |
} | |
function n(e) { | |
r( | |
"typeof " + c + '==="' + e + '"', | |
"invalid type, expected " + e | |
); | |
} | |
function a(t, n) { | |
r( | |
f.isArrayLike + "(" + c + ")&&" + c + ".length===" + t, | |
"invalid vector, should have length " + t, | |
e.commandStr | |
); | |
} | |
function i(t) { | |
r( | |
"typeof " + | |
c + | |
'==="function"&&' + | |
c + | |
'._reglType==="texture' + | |
(t === ta ? "2d" : "Cube") + | |
'"', | |
"invalid texture type", | |
e.commandStr | |
); | |
} | |
switch (m) { | |
case ba: | |
n("number"); | |
break; | |
case va: | |
a(2); | |
break; | |
case ga: | |
a(3); | |
break; | |
case ya: | |
a(4); | |
break; | |
case da: | |
n("number"); | |
break; | |
case ma: | |
a(2); | |
break; | |
case pa: | |
a(3); | |
break; | |
case ha: | |
a(4); | |
break; | |
case xa: | |
n("boolean"); | |
break; | |
case wa: | |
a(2); | |
break; | |
case Aa: | |
a(3); | |
break; | |
case _a: | |
case ka: | |
a(4); | |
break; | |
case Sa: | |
a(9); | |
break; | |
case Ea: | |
a(16); | |
break; | |
case Oa: | |
i(ta); | |
break; | |
case Ta: | |
i(ra); | |
} | |
}); | |
var x = 1; | |
switch (m) { | |
case Oa: | |
case Ta: | |
var w = t.def(c, "._texture"); | |
t(u, ".uniform1i(", h, ",", w, ".bind());"), | |
t.exit(w, ".unbind();"); | |
continue; | |
case ba: | |
case xa: | |
o = "1i"; | |
break; | |
case va: | |
case wa: | |
(o = "2i"), (x = 2); | |
break; | |
case ga: | |
case Aa: | |
(o = "3i"), (x = 3); | |
break; | |
case ya: | |
case _a: | |
(o = "4i"), (x = 4); | |
break; | |
case da: | |
o = "1f"; | |
break; | |
case ma: | |
(o = "2f"), (x = 2); | |
break; | |
case pa: | |
(o = "3f"), (x = 3); | |
break; | |
case ha: | |
(o = "4f"), (x = 4); | |
break; | |
case ka: | |
o = "Matrix2fv"; | |
break; | |
case Sa: | |
o = "Matrix3fv"; | |
break; | |
case Ea: | |
o = "Matrix4fv"; | |
} | |
if ((t(u, ".uniform", o, "(", h, ","), "M" === o.charAt(0))) { | |
var A = Math.pow(m - ka + 2, 2), | |
_ = e.global.def("new Float32Array(", A, ")"); | |
t( | |
"false,(Array.isArray(", | |
c, | |
")||", | |
c, | |
" instanceof Float32Array)?", | |
c, | |
":(", | |
N(A, function (e) { | |
return _ + "[" + e + "]=" + c + "[" + e + "]"; | |
}), | |
",", | |
_, | |
")" | |
); | |
} else | |
t( | |
x > 1 | |
? N(x, function (e) { | |
return c + "[" + e + "]"; | |
}) | |
: c | |
); | |
t(");"); | |
} | |
} | |
function G(e, t, r, n) { | |
var a = e.shared, | |
i = a.gl, | |
o = a.draw, | |
f = n.draw; | |
var u = (function () { | |
var a, | |
u = f.elements, | |
s = t; | |
return ( | |
u | |
? (((u.contextDep && n.contextDynamic) || u.propDep) && | |
(s = r), | |
(a = u.append(e, s))) | |
: (a = s.def(o, ".", Mn)), | |
a && | |
s( | |
"if(" + | |
a + | |
")" + | |
i + | |
".bindBuffer(" + | |
ea + | |
"," + | |
a + | |
".buffer.buffer);" | |
), | |
a | |
); | |
})(); | |
function s(a) { | |
var i = f[a]; | |
return i | |
? (i.contextDep && n.contextDynamic) || i.propDep | |
? i.append(e, r) | |
: i.append(e, t) | |
: t.def(o, ".", a); | |
} | |
var c, | |
l, | |
d = s(Wn), | |
m = s(Gn), | |
p = (function () { | |
var a, | |
i = f.count, | |
u = t; | |
return ( | |
i | |
? (((i.contextDep && n.contextDynamic) || i.propDep) && | |
(u = r), | |
(a = i.append(e, u)), | |
F.optional(function () { | |
i.MISSING && | |
e.assert(t, "false", "missing vertex count"), | |
i.DYNAMIC && | |
e.assert(u, a + ">=0", "missing vertex count"); | |
})) | |
: ((a = u.def(o, ".", Un)), | |
F.optional(function () { | |
e.assert(u, a + ">=0", "missing vertex count"); | |
})), | |
a | |
); | |
})(); | |
if ("number" == typeof p) { | |
if (0 === p) return; | |
} else r("if(", p, "){"), r.exit("}"); | |
g && ((c = s(Hn)), (l = e.instancing)); | |
var h = u + ".type", | |
b = f.elements && Za(f.elements); | |
function v() { | |
function e() { | |
r( | |
l, | |
".drawElementsInstancedANGLE(", | |
[d, p, h, m + "<<((" + h + "-" + en + ")>>1)", c], | |
");" | |
); | |
} | |
function t() { | |
r(l, ".drawArraysInstancedANGLE(", [d, m, p, c], ");"); | |
} | |
u | |
? b | |
? e() | |
: (r("if(", u, "){"), e(), r("}else{"), t(), r("}")) | |
: t(); | |
} | |
function y() { | |
function e() { | |
r( | |
i + | |
".drawElements(" + | |
[d, p, h, m + "<<((" + h + "-" + en + ")>>1)"] + | |
");" | |
); | |
} | |
function t() { | |
r(i + ".drawArrays(" + [d, m, p] + ");"); | |
} | |
u | |
? b | |
? e() | |
: (r("if(", u, "){"), e(), r("}else{"), t(), r("}")) | |
: t(); | |
} | |
g && ("number" != typeof c || c >= 0) | |
? "string" == typeof c | |
? (r("if(", c, ">0){"), | |
v(), | |
r("}else if(", c, "<0){"), | |
y(), | |
r("}")) | |
: v() | |
: y(); | |
} | |
function H(e, t, r, n, a) { | |
var i = C(), | |
o = i.proc("body", a); | |
return ( | |
F.optional(function () { | |
(i.commandStr = t.commandStr), | |
(i.command = i.link(t.commandStr)); | |
}), | |
g && | |
(i.instancing = o.def( | |
i.shared.extensions, | |
".angle_instanced_arrays" | |
)), | |
e(i, o, r, n), | |
i.compile().body | |
); | |
} | |
function q(e, t, r, n) { | |
R(e, t), | |
r.useVAO | |
? r.drawVAO | |
? t(e.shared.vao, ".setVAO(", r.drawVAO.append(e, t), ");") | |
: t(e.shared.vao, ".setVAO(", e.shared.vao, ".targetVAO);") | |
: (t(e.shared.vao, ".setVAO(null);"), | |
W(e, t, r, n.attributes, function () { | |
return !0; | |
})), | |
U(e, t, r, n.uniforms, function () { | |
return !0; | |
}), | |
G(e, t, t, r); | |
} | |
function Q(e, t, r, n) { | |
function a() { | |
return !0; | |
} | |
(e.batchId = "a1"), | |
R(e, t), | |
W(e, t, r, n.attributes, a), | |
U(e, t, r, n.uniforms, a), | |
G(e, t, t, r); | |
} | |
function Y(e, t, r, n) { | |
R(e, t); | |
var a = r.contextDep, | |
i = t.def(), | |
o = t.def(); | |
(e.shared.props = o), (e.batchId = i); | |
var f = e.scope(), | |
u = e.scope(); | |
function s(e) { | |
return (e.contextDep && a) || e.propDep; | |
} | |
function c(e) { | |
return !s(e); | |
} | |
if ( | |
(t( | |
f.entry, | |
"for(", | |
i, | |
"=0;", | |
i, | |
"<", | |
"a1", | |
";++", | |
i, | |
"){", | |
o, | |
"=", | |
"a0", | |
"[", | |
i, | |
"];", | |
u, | |
"}", | |
f.exit | |
), | |
r.needsContext && B(e, u, r.context), | |
r.needsFramebuffer && V(e, u, r.framebuffer), | |
L(e, u, r.state, s), | |
r.profile && s(r.profile) && M(e, u, r, !1, !0), | |
n) | |
) | |
r.useVAO | |
? r.drawVAO | |
? s(r.drawVAO) | |
? u( | |
e.shared.vao, | |
".setVAO(", | |
r.drawVAO.append(e, u), | |
");" | |
) | |
: f( | |
e.shared.vao, | |
".setVAO(", | |
r.drawVAO.append(e, f), | |
");" | |
) | |
: f(e.shared.vao, ".setVAO(", e.shared.vao, ".targetVAO);") | |
: (f(e.shared.vao, ".setVAO(null);"), | |
W(e, f, r, n.attributes, c), | |
W(e, u, r, n.attributes, s)), | |
U(e, f, r, n.uniforms, c), | |
U(e, u, r, n.uniforms, s), | |
G(e, f, u, r); | |
else { | |
var l = e.global.def("{}"), | |
d = r.shader.progVar.append(e, u), | |
m = u.def(d, ".id"), | |
p = u.def(l, "[", m, "]"); | |
u( | |
e.shared.gl, | |
".useProgram(", | |
d, | |
".program);", | |
"if(!", | |
p, | |
"){", | |
p, | |
"=", | |
l, | |
"[", | |
m, | |
"]=", | |
e.link(function (t) { | |
return H(Q, e, r, t, 2); | |
}), | |
"(", | |
d, | |
");}", | |
p, | |
".call(this,a0[", | |
i, | |
"],", | |
i, | |
");" | |
); | |
} | |
} | |
function X(e, t, r) { | |
var n = t.static[r]; | |
if ( | |
n && | |
(function (e) { | |
if ("object" == typeof e && !Le(e)) { | |
for (var t = Object.keys(e), r = 0; r < t.length; ++r) | |
if (I.isDynamic(e[t[r]])) return !0; | |
return !1; | |
} | |
})(n) | |
) { | |
var a = e.global, | |
i = Object.keys(n), | |
o = !1, | |
f = !1, | |
u = !1, | |
s = e.global.def("{}"); | |
i.forEach(function (t) { | |
var r = n[t]; | |
if (I.isDynamic(r)) { | |
"function" == typeof r && (r = n[t] = I.unbox(r)); | |
var i = ti(r, null); | |
(o = o || i.thisDep), | |
(u = u || i.propDep), | |
(f = f || i.contextDep); | |
} else { | |
switch ((a(s, ".", t, "="), typeof r)) { | |
case "number": | |
a(r); | |
break; | |
case "string": | |
a('"', r, '"'); | |
break; | |
case "object": | |
Array.isArray(r) && a("[", r.join(), "]"); | |
break; | |
default: | |
a(e.link(r)); | |
} | |
a(";"); | |
} | |
}), | |
(t.dynamic[r] = new I.DynamicVariable(un, { | |
thisDep: o, | |
contextDep: f, | |
propDep: u, | |
ref: s, | |
append: function (e, t) { | |
i.forEach(function (r) { | |
var a = n[r]; | |
if (I.isDynamic(a)) { | |
var i = e.invoke(t, a); | |
t(s, ".", r, "=", i, ";"); | |
} | |
}); | |
}, | |
})), | |
delete t.static[r]; | |
} | |
} | |
return { | |
next: w, | |
current: x, | |
procs: (function () { | |
var e = C(), | |
t = e.proc("poll"), | |
r = e.proc("refresh"), | |
i = e.block(); | |
t(i), r(i); | |
var o, | |
f = e.shared, | |
u = f.gl, | |
s = f.next, | |
c = f.current; | |
i(c, ".dirty=false;"), | |
V(e, t), | |
V(e, r, null, !0), | |
g && (o = e.link(g)), | |
n.oes_vertex_array_object && | |
r( | |
e.link(n.oes_vertex_array_object), | |
".bindVertexArrayOES(null);" | |
); | |
for (var l = 0; l < a.maxAttributes; ++l) { | |
var d = r.def(f.attributes, "[", l, "]"), | |
m = e.cond(d, ".buffer"); | |
m | |
.then( | |
u, | |
".enableVertexAttribArray(", | |
l, | |
");", | |
u, | |
".bindBuffer(", | |
Zn, | |
",", | |
d, | |
".buffer.buffer);", | |
u, | |
".vertexAttribPointer(", | |
l, | |
",", | |
d, | |
".size,", | |
d, | |
".type,", | |
d, | |
".normalized,", | |
d, | |
".stride,", | |
d, | |
".offset);" | |
) | |
.else( | |
u, | |
".disableVertexAttribArray(", | |
l, | |
");", | |
u, | |
".vertexAttrib4f(", | |
l, | |
",", | |
d, | |
".x,", | |
d, | |
".y,", | |
d, | |
".z,", | |
d, | |
".w);", | |
d, | |
".buffer=null;" | |
), | |
r(m), | |
g && | |
r( | |
o, | |
".vertexAttribDivisorANGLE(", | |
l, | |
",", | |
d, | |
".divisor);" | |
); | |
} | |
return ( | |
r( | |
e.shared.vao, | |
".currentVAO=null;", | |
e.shared.vao, | |
".setVAO(", | |
e.shared.vao, | |
".targetVAO);" | |
), | |
Object.keys(_).forEach(function (n) { | |
var a = _[n], | |
o = i.def(s, ".", n), | |
f = e.block(); | |
f( | |
"if(", | |
o, | |
"){", | |
u, | |
".enable(", | |
a, | |
")}else{", | |
u, | |
".disable(", | |
a, | |
")}", | |
c, | |
".", | |
n, | |
"=", | |
o, | |
";" | |
), | |
r(f), | |
t("if(", o, "!==", c, ".", n, "){", f, "}"); | |
}), | |
Object.keys(k).forEach(function (n) { | |
var a, | |
o, | |
f = k[n], | |
l = x[n], | |
d = e.block(); | |
if ((d(u, ".", f, "("), Le(l))) { | |
var m = l.length; | |
(a = e.global.def(s, ".", n)), | |
(o = e.global.def(c, ".", n)), | |
d( | |
N(m, function (e) { | |
return a + "[" + e + "]"; | |
}), | |
");", | |
N(m, function (e) { | |
return o + "[" + e + "]=" + a + "[" + e + "];"; | |
}).join("") | |
), | |
t( | |
"if(", | |
N(m, function (e) { | |
return a + "[" + e + "]!==" + o + "[" + e + "]"; | |
}).join("||"), | |
"){", | |
d, | |
"}" | |
); | |
} else (a = i.def(s, ".", n)), (o = i.def(c, ".", n)), d(a, ");", c, ".", n, "=", a, ";"), t("if(", a, "!==", o, "){", d, "}"); | |
r(d); | |
}), | |
e.compile() | |
); | |
})(), | |
compile: function (e, t, n, a, i) { | |
var o = C(); | |
(o.stats = o.link(i)), | |
Object.keys(t.static).forEach(function (e) { | |
X(o, t, e); | |
}), | |
Jn.forEach(function (t) { | |
X(o, e, t); | |
}); | |
var f = z(e, t, n, a, o); | |
return ( | |
(function (e, t) { | |
var r = e.proc("draw", 1); | |
R(e, r), | |
B(e, r, t.context), | |
V(e, r, t.framebuffer), | |
P(e, r, t), | |
L(e, r, t.state), | |
M(e, r, t, !1, !0); | |
var n = t.shader.progVar.append(e, r); | |
if ( | |
(r(e.shared.gl, ".useProgram(", n, ".program);"), | |
t.shader.program) | |
) | |
q(e, r, t, t.shader.program); | |
else { | |
r(e.shared.vao, ".setVAO(null);"); | |
var a = e.global.def("{}"), | |
i = r.def(n, ".id"), | |
o = r.def(a, "[", i, "]"); | |
r( | |
e | |
.cond(o) | |
.then(o, ".call(this,a0);") | |
.else( | |
o, | |
"=", | |
a, | |
"[", | |
i, | |
"]=", | |
e.link(function (r) { | |
return H(q, e, t, r, 1); | |
}), | |
"(", | |
n, | |
");", | |
o, | |
".call(this,a0);" | |
) | |
); | |
} | |
Object.keys(t.state).length > 0 && | |
r(e.shared.current, ".dirty=true;"); | |
})(o, f), | |
(function (e, t) { | |
var n = e.proc("scope", 3); | |
e.batchId = "a2"; | |
var a = e.shared, | |
i = a.current; | |
function o(r) { | |
var i = t.shader[r]; | |
i && n.set(a.shader, "." + r, i.append(e, n)); | |
} | |
B(e, n, t.context), | |
t.framebuffer && t.framebuffer.append(e, n), | |
Ka(Object.keys(t.state)).forEach(function (r) { | |
var i = t.state[r].append(e, n); | |
Le(i) | |
? i.forEach(function (t, a) { | |
n.set(e.next[r], "[" + a + "]", t); | |
}) | |
: n.set(a.next, "." + r, i); | |
}), | |
M(e, n, t, !0, !0), | |
[Mn, Gn, Un, Hn, Wn].forEach(function (r) { | |
var i = t.draw[r]; | |
i && n.set(a.draw, "." + r, "" + i.append(e, n)); | |
}), | |
Object.keys(t.uniforms).forEach(function (i) { | |
n.set( | |
a.uniforms, | |
"[" + r.id(i) + "]", | |
t.uniforms[i].append(e, n) | |
); | |
}), | |
Object.keys(t.attributes).forEach(function (r) { | |
var a = t.attributes[r].append(e, n), | |
i = e.scopeAttrib(r); | |
Object.keys(new b()).forEach(function (e) { | |
n.set(i, "." + e, a[e]); | |
}); | |
}), | |
t.scopeVAO && | |
n.set(a.vao, ".targetVAO", t.scopeVAO.append(e, n)), | |
o(Rn), | |
o(In), | |
Object.keys(t.state).length > 0 && | |
(n(i, ".dirty=true;"), n.exit(i, ".dirty=true;")), | |
n("a1(", e.shared.context, ",a0,", e.batchId, ");"); | |
})(o, f), | |
(function (e, t) { | |
var r = e.proc("batch", 2); | |
(e.batchId = "0"), R(e, r); | |
var n = !1, | |
a = !0; | |
Object.keys(t.context).forEach(function (e) { | |
n = n || t.context[e].propDep; | |
}), | |
n || (B(e, r, t.context), (a = !1)); | |
var i = t.framebuffer, | |
o = !1; | |
function f(e) { | |
return (e.contextDep && n) || e.propDep; | |
} | |
i | |
? (i.propDep | |
? (n = o = !0) | |
: i.contextDep && n && (o = !0), | |
o || V(e, r, i)) | |
: V(e, r, null), | |
t.state.viewport && t.state.viewport.propDep && (n = !0), | |
P(e, r, t), | |
L(e, r, t.state, function (e) { | |
return !f(e); | |
}), | |
(t.profile && f(t.profile)) || M(e, r, t, !1, "a1"), | |
(t.contextDep = n), | |
(t.needsContext = a), | |
(t.needsFramebuffer = o); | |
var u = t.shader.progVar; | |
if ((u.contextDep && n) || u.propDep) Y(e, r, t, null); | |
else { | |
var s = u.append(e, r); | |
if ( | |
(r(e.shared.gl, ".useProgram(", s, ".program);"), | |
t.shader.program) | |
) | |
Y(e, r, t, t.shader.program); | |
else { | |
r(e.shared.vao, ".setVAO(null);"); | |
var c = e.global.def("{}"), | |
l = r.def(s, ".id"), | |
d = r.def(c, "[", l, "]"); | |
r( | |
e | |
.cond(d) | |
.then(d, ".call(this,a0,a1);") | |
.else( | |
d, | |
"=", | |
c, | |
"[", | |
l, | |
"]=", | |
e.link(function (r) { | |
return H(Y, e, t, r, 2); | |
}), | |
"(", | |
s, | |
");", | |
d, | |
".call(this,a0,a1);" | |
) | |
); | |
} | |
} | |
Object.keys(t.state).length > 0 && | |
r(e.shared.current, ".dirty=true;"); | |
})(o, f), | |
o.compile() | |
); | |
}, | |
}; | |
} | |
var ai = 34918, | |
ii = 34919, | |
oi = 35007, | |
fi = function (e, t) { | |
if (!t.ext_disjoint_timer_query) return null; | |
var r = []; | |
function n(e) { | |
r.push(e); | |
} | |
var a = []; | |
function i() { | |
(this.startQueryIndex = -1), | |
(this.endQueryIndex = -1), | |
(this.sum = 0), | |
(this.stats = null); | |
} | |
var o = []; | |
function f(e) { | |
o.push(e); | |
} | |
var u = []; | |
function s(e, t, r) { | |
var n = o.pop() || new i(); | |
(n.startQueryIndex = e), | |
(n.endQueryIndex = t), | |
(n.sum = 0), | |
(n.stats = r), | |
u.push(n); | |
} | |
var c = [], | |
l = []; | |
return { | |
beginQuery: function (e) { | |
var n = | |
r.pop() || t.ext_disjoint_timer_query.createQueryEXT(); | |
t.ext_disjoint_timer_query.beginQueryEXT(oi, n), | |
a.push(n), | |
s(a.length - 1, a.length, e); | |
}, | |
endQuery: function () { | |
t.ext_disjoint_timer_query.endQueryEXT(oi); | |
}, | |
pushScopeStats: s, | |
update: function () { | |
var e, | |
r, | |
i = a.length; | |
if (0 !== i) { | |
(l.length = Math.max(l.length, i + 1)), | |
(c.length = Math.max(c.length, i + 1)), | |
(c[0] = 0), | |
(l[0] = 0); | |
var o = 0; | |
for (e = 0, r = 0; r < a.length; ++r) { | |
var s = a[r]; | |
t.ext_disjoint_timer_query.getQueryObjectEXT(s, ii) | |
? ((o += t.ext_disjoint_timer_query.getQueryObjectEXT( | |
s, | |
ai | |
)), | |
n(s)) | |
: (a[e++] = s), | |
(c[r + 1] = o), | |
(l[r + 1] = e); | |
} | |
for (a.length = e, e = 0, r = 0; r < u.length; ++r) { | |
var d = u[r], | |
m = d.startQueryIndex, | |
p = d.endQueryIndex; | |
d.sum += c[p] - c[m]; | |
var h = l[m], | |
b = l[p]; | |
b === h | |
? ((d.stats.gpuTime += d.sum / 1e6), f(d)) | |
: ((d.startQueryIndex = h), | |
(d.endQueryIndex = b), | |
(u[e++] = d)); | |
} | |
u.length = e; | |
} | |
}, | |
getNumPendingQueries: function () { | |
return a.length; | |
}, | |
clear: function () { | |
r.push.apply(r, a); | |
for (var e = 0; e < r.length; e++) | |
t.ext_disjoint_timer_query.deleteQueryEXT(r[e]); | |
(a.length = 0), (r.length = 0); | |
}, | |
restore: function () { | |
(a.length = 0), (r.length = 0); | |
}, | |
}; | |
}, | |
ui = 16384, | |
si = 256, | |
ci = 1024, | |
li = 34962, | |
di = "webglcontextlost", | |
mi = "webglcontextrestored", | |
pi = 1, | |
hi = 2, | |
bi = 3; | |
function vi(e, t) { | |
for (var r = 0; r < e.length; ++r) if (e[r] === t) return r; | |
return -1; | |
} | |
return function (r) { | |
var n = H(r); | |
if (!n) return null; | |
var a = n.gl, | |
i = a.getContextAttributes(), | |
o = a.isContextLost(), | |
f = (function (e, t) { | |
var r = {}; | |
function n(t) { | |
F.type(t, "string", "extension name must be string"); | |
var n, | |
a = t.toLowerCase(); | |
try { | |
n = r[a] = e.getExtension(a); | |
} catch (i) {} | |
return !!n; | |
} | |
for (var a = 0; a < t.extensions.length; ++a) { | |
var i = t.extensions[a]; | |
if (!n(i)) | |
return ( | |
t.onDestroy(), | |
t.onDone( | |
'"' + | |
i + | |
'" extension is not supported by the current WebGL context, try upgrading your system or a different browser' | |
), | |
null | |
); | |
} | |
return ( | |
t.optionalExtensions.forEach(n), | |
{ | |
extensions: r, | |
restore: function () { | |
Object.keys(r).forEach(function (e) { | |
if (r[e] && !n(e)) | |
throw new Error( | |
"(regl): error restoring extension " + e | |
); | |
}); | |
}, | |
} | |
); | |
})(a, n); | |
if (!f) return null; | |
var u, | |
s, | |
c = | |
((u = { "": 0 }), | |
(s = [""]), | |
{ | |
id: function (e) { | |
var t = u[e]; | |
return t || ((t = u[e] = s.length), s.push(e), t); | |
}, | |
str: function (e) { | |
return s[e]; | |
}, | |
}), | |
l = { | |
vaoCount: 0, | |
bufferCount: 0, | |
elementsCount: 0, | |
framebufferCount: 0, | |
shaderCount: 0, | |
textureCount: 0, | |
cubeCount: 0, | |
renderbufferCount: 0, | |
maxTextureUnits: 0, | |
}, | |
d = f.extensions, | |
m = fi(a, d), | |
p = W(), | |
h = a.drawingBufferWidth, | |
b = a.drawingBufferHeight, | |
v = { | |
tick: 0, | |
time: 0, | |
viewportWidth: h, | |
viewportHeight: b, | |
framebufferWidth: h, | |
framebufferHeight: b, | |
drawingBufferWidth: h, | |
drawingBufferHeight: b, | |
pixelRatio: n.pixelRatio, | |
}, | |
g = re(a, d), | |
y = (function (t, r, n, a) { | |
var i = 0, | |
o = {}; | |
function f(e) { | |
(this.id = i++), | |
(this.buffer = t.createBuffer()), | |
(this.type = e), | |
(this.usage = de), | |
(this.byteLength = 0), | |
(this.dimension = 1), | |
(this.dtype = pe), | |
(this.persistentData = null), | |
n.profile && (this.stats = { size: 0 }); | |
} | |
(f.prototype.bind = function () { | |
t.bindBuffer(this.type, this.buffer); | |
}), | |
(f.prototype.destroy = function () { | |
l(this); | |
}); | |
var u = []; | |
function s(e, r, n) { | |
(e.byteLength = r.byteLength), t.bufferData(e.type, r, n); | |
} | |
function c(t, r, n, a, i, o) { | |
var f, u; | |
if (((t.usage = n), Array.isArray(r))) { | |
if (((t.dtype = a || he), r.length > 0)) | |
if (Array.isArray(r[0])) { | |
f = le(r); | |
for (var c = 1, l = 1; l < f.length; ++l) c *= f[l]; | |
(t.dimension = c), | |
s(t, (u = ce(r, f, t.dtype)), n), | |
o ? (t.persistentData = u) : te.freeType(u); | |
} else if ("number" == typeof r[0]) { | |
t.dimension = i; | |
var d = te.allocType(t.dtype, r.length); | |
ge(d, r), | |
s(t, d, n), | |
o ? (t.persistentData = d) : te.freeType(d); | |
} else | |
e(r[0]) | |
? ((t.dimension = r[0].length), | |
(t.dtype = a || ve(r[0]) || he), | |
s( | |
t, | |
(u = ce(r, [r.length, r[0].length], t.dtype)), | |
n | |
), | |
o ? (t.persistentData = u) : te.freeType(u)) | |
: F.raise("invalid buffer data"); | |
} else if (e(r)) | |
(t.dtype = a || ve(r)), | |
(t.dimension = i), | |
s(t, r, n), | |
o && | |
(t.persistentData = new Uint8Array( | |
new Uint8Array(r.buffer) | |
)); | |
else if (ne(r)) { | |
f = r.shape; | |
var m = r.stride, | |
p = r.offset, | |
h = 0, | |
b = 0, | |
v = 0, | |
g = 0; | |
1 === f.length | |
? ((h = f[0]), (b = 1), (v = m[0]), (g = 0)) | |
: 2 === f.length | |
? ((h = f[0]), (b = f[1]), (v = m[0]), (g = m[1])) | |
: F.raise("invalid shape"), | |
(t.dtype = a || ve(r.data) || he), | |
(t.dimension = b); | |
var y = te.allocType(t.dtype, h * b); | |
ye(y, r.data, h, b, v, g, p), | |
s(t, y, n), | |
o ? (t.persistentData = y) : te.freeType(y); | |
} else | |
r instanceof ArrayBuffer | |
? ((t.dtype = pe), | |
(t.dimension = i), | |
s(t, r, n), | |
o && | |
(t.persistentData = new Uint8Array( | |
new Uint8Array(r) | |
))) | |
: F.raise("invalid buffer data"); | |
} | |
function l(e) { | |
r.bufferCount--, a(e); | |
var n = e.buffer; | |
F(n, "buffer must not be deleted already"), | |
t.deleteBuffer(n), | |
(e.buffer = null), | |
delete o[e.id]; | |
} | |
return ( | |
n.profile && | |
(r.getTotalBufferSize = function () { | |
var e = 0; | |
return ( | |
Object.keys(o).forEach(function (t) { | |
e += o[t].stats.size; | |
}), | |
e | |
); | |
}), | |
{ | |
create: function (a, i, u, s) { | |
r.bufferCount++; | |
var d = new f(i); | |
function m(r) { | |
var a = de, | |
i = null, | |
o = 0, | |
f = 0, | |
u = 1; | |
return ( | |
Array.isArray(r) || | |
e(r) || | |
ne(r) || | |
r instanceof ArrayBuffer | |
? (i = r) | |
: "number" == typeof r | |
? (o = 0 | r) | |
: r && | |
(F.type( | |
r, | |
"object", | |
"buffer arguments must be an object, a number or an array" | |
), | |
"data" in r && | |
(F( | |
null === i || | |
Array.isArray(i) || | |
e(i) || | |
ne(i), | |
"invalid data for buffer" | |
), | |
(i = r.data)), | |
"usage" in r && | |
(F.parameter( | |
r.usage, | |
se, | |
"invalid buffer usage" | |
), | |
(a = se[r.usage])), | |
"type" in r && | |
(F.parameter(r.type, ue, "invalid buffer type"), | |
(f = ue[r.type])), | |
"dimension" in r && | |
(F.type( | |
r.dimension, | |
"number", | |
"invalid dimension" | |
), | |
(u = 0 | r.dimension)), | |
"length" in r && | |
(F.nni( | |
o, | |
"buffer length must be a nonnegative integer" | |
), | |
(o = 0 | r.length))), | |
d.bind(), | |
i | |
? c(d, i, a, f, u, s) | |
: (o && t.bufferData(d.type, o, a), | |
(d.dtype = f || pe), | |
(d.usage = a), | |
(d.dimension = u), | |
(d.byteLength = o)), | |
n.profile && | |
(d.stats.size = d.byteLength * be[d.dtype]), | |
m | |
); | |
} | |
function p(e, r) { | |
F( | |
r + e.byteLength <= d.byteLength, | |
"invalid buffer subdata call, buffer is too small. Can't write data of size " + | |
e.byteLength + | |
" starting from offset " + | |
r + | |
" to a buffer of size " + | |
d.byteLength | |
), | |
t.bufferSubData(d.type, r, e); | |
} | |
return ( | |
(o[d.id] = d), | |
u || m(a), | |
(m._reglType = "buffer"), | |
(m._buffer = d), | |
(m.subdata = function (t, r) { | |
var n, | |
a = 0 | (r || 0); | |
if ((d.bind(), e(t) || t instanceof ArrayBuffer)) | |
p(t, a); | |
else if (Array.isArray(t)) { | |
if (t.length > 0) | |
if ("number" == typeof t[0]) { | |
var i = te.allocType(d.dtype, t.length); | |
ge(i, t), p(i, a), te.freeType(i); | |
} else if (Array.isArray(t[0]) || e(t[0])) { | |
n = le(t); | |
var o = ce(t, n, d.dtype); | |
p(o, a), te.freeType(o); | |
} else F.raise("invalid buffer data"); | |
} else if (ne(t)) { | |
n = t.shape; | |
var f = t.stride, | |
u = 0, | |
s = 0, | |
c = 0, | |
l = 0; | |
1 === n.length | |
? ((u = n[0]), (s = 1), (c = f[0]), (l = 0)) | |
: 2 === n.length | |
? ((u = n[0]), (s = n[1]), (c = f[0]), (l = f[1])) | |
: F.raise("invalid shape"); | |
var h = Array.isArray(t.data) | |
? d.dtype | |
: ve(t.data), | |
b = te.allocType(h, u * s); | |
ye(b, t.data, u, s, c, l, t.offset), | |
p(b, a), | |
te.freeType(b); | |
} else F.raise("invalid data for buffer subdata"); | |
return m; | |
}), | |
n.profile && (m.stats = d.stats), | |
(m.destroy = function () { | |
l(d); | |
}), | |
m | |
); | |
}, | |
createStream: function (e, t) { | |
var r = u.pop(); | |
return ( | |
r || (r = new f(e)), r.bind(), c(r, t, me, 0, 1, !1), r | |
); | |
}, | |
destroyStream: function (e) { | |
u.push(e); | |
}, | |
clear: function () { | |
ae(o).forEach(l), u.forEach(l); | |
}, | |
getBuffer: function (e) { | |
return e && e._buffer instanceof f ? e._buffer : null; | |
}, | |
restore: function () { | |
ae(o).forEach(function (e) { | |
(e.buffer = t.createBuffer()), | |
t.bindBuffer(e.type, e.buffer), | |
t.bufferData( | |
e.type, | |
e.persistentData || e.byteLength, | |
e.usage | |
); | |
}); | |
}, | |
_initBuffer: c, | |
} | |
); | |
})(a, l, n, function (e) { | |
return x.destroyBuffer(e); | |
}), | |
x = (function (t, r, n, a, i) { | |
for ( | |
var o = n.maxAttributes, f = new Array(o), u = 0; | |
u < o; | |
++u | |
) | |
f[u] = new Wr(); | |
var s = 0, | |
c = {}, | |
l = { | |
Record: Wr, | |
scope: {}, | |
state: f, | |
currentVAO: null, | |
targetVAO: null, | |
restore: d() | |
? function () { | |
d() && | |
ae(c).forEach(function (e) { | |
e.refresh(); | |
}); | |
} | |
: function () {}, | |
createVAO: function (t) { | |
var n = new p(); | |
function f(t) { | |
F( | |
Array.isArray(t), | |
"arguments to vertex array constructor must be an array" | |
), | |
F(t.length < o, "too many attributes"), | |
F( | |
t.length > 0, | |
"must specify at least one attribute" | |
); | |
for (var a = 0; a < n.buffers.length; ++a) | |
n.buffers[a].destroy(); | |
n.buffers.length = 0; | |
var u = n.attributes; | |
u.length = t.length; | |
for (var s = 0; s < t.length; ++s) { | |
var c = t[s], | |
l = (u[s] = new Wr()); | |
if (Array.isArray(c) || e(c) || ne(c)) { | |
var d = i.create(c, Mr, !1, !0); | |
(l.buffer = i.getBuffer(d)), | |
(l.size = 0 | l.buffer.dimension), | |
(l.normalized = !1), | |
(l.type = l.buffer.dtype), | |
(l.offset = 0), | |
(l.stride = 0), | |
(l.divisor = 0), | |
(l.state = 1), | |
n.buffers.push(d); | |
} else | |
i.getBuffer(c) | |
? ((l.buffer = i.getBuffer(c)), | |
(l.size = 0 | l.buffer.dimension), | |
(l.normalized = !1), | |
(l.type = l.buffer.dtype), | |
(l.offset = 0), | |
(l.stride = 0), | |
(l.divisor = 0), | |
(l.state = 1)) | |
: i.getBuffer(c.buffer) | |
? ((l.buffer = i.getBuffer(c.buffer)), | |
(l.size = 0 | (+c.size || l.buffer.dimension)), | |
(l.normalized = !!c.normalized || !1), | |
"type" in c | |
? (F.parameter( | |
c.type, | |
ue, | |
"invalid buffer type" | |
), | |
(l.type = ue[c.type])) | |
: (l.type = l.buffer.dtype), | |
(l.offset = 0 | (c.offset || 0)), | |
(l.stride = 0 | (c.stride || 0)), | |
(l.divisor = 0 | (c.divisor || 0)), | |
(l.state = 1), | |
F( | |
l.size >= 1 && l.size <= 4, | |
"size must be between 1 and 4" | |
), | |
F(l.offset >= 0, "invalid offset"), | |
F( | |
l.stride >= 0 && l.stride <= 255, | |
"stride must be between 0 and 255" | |
), | |
F(l.divisor >= 0, "divisor must be positive"), | |
F( | |
!l.divisor || !!r.angle_instanced_arrays, | |
"ANGLE_instanced_arrays must be enabled to use divisor" | |
)) | |
: "x" in c | |
? (F( | |
s > 0, | |
"first attribute must not be a constant" | |
), | |
(l.x = +c.x || 0), | |
(l.y = +c.y || 0), | |
(l.z = +c.z || 0), | |
(l.w = +c.w || 0), | |
(l.state = 2)) | |
: F( | |
!1, | |
"invalid attribute spec for location " + s | |
); | |
} | |
return n.refresh(), f; | |
} | |
return ( | |
(a.vaoCount += 1), | |
(f.destroy = function () { | |
n.destroy(); | |
}), | |
(f._vao = n), | |
(f._reglType = "vao"), | |
f(t) | |
); | |
}, | |
getVAO: function (e) { | |
return "function" == typeof e && e._vao ? e._vao : null; | |
}, | |
destroyBuffer: function (e) { | |
for (var r = 0; r < f.length; ++r) { | |
var n = f[r]; | |
n.buffer === e && | |
(t.disableVertexAttribArray(r), (n.buffer = null)); | |
} | |
}, | |
setVAO: d() | |
? function (e) { | |
if (e !== l.currentVAO) { | |
var t = d(); | |
e | |
? t.bindVertexArrayOES(e.vao) | |
: t.bindVertexArrayOES(null), | |
(l.currentVAO = e); | |
} | |
} | |
: function (e) { | |
if (e !== l.currentVAO) { | |
if (e) e.bindAttrs(); | |
else | |
for (var r = m(), n = 0; n < f.length; ++n) { | |
var a = f[n]; | |
a.buffer | |
? (t.enableVertexAttribArray(n), | |
t.vertexAttribPointer( | |
n, | |
a.size, | |
a.type, | |
a.normalized, | |
a.stride, | |
a.offfset | |
), | |
r && | |
r.vertexAttribDivisorANGLE(n, a.divisor)) | |
: (t.disableVertexAttribArray(n), | |
t.vertexAttrib4f(n, a.x, a.y, a.z, a.w)); | |
} | |
l.currentVAO = e; | |
} | |
}, | |
clear: d() | |
? function () { | |
ae(c).forEach(function (e) { | |
e.destroy(); | |
}); | |
} | |
: function () {}, | |
}; | |
function d() { | |
return r.oes_vertex_array_object; | |
} | |
function m() { | |
return r.angle_instanced_arrays; | |
} | |
function p() { | |
(this.id = ++s), (this.attributes = []); | |
var e = d(); | |
(this.vao = e ? e.createVertexArrayOES() : null), | |
(c[this.id] = this), | |
(this.buffers = []); | |
} | |
return ( | |
(p.prototype.bindAttrs = function () { | |
for ( | |
var e = m(), r = this.attributes, n = 0; | |
n < r.length; | |
++n | |
) { | |
var a = r[n]; | |
a.buffer | |
? (t.enableVertexAttribArray(n), | |
t.bindBuffer(Mr, a.buffer.buffer), | |
t.vertexAttribPointer( | |
n, | |
a.size, | |
a.type, | |
a.normalized, | |
a.stride, | |
a.offset | |
), | |
e && e.vertexAttribDivisorANGLE(n, a.divisor)) | |
: (t.disableVertexAttribArray(n), | |
t.vertexAttrib4f(n, a.x, a.y, a.z, a.w)); | |
} | |
for (var i = r.length; i < o; ++i) | |
t.disableVertexAttribArray(i); | |
}), | |
(p.prototype.refresh = function () { | |
var e = d(); | |
e && | |
(e.bindVertexArrayOES(this.vao), | |
this.bindAttrs(), | |
(l.currentVAO = this)); | |
}), | |
(p.prototype.destroy = function () { | |
if (this.vao) { | |
var e = d(); | |
this === l.currentVAO && | |
((l.currentVAO = null), e.bindVertexArrayOES(null)), | |
e.deleteVertexArrayOES(this.vao), | |
(this.vao = null); | |
} | |
c[this.id] && (delete c[this.id], (a.vaoCount -= 1)); | |
}), | |
l | |
); | |
})(a, d, g, l, y), | |
w = (function (t, r, n, a) { | |
var i = {}, | |
o = 0, | |
f = { uint8: Se, uint16: Oe }; | |
function u(e) { | |
(this.id = o++), | |
(i[this.id] = this), | |
(this.buffer = e), | |
(this.primType = _e), | |
(this.vertCount = 0), | |
(this.type = 0); | |
} | |
r.oes_element_index_uint && (f.uint32 = je), | |
(u.prototype.bind = function () { | |
this.buffer.bind(); | |
}); | |
var s = []; | |
function c(a, i, o, f, u, s, c) { | |
var l; | |
if ((a.buffer.bind(), i)) { | |
var d = c; | |
c || | |
(e(i) && (!ne(i) || e(i.data))) || | |
(d = r.oes_element_index_uint ? je : Oe), | |
n._initBuffer(a.buffer, i, o, d, 3); | |
} else | |
t.bufferData(De, s, o), | |
(a.buffer.dtype = l || Se), | |
(a.buffer.usage = o), | |
(a.buffer.dimension = 3), | |
(a.buffer.byteLength = s); | |
if (((l = c), !c)) { | |
switch (a.buffer.dtype) { | |
case Se: | |
case ke: | |
l = Se; | |
break; | |
case Oe: | |
case Ee: | |
l = Oe; | |
break; | |
case je: | |
case Te: | |
l = je; | |
break; | |
default: | |
F.raise("unsupported type for element array"); | |
} | |
a.buffer.dtype = l; | |
} | |
(a.type = l), | |
F( | |
l !== je || !!r.oes_element_index_uint, | |
"32 bit element buffers not supported, enable oes_element_index_uint first" | |
); | |
var m = u; | |
m < 0 && | |
((m = a.buffer.byteLength), | |
l === Oe ? (m >>= 1) : l === je && (m >>= 2)), | |
(a.vertCount = m); | |
var p = f; | |
if (f < 0) { | |
p = _e; | |
var h = a.buffer.dimension; | |
1 === h && (p = we), | |
2 === h && (p = Ae), | |
3 === h && (p = _e); | |
} | |
a.primType = p; | |
} | |
function l(e) { | |
a.elementsCount--, | |
F(null !== e.buffer, "must not double destroy elements"), | |
delete i[e.id], | |
e.buffer.destroy(), | |
(e.buffer = null); | |
} | |
return { | |
create: function (t, r) { | |
var i = n.create(null, De, !0), | |
o = new u(i._buffer); | |
function s(t) { | |
if (t) | |
if ("number" == typeof t) | |
i(t), | |
(o.primType = _e), | |
(o.vertCount = 0 | t), | |
(o.type = Se); | |
else { | |
var r = null, | |
n = ze, | |
a = -1, | |
u = -1, | |
l = 0, | |
d = 0; | |
Array.isArray(t) || e(t) || ne(t) | |
? (r = t) | |
: (F.type( | |
t, | |
"object", | |
"invalid arguments for elements" | |
), | |
"data" in t && | |
((r = t.data), | |
F( | |
Array.isArray(r) || e(r) || ne(r), | |
"invalid data for element buffer" | |
)), | |
"usage" in t && | |
(F.parameter( | |
t.usage, | |
se, | |
"invalid element buffer usage" | |
), | |
(n = se[t.usage])), | |
"primitive" in t && | |
(F.parameter( | |
t.primitive, | |
xe, | |
"invalid element buffer primitive" | |
), | |
(a = xe[t.primitive])), | |
"count" in t && | |
(F( | |
"number" == typeof t.count && t.count >= 0, | |
"invalid vertex count for elements" | |
), | |
(u = 0 | t.count)), | |
"type" in t && | |
(F.parameter(t.type, f, "invalid buffer type"), | |
(d = f[t.type])), | |
"length" in t | |
? (l = 0 | t.length) | |
: ((l = u), | |
d === Oe || d === Ee | |
? (l *= 2) | |
: (d !== je && d !== Te) || (l *= 4))), | |
c(o, r, n, a, u, l, d); | |
} | |
else | |
i(), | |
(o.primType = _e), | |
(o.vertCount = 0), | |
(o.type = Se); | |
return s; | |
} | |
return ( | |
a.elementsCount++, | |
s(t), | |
(s._reglType = "elements"), | |
(s._elements = o), | |
(s.subdata = function (e, t) { | |
return i.subdata(e, t), s; | |
}), | |
(s.destroy = function () { | |
l(o); | |
}), | |
s | |
); | |
}, | |
createStream: function (e) { | |
var t = s.pop(); | |
return ( | |
t || (t = new u(n.create(null, De, !0, !1)._buffer)), | |
c(t, e, Ce, -1, -1, 0, 0), | |
t | |
); | |
}, | |
destroyStream: function (e) { | |
s.push(e); | |
}, | |
getElements: function (e) { | |
return "function" == typeof e && e._elements instanceof u | |
? e._elements | |
: null; | |
}, | |
clear: function () { | |
ae(i).forEach(l); | |
}, | |
}; | |
})(a, d, y, l), | |
A = (function (e, t, r, n) { | |
var a = {}, | |
i = {}; | |
function o(e, t, r, n) { | |
(this.name = e), | |
(this.id = t), | |
(this.location = r), | |
(this.info = n); | |
} | |
function f(e, t) { | |
for (var r = 0; r < e.length; ++r) | |
if (e[r].id === t.id) | |
return void (e[r].location = t.location); | |
e.push(t); | |
} | |
function u(r, n, o) { | |
var f = r === Ur ? a : i, | |
u = f[n]; | |
if (!u) { | |
var s = t.str(n); | |
(u = e.createShader(r)), | |
e.shaderSource(u, s), | |
e.compileShader(u), | |
F.shaderError(e, u, s, r, o), | |
(f[n] = u); | |
} | |
return u; | |
} | |
var s = {}, | |
c = [], | |
l = 0; | |
function d(e, t) { | |
(this.id = l++), | |
(this.fragId = e), | |
(this.vertId = t), | |
(this.program = null), | |
(this.uniforms = []), | |
(this.attributes = []), | |
n.profile && | |
(this.stats = { uniformsCount: 0, attributesCount: 0 }); | |
} | |
function m(r, a, i) { | |
var s, | |
c, | |
l = u(Ur, r.fragId), | |
d = u(Gr, r.vertId), | |
m = (r.program = e.createProgram()); | |
if ((e.attachShader(m, l), e.attachShader(m, d), i)) | |
for (s = 0; s < i.length; ++s) { | |
var p = i[s]; | |
e.bindAttribLocation(m, p[0], p[1]); | |
} | |
e.linkProgram(m), | |
F.linkError(e, m, t.str(r.fragId), t.str(r.vertId), a); | |
var h = e.getProgramParameter(m, Hr); | |
n.profile && (r.stats.uniformsCount = h); | |
var b = r.uniforms; | |
for (s = 0; s < h; ++s) | |
if ((c = e.getActiveUniform(m, s))) | |
if (c.size > 1) | |
for (var v = 0; v < c.size; ++v) { | |
var g = c.name.replace("[0]", "[" + v + "]"); | |
f( | |
b, | |
new o(g, t.id(g), e.getUniformLocation(m, g), c) | |
); | |
} | |
else | |
f( | |
b, | |
new o( | |
c.name, | |
t.id(c.name), | |
e.getUniformLocation(m, c.name), | |
c | |
) | |
); | |
var y = e.getProgramParameter(m, Nr); | |
n.profile && (r.stats.attributesCount = y); | |
var x = r.attributes; | |
for (s = 0; s < y; ++s) | |
(c = e.getActiveAttrib(m, s)) && | |
f( | |
x, | |
new o( | |
c.name, | |
t.id(c.name), | |
e.getAttribLocation(m, c.name), | |
c | |
) | |
); | |
} | |
return ( | |
n.profile && | |
((r.getMaxUniformsCount = function () { | |
var e = 0; | |
return ( | |
c.forEach(function (t) { | |
t.stats.uniformsCount > e && | |
(e = t.stats.uniformsCount); | |
}), | |
e | |
); | |
}), | |
(r.getMaxAttributesCount = function () { | |
var e = 0; | |
return ( | |
c.forEach(function (t) { | |
t.stats.attributesCount > e && | |
(e = t.stats.attributesCount); | |
}), | |
e | |
); | |
})), | |
{ | |
clear: function () { | |
var t = e.deleteShader.bind(e); | |
ae(a).forEach(t), | |
(a = {}), | |
ae(i).forEach(t), | |
(i = {}), | |
c.forEach(function (t) { | |
e.deleteProgram(t.program); | |
}), | |
(c.length = 0), | |
(s = {}), | |
(r.shaderCount = 0); | |
}, | |
program: function (e, t, n, a) { | |
F.command(e >= 0, "missing vertex shader", n), | |
F.command(t >= 0, "missing fragment shader", n); | |
var i = s[t]; | |
i || (i = s[t] = {}); | |
var o = i[e]; | |
if (o && !a) return o; | |
var f = new d(t, e); | |
return ( | |
r.shaderCount++, | |
m(f, n, a), | |
o || (i[e] = f), | |
c.push(f), | |
f | |
); | |
}, | |
restore: function () { | |
(a = {}), (i = {}); | |
for (var e = 0; e < c.length; ++e) | |
m( | |
c[e], | |
null, | |
c[e].attributes.map(function (e) { | |
return [e.location, e.name]; | |
}) | |
); | |
}, | |
shader: u, | |
frag: -1, | |
vert: -1, | |
} | |
); | |
})(a, c, l, n), | |
_ = hr( | |
a, | |
d, | |
g, | |
function () { | |
E.procs.poll(); | |
}, | |
v, | |
l, | |
n | |
), | |
k = xr(a, d, g, l, n), | |
S = (function (e, r, n, a, i, o) { | |
var f = { cur: null, next: null, dirty: !1, setFBO: null }, | |
u = ["rgba"], | |
s = ["rgba4", "rgb565", "rgb5 a1"]; | |
r.ext_srgb && s.push("srgba"), | |
r.ext_color_buffer_half_float && s.push("rgba16f", "rgb16f"), | |
r.webgl_color_buffer_float && s.push("rgba32f"); | |
var c = ["uint8"]; | |
function l(e, t, r) { | |
(this.target = e), | |
(this.texture = t), | |
(this.renderbuffer = r); | |
var n = 0, | |
a = 0; | |
t | |
? ((n = t.width), (a = t.height)) | |
: r && ((n = r.width), (a = r.height)), | |
(this.width = n), | |
(this.height = a); | |
} | |
function d(e) { | |
e && | |
(e.texture && e.texture._texture.decRef(), | |
e.renderbuffer && e.renderbuffer._renderbuffer.decRef()); | |
} | |
function m(e, t, r) { | |
if (e) | |
if (e.texture) { | |
var n = e.texture._texture, | |
a = Math.max(1, n.width), | |
i = Math.max(1, n.height); | |
F( | |
a === t && i === r, | |
"inconsistent width/height for supplied texture" | |
), | |
(n.refCount += 1); | |
} else { | |
var o = e.renderbuffer._renderbuffer; | |
F( | |
o.width === t && o.height === r, | |
"inconsistent width/height for renderbuffer" | |
), | |
(o.refCount += 1); | |
} | |
} | |
function p(t, r) { | |
r && | |
(r.texture | |
? e.framebufferTexture2D( | |
wr, | |
t, | |
r.target, | |
r.texture._texture.texture, | |
0 | |
) | |
: e.framebufferRenderbuffer( | |
wr, | |
t, | |
Ar, | |
r.renderbuffer._renderbuffer.renderbuffer | |
)); | |
} | |
function h(e) { | |
var t = _r, | |
r = null, | |
n = null, | |
a = e; | |
"object" == typeof e && | |
((a = e.data), "target" in e && (t = 0 | e.target)), | |
F.type(a, "function", "invalid attachment data"); | |
var i = a._reglType; | |
return ( | |
"texture2d" === i | |
? ((r = a), F(t === _r)) | |
: "textureCube" === i | |
? ((r = a), | |
F(t >= kr && t < kr + 6, "invalid cube map target")) | |
: "renderbuffer" === i | |
? ((n = a), (t = Ar)) | |
: F.raise("invalid regl object for attachment"), | |
new l(t, r, n) | |
); | |
} | |
function b(e, t, r, n, o) { | |
if (r) { | |
var f = a.create2D({ | |
width: e, | |
height: t, | |
format: n, | |
type: o, | |
}); | |
return (f._texture.refCount = 0), new l(_r, f, null); | |
} | |
var u = i.create({ width: e, height: t, format: n }); | |
return (u._renderbuffer.refCount = 0), new l(Ar, null, u); | |
} | |
function v(e) { | |
return e && (e.texture || e.renderbuffer); | |
} | |
function g(e, t, r) { | |
e && | |
(e.texture | |
? e.texture.resize(t, r) | |
: e.renderbuffer && e.renderbuffer.resize(t, r), | |
(e.width = t), | |
(e.height = r)); | |
} | |
r.oes_texture_half_float && c.push("half float", "float16"), | |
r.oes_texture_float && c.push("float", "float32"); | |
var y = 0, | |
x = {}; | |
function w() { | |
(this.id = y++), | |
(x[this.id] = this), | |
(this.framebuffer = e.createFramebuffer()), | |
(this.width = 0), | |
(this.height = 0), | |
(this.colorAttachments = []), | |
(this.depthAttachment = null), | |
(this.stencilAttachment = null), | |
(this.depthStencilAttachment = null); | |
} | |
function A(e) { | |
e.colorAttachments.forEach(d), | |
d(e.depthAttachment), | |
d(e.stencilAttachment), | |
d(e.depthStencilAttachment); | |
} | |
function _(t) { | |
var r = t.framebuffer; | |
F(r, "must not double destroy framebuffer"), | |
e.deleteFramebuffer(r), | |
(t.framebuffer = null), | |
o.framebufferCount--, | |
delete x[t.id]; | |
} | |
function k(t) { | |
var r; | |
e.bindFramebuffer(wr, t.framebuffer); | |
var a = t.colorAttachments; | |
for (r = 0; r < a.length; ++r) p(Sr + r, a[r]); | |
for (r = a.length; r < n.maxColorAttachments; ++r) | |
e.framebufferTexture2D(wr, Sr + r, _r, null, 0); | |
e.framebufferTexture2D(wr, Tr, _r, null, 0), | |
e.framebufferTexture2D(wr, Er, _r, null, 0), | |
e.framebufferTexture2D(wr, Or, _r, null, 0), | |
p(Er, t.depthAttachment), | |
p(Or, t.stencilAttachment), | |
p(Tr, t.depthStencilAttachment); | |
var i = e.checkFramebufferStatus(wr); | |
e.isContextLost() || | |
i === jr || | |
F.raise( | |
"framebuffer configuration not supported, status = " + | |
Rr[i] | |
), | |
e.bindFramebuffer(wr, f.next ? f.next.framebuffer : null), | |
(f.cur = f.next), | |
e.getError(); | |
} | |
function S(e, a) { | |
var i = new w(); | |
function l(e, t) { | |
var a; | |
F( | |
f.next !== i, | |
"can not update framebuffer which is currently in use" | |
); | |
var o = 0, | |
d = 0, | |
p = !0, | |
g = !0, | |
y = null, | |
x = !0, | |
w = "rgba", | |
_ = "uint8", | |
S = 1, | |
E = null, | |
O = null, | |
T = null, | |
j = !1; | |
if ("number" == typeof e) (o = 0 | e), (d = 0 | t || o); | |
else if (e) { | |
F.type(e, "object", "invalid arguments for framebuffer"); | |
var D = e; | |
if ("shape" in D) { | |
var C = D.shape; | |
F( | |
Array.isArray(C) && C.length >= 2, | |
"invalid shape for framebuffer" | |
), | |
(o = C[0]), | |
(d = C[1]); | |
} else | |
"radius" in D && (o = d = D.radius), | |
"width" in D && (o = D.width), | |
"height" in D && (d = D.height); | |
("color" in D || "colors" in D) && | |
((y = D.color || D.colors), | |
Array.isArray(y) && | |
F( | |
1 === y.length || r.webgl_draw_buffers, | |
"multiple render targets not supported" | |
)), | |
y || | |
("colorCount" in D && | |
((S = 0 | D.colorCount), | |
F(S > 0, "invalid color buffer count")), | |
"colorTexture" in D && | |
((x = !!D.colorTexture), (w = "rgba4")), | |
"colorType" in D && | |
((_ = D.colorType), | |
x | |
? (F( | |
r.oes_texture_float || | |
!("float" === _ || "float32" === _), | |
"you must enable OES_texture_float in order to use floating point framebuffer objects" | |
), | |
F( | |
r.oes_texture_half_float || | |
!("half float" === _ || "float16" === _), | |
"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects" | |
)) | |
: "half float" === _ || "float16" === _ | |
? (F( | |
r.ext_color_buffer_half_float, | |
"you must enable EXT_color_buffer_half_float to use 16-bit render buffers" | |
), | |
(w = "rgba16f")) | |
: ("float" !== _ && "float32" !== _) || | |
(F( | |
r.webgl_color_buffer_float, | |
"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers" | |
), | |
(w = "rgba32f")), | |
F.oneOf(_, c, "invalid color type")), | |
"colorFormat" in D && | |
((w = D.colorFormat), | |
u.indexOf(w) >= 0 | |
? (x = !0) | |
: s.indexOf(w) >= 0 | |
? (x = !1) | |
: x | |
? F.oneOf( | |
D.colorFormat, | |
u, | |
"invalid color format for texture" | |
) | |
: F.oneOf( | |
D.colorFormat, | |
s, | |
"invalid color format for renderbuffer" | |
))), | |
("depthTexture" in D || "depthStencilTexture" in D) && | |
((j = !(!D.depthTexture && !D.depthStencilTexture)), | |
F( | |
!j || r.webgl_depth_texture, | |
"webgl_depth_texture extension not supported" | |
)), | |
"depth" in D && | |
("boolean" == typeof D.depth | |
? (p = D.depth) | |
: ((E = D.depth), (g = !1))), | |
"stencil" in D && | |
("boolean" == typeof D.stencil | |
? (g = D.stencil) | |
: ((O = D.stencil), (p = !1))), | |
"depthStencil" in D && | |
("boolean" == typeof D.depthStencil | |
? (p = g = D.depthStencil) | |
: ((T = D.depthStencil), (p = !1), (g = !1))); | |
} else o = d = 1; | |
var z = null, | |
B = null, | |
V = null, | |
P = null; | |
if (Array.isArray(y)) z = y.map(h); | |
else if (y) z = [h(y)]; | |
else | |
for (z = new Array(S), a = 0; a < S; ++a) | |
z[a] = b(o, d, x, w, _); | |
F( | |
r.webgl_draw_buffers || z.length <= 1, | |
"you must enable the WEBGL_draw_buffers extension in order to use multiple color buffers." | |
), | |
F( | |
z.length <= n.maxColorAttachments, | |
"too many color attachments, not supported" | |
), | |
(o = o || z[0].width), | |
(d = d || z[0].height), | |
E | |
? (B = h(E)) | |
: p && !g && (B = b(o, d, j, "depth", "uint32")), | |
O | |
? (V = h(O)) | |
: g && !p && (V = b(o, d, !1, "stencil", "uint8")), | |
T | |
? (P = h(T)) | |
: !E && | |
!O && | |
g && | |
p && | |
(P = b(o, d, j, "depth stencil", "depth stencil")), | |
F( | |
!!E + !!O + !!T <= 1, | |
"invalid framebuffer configuration, can specify exactly one depth/stencil attachment" | |
); | |
var L = null; | |
for (a = 0; a < z.length; ++a) | |
if ( | |
(m(z[a], o, d), | |
F( | |
!z[a] || | |
(z[a].texture && | |
Cr.indexOf(z[a].texture._texture.format) >= 0) || | |
(z[a].renderbuffer && | |
Lr.indexOf( | |
z[a].renderbuffer._renderbuffer.format | |
) >= 0), | |
"framebuffer color attachment " + a + " is invalid" | |
), | |
z[a] && z[a].texture) | |
) { | |
var R = | |
zr[z[a].texture._texture.format] * | |
Fr[z[a].texture._texture.type]; | |
null === L | |
? (L = R) | |
: F( | |
L === R, | |
"all color attachments much have the same number of bits per pixel." | |
); | |
} | |
return ( | |
m(B, o, d), | |
F( | |
!B || | |
(B.texture && B.texture._texture.format === Dr) || | |
(B.renderbuffer && | |
B.renderbuffer._renderbuffer.format === Br), | |
"invalid depth attachment for framebuffer object" | |
), | |
m(V, o, d), | |
F( | |
!V || | |
(V.renderbuffer && | |
V.renderbuffer._renderbuffer.format === Vr), | |
"invalid stencil attachment for framebuffer object" | |
), | |
m(P, o, d), | |
F( | |
!P || | |
(P.texture && P.texture._texture.format === Pr) || | |
(P.renderbuffer && | |
P.renderbuffer._renderbuffer.format === Pr), | |
"invalid depth-stencil attachment for framebuffer object" | |
), | |
A(i), | |
(i.width = o), | |
(i.height = d), | |
(i.colorAttachments = z), | |
(i.depthAttachment = B), | |
(i.stencilAttachment = V), | |
(i.depthStencilAttachment = P), | |
(l.color = z.map(v)), | |
(l.depth = v(B)), | |
(l.stencil = v(V)), | |
(l.depthStencil = v(P)), | |
(l.width = i.width), | |
(l.height = i.height), | |
k(i), | |
l | |
); | |
} | |
return ( | |
o.framebufferCount++, | |
l(e, a), | |
t(l, { | |
resize: function (e, t) { | |
F( | |
f.next !== i, | |
"can not resize a framebuffer which is currently in use" | |
); | |
var r = Math.max(0 | e, 1), | |
n = Math.max(0 | t || r, 1); | |
if (r === i.width && n === i.height) return l; | |
for ( | |
var a = i.colorAttachments, o = 0; | |
o < a.length; | |
++o | |
) | |
g(a[o], r, n); | |
return ( | |
g(i.depthAttachment, r, n), | |
g(i.stencilAttachment, r, n), | |
g(i.depthStencilAttachment, r, n), | |
(i.width = l.width = r), | |
(i.height = l.height = n), | |
k(i), | |
l | |
); | |
}, | |
_reglType: "framebuffer", | |
_framebuffer: i, | |
destroy: function () { | |
_(i), A(i); | |
}, | |
use: function (e) { | |
f.setFBO({ framebuffer: l }, e); | |
}, | |
}) | |
); | |
} | |
return t(f, { | |
getFramebuffer: function (e) { | |
if ( | |
"function" == typeof e && | |
"framebuffer" === e._reglType | |
) { | |
var t = e._framebuffer; | |
if (t instanceof w) return t; | |
} | |
return null; | |
}, | |
create: S, | |
createCube: function (e) { | |
var i = Array(6); | |
function o(e) { | |
var n; | |
F( | |
i.indexOf(f.next) < 0, | |
"can not update framebuffer which is currently in use" | |
); | |
var s, | |
l = { color: null }, | |
d = 0, | |
m = null, | |
p = "rgba", | |
h = "uint8", | |
b = 1; | |
if ("number" == typeof e) d = 0 | e; | |
else if (e) { | |
F.type( | |
e, | |
"object", | |
"invalid arguments for framebuffer" | |
); | |
var v = e; | |
if ("shape" in v) { | |
var g = v.shape; | |
F( | |
Array.isArray(g) && g.length >= 2, | |
"invalid shape for framebuffer" | |
), | |
F(g[0] === g[1], "cube framebuffer must be square"), | |
(d = g[0]); | |
} else | |
"radius" in v && (d = 0 | v.radius), | |
"width" in v | |
? ((d = 0 | v.width), | |
"height" in v && | |
F(v.height === d, "must be square")) | |
: "height" in v && (d = 0 | v.height); | |
("color" in v || "colors" in v) && | |
((m = v.color || v.colors), | |
Array.isArray(m) && | |
F( | |
1 === m.length || r.webgl_draw_buffers, | |
"multiple render targets not supported" | |
)), | |
m || | |
("colorCount" in v && | |
((b = 0 | v.colorCount), | |
F(b > 0, "invalid color buffer count")), | |
"colorType" in v && | |
(F.oneOf(v.colorType, c, "invalid color type"), | |
(h = v.colorType)), | |
"colorFormat" in v && | |
((p = v.colorFormat), | |
F.oneOf( | |
v.colorFormat, | |
u, | |
"invalid color format for texture" | |
))), | |
"depth" in v && (l.depth = v.depth), | |
"stencil" in v && (l.stencil = v.stencil), | |
"depthStencil" in v && | |
(l.depthStencil = v.depthStencil); | |
} else d = 1; | |
if (m) | |
if (Array.isArray(m)) | |
for (s = [], n = 0; n < m.length; ++n) s[n] = m[n]; | |
else s = [m]; | |
else { | |
s = Array(b); | |
var y = { radius: d, format: p, type: h }; | |
for (n = 0; n < b; ++n) s[n] = a.createCube(y); | |
} | |
for ( | |
l.color = Array(s.length), n = 0; | |
n < s.length; | |
++n | |
) { | |
var x = s[n]; | |
F( | |
"function" == typeof x && | |
"textureCube" === x._reglType, | |
"invalid cube map" | |
), | |
(d = d || x.width), | |
F( | |
x.width === d && x.height === d, | |
"invalid cube map shape" | |
), | |
(l.color[n] = { target: kr, data: s[n] }); | |
} | |
for (n = 0; n < 6; ++n) { | |
for (var w = 0; w < s.length; ++w) | |
l.color[w].target = kr + n; | |
n > 0 && | |
((l.depth = i[0].depth), | |
(l.stencil = i[0].stencil), | |
(l.depthStencil = i[0].depthStencil)), | |
i[n] ? i[n](l) : (i[n] = S(l)); | |
} | |
return t(o, { width: d, height: d, color: s }); | |
} | |
return ( | |
o(e), | |
t(o, { | |
faces: i, | |
resize: function (e) { | |
var t, | |
r = 0 | e; | |
if ( | |
(F( | |
r > 0 && r <= n.maxCubeMapSize, | |
"invalid radius for cube fbo" | |
), | |
r === o.width) | |
) | |
return o; | |
var a = o.color; | |
for (t = 0; t < a.length; ++t) a[t].resize(r); | |
for (t = 0; t < 6; ++t) i[t].resize(r); | |
return (o.width = o.height = r), o; | |
}, | |
_reglType: "framebufferCube", | |
destroy: function () { | |
i.forEach(function (e) { | |
e.destroy(); | |
}); | |
}, | |
}) | |
); | |
}, | |
clear: function () { | |
ae(x).forEach(_); | |
}, | |
restore: function () { | |
(f.cur = null), | |
(f.next = null), | |
(f.dirty = !0), | |
ae(x).forEach(function (t) { | |
(t.framebuffer = e.createFramebuffer()), k(t); | |
}); | |
}, | |
}); | |
})(a, d, g, _, k, l), | |
E = ni( | |
a, | |
c, | |
d, | |
g, | |
y, | |
w, | |
0, | |
S, | |
{}, | |
x, | |
A, | |
{ | |
elements: null, | |
primitive: 4, | |
count: -1, | |
offset: 0, | |
instances: -1, | |
}, | |
v, | |
m, | |
n | |
), | |
O = $r(a, S, E.procs.poll, v, i, d, g), | |
T = E.next, | |
j = a.canvas, | |
D = [], | |
C = [], | |
z = [], | |
B = [n.onDestroy], | |
V = null; | |
function P() { | |
if (0 === D.length) return m && m.update(), void (V = null); | |
(V = M.next(P)), $(); | |
for (var e = D.length - 1; e >= 0; --e) { | |
var t = D[e]; | |
t && t(v, null, 0); | |
} | |
a.flush(), m && m.update(); | |
} | |
function L() { | |
!V && D.length > 0 && (V = M.next(P)); | |
} | |
function R() { | |
V && (M.cancel(P), (V = null)); | |
} | |
function U(e) { | |
e.preventDefault(), | |
(o = !0), | |
R(), | |
C.forEach(function (e) { | |
e(); | |
}); | |
} | |
function G(e) { | |
a.getError(), | |
(o = !1), | |
f.restore(), | |
A.restore(), | |
y.restore(), | |
_.restore(), | |
k.restore(), | |
S.restore(), | |
x.restore(), | |
m && m.restore(), | |
E.procs.refresh(), | |
L(), | |
z.forEach(function (e) { | |
e(); | |
}); | |
} | |
function N(e) { | |
function r(e) { | |
var t = {}, | |
r = {}; | |
return ( | |
Object.keys(e).forEach(function (n) { | |
var a = e[n]; | |
I.isDynamic(a) ? (r[n] = I.unbox(a, n)) : (t[n] = a); | |
}), | |
{ dynamic: r, static: t } | |
); | |
} | |
F(!!e, "invalid args to regl({...})"), | |
F.type(e, "object", "invalid args to regl({...})"); | |
var n = r(e.context || {}), | |
a = r(e.uniforms || {}), | |
i = r(e.attributes || {}), | |
f = r( | |
(function (e) { | |
var r = t({}, e); | |
function n(e) { | |
if (e in r) { | |
var t = r[e]; | |
delete r[e], | |
Object.keys(t).forEach(function (n) { | |
r[e + "." + n] = t[n]; | |
}); | |
} | |
} | |
return ( | |
delete r.uniforms, | |
delete r.attributes, | |
delete r.context, | |
delete r.vao, | |
"stencil" in r && | |
r.stencil.op && | |
((r.stencil.opBack = r.stencil.opFront = r.stencil.op), | |
delete r.stencil.op), | |
n("blend"), | |
n("depth"), | |
n("cull"), | |
n("stencil"), | |
n("polygonOffset"), | |
n("scissor"), | |
n("sample"), | |
"vao" in e && (r.vao = e.vao), | |
r | |
); | |
})(e) | |
), | |
u = { gpuTime: 0, cpuTime: 0, count: 0 }, | |
s = E.compile(f, i, a, n, u), | |
c = s.draw, | |
l = s.batch, | |
d = s.scope, | |
m = []; | |
return t( | |
function (e, t) { | |
var r; | |
if ((o && F.raise("context lost"), "function" == typeof e)) | |
return d.call(this, null, e, 0); | |
if ("function" == typeof t) | |
if ("number" == typeof e) | |
for (r = 0; r < e; ++r) d.call(this, null, t, r); | |
else { | |
if (!Array.isArray(e)) return d.call(this, e, t, 0); | |
for (r = 0; r < e.length; ++r) d.call(this, e[r], t, r); | |
} | |
else if ("number" == typeof e) { | |
if (e > 0) | |
return l.call( | |
this, | |
(function (e) { | |
for (; m.length < e; ) m.push(null); | |
return m; | |
})(0 | e), | |
0 | e | |
); | |
} else { | |
if (!Array.isArray(e)) return c.call(this, e); | |
if (e.length) return l.call(this, e, e.length); | |
} | |
}, | |
{ stats: u } | |
); | |
} | |
j && (j.addEventListener(di, U, !1), j.addEventListener(mi, G, !1)); | |
var q = (S.setFBO = N({ | |
framebuffer: I.define.call(null, pi, "framebuffer"), | |
})); | |
function Q(e, t) { | |
var r = 0; | |
E.procs.poll(); | |
var n = t.color; | |
n && | |
(a.clearColor(+n[0] || 0, +n[1] || 0, +n[2] || 0, +n[3] || 0), | |
(r |= ui)), | |
"depth" in t && (a.clearDepth(+t.depth), (r |= si)), | |
"stencil" in t && (a.clearStencil(0 | t.stencil), (r |= ci)), | |
F(!!r, "called regl.clear with no buffer specified"), | |
a.clear(r); | |
} | |
function Y(e) { | |
return ( | |
F.type( | |
e, | |
"function", | |
"regl.frame() callback must be a function" | |
), | |
D.push(e), | |
L(), | |
{ | |
cancel: function () { | |
var t = vi(D, e); | |
F(t >= 0, "cannot cancel a frame twice"), | |
(D[t] = function e() { | |
var t = vi(D, e); | |
(D[t] = D[D.length - 1]), | |
(D.length -= 1), | |
D.length <= 0 && R(); | |
}); | |
}, | |
} | |
); | |
} | |
function X() { | |
var e = T.viewport, | |
t = T.scissor_box; | |
(e[0] = e[1] = t[0] = t[1] = 0), | |
(v.viewportWidth = v.framebufferWidth = v.drawingBufferWidth = e[2] = t[2] = | |
a.drawingBufferWidth), | |
(v.viewportHeight = v.framebufferHeight = v.drawingBufferHeight = e[3] = t[3] = | |
a.drawingBufferHeight); | |
} | |
function $() { | |
(v.tick += 1), (v.time = J()), X(), E.procs.poll(); | |
} | |
function K() { | |
X(), E.procs.refresh(), m && m.update(); | |
} | |
function J() { | |
return (W() - p) / 1e3; | |
} | |
K(); | |
var Z = t(N, { | |
clear: function (e) { | |
if ( | |
(F( | |
"object" == typeof e && e, | |
"regl.clear() takes an object as input" | |
), | |
"framebuffer" in e) | |
) | |
if ( | |
e.framebuffer && | |
"framebufferCube" === e.framebuffer_reglType | |
) | |
for (var r = 0; r < 6; ++r) | |
q(t({ framebuffer: e.framebuffer.faces[r] }, e), Q); | |
else q(e, Q); | |
else Q(0, e); | |
}, | |
prop: I.define.bind(null, pi), | |
context: I.define.bind(null, hi), | |
this: I.define.bind(null, bi), | |
draw: N({}), | |
buffer: function (e) { | |
return y.create(e, li, !1, !1); | |
}, | |
elements: function (e) { | |
return w.create(e, !1); | |
}, | |
texture: _.create2D, | |
cube: _.createCube, | |
renderbuffer: k.create, | |
framebuffer: S.create, | |
framebufferCube: S.createCube, | |
vao: x.createVAO, | |
attributes: i, | |
frame: Y, | |
on: function (e, t) { | |
var r; | |
switch ( | |
(F.type( | |
t, | |
"function", | |
"listener callback must be a function" | |
), | |
e) | |
) { | |
case "frame": | |
return Y(t); | |
case "lost": | |
r = C; | |
break; | |
case "restore": | |
r = z; | |
break; | |
case "destroy": | |
r = B; | |
break; | |
default: | |
F.raise( | |
"invalid event, must be one of frame,lost,restore,destroy" | |
); | |
} | |
return ( | |
r.push(t), | |
{ | |
cancel: function () { | |
for (var e = 0; e < r.length; ++e) | |
if (r[e] === t) | |
return (r[e] = r[r.length - 1]), void r.pop(); | |
}, | |
} | |
); | |
}, | |
limits: g, | |
hasExtension: function (e) { | |
return g.extensions.indexOf(e.toLowerCase()) >= 0; | |
}, | |
read: O, | |
destroy: function () { | |
(D.length = 0), | |
R(), | |
j && | |
(j.removeEventListener(di, U), | |
j.removeEventListener(mi, G)), | |
A.clear(), | |
S.clear(), | |
k.clear(), | |
_.clear(), | |
w.clear(), | |
y.clear(), | |
x.clear(), | |
m && m.clear(), | |
B.forEach(function (e) { | |
e(); | |
}); | |
}, | |
_gl: a, | |
_refresh: K, | |
poll: function () { | |
$(), m && m.update(); | |
}, | |
now: J, | |
stats: l, | |
}); | |
return n.onDone(null, Z), Z; | |
}; | |
}); | |
}, | |
{}, | |
], | |
YOwE: [ | |
function (require, module, exports) { | |
"use strict"; | |
function e(e) { | |
if (null == e) | |
throw new TypeError( | |
"Object.assign cannot be called with null or undefined" | |
); | |
return Object(e); | |
} | |
module.exports = | |
Object.assign || | |
function (n, t) { | |
for (var r, c, o = e(n), l = 1; l < arguments.length; l++) { | |
(r = arguments[l]), (c = Object.keys(Object(r))); | |
for (var u = 0; u < c.length; u++) o[c[u]] = r[c[u]]; | |
} | |
return o; | |
}; | |
}, | |
{}, | |
], | |
lR3J: [ | |
function (require, module, exports) { | |
function r(r, e, n) { | |
var o = e[0], | |
t = e[1], | |
u = e[2], | |
a = n[0], | |
c = n[1], | |
d = n[2]; | |
return ( | |
(r[0] = t * d - u * c), | |
(r[1] = u * a - o * d), | |
(r[2] = o * c - t * a), | |
r | |
); | |
} | |
module.exports = r; | |
}, | |
{}, | |
], | |
DCLs: [ | |
function (require, module, exports) { | |
function e(e, n) { | |
return e[0] * n[0] + e[1] * n[1] + e[2] * n[2]; | |
} | |
module.exports = e; | |
}, | |
{}, | |
], | |
djGl: [ | |
function (require, module, exports) { | |
function e(e, n, o) { | |
return ( | |
(e[0] = n[0] - o[0]), (e[1] = n[1] - o[1]), (e[2] = n[2] - o[2]), e | |
); | |
} | |
module.exports = e; | |
}, | |
{}, | |
], | |
DrNi: [ | |
function (require, module, exports) { | |
var r = require("gl-vec3/cross"), | |
e = require("gl-vec3/dot"), | |
u = require("gl-vec3/subtract"), | |
l = 1e-6, | |
n = [0, 0, 0], | |
t = [0, 0, 0], | |
v = [0, 0, 0], | |
i = [0, 0, 0], | |
a = [0, 0, 0]; | |
function c(c, o, f, s) { | |
u(n, s[1], s[0]), u(t, s[2], s[0]), r(i, f, t); | |
var g = e(n, i); | |
if (g < l) return null; | |
u(v, o, s[0]); | |
var q = e(v, i); | |
if (q < 0 || q > g) return null; | |
r(a, v, n); | |
var d = e(f, a); | |
if (d < 0 || q + d > g) return null; | |
var b = e(t, a) / g; | |
return ( | |
(c[0] = o[0] + b * f[0]), | |
(c[1] = o[1] + b * f[1]), | |
(c[2] = o[2] + b * f[2]), | |
c | |
); | |
} | |
module.exports = c; | |
}, | |
{ | |
"gl-vec3/cross": "lR3J", | |
"gl-vec3/dot": "DCLs", | |
"gl-vec3/subtract": "djGl", | |
}, | |
], | |
VR1w: [ | |
function (require, module, exports) { | |
function e(e, n, o) { | |
return ( | |
(e[0] = n[0] + o[0]), (e[1] = n[1] + o[1]), (e[2] = n[2] + o[2]), e | |
); | |
} | |
module.exports = e; | |
}, | |
{}, | |
], | |
lf2r: [ | |
function (require, module, exports) { | |
function e(e, n, o) { | |
return (e[0] = n[0] * o), (e[1] = n[1] * o), (e[2] = n[2] * o), e; | |
} | |
module.exports = e; | |
}, | |
{}, | |
], | |
rCDI: [ | |
function (require, module, exports) { | |
function e(e, n) { | |
return (e[0] = n[0]), (e[1] = n[1]), (e[2] = n[2]), e; | |
} | |
module.exports = e; | |
}, | |
{}, | |
], | |
uJdh: [ | |
function (require, module, exports) { | |
var e = require("gl-vec3/dot"), | |
r = require("gl-vec3/add"), | |
l = require("gl-vec3/scale"), | |
u = require("gl-vec3/copy"); | |
module.exports = c; | |
var v = [0, 0, 0]; | |
function c(c, a, i, n, o) { | |
var t = e(i, n); | |
if (0 !== t) { | |
var d = -(e(a, n) + o) / t; | |
return d < 0 ? null : (l(v, i, d), r(c, a, v)); | |
} | |
return e(n, a) + o === 0 ? u(c, a) : null; | |
} | |
}, | |
{ | |
"gl-vec3/dot": "DCLs", | |
"gl-vec3/add": "VR1w", | |
"gl-vec3/scale": "lf2r", | |
"gl-vec3/copy": "rCDI", | |
}, | |
], | |
auyH: [ | |
function (require, module, exports) { | |
function r(r, e) { | |
var n = e[0] - r[0], | |
o = e[1] - r[1], | |
t = e[2] - r[2]; | |
return n * n + o * o + t * t; | |
} | |
module.exports = r; | |
}, | |
{}, | |
], | |
ZYID: [ | |
function (require, module, exports) { | |
function e(e, n, o, r) { | |
return ( | |
(e[0] = n[0] + o[0] * r), | |
(e[1] = n[1] + o[1] * r), | |
(e[2] = n[2] + o[2] * r), | |
e | |
); | |
} | |
module.exports = e; | |
}, | |
{}, | |
], | |
Zbw3: [ | |
function (require, module, exports) { | |
var e = require("gl-vec3/squaredDistance"), | |
r = require("gl-vec3/dot"), | |
u = require("gl-vec3/subtract"), | |
l = require("gl-vec3/scaleAndAdd"), | |
c = require("gl-vec3/scale"), | |
a = require("gl-vec3/add"), | |
t = [0, 0, 0]; | |
function i(i, v, d, n, q) { | |
u(t, n, v); | |
var s = r(d, t); | |
if (s < 0) return null; | |
l(t, v, d, s); | |
var g = e(n, t), | |
o = q * q; | |
return g > o ? null : (c(i, d, s - Math.sqrt(o - g)), a(i, i, v)); | |
} | |
module.exports = i; | |
}, | |
{ | |
"gl-vec3/squaredDistance": "auyH", | |
"gl-vec3/dot": "DCLs", | |
"gl-vec3/subtract": "djGl", | |
"gl-vec3/scaleAndAdd": "ZYID", | |
"gl-vec3/scale": "lf2r", | |
"gl-vec3/add": "VR1w", | |
}, | |
], | |
W8jU: [ | |
function (require, module, exports) { | |
function r(r, n, t, o) { | |
var u = e(n, t, o); | |
if (u === 1 / 0) r = null; | |
else { | |
r = r || []; | |
for (var f = 0; f < n.length; f++) r[f] = n[f] + t[f] * u; | |
} | |
return r; | |
} | |
function e(r, e, n) { | |
for (var t = r.length, o = -1 / 0, u = 1 / 0, f = 0; f < t; f++) { | |
var l = (n[0][f] - r[f]) / e[f], | |
a = (n[1][f] - r[f]) / e[f]; | |
if (l > a) { | |
var i = l; | |
(l = a), (a = i); | |
} | |
if (a < o || l > u) return 1 / 0; | |
l > o && (o = l), a < u && (u = a); | |
} | |
return o > u ? 1 / 0 : o; | |
} | |
(module.exports = r), (module.exports.distance = e); | |
}, | |
{}, | |
], | |
yhjv: [ | |
function (require, module, exports) { | |
var i = require("ray-triangle-intersection"), | |
t = require("ray-plane-intersection"), | |
r = require("ray-sphere-intersection"), | |
e = require("ray-aabb-intersection"), | |
n = require("gl-vec3/copy"), | |
o = [ | |
[0, 0, 0], | |
[0, 0, 0], | |
[0, 0, 0], | |
], | |
s = [0, 0, 0]; | |
function c(i, t) { | |
(this.origin = i || [0, 0, 0]), (this.direction = t || [0, 0, -1]); | |
} | |
(module.exports = c), | |
(c.prototype.set = function (i, t) { | |
(this.origin = i), (this.direction = t); | |
}), | |
(c.prototype.copy = function (i) { | |
n(this.origin, i.origin), n(this.direction, i.direction); | |
}), | |
(c.prototype.clone = function () { | |
var i = new c(); | |
return i.copy(this), i; | |
}), | |
(c.prototype.intersectsSphere = function (i, t) { | |
return r(s, this.origin, this.direction, i, t); | |
}), | |
(c.prototype.intersectsPlane = function (i, r) { | |
return t(s, this.origin, this.direction, i, r); | |
}), | |
(c.prototype.intersectsTriangle = function (t) { | |
return i(s, this.origin, this.direction, t); | |
}), | |
(c.prototype.intersectsBox = function (i) { | |
return e(s, this.origin, this.direction, i); | |
}), | |
(c.prototype.intersectsTriangleCell = function (i, t) { | |
var r = i[0], | |
e = i[1], | |
n = i[2]; | |
return ( | |
(o[0] = t[r]), | |
(o[1] = t[e]), | |
(o[2] = t[n]), | |
this.intersectsTriangle(o) | |
); | |
}); | |
}, | |
{ | |
"ray-triangle-intersection": "DrNi", | |
"ray-plane-intersection": "uJdh", | |
"ray-sphere-intersection": "Zbw3", | |
"ray-aabb-intersection": "W8jU", | |
"gl-vec3/copy": "rCDI", | |
}, | |
], | |
mQ7E: [ | |
function (require, module, exports) { | |
function r(r, e, n) { | |
var o = e[0], | |
t = e[1], | |
u = e[2], | |
a = e[3]; | |
return ( | |
(r[0] = n[0] * o + n[4] * t + n[8] * u + n[12] * a), | |
(r[1] = n[1] * o + n[5] * t + n[9] * u + n[13] * a), | |
(r[2] = n[2] * o + n[6] * t + n[10] * u + n[14] * a), | |
(r[3] = n[3] * o + n[7] * t + n[11] * u + n[15] * a), | |
r | |
); | |
} | |
module.exports = r; | |
}, | |
{}, | |
], | |
xB81: [ | |
function (require, module, exports) { | |
function e(e, n, o, r, t) { | |
return (e[0] = n), (e[1] = o), (e[2] = r), (e[3] = t), e; | |
} | |
module.exports = e; | |
}, | |
{}, | |
], | |
lJtm: [ | |
function (require, module, exports) { | |
var r = require("gl-vec4/transformMat4"), | |
e = require("gl-vec4/set"), | |
t = 0, | |
a = 1, | |
u = [0, 0, 0, 0]; | |
function v(v, n, o, c) { | |
var i = o[0], | |
l = o[1], | |
s = o[2], | |
f = o[3], | |
g = t, | |
m = a; | |
e(u, n[0], n[1], n[2], 1), r(u, u, c); | |
var q = u[3]; | |
return ( | |
0 !== q && | |
((u[0] = u[0] / q), (u[1] = u[1] / q), (u[2] = u[2] / q)), | |
(v[0] = i + (s / 2) * u[0] + (0 + s / 2)), | |
(v[1] = l + (f / 2) * u[1] + (0 + f / 2)), | |
(v[2] = ((m - g) / 2) * u[2] + (m + g) / 2), | |
(v[3] = 0 === q ? 0 : 1 / q), | |
v | |
); | |
} | |
module.exports = v; | |
}, | |
{ "gl-vec4/transformMat4": "mQ7E", "gl-vec4/set": "xB81" }, | |
], | |
nKk4: [ | |
function (require, module, exports) { | |
function r(r, e, n) { | |
var o = e[0], | |
t = e[1], | |
u = e[2], | |
a = n[0], | |
c = n[1], | |
d = n[2], | |
f = n[3], | |
i = n[4], | |
l = n[5], | |
m = n[6], | |
p = n[7], | |
s = n[8], | |
v = n[9], | |
x = n[10], | |
b = n[11], | |
g = n[12], | |
h = n[13], | |
j = n[14], | |
k = 1 / (o * f + t * p + u * b + n[15]); | |
return ( | |
(r[0] = (o * a + t * i + u * s + g) * k), | |
(r[1] = (o * c + t * l + u * v + h) * k), | |
(r[2] = (o * d + t * m + u * x + j) * k), | |
r | |
); | |
} | |
module.exports = r; | |
}, | |
{}, | |
], | |
pVYe: [ | |
function (require, module, exports) { | |
var r = require("./lib/projectMat4"); | |
function e(e, t, o, u) { | |
var a = o[0], | |
i = o[1], | |
n = o[2], | |
c = o[3], | |
l = t[0], | |
p = t[1], | |
v = t[2]; | |
return ( | |
(l -= a), | |
(p = c - p - 1), | |
(p -= i), | |
(e[0] = (2 * l) / n - 1), | |
(e[1] = (2 * p) / c - 1), | |
(e[2] = 2 * v - 1), | |
r(e, e, u) | |
); | |
} | |
module.exports = e; | |
}, | |
{ "./lib/projectMat4": "nKk4" }, | |
], | |
qJ7p: [ | |
function (require, module, exports) { | |
function r(r, t) { | |
var e = t[0], | |
n = t[1], | |
o = t[2], | |
u = e * e + n * n + o * o; | |
return ( | |
u > 0 && | |
((u = 1 / Math.sqrt(u)), | |
(r[0] = t[0] * u), | |
(r[1] = t[1] * u), | |
(r[2] = t[2] * u)), | |
r | |
); | |
} | |
module.exports = r; | |
}, | |
{}, | |
], | |
lMRG: [ | |
function (require, module, exports) { | |
var e = require("gl-vec3/cross"), | |
r = require("gl-vec3/subtract"), | |
c = require("gl-vec3/normalize"), | |
a = require("gl-vec3/copy"), | |
i = require("gl-vec3/dot"), | |
l = require("gl-vec3/scale"), | |
u = [0, 0, 0], | |
v = 1e-9; | |
module.exports = function (o, s, t, g) { | |
if ( | |
(r(u, g, t), c(u, u), !(0 === u[0] && 0 === u[1] && 0 === u[2])) | |
) { | |
var q = i(u, s); | |
Math.abs(q - 1) < v ? l(s, o, -1) : Math.abs(q + 1) < v && a(s, o), | |
a(o, u), | |
e(u, o, s), | |
c(u, u), | |
e(s, u, o), | |
c(s, s); | |
} | |
}; | |
}, | |
{ | |
"gl-vec3/cross": "lR3J", | |
"gl-vec3/subtract": "djGl", | |
"gl-vec3/normalize": "qJ7p", | |
"gl-vec3/copy": "rCDI", | |
"gl-vec3/dot": "DCLs", | |
"gl-vec3/scale": "lf2r", | |
}, | |
], | |
uVIA: [ | |
function (require, module, exports) { | |
function e(e, n, o, r) { | |
return (e[0] = n), (e[1] = o), (e[2] = r), e; | |
} | |
module.exports = e; | |
}, | |
{}, | |
], | |
gPAD: [ | |
function (require, module, exports) { | |
var e = require("camera-unproject"), | |
r = require("gl-vec3/set"), | |
u = require("gl-vec3/subtract"), | |
c = require("gl-vec3/normalize"); | |
function i(i, t, a, l, o) { | |
r(i, a[0], a[1], 0), | |
r(t, a[0], a[1], 1), | |
e(i, i, l, o), | |
e(t, t, l, o), | |
u(t, t, i), | |
c(t, t); | |
} | |
module.exports = i; | |
}, | |
{ | |
"camera-unproject": "pVYe", | |
"gl-vec3/set": "uVIA", | |
"gl-vec3/subtract": "djGl", | |
"gl-vec3/normalize": "qJ7p", | |
}, | |
], | |
FnI8: [ | |
function (require, module, exports) { | |
function r(r, e, n) { | |
var o = e[0], | |
t = e[1], | |
u = e[2], | |
a = e[3], | |
c = e[4], | |
d = e[5], | |
f = e[6], | |
i = e[7], | |
l = e[8], | |
m = e[9], | |
p = e[10], | |
s = e[11], | |
v = e[12], | |
x = e[13], | |
b = e[14], | |
g = e[15], | |
h = n[0], | |
j = n[1], | |
k = n[2], | |
q = n[3]; | |
return ( | |
(r[0] = h * o + j * c + k * l + q * v), | |
(r[1] = h * t + j * d + k * m + q * x), | |
(r[2] = h * u + j * f + k * p + q * b), | |
(r[3] = h * a + j * i + k * s + q * g), | |
(h = n[4]), | |
(j = n[5]), | |
(k = n[6]), | |
(q = n[7]), | |
(r[4] = h * o + j * c + k * l + q * v), | |
(r[5] = h * t + j * d + k * m + q * x), | |
(r[6] = h * u + j * f + k * p + q * b), | |
(r[7] = h * a + j * i + k * s + q * g), | |
(h = n[8]), | |
(j = n[9]), | |
(k = n[10]), | |
(q = n[11]), | |
(r[8] = h * o + j * c + k * l + q * v), | |
(r[9] = h * t + j * d + k * m + q * x), | |
(r[10] = h * u + j * f + k * p + q * b), | |
(r[11] = h * a + j * i + k * s + q * g), | |
(h = n[12]), | |
(j = n[13]), | |
(k = n[14]), | |
(q = n[15]), | |
(r[12] = h * o + j * c + k * l + q * v), | |
(r[13] = h * t + j * d + k * m + q * x), | |
(r[14] = h * u + j * f + k * p + q * b), | |
(r[15] = h * a + j * i + k * s + q * g), | |
r | |
); | |
} | |
module.exports = r; | |
}, | |
{}, | |
], | |
n8ou: [ | |
function (require, module, exports) { | |
function n(n, r) { | |
var u = r[0], | |
e = r[1], | |
l = r[2], | |
o = r[3], | |
t = r[4], | |
a = r[5], | |
c = r[6], | |
d = r[7], | |
f = r[8], | |
i = r[9], | |
m = r[10], | |
p = r[11], | |
s = r[12], | |
v = r[13], | |
x = r[14], | |
b = r[15], | |
g = u * a - e * t, | |
h = u * c - l * t, | |
j = u * d - o * t, | |
k = e * c - l * a, | |
q = e * d - o * a, | |
w = l * d - o * c, | |
y = f * v - i * s, | |
z = f * x - m * s, | |
A = f * b - p * s, | |
B = i * x - m * v, | |
C = i * b - p * v, | |
D = m * b - p * x, | |
E = g * D - h * C + j * B + k * A - q * z + w * y; | |
return E | |
? ((E = 1 / E), | |
(n[0] = (a * D - c * C + d * B) * E), | |
(n[1] = (l * C - e * D - o * B) * E), | |
(n[2] = (v * w - x * q + b * k) * E), | |
(n[3] = (m * q - i * w - p * k) * E), | |
(n[4] = (c * A - t * D - d * z) * E), | |
(n[5] = (u * D - l * A + o * z) * E), | |
(n[6] = (x * j - s * w - b * h) * E), | |
(n[7] = (f * w - m * j + p * h) * E), | |
(n[8] = (t * C - a * A + d * y) * E), | |
(n[9] = (e * A - u * C - o * y) * E), | |
(n[10] = (s * q - v * j + b * g) * E), | |
(n[11] = (i * j - f * q - p * g) * E), | |
(n[12] = (a * z - t * B - c * y) * E), | |
(n[13] = (u * B - e * z + l * y) * E), | |
(n[14] = (v * h - s * k - x * g) * E), | |
(n[15] = (f * k - i * h + m * g) * E), | |
n) | |
: null; | |
} | |
module.exports = n; | |
}, | |
{}, | |
], | |
yCc6: [ | |
function (require, module, exports) { | |
function e(e) { | |
return ( | |
(e[0] = 1), | |
(e[1] = 0), | |
(e[2] = 0), | |
(e[3] = 0), | |
(e[4] = 0), | |
(e[5] = 1), | |
(e[6] = 0), | |
(e[7] = 0), | |
(e[8] = 0), | |
(e[9] = 0), | |
(e[10] = 1), | |
(e[11] = 0), | |
(e[12] = 0), | |
(e[13] = 0), | |
(e[14] = 0), | |
(e[15] = 1), | |
e | |
); | |
} | |
module.exports = e; | |
}, | |
{}, | |
], | |
ZR1s: [ | |
function (require, module, exports) { | |
var i = require("object-assign"), | |
r = require("ray-3d"), | |
e = require("camera-project"), | |
o = require("camera-unproject"), | |
t = require("./camera-look-at"), | |
n = require("camera-picking-ray"), | |
u = require("gl-vec3/add"), | |
c = require("gl-mat4/multiply"), | |
p = require("gl-mat4/invert"), | |
a = require("gl-mat4/identity"), | |
w = require("gl-vec3/set"); | |
module.exports = function (v) { | |
v = v || {}; | |
var j = { | |
projection: a([]), | |
view: a([]), | |
position: v.position || [0, 0, 0], | |
direction: v.direction || [0, 0, -1], | |
up: v.up || [0, 1, 0], | |
viewport: v.viewport || [-1, -1, 1, 1], | |
projView: a([]), | |
invProjView: a([]), | |
}; | |
return i(j, { | |
translate: function (i) { | |
return u(j.position, j.position, i), j; | |
}, | |
identity: function () { | |
return ( | |
w(j.position, 0, 0, 0), | |
w(j.direction, 0, 0, -1), | |
w(j.up, 0, 1, 0), | |
a(j.view), | |
a(j.projection), | |
a(j.projView), | |
a(j.invProjView), | |
j | |
); | |
}, | |
lookAt: function (i) { | |
return t(j.direction, j.up, j.position, i), j; | |
}, | |
createPickingRay: function (i) { | |
var e = new r(); | |
return n(e.origin, e.direction, i, j.viewport, j.invProjView), e; | |
}, | |
update: function () { | |
if ( | |
(c(j.projView, j.projection, j.view), | |
!p(j.invProjView, j.projView)) | |
) | |
throw new Error("camera projection * view is non-invertible"); | |
}, | |
project: function (i) { | |
return e([], i, j.viewport, j.projView); | |
}, | |
unproject: function (i) { | |
return o([], i, j.viewport, j.invProjView); | |
}, | |
}); | |
}; | |
}, | |
{ | |
"object-assign": "YOwE", | |
"ray-3d": "yhjv", | |
"camera-project": "lJtm", | |
"camera-unproject": "pVYe", | |
"./camera-look-at": "lMRG", | |
"camera-picking-ray": "gPAD", | |
"gl-vec3/add": "VR1w", | |
"gl-mat4/multiply": "FnI8", | |
"gl-mat4/invert": "n8ou", | |
"gl-mat4/identity": "yCc6", | |
"gl-vec3/set": "uVIA", | |
}, | |
], | |
cE2j: [ | |
function (require, module, exports) { | |
module.exports = function () { | |
for (var o = 0; o < arguments.length; o++) | |
if (void 0 !== arguments[o]) return arguments[o]; | |
}; | |
}, | |
{}, | |
], | |
dDpk: [ | |
function (require, module, exports) { | |
function t(t, n, r, a, e) { | |
var o = 1 / Math.tan(n / 2), | |
u = 1 / (a - e); | |
return ( | |
(t[0] = o / r), | |
(t[1] = 0), | |
(t[2] = 0), | |
(t[3] = 0), | |
(t[4] = 0), | |
(t[5] = o), | |
(t[6] = 0), | |
(t[7] = 0), | |
(t[8] = 0), | |
(t[9] = 0), | |
(t[10] = (e + a) * u), | |
(t[11] = -1), | |
(t[12] = 0), | |
(t[13] = 0), | |
(t[14] = 2 * e * a * u), | |
(t[15] = 0), | |
t | |
); | |
} | |
module.exports = t; | |
}, | |
{}, | |
], | |
SStW: [ | |
function (require, module, exports) { | |
var t = require("./identity"); | |
function a(a, r, e, s) { | |
var h, | |
M, | |
i, | |
n, | |
q, | |
u, | |
b, | |
o, | |
d, | |
v, | |
c = r[0], | |
f = r[1], | |
l = r[2], | |
m = s[0], | |
p = s[1], | |
x = s[2], | |
y = e[0], | |
g = e[1], | |
j = e[2]; | |
return Math.abs(c - y) < 1e-6 && | |
Math.abs(f - g) < 1e-6 && | |
Math.abs(l - j) < 1e-6 | |
? t(a) | |
: ((b = c - y), | |
(o = f - g), | |
(d = l - j), | |
(h = | |
p * (d *= v = 1 / Math.sqrt(b * b + o * o + d * d)) - | |
x * (o *= v)), | |
(M = x * (b *= v) - m * d), | |
(i = m * o - p * b), | |
(v = Math.sqrt(h * h + M * M + i * i)) | |
? ((h *= v = 1 / v), (M *= v), (i *= v)) | |
: ((h = 0), (M = 0), (i = 0)), | |
(n = o * i - d * M), | |
(q = d * h - b * i), | |
(u = b * M - o * h), | |
(v = Math.sqrt(n * n + q * q + u * u)) | |
? ((n *= v = 1 / v), (q *= v), (u *= v)) | |
: ((n = 0), (q = 0), (u = 0)), | |
(a[0] = h), | |
(a[1] = n), | |
(a[2] = b), | |
(a[3] = 0), | |
(a[4] = M), | |
(a[5] = q), | |
(a[6] = o), | |
(a[7] = 0), | |
(a[8] = i), | |
(a[9] = u), | |
(a[10] = d), | |
(a[11] = 0), | |
(a[12] = -(h * c + M * f + i * l)), | |
(a[13] = -(n * c + q * f + u * l)), | |
(a[14] = -(b * c + o * f + d * l)), | |
(a[15] = 1), | |
a); | |
} | |
module.exports = a; | |
}, | |
{ "./identity": "yCc6" }, | |
], | |
KuHx: [ | |
function (require, module, exports) { | |
var e = require("./camera-base"), | |
r = require("object-assign"), | |
a = require("defined"), | |
i = require("gl-mat4/perspective"), | |
t = require("gl-mat4/lookAt"), | |
o = require("gl-vec3/add"); | |
module.exports = function (n) { | |
var u = e((n = n || {})); | |
(u.fov = a(n.fov, Math.PI / 4)), | |
(u.near = a(n.near, 1)), | |
(u.far = a(n.far, 100)); | |
var v = [0, 0, 0], | |
p = u.update; | |
function f() { | |
var e = u.viewport[2] / u.viewport[3]; | |
return ( | |
i(u.projection, u.fov, e, Math.abs(u.near), Math.abs(u.far)), | |
o(v, u.position, u.direction), | |
t(u.view, u.position, v, u.up), | |
p(), | |
u | |
); | |
} | |
return f(), r(u, { update: f }); | |
}; | |
}, | |
{ | |
"./camera-base": "ZR1s", | |
"object-assign": "YOwE", | |
defined: "cE2j", | |
"gl-mat4/perspective": "dDpk", | |
"gl-mat4/lookAt": "SStW", | |
"gl-vec3/add": "VR1w", | |
}, | |
], | |
Q1pF: [ | |
function (require, module, exports) { | |
module.exports = require("./lib/camera-perspective"); | |
}, | |
{ "./lib/camera-perspective": "KuHx" }, | |
], | |
I6tr: [ | |
function (require, module, exports) { | |
function r() { | |
var r = new Float32Array(16); | |
return ( | |
(r[0] = 1), | |
(r[1] = 0), | |
(r[2] = 0), | |
(r[3] = 0), | |
(r[4] = 0), | |
(r[5] = 1), | |
(r[6] = 0), | |
(r[7] = 0), | |
(r[8] = 0), | |
(r[9] = 0), | |
(r[10] = 1), | |
(r[11] = 0), | |
(r[12] = 0), | |
(r[13] = 0), | |
(r[14] = 0), | |
(r[15] = 1), | |
r | |
); | |
} | |
module.exports = r; | |
}, | |
{}, | |
], | |
wWnm: [ | |
function (require, module, exports) { | |
function r(r) { | |
var e = new Float32Array(16); | |
return ( | |
(e[0] = r[0]), | |
(e[1] = r[1]), | |
(e[2] = r[2]), | |
(e[3] = r[3]), | |
(e[4] = r[4]), | |
(e[5] = r[5]), | |
(e[6] = r[6]), | |
(e[7] = r[7]), | |
(e[8] = r[8]), | |
(e[9] = r[9]), | |
(e[10] = r[10]), | |
(e[11] = r[11]), | |
(e[12] = r[12]), | |
(e[13] = r[13]), | |
(e[14] = r[14]), | |
(e[15] = r[15]), | |
e | |
); | |
} | |
module.exports = r; | |
}, | |
{}, | |
], | |
ecdU: [ | |
function (require, module, exports) { | |
function e(e, n) { | |
return ( | |
(e[0] = n[0]), | |
(e[1] = n[1]), | |
(e[2] = n[2]), | |
(e[3] = n[3]), | |
(e[4] = n[4]), | |
(e[5] = n[5]), | |
(e[6] = n[6]), | |
(e[7] = n[7]), | |
(e[8] = n[8]), | |
(e[9] = n[9]), | |
(e[10] = n[10]), | |
(e[11] = n[11]), | |
(e[12] = n[12]), | |
(e[13] = n[13]), | |
(e[14] = n[14]), | |
(e[15] = n[15]), | |
e | |
); | |
} | |
module.exports = e; | |
}, | |
{}, | |
], | |
BsGG: [ | |
function (require, module, exports) { | |
function e(e, r) { | |
if (e === r) { | |
var n = r[1], | |
o = r[2], | |
t = r[3], | |
u = r[6], | |
f = r[7], | |
i = r[11]; | |
(e[1] = r[4]), | |
(e[2] = r[8]), | |
(e[3] = r[12]), | |
(e[4] = n), | |
(e[6] = r[9]), | |
(e[7] = r[13]), | |
(e[8] = o), | |
(e[9] = u), | |
(e[11] = r[14]), | |
(e[12] = t), | |
(e[13] = f), | |
(e[14] = i); | |
} else | |
(e[0] = r[0]), | |
(e[1] = r[4]), | |
(e[2] = r[8]), | |
(e[3] = r[12]), | |
(e[4] = r[1]), | |
(e[5] = r[5]), | |
(e[6] = r[9]), | |
(e[7] = r[13]), | |
(e[8] = r[2]), | |
(e[9] = r[6]), | |
(e[10] = r[10]), | |
(e[11] = r[14]), | |
(e[12] = r[3]), | |
(e[13] = r[7]), | |
(e[14] = r[11]), | |
(e[15] = r[15]); | |
return e; | |
} | |
module.exports = e; | |
}, | |
{}, | |
], | |
UWDD: [ | |
function (require, module, exports) { | |
function r(r, e) { | |
var n = e[0], | |
o = e[1], | |
t = e[2], | |
u = e[3], | |
a = e[4], | |
c = e[5], | |
d = e[6], | |
f = e[7], | |
i = e[8], | |
l = e[9], | |
m = e[10], | |
p = e[11], | |
s = e[12], | |
v = e[13], | |
x = e[14], | |
b = e[15]; | |
return ( | |
(r[0] = | |
c * (m * b - p * x) - l * (d * b - f * x) + v * (d * p - f * m)), | |
(r[1] = -( | |
o * (m * b - p * x) - | |
l * (t * b - u * x) + | |
v * (t * p - u * m) | |
)), | |
(r[2] = | |
o * (d * b - f * x) - c * (t * b - u * x) + v * (t * f - u * d)), | |
(r[3] = -( | |
o * (d * p - f * m) - | |
c * (t * p - u * m) + | |
l * (t * f - u * d) | |
)), | |
(r[4] = -( | |
a * (m * b - p * x) - | |
i * (d * b - f * x) + | |
s * (d * p - f * m) | |
)), | |
(r[5] = | |
n * (m * b - p * x) - i * (t * b - u * x) + s * (t * p - u * m)), | |
(r[6] = -( | |
n * (d * b - f * x) - | |
a * (t * b - u * x) + | |
s * (t * f - u * d) | |
)), | |
(r[7] = | |
n * (d * p - f * m) - a * (t * p - u * m) + i * (t * f - u * d)), | |
(r[8] = | |
a * (l * b - p * v) - i * (c * b - f * v) + s * (c * p - f * l)), | |
(r[9] = -( | |
n * (l * b - p * v) - | |
i * (o * b - u * v) + | |
s * (o * p - u * l) | |
)), | |
(r[10] = | |
n * (c * b - f * v) - a * (o * b - u * v) + s * (o * f - u * c)), | |
(r[11] = -( | |
n * (c * p - f * l) - | |
a * (o * p - u * l) + | |
i * (o * f - u * c) | |
)), | |
(r[12] = -( | |
a * (l * x - m * v) - | |
i * (c * x - d * v) + | |
s * (c * m - d * l) | |
)), | |
(r[13] = | |
n * (l * x - m * v) - i * (o * x - t * v) + s * (o * m - t * l)), | |
(r[14] = -( | |
n * (c * x - d * v) - | |
a * (o * x - t * v) + | |
s * (o * d - t * c) | |
)), | |
(r[15] = | |
n * (c * m - d * l) - a * (o * m - t * l) + i * (o * d - t * c)), | |
r | |
); | |
} | |
module.exports = r; | |
}, | |
{}, | |
], | |
lTee: [ | |
function (require, module, exports) { | |
function r(r) { | |
var e = r[0], | |
n = r[1], | |
o = r[2], | |
t = r[3], | |
u = r[4], | |
a = r[5], | |
c = r[6], | |
d = r[7], | |
f = r[8], | |
i = r[9], | |
l = r[10], | |
m = r[11], | |
p = r[12], | |
s = r[13], | |
v = r[14], | |
x = r[15]; | |
return ( | |
(e * a - n * u) * (l * x - m * v) - | |
(e * c - o * u) * (i * x - m * s) + | |
(e * d - t * u) * (i * v - l * s) + | |
(n * c - o * a) * (f * x - m * p) - | |
(n * d - t * a) * (f * v - l * p) + | |
(o * d - t * c) * (f * s - i * p) | |
); | |
} | |
module.exports = r; | |
}, | |
{}, | |
], | |
ZdZu: [ | |
function (require, module, exports) { | |
function r(r, e, n) { | |
var o, | |
t, | |
u, | |
a, | |
c, | |
d, | |
f, | |
i, | |
l, | |
m, | |
p, | |
s, | |
v = n[0], | |
x = n[1], | |
b = n[2]; | |
return ( | |
e === r | |
? ((r[12] = e[0] * v + e[4] * x + e[8] * b + e[12]), | |
(r[13] = e[1] * v + e[5] * x + e[9] * b + e[13]), | |
(r[14] = e[2] * v + e[6] * x + e[10] * b + e[14]), | |
(r[15] = e[3] * v + e[7] * x + e[11] * b + e[15])) | |
: ((o = e[0]), | |
(t = e[1]), | |
(u = e[2]), | |
(a = e[3]), | |
(c = e[4]), | |
(d = e[5]), | |
(f = e[6]), | |
(i = e[7]), | |
(l = e[8]), | |
(m = e[9]), | |
(p = e[10]), | |
(s = e[11]), | |
(r[0] = o), | |
(r[1] = t), | |
(r[2] = u), | |
(r[3] = a), | |
(r[4] = c), | |
(r[5] = d), | |
(r[6] = f), | |
(r[7] = i), | |
(r[8] = l), | |
(r[9] = m), | |
(r[10] = p), | |
(r[11] = s), | |
(r[12] = o * v + c * x + l * b + e[12]), | |
(r[13] = t * v + d * x + m * b + e[13]), | |
(r[14] = u * v + f * x + p * b + e[14]), | |
(r[15] = a * v + i * x + s * b + e[15])), | |
r | |
); | |
} | |
module.exports = r; | |
}, | |
{}, | |
], | |
rqbz: [ | |
function (require, module, exports) { | |
function r(r, e, n) { | |
var o = n[0], | |
t = n[1], | |
u = n[2]; | |
return ( | |
(r[0] = e[0] * o), | |
(r[1] = e[1] * o), | |
(r[2] = e[2] * o), | |
(r[3] = e[3] * o), | |
(r[4] = e[4] * t), | |
(r[5] = e[5] * t), | |
(r[6] = e[6] * t), | |
(r[7] = e[7] * t), | |
(r[8] = e[8] * u), | |
(r[9] = e[9] * u), | |
(r[10] = e[10] * u), | |
(r[11] = e[11] * u), | |
(r[12] = e[12]), | |
(r[13] = e[13]), | |
(r[14] = e[14]), | |
(r[15] = e[15]), | |
r | |
); | |
} | |
module.exports = r; | |
}, | |
{}, | |
], | |
psTE: [ | |
function (require, module, exports) { | |
function t(t, a, n, r) { | |
var s, | |
e, | |
h, | |
o, | |
u, | |
M, | |
l, | |
c, | |
i, | |
b, | |
d, | |
f, | |
m, | |
p, | |
q, | |
v, | |
x, | |
g, | |
j, | |
k, | |
w, | |
y, | |
z, | |
A, | |
B = r[0], | |
C = r[1], | |
D = r[2], | |
E = Math.sqrt(B * B + C * C + D * D); | |
return Math.abs(E) < 1e-6 | |
? null | |
: ((B *= E = 1 / E), | |
(C *= E), | |
(D *= E), | |
(s = Math.sin(n)), | |
(h = 1 - (e = Math.cos(n))), | |
(o = a[0]), | |
(u = a[1]), | |
(M = a[2]), | |
(l = a[3]), | |
(c = a[4]), | |
(i = a[5]), | |
(b = a[6]), | |
(d = a[7]), | |
(f = a[8]), | |
(m = a[9]), | |
(p = a[10]), | |
(q = a[11]), | |
(v = B * B * h + e), | |
(x = C * B * h + D * s), | |
(g = D * B * h - C * s), | |
(j = B * C * h - D * s), | |
(k = C * C * h + e), | |
(w = D * C * h + B * s), | |
(y = B * D * h + C * s), | |
(z = C * D * h - B * s), | |
(A = D * D * h + e), | |
(t[0] = o * v + c * x + f * g), | |
(t[1] = u * v + i * x + m * g), | |
(t[2] = M * v + b * x + p * g), | |
(t[3] = l * v + d * x + q * g), | |
(t[4] = o * j + c * k + f * w), | |
(t[5] = u * j + i * k + m * w), | |
(t[6] = M * j + b * k + p * w), | |
(t[7] = l * j + d * k + q * w), | |
(t[8] = o * y + c * z + f * A), | |
(t[9] = u * y + i * z + m * A), | |
(t[10] = M * y + b * z + p * A), | |
(t[11] = l * y + d * z + q * A), | |
a !== t && | |
((t[12] = a[12]), | |
(t[13] = a[13]), | |
(t[14] = a[14]), | |
(t[15] = a[15])), | |
t); | |
} | |
module.exports = t; | |
}, | |
{}, | |
], | |
Uh3r: [ | |
function (require, module, exports) { | |
function t(t, n, o) { | |
var r = Math.sin(o), | |
a = Math.cos(o), | |
e = n[4], | |
s = n[5], | |
u = n[6], | |
c = n[7], | |
h = n[8], | |
i = n[9], | |
M = n[10], | |
d = n[11]; | |
return ( | |
n !== t && | |
((t[0] = n[0]), | |
(t[1] = n[1]), | |
(t[2] = n[2]), | |
(t[3] = n[3]), | |
(t[12] = n[12]), | |
(t[13] = n[13]), | |
(t[14] = n[14]), | |
(t[15] = n[15])), | |
(t[4] = e * a + h * r), | |
(t[5] = s * a + i * r), | |
(t[6] = u * a + M * r), | |
(t[7] = c * a + d * r), | |
(t[8] = h * a - e * r), | |
(t[9] = i * a - s * r), | |
(t[10] = M * a - u * r), | |
(t[11] = d * a - c * r), | |
t | |
); | |
} | |
module.exports = t; | |
}, | |
{}, | |
], | |
vdkJ: [ | |
function (require, module, exports) { | |
function t(t, n, o) { | |
var r = Math.sin(o), | |
a = Math.cos(o), | |
e = n[0], | |
s = n[1], | |
u = n[2], | |
c = n[3], | |
h = n[8], | |
i = n[9], | |
M = n[10], | |
d = n[11]; | |
return ( | |
n !== t && | |
((t[4] = n[4]), | |
(t[5] = n[5]), | |
(t[6] = n[6]), | |
(t[7] = n[7]), | |
(t[12] = n[12]), | |
(t[13] = n[13]), | |
(t[14] = n[14]), | |
(t[15] = n[15])), | |
(t[0] = e * a - h * r), | |
(t[1] = s * a - i * r), | |
(t[2] = u * a - M * r), | |
(t[3] = c * a - d * r), | |
(t[8] = e * r + h * a), | |
(t[9] = s * r + i * a), | |
(t[10] = u * r + M * a), | |
(t[11] = c * r + d * a), | |
t | |
); | |
} | |
module.exports = t; | |
}, | |
{}, | |
], | |
NdtU: [ | |
function (require, module, exports) { | |
function t(t, n, o) { | |
var r = Math.sin(o), | |
a = Math.cos(o), | |
e = n[0], | |
s = n[1], | |
u = n[2], | |
c = n[3], | |
h = n[4], | |
i = n[5], | |
M = n[6], | |
d = n[7]; | |
return ( | |
n !== t && | |
((t[8] = n[8]), | |
(t[9] = n[9]), | |
(t[10] = n[10]), | |
(t[11] = n[11]), | |
(t[12] = n[12]), | |
(t[13] = n[13]), | |
(t[14] = n[14]), | |
(t[15] = n[15])), | |
(t[0] = e * a + h * r), | |
(t[1] = s * a + i * r), | |
(t[2] = u * a + M * r), | |
(t[3] = c * a + d * r), | |
(t[4] = h * a - e * r), | |
(t[5] = i * a - s * r), | |
(t[6] = M * a - u * r), | |
(t[7] = d * a - c * r), | |
t | |
); | |
} | |
module.exports = t; | |
}, | |
{}, | |
], | |
R7oY: [ | |
function (require, module, exports) { | |
function t(t, a, n) { | |
var r, | |
s, | |
e, | |
h = n[0], | |
o = n[1], | |
u = n[2], | |
M = Math.sqrt(h * h + o * o + u * u); | |
return Math.abs(M) < 1e-6 | |
? null | |
: ((h *= M = 1 / M), | |
(o *= M), | |
(u *= M), | |
(r = Math.sin(a)), | |
(e = 1 - (s = Math.cos(a))), | |
(t[0] = h * h * e + s), | |
(t[1] = o * h * e + u * r), | |
(t[2] = u * h * e - o * r), | |
(t[3] = 0), | |
(t[4] = h * o * e - u * r), | |
(t[5] = o * o * e + s), | |
(t[6] = u * o * e + h * r), | |
(t[7] = 0), | |
(t[8] = h * u * e + o * r), | |
(t[9] = o * u * e - h * r), | |
(t[10] = u * u * e + s), | |
(t[11] = 0), | |
(t[12] = 0), | |
(t[13] = 0), | |
(t[14] = 0), | |
(t[15] = 1), | |
t); | |
} | |
module.exports = t; | |
}, | |
{}, | |
], | |
E1sJ: [ | |
function (require, module, exports) { | |
function r(r, e, n) { | |
var o = e[0], | |
t = e[1], | |
u = e[2], | |
a = e[3], | |
c = o + o, | |
d = t + t, | |
f = u + u, | |
i = o * c, | |
l = o * d, | |
m = o * f, | |
p = t * d, | |
s = t * f, | |
v = u * f, | |
x = a * c, | |
b = a * d, | |
g = a * f; | |
return ( | |
(r[0] = 1 - (p + v)), | |
(r[1] = l + g), | |
(r[2] = m - b), | |
(r[3] = 0), | |
(r[4] = l - g), | |
(r[5] = 1 - (i + v)), | |
(r[6] = s + x), | |
(r[7] = 0), | |
(r[8] = m + b), | |
(r[9] = s - x), | |
(r[10] = 1 - (i + p)), | |
(r[11] = 0), | |
(r[12] = n[0]), | |
(r[13] = n[1]), | |
(r[14] = n[2]), | |
(r[15] = 1), | |
r | |
); | |
} | |
module.exports = r; | |
}, | |
{}, | |
], | |
nV4m: [ | |
function (require, module, exports) { | |
function e(e, n) { | |
return ( | |
(e[0] = n[0]), | |
(e[1] = 0), | |
(e[2] = 0), | |
(e[3] = 0), | |
(e[4] = 0), | |
(e[5] = n[1]), | |
(e[6] = 0), | |
(e[7] = 0), | |
(e[8] = 0), | |
(e[9] = 0), | |
(e[10] = n[2]), | |
(e[11] = 0), | |
(e[12] = 0), | |
(e[13] = 0), | |
(e[14] = 0), | |
(e[15] = 1), | |
e | |
); | |
} | |
module.exports = e; | |
}, | |
{}, | |
], | |
AK4g: [ | |
function (require, module, exports) { | |
function e(e, n) { | |
return ( | |
(e[0] = 1), | |
(e[1] = 0), | |
(e[2] = 0), | |
(e[3] = 0), | |
(e[4] = 0), | |
(e[5] = 1), | |
(e[6] = 0), | |
(e[7] = 0), | |
(e[8] = 0), | |
(e[9] = 0), | |
(e[10] = 1), | |
(e[11] = 0), | |
(e[12] = n[0]), | |
(e[13] = n[1]), | |
(e[14] = n[2]), | |
(e[15] = 1), | |
e | |
); | |
} | |
module.exports = e; | |
}, | |
{}, | |
], | |
s3d0: [ | |
function (require, module, exports) { | |
function t(t, n) { | |
var o = Math.sin(n), | |
r = Math.cos(n); | |
return ( | |
(t[0] = 1), | |
(t[1] = 0), | |
(t[2] = 0), | |
(t[3] = 0), | |
(t[4] = 0), | |
(t[5] = r), | |
(t[6] = o), | |
(t[7] = 0), | |
(t[8] = 0), | |
(t[9] = -o), | |
(t[10] = r), | |
(t[11] = 0), | |
(t[12] = 0), | |
(t[13] = 0), | |
(t[14] = 0), | |
(t[15] = 1), | |
t | |
); | |
} | |
module.exports = t; | |
}, | |
{}, | |
], | |
UCYc: [ | |
function (require, module, exports) { | |
function t(t, n) { | |
var o = Math.sin(n), | |
r = Math.cos(n); | |
return ( | |
(t[0] = r), | |
(t[1] = 0), | |
(t[2] = -o), | |
(t[3] = 0), | |
(t[4] = 0), | |
(t[5] = 1), | |
(t[6] = 0), | |
(t[7] = 0), | |
(t[8] = o), | |
(t[9] = 0), | |
(t[10] = r), | |
(t[11] = 0), | |
(t[12] = 0), | |
(t[13] = 0), | |
(t[14] = 0), | |
(t[15] = 1), | |
t | |
); | |
} | |
module.exports = t; | |
}, | |
{}, | |
], | |
rNFz: [ | |
function (require, module, exports) { | |
function t(t, n) { | |
var o = Math.sin(n), | |
r = Math.cos(n); | |
return ( | |
(t[0] = r), | |
(t[1] = o), | |
(t[2] = 0), | |
(t[3] = 0), | |
(t[4] = -o), | |
(t[5] = r), | |
(t[6] = 0), | |
(t[7] = 0), | |
(t[8] = 0), | |
(t[9] = 0), | |
(t[10] = 1), | |
(t[11] = 0), | |
(t[12] = 0), | |
(t[13] = 0), | |
(t[14] = 0), | |
(t[15] = 1), | |
t | |
); | |
} | |
module.exports = t; | |
}, | |
{}, | |
], | |
BJTU: [ | |
function (require, module, exports) { | |
function r(r, e) { | |
var n = e[0], | |
o = e[1], | |
t = e[2], | |
u = e[3], | |
a = n + n, | |
c = o + o, | |
d = t + t, | |
f = n * a, | |
i = o * a, | |
l = o * c, | |
m = t * a, | |
p = t * c, | |
s = t * d, | |
v = u * a, | |
x = u * c, | |
b = u * d; | |
return ( | |
(r[0] = 1 - l - s), | |
(r[1] = i + b), | |
(r[2] = m - x), | |
(r[3] = 0), | |
(r[4] = i - b), | |
(r[5] = 1 - f - s), | |
(r[6] = p + v), | |
(r[7] = 0), | |
(r[8] = m + x), | |
(r[9] = p - v), | |
(r[10] = 1 - f - l), | |
(r[11] = 0), | |
(r[12] = 0), | |
(r[13] = 0), | |
(r[14] = 0), | |
(r[15] = 1), | |
r | |
); | |
} | |
module.exports = r; | |
}, | |
{}, | |
], | |
c5Ca: [ | |
function (require, module, exports) { | |
function r(r, e, n, o, t, u, a) { | |
var c = 1 / (n - e), | |
d = 1 / (t - o), | |
f = 1 / (u - a); | |
return ( | |
(r[0] = 2 * u * c), | |
(r[1] = 0), | |
(r[2] = 0), | |
(r[3] = 0), | |
(r[4] = 0), | |
(r[5] = 2 * u * d), | |
(r[6] = 0), | |
(r[7] = 0), | |
(r[8] = (n + e) * c), | |
(r[9] = (t + o) * d), | |
(r[10] = (a + u) * f), | |
(r[11] = -1), | |
(r[12] = 0), | |
(r[13] = 0), | |
(r[14] = a * u * 2 * f), | |
(r[15] = 0), | |
r | |
); | |
} | |
module.exports = r; | |
}, | |
{}, | |
], | |
wnAI: [ | |
function (require, module, exports) { | |
function t(t, e, a, h) { | |
var r = Math.tan((e.upDegrees * Math.PI) / 180), | |
n = Math.tan((e.downDegrees * Math.PI) / 180), | |
M = Math.tan((e.leftDegrees * Math.PI) / 180), | |
g = Math.tan((e.rightDegrees * Math.PI) / 180), | |
s = 2 / (M + g), | |
o = 2 / (r + n); | |
return ( | |
(t[0] = s), | |
(t[1] = 0), | |
(t[2] = 0), | |
(t[3] = 0), | |
(t[4] = 0), | |
(t[5] = o), | |
(t[6] = 0), | |
(t[7] = 0), | |
(t[8] = -(M - g) * s * 0.5), | |
(t[9] = (r - n) * o * 0.5), | |
(t[10] = h / (a - h)), | |
(t[11] = -1), | |
(t[12] = 0), | |
(t[13] = 0), | |
(t[14] = (h * a) / (a - h)), | |
(t[15] = 0), | |
t | |
); | |
} | |
module.exports = t; | |
}, | |
{}, | |
], | |
cDQx: [ | |
function (require, module, exports) { | |
function r(r, e, n, o, t, u, a) { | |
var c = 1 / (e - n), | |
d = 1 / (o - t), | |
f = 1 / (u - a); | |
return ( | |
(r[0] = -2 * c), | |
(r[1] = 0), | |
(r[2] = 0), | |
(r[3] = 0), | |
(r[4] = 0), | |
(r[5] = -2 * d), | |
(r[6] = 0), | |
(r[7] = 0), | |
(r[8] = 0), | |
(r[9] = 0), | |
(r[10] = 2 * f), | |
(r[11] = 0), | |
(r[12] = (e + n) * c), | |
(r[13] = (t + o) * d), | |
(r[14] = (a + u) * f), | |
(r[15] = 1), | |
r | |
); | |
} | |
module.exports = r; | |
}, | |
{}, | |
], | |
lPvU: [ | |
function (require, module, exports) { | |
function t(t) { | |
return ( | |
"mat4(" + | |
t[0] + | |
", " + | |
t[1] + | |
", " + | |
t[2] + | |
", " + | |
t[3] + | |
", " + | |
t[4] + | |
", " + | |
t[5] + | |
", " + | |
t[6] + | |
", " + | |
t[7] + | |
", " + | |
t[8] + | |
", " + | |
t[9] + | |
", " + | |
t[10] + | |
", " + | |
t[11] + | |
", " + | |
t[12] + | |
", " + | |
t[13] + | |
", " + | |
t[14] + | |
", " + | |
t[15] + | |
")" | |
); | |
} | |
module.exports = t; | |
}, | |
{}, | |
], | |
hnHK: [ | |
function (require, module, exports) { | |
module.exports = { | |
create: require("./create"), | |
clone: require("./clone"), | |
copy: require("./copy"), | |
identity: require("./identity"), | |
transpose: require("./transpose"), | |
invert: require("./invert"), | |
adjoint: require("./adjoint"), | |
determinant: require("./determinant"), | |
multiply: require("./multiply"), | |
translate: require("./translate"), | |
scale: require("./scale"), | |
rotate: require("./rotate"), | |
rotateX: require("./rotateX"), | |
rotateY: require("./rotateY"), | |
rotateZ: require("./rotateZ"), | |
fromRotation: require("./fromRotation"), | |
fromRotationTranslation: require("./fromRotationTranslation"), | |
fromScaling: require("./fromScaling"), | |
fromTranslation: require("./fromTranslation"), | |
fromXRotation: require("./fromXRotation"), | |
fromYRotation: require("./fromYRotation"), | |
fromZRotation: require("./fromZRotation"), | |
fromQuat: require("./fromQuat"), | |
frustum: require("./frustum"), | |
perspective: require("./perspective"), | |
perspectiveFromFieldOfView: require("./perspectiveFromFieldOfView"), | |
ortho: require("./ortho"), | |
lookAt: require("./lookAt"), | |
str: require("./str"), | |
}; | |
}, | |
{ | |
"./create": "I6tr", | |
"./clone": "wWnm", | |
"./copy": "ecdU", | |
"./identity": "yCc6", | |
"./transpose": "BsGG", | |
"./invert": "n8ou", | |
"./adjoint": "UWDD", | |
"./determinant": "lTee", | |
"./multiply": "FnI8", | |
"./translate": "ZdZu", | |
"./scale": "rqbz", | |
"./rotate": "psTE", | |
"./rotateX": "Uh3r", | |
"./rotateY": "vdkJ", | |
"./rotateZ": "NdtU", | |
"./fromRotation": "R7oY", | |
"./fromRotationTranslation": "E1sJ", | |
"./fromScaling": "nV4m", | |
"./fromTranslation": "AK4g", | |
"./fromXRotation": "s3d0", | |
"./fromYRotation": "UCYc", | |
"./fromZRotation": "rNFz", | |
"./fromQuat": "BJTU", | |
"./frustum": "c5Ca", | |
"./perspective": "dDpk", | |
"./perspectiveFromFieldOfView": "wnAI", | |
"./ortho": "cDQx", | |
"./lookAt": "SStW", | |
"./str": "lPvU", | |
}, | |
], | |
lpRu: [ | |
function (require, module, exports) { | |
window.deps = { | |
createRegl: require("regl"), | |
createCamera: require("perspective-camera"), | |
mat4: require("gl-mat4"), | |
}; | |
}, | |
{ regl: "EBub", "perspective-camera": "Q1pF", "gl-mat4": "hnHK" }, | |
], | |
}, | |
{}, | |
["lpRu"], | |
null | |
); | |
//# sourceMappingURL=/deps.js.map |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment