From 33ae56501146e38dd9e0d3719c07ea1b230ff72b Mon Sep 17 00:00:00 2001 From: Daniel Joyce Date: Wed, 7 Feb 2024 19:53:37 -0800 Subject: [PATCH] Modernize drawables part of program * Update js style * Convert to typescript to catch more type erros ( found a few! ) * enhance eslint config * Fix up a few other files impacted by eslint changes --- .eslintrc.js | 36 +++ .eslintrc.json | 28 --- jsconfig.json | 15 ++ package.json | 3 +- src/Scene.js | 27 ++- src/drawables/Background.js | 141 ----------- src/drawables/Background.ts | 189 +++++++++++++++ .../{Primitives.js => Primitives.ts} | 135 ++++++----- src/drawables/Rtt.js | 111 --------- src/drawables/Rtt.ts | 127 ++++++++++ src/drawables/Selection.js | 178 -------------- src/drawables/Selection.ts | 223 ++++++++++++++++++ src/gui/GuiBackground.js | 15 +- src/render/shaders/ShaderBackground.js | 24 +- src/worker/deflate.js | 153 ++++++------ src/worker/z-worker.js | 4 +- yarn.lock | 210 ++++++++++++++++- 17 files changed, 1006 insertions(+), 613 deletions(-) create mode 100644 .eslintrc.js delete mode 100644 .eslintrc.json create mode 100644 jsconfig.json delete mode 100644 src/drawables/Background.js create mode 100644 src/drawables/Background.ts rename src/drawables/{Primitives.js => Primitives.ts} (76%) delete mode 100644 src/drawables/Rtt.js create mode 100644 src/drawables/Rtt.ts delete mode 100644 src/drawables/Selection.js create mode 100644 src/drawables/Selection.ts diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 00000000..874b0c27 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,36 @@ +module.exports = { +// For rules: https://eslint.style/rules + plugins: [ + '@stylistic' + ], + 'env': { + 'browser': true, + 'es2023': true + }, + 'parserOptions': { + 'ecmaVersion': 'latest', + 'sourceType': 'module' + }, + 'rules': { + '@stylistic/indent': [ + 'error', + 2 + ], + '@stylistic/linebreak-style': [ + 'error', + 'unix' + ], + '@stylistic/quotes': [ + 'error', + 'single' + ], + '@stylistic/semi': [ + 'error', + 'always' + ], + '@stylistic/max-len': [ + 'error', + 100 + ], + } +}; \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index e9b79bef..00000000 --- a/.eslintrc.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "env": { - "browser": true, - "es2023": true - }, - "parserOptions": { - "ecmaVersion": "latest", - "sourceType": "module" - }, - "rules": { - "indent": [ - "error", - 2 - ], - "linebreak-style": [ - "error", - "unix" - ], - "quotes": [ - "error", - "single" - ], - "semi": [ - "error", - "always" - ] - } -} \ No newline at end of file diff --git a/jsconfig.json b/jsconfig.json new file mode 100644 index 00000000..961a4a5e --- /dev/null +++ b/jsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "module": "ESNext", + "moduleResolution": "Node", + "target": "ES2020", + "jsx": "react", + "allowImportingTsExtensions": true, + "strictNullChecks": true, + "strictFunctionTypes": true + }, + "exclude": [ + "node_modules", + "**/node_modules/*" + ] +} \ No newline at end of file diff --git a/package.json b/package.json index 74b70888..315caf03 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "devDependencies": { "@parcel/reporter-bundle-analyzer": "^2.11.0", "@parcel/transformer-glsl": "^2.11.0", + "@stylistic/eslint-plugin": "^1.6.0", "eslint": "^8.56.0", "parcel": "^2.11.0" }, @@ -30,4 +31,4 @@ "bugs": { "url": "https://github.com/stephomi/sculptgl/issues" } -} \ No newline at end of file +} diff --git a/src/Scene.js b/src/Scene.js index 8c4f8e51..fa3742aa 100644 --- a/src/Scene.js +++ b/src/Scene.js @@ -274,7 +274,11 @@ class Scene { // CONTOUR 1/2 /////////////// gl.disable(gl.DEPTH_TEST); - var showContour = this._selectMeshes.length > 0 && this._showContour && ShaderLib[Enums.Shader.CONTOUR].color[3] > 0.0; + + let showContour = this._selectMeshes.length > 0 + && this._showContour + && ShaderLib[Enums.Shader.CONTOUR].color[3] > 0.0; + if (showContour) { gl.bindFramebuffer(gl.FRAMEBUFFER, this._rttContour.getFramebuffer()); gl.clear(gl.COLOR_BUFFER_BIT); @@ -367,7 +371,10 @@ class Scene { }; var canvas = document.getElementById('canvas'); - var gl = this._gl = canvas.getContext('webgl', attributes) || canvas.getContext('experimental-webgl', attributes); + + var gl = this._gl = canvas.getContext('webgl', attributes) + || canvas.getContext('experimental-webgl', attributes); + if (!gl) { window.alert('Could not initialise WebGL. No WebGL, no SculptGL. Sorry.'); return; @@ -489,7 +496,11 @@ class Scene { var mCen = mat4.create(); mat4.scale(mCen, mCen, [scale, scale, scale]); - mat4.translate(mCen, mCen, [-(box[0] + box[3]) * 0.5, -(box[1] + box[4]) * 0.5, -(box[2] + box[5]) * 0.5]); + mat4.translate( + mCen, + mCen, + [-(box[0] + box[3]) * 0.5, -(box[1] + box[4]) * 0.5, -(box[2] + box[5]) * 0.5] + ); for (var i = 0, l = meshes.length; i < l; ++i) { var mat = meshes[i].getMatrix(); @@ -522,7 +533,15 @@ class Scene { } addTorus(preview) { - var mesh = new Multimesh(Primitives.createTorus(this._gl, this._torusLength, this._torusWidth, this._torusRadius, this._torusRadial, this._torusTubular)); + var mesh = new Multimesh( + Primitives.createTorus( + this._gl, + this._torusLength, + this._torusWidth, + this._torusRadius, + this._torusRadial, + this._torusTubular) + ); if (preview) { mesh.setShowWireframe(true); var scale = 0.3 * Utils.SCALE; diff --git a/src/drawables/Background.js b/src/drawables/Background.js deleted file mode 100644 index 111d6671..00000000 --- a/src/drawables/Background.js +++ /dev/null @@ -1,141 +0,0 @@ -import Buffer from '../render/Buffer'; -import Shader from '../render/ShaderLib'; -import Enums from '../misc/Enums'; - -class Background { - - constructor(gl, main) { - this._main = main; - this._gl = gl; // webgl context - - this._vertexBuffer = new Buffer(gl, gl.ARRAY_BUFFER, gl.STATIC_DRAW); // vertices buffer - this._texCoordBuffer = new Buffer(gl, gl.ARRAY_BUFFER, gl.STATIC_DRAW); // tex coord buffer - this._fill = true; // if the canvas should be fille by the background - - this._monoTex = null; - this._texture = null; // texture background - this._texWidth = 1; - this._texHeight = 1; - - this._type = 0; // 0: fixed grey, 1 env spec, 2 env ambient - this._blur = 0.0; - - this.init(); - } - - init() { - this.getTexCoordBuffer().update(new Float32Array([0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0])); - this._monoTex = this.createOnePixelTexture(50, 50, 50, 255); - document.getElementById('backgroundopen').addEventListener('change', this.loadBackground.bind(this), false); - } - - loadBackground(event) { - if (event.target.files.length === 0) - return; - - var file = event.target.files[0]; - if (!file.type.match('image.*')) - return; - - var self = this; - var reader = new FileReader(); - reader.onload = function (evt) { - var bg = new Image(); - bg.src = evt.target.result; - - bg.onload = function () { - - var canvas = self._main.getCanvas(); - self.loadBackgroundTexture(bg); - self.onResize(canvas.width, canvas.height); - self._main.render(); - }; - }; - - document.getElementById('backgroundopen').value = ''; - reader.readAsDataURL(file); - } - - getGL() { - return this._gl; - } - - getBlur() { - return this._blur; - } - - getVertexBuffer() { - return this._vertexBuffer; - } - - getTexCoordBuffer() { - return this._texCoordBuffer; - } - - release() { - this.deleteTexture(); - this.getVertexBuffer().release(); - this.getTexCoordBuffer().release(); - } - - getType() { - return this._type; - } - - setType(val) { - this._type = val; - } - - onResize(width, height) { - var ratio = (width / height) / (this._texWidth / this._texHeight); - var comp = this._fill || this._type !== 0 ? 1.0 / ratio : ratio; - var x = comp < 1.0 ? 1.0 : 1.0 / ratio; - var y = comp < 1.0 ? ratio : 1.0; - this.getVertexBuffer().update(new Float32Array([-x, -y, x, -y, -x, y, x, y])); - } - - getTexture() { - return this._texture ? this._texture : this._monoTex; - } - - createOnePixelTexture(r, g, b, a) { - var gl = this._gl; - var tex = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, tex); - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array([r, g, b, a])); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); - gl.bindTexture(gl.TEXTURE_2D, null); - return tex; - } - - loadBackgroundTexture(tex) { - var gl = this._gl; - this.deleteTexture(); - - this._texWidth = tex.width; - this._texHeight = tex.height; - this._texture = gl.createTexture(); - - gl.bindTexture(gl.TEXTURE_2D, this._texture); - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, tex); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - gl.bindTexture(gl.TEXTURE_2D, null); - } - - deleteTexture() { - if (this._texture) { - this._texWidth = this._texHeight = 1; - this._gl.deleteTexture(this._texture); - this._texture = null; - } - } - - render() { - Shader[Enums.Shader.BACKGROUND].getOrCreate(this._gl).draw(this); - } -} - -export default Background; diff --git a/src/drawables/Background.ts b/src/drawables/Background.ts new file mode 100644 index 00000000..0942beed --- /dev/null +++ b/src/drawables/Background.ts @@ -0,0 +1,189 @@ +import Buffer from '../render/Buffer'; +import Shader from '../render/ShaderLib'; +import Enums from '../misc/Enums'; + +/** + * Handles drawing a background for a 3D scene + */ +class Background { + + /** WebGL Context */ + #gl; + /** Owning scene */ + #main; + /** VertexBuffer */ + #vertexBuffer; + /** Texture coordinates buffer */ + #texCoordBuffer; + /** Should canvas be filled by background @type {boolean} */ + #fill; + /** One pixel texture used as background if no other is supplied */ + #monoTex; + /** Background texture ( if one is provided ) */ + #texture; + /** Height of the texture */ + #texWidth; + /** Width of the texture */ + #texHeight; + /** Texture type, 0: fixed grey, 1 env spec, 2 env ambient */ + #type; + /** Should the texture be blurred @type {boolean} */ + #blur; + + constructor(gl, main) { + this.#gl = gl; + this.#main = main; + this.#vertexBuffer = new Buffer(gl, gl.ARRAY_BUFFER, gl.STATIC_DRAW); + this.#texCoordBuffer = new Buffer(gl, gl.ARRAY_BUFFER, gl.STATIC_DRAW); + this.#fill = true; + this.#monoTex = null; + this.#texture = null; + this.#texWidth = 1; + this.#texHeight = 1; + this.#type = 0; + this.#blur = 0.0; + this.init(); + } + + init() { + this.#texCoordBuffer.update(new Float32Array([0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0])); + this.#monoTex = this.createOnePixelTexture(50, 50, 50, 255); + let element = document + .getElementById('backgroundopen'); + if (element !== null) { + element.addEventListener('change', this.loadBackground.bind(this), false); + } else { + console.error('Could not find DOM element with id of "background"') + } + } + + loadBackground(event) { + if (event.target.files.length === 0) + return; + + var file = event.target.files[0]; + if (!file.type.match('image.*')) + return; + + var self = this; + var reader = new FileReader(); + reader.onload = function (evt) { + var bg = new Image(); + if (evt.target !== null && typeof evt.target.result === "string") { + bg.src = evt.target.result; + } else { + console.error("Could not load image"); + } + bg.onload = function () { + + var canvas = self.#main.getCanvas(); + self.loadBackgroundTexture(bg); + self.onResize(canvas.width, canvas.height); + self.main.render(); + }; + }; + + let element = document.getElementById('backgroundopen') + if (element !== null) { + element.value = ''; + } + reader.readAsDataURL(file); + } + + get gl() { + return this.#gl; + } + + get main() { + return this.#main; + } + + get blur() { + return this.#blur; + } + + get vertexBuffer() { + return this.#vertexBuffer; + } + + get texCoordBuffer() { + return this.#texCoordBuffer; + } + + release() { + this.deleteTexture(); + this.#vertexBuffer().release(); + this.#texCoordBuffer().release(); + } + + get type() { + return this.#type; + } + + set type(val) { + this.#type = val; + } + + onResize(width, height) { + var ratio = (width / height) / (this.#texWidth / this.#texHeight); + var comp = this.#fill || this.#type !== 0 ? 1.0 / ratio : ratio; + var x = comp < 1.0 ? 1.0 : 1.0 / ratio; + var y = comp < 1.0 ? ratio : 1.0; + this.#vertexBuffer.update(new Float32Array([-x, -y, x, -y, -x, y, x, y])); + } + + getTexture() { + return this.#texture ? this.#texture : this.#monoTex; + } + + createOnePixelTexture(r, g, b, a) { + var gl = this.#gl; + var tex = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, tex); + gl.texImage2D( + gl.TEXTURE_2D, + 0, + gl.RGBA, + 1, + 1, + 0, + gl.RGBA, + gl.UNSIGNED_BYTE, + new Uint8Array([r, g, b, a]) + ); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); + gl.bindTexture(gl.TEXTURE_2D, null); + return tex; + } + + loadBackgroundTexture(tex) { + var gl = this.#gl; + this.deleteTexture(); + + this.#texWidth = tex.width; + this.#texHeight = tex.height; + this.#texture = gl.createTexture(); + + gl.bindTexture(gl.TEXTURE_2D, this.#texture); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, tex); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.bindTexture(gl.TEXTURE_2D, null); + } + + deleteTexture() { + if (this.#texture) { + this.#texWidth = this.#texHeight = 1; + this.#gl.deleteTexture(this.#texture); + this.#texture = null; + } + } + + render() { + Shader[Enums.Shader.BACKGROUND].getOrCreate(this.#gl).draw(this); + } +} + +export default Background; diff --git a/src/drawables/Primitives.js b/src/drawables/Primitives.ts similarity index 76% rename from src/drawables/Primitives.js rename to src/drawables/Primitives.ts index fa06cf98..ea5179f3 100644 --- a/src/drawables/Primitives.js +++ b/src/drawables/Primitives.ts @@ -2,9 +2,7 @@ import Utils from '../misc/Utils'; import MeshStatic from '../mesh/meshStatic/MeshStatic'; import Remesh from '../editing/Remesh'; -var Primitives = {}; - -var createPlaneArray = function ( +function createPlaneArray ( lx = -0.5, ly = 0.0, lz = -0.5, wx = 1.0, wy = 0.0, wz = 0.0, hx = 0.0, hy = 0.0, hz = 1.0 @@ -39,10 +37,13 @@ var createPlaneArray = function ( }; }; -var createCubeArray = function (side = 1.0) { +function createCubeArray (side = 1.0) { var v = new Float32Array(24); - v[1] = v[2] = v[4] = v[6] = v[7] = v[9] = v[10] = v[11] = v[14] = v[18] = v[21] = v[23] = -side * 0.5; - v[0] = v[3] = v[5] = v[8] = v[12] = v[13] = v[15] = v[16] = v[17] = v[19] = v[20] = v[22] = side * 0.5; + v[1] = v[2] = v[4] = v[6] = v[7] = v[9] = -side * 0.5; + v[10] = v[11] = v[14] = v[18] = v[21] = v[23] = -side * 0.5; + + v[0] = v[3] = v[5] = v[8] = v[12] = v[13] = side * 0.5; + v[15] = v[16] = v[17] = v[19] = v[20] = v[22] = side * 0.5; var uv = new Float32Array(28); uv[0] = uv[6] = uv[8] = uv[10] = uv[11] = uv[13] = uv[16] = uv[23] = uv[25] = 0.5; @@ -76,7 +77,7 @@ var createCubeArray = function (side = 1.0) { }; }; -var createCylinderArray = function ( +function createCylinderArray ( radiusTop = 0.5, radiusBottom = 0.5, height = 2.0, radSegments = 64, heightSegments = 64, topCap = true, lowCap = true ) { @@ -165,7 +166,12 @@ var createCylinderArray = function ( }; }; -var createTorusArray = function (radiusOut = 0.5, radiusWidth = 0.1, arc = Math.PI * 2, nbRadial = 32, nbTubular = 128) { +function createTorusArray ( + radiusOut = 0.5, + radiusWidth = 0.1, + arc = Math.PI * 2, + nbRadial = 32, + nbTubular = 128) { var isFull = Math.PI * 2 - arc < 1e-2; var nbVertices = nbRadial * nbTubular; @@ -173,7 +179,7 @@ var createTorusArray = function (radiusOut = 0.5, radiusWidth = 0.1, arc = Math. if (!isFull) { nbVertices += 2; nbFaces += nbRadial; - } + } var endTubular = isFull ? nbTubular : nbTubular - 1; var vAr = new Float32Array(nbVertices * 3); @@ -236,7 +242,7 @@ var createTorusArray = function (radiusOut = 0.5, radiusWidth = 0.1, arc = Math. }; }; -var createGridArray = function ( +function createGridArray( cx = -0.5, cy = 0.0, cz = -0.5, wx = 1.0, wy = 0.0, wz = 0.0, hx = 0.0, hy = 0.0, hz = 1.0, @@ -283,7 +289,8 @@ var createGridArray = function ( }; }; -var createMesh = function (gl, arr) { + +function createMesh (gl, arr) { var mesh = new MeshStatic(gl); mesh.setVertices(arr.vertices); if (arr.faces) mesh.setFaces(arr.faces); @@ -296,55 +303,75 @@ var createMesh = function (gl, arr) { var slice = Array.prototype.slice; -Primitives.createGrid = function (gl) { - var mesh = createMesh(gl, createGridArray.apply(this, slice.call(arguments, 1))); - if (gl) { - mesh.setMode(gl.LINES); - mesh.setUseDrawArrays(true); - mesh.setAlreadyDrawArrays(); - } - return mesh; -}; +class Primitives { -Primitives.createCube = function (gl) { - return createMesh(gl, createCubeArray.apply(this, slice.call(arguments, 1))); -}; + static createGrid (gl) { + var mesh = createMesh(gl, createGridArray.apply(this, slice.call(arguments, 1))); + if (gl) { + mesh.setMode(gl.LINES); + mesh.setUseDrawArrays(true); + mesh.setAlreadyDrawArrays(); + } + return mesh; + }; -Primitives.createCylinder = function (gl) { - return createMesh(gl, createCylinderArray.apply(this, slice.call(arguments, 1))); -}; + static createCube (gl) { + return createMesh(gl, createCubeArray.apply(this, slice.call(arguments, 1))); + }; -Primitives.createTorus = function (gl) { - return createMesh(gl, createTorusArray.apply(this, slice.call(arguments, 1))); -}; + static createCylinder (gl) { + return createMesh(gl, createCylinderArray.apply(this, slice.call(arguments, 1))); + }; -Primitives.createPlane = function (gl) { - return createMesh(gl, createPlaneArray.apply(this, slice.call(arguments, 1))); -}; + static createTorus (gl) { + return createMesh(gl, createTorusArray.apply(this, slice.call(arguments, 1))); + }; -Primitives.createArrow = function (gl, thick = 0.5, height = 2.0, rConeT = 5.0, rConeH = 0.2, radSegments = 4, heightSegments = 1) { - var base = createMesh(null, createCylinderArray(thick, thick, height, radSegments, heightSegments)); - var cone = createMesh(null, createCylinderArray(0.0, thick * rConeT, height * rConeH, radSegments, heightSegments)); - cone.getMatrix()[13] = height * 0.5; + static createPlane (gl) { + return createMesh(gl, createPlaneArray.apply(this, slice.call(arguments, 1))); + }; - var arrow = { - vertices: null, - faces: null + static createArrow ( + gl, + thick = 0.5, + height = 2.0, + rConeT = 5.0, + rConeH = 0.2, + radSegments = 4, + heightSegments = 1) { + + var base = createMesh( + null, + createCylinderArray(thick, thick, height, radSegments, heightSegments) + ); + + var cone = createMesh( + null, + createCylinderArray(0.0, thick * rConeT, height * rConeH, radSegments, heightSegments) + ); + + cone.getMatrix()[13] = height * 0.5; + + var arrow = { + vertices: null, + faces: null + }; + Remesh.mergeArrays([base, cone], arrow); + return createMesh(gl, arrow); }; - Remesh.mergeArrays([base, cone], arrow); - return createMesh(gl, arrow); -}; -Primitives.createLine2D = function (gl, lx = 0.0, ly = 0.0, ux = 0.0, uy = 0.0) { - var mesh = createMesh(gl, { - vertices: new Float32Array([lx, ly, 0.0, ux, uy, 0.0]) - }); - if (gl) { - mesh.setMode(gl.LINES); - mesh.setUseDrawArrays(true); - mesh.setAlreadyDrawArrays(); - } - return mesh; -}; + static createLine2D (gl, lx = 0.0, ly = 0.0, ux = 0.0, uy = 0.0) { + var mesh = createMesh(gl, { + vertices: new Float32Array([lx, ly, 0.0, ux, uy, 0.0]) + }); + if (gl) { + mesh.setMode(gl.LINES); + mesh.setUseDrawArrays(true); + mesh.setAlreadyDrawArrays(); + } + return mesh; + }; + +} -export default Primitives; +export default Primitives; \ No newline at end of file diff --git a/src/drawables/Rtt.js b/src/drawables/Rtt.js deleted file mode 100644 index 2b9915c8..00000000 --- a/src/drawables/Rtt.js +++ /dev/null @@ -1,111 +0,0 @@ -import Buffer from '../render/Buffer'; -import Shader from '../render/ShaderLib'; -import WebGLCaps from '../render/WebGLCaps'; - -var singletonBuffer; - -class Rtt { - - constructor(gl, shaderName = null, depth = gl.createRenderbuffer(), halfFloat = false) { - this._gl = gl; // webgl context - - this._texture = gl.createTexture(); - this._depth = depth; - this._framebuffer = gl.createFramebuffer(); - - this._shaderType = shaderName; - this._invSize = new Float32Array(2); - this._vertexBuffer = null; - - if (halfFloat && WebGLCaps.hasRTTHalfFloat()) this._type = WebGLCaps.HALF_FLOAT_OES; - else if (halfFloat && WebGLCaps.hasRTTFloat()) this._type = gl.FLOAT; - else this._type = gl.UNSIGNED_BYTE; - - this.setWrapRepeat(false); - this.setFilterNearest(false); - this.init(); - } - - getGL() { - return this._gl; - } - - getVertexBuffer() { - return this._vertexBuffer; - } - - getFramebuffer() { - return this._framebuffer; - } - - getTexture() { - return this._texture; - } - - getDepth() { - return this._depth; - } - - getInverseSize() { - return this._invSize; - } - - init() { - var gl = this._gl; - - if (!singletonBuffer) { - singletonBuffer = new Buffer(gl, gl.ARRAY_BUFFER, gl.STATIC_DRAW); - singletonBuffer.update(new Float32Array([-1.0, -1.0, 4.0, -1.0, -1.0, 4.0])); - } - - this._vertexBuffer = singletonBuffer; - } - - setWrapRepeat(bool) { - this._wrapRepeat = bool; - } - - setFilterNearest(bool) { - this._filterNearest = bool; - } - - onResize(width, height) { - var gl = this._gl; - - this._invSize[0] = 1.0 / width; - this._invSize[1] = 1.0 / height; - - gl.bindTexture(gl.TEXTURE_2D, this._texture); - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, this._type, null); - - var filter = this._filterNearest ? gl.NEAREST : gl.LINEAR; - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter); - - var wrap = this._wrapRepeat ? gl.REPEAT : gl.CLAMP_TO_EDGE; - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, wrap); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, wrap); - - if (this._depth) { - gl.bindRenderbuffer(gl.RENDERBUFFER, this._depth); - gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, width, height); - } - - gl.bindFramebuffer(gl.FRAMEBUFFER, this._framebuffer); - gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this._texture, 0); - gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, this._depth); - - gl.bindTexture(gl.TEXTURE_2D, null); - } - - release() { - if (this._texture) this._gl.deleteTexture(this._texture); - this.getVertexBuffer().release(); - } - - render(main) { - Shader[this._shaderType].getOrCreate(this._gl).draw(this, main); - } -} - -export default Rtt; diff --git a/src/drawables/Rtt.ts b/src/drawables/Rtt.ts new file mode 100644 index 00000000..0dd6f1b7 --- /dev/null +++ b/src/drawables/Rtt.ts @@ -0,0 +1,127 @@ +import Buffer from '../render/Buffer'; +import Shader from '../render/ShaderLib'; +import WebGLCaps from '../render/WebGLCaps'; + +var singletonBuffer; + +/** + * RenderToTexture target implementation. + */ +class Rtt { + + #gl; + #texture; + #depth; + #framebuffer; + #shaderType; + inverseSize; + #vertexBuffer; + #type; + #wrapRepeat; + #filterNearest; + + constructor(gl, shaderName = null, depth = gl.createRenderbuffer(), halfFloat = false) { + this.#gl = gl; // webgl context + + this.#texture = gl.createTexture(); + this.#depth = depth; + this.#framebuffer = gl.createFramebuffer(); + + this.#shaderType = shaderName; + this.inverseSize = new Float32Array(2); + this.#vertexBuffer = null; + + if (halfFloat && WebGLCaps.hasRTTHalfFloat()) this.#type = WebGLCaps.HALF_FLOAT_OES; + else if (halfFloat && WebGLCaps.hasRTTFloat()) this.#type = gl.FLOAT; + else this.#type = gl.UNSIGNED_BYTE; + + this.setWrapRepeat(false); + this.setFilterNearest(false); + this.init(); + } + + getGL() { + return this.#gl; + } + + getVertexBuffer() { + return this.#vertexBuffer; + } + + getFramebuffer() { + return this.#framebuffer; + } + + getTexture() { + return this.#texture; + } + + getDepth() { + return this.#depth; + } + + getInverseSize() { + return this.inverseSize; + } + + init() { + var gl = this.#gl; + + if (!singletonBuffer) { + singletonBuffer = new Buffer(gl, gl.ARRAY_BUFFER, gl.STATIC_DRAW); + singletonBuffer.update(new Float32Array([-1.0, -1.0, 4.0, -1.0, -1.0, 4.0])); + } + + this.#vertexBuffer = singletonBuffer; + } + + setWrapRepeat(bool) { + this.#wrapRepeat = bool; + } + + setFilterNearest(bool) { + this.#filterNearest = bool; + } + + onResize(width, height) { + var gl = this.#gl; + + this.inverseSize[0] = 1.0 / width; + this.inverseSize[1] = 1.0 / height; + + gl.bindTexture(gl.TEXTURE_2D, this.#texture); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, this.#type, null); + + var filter = this.#filterNearest ? gl.NEAREST : gl.LINEAR; + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter); + + var wrap = this.#wrapRepeat ? gl.REPEAT : gl.CLAMP_TO_EDGE; + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, wrap); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, wrap); + + if (this.#depth) { + gl.bindRenderbuffer(gl.RENDERBUFFER, this.#depth); + gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, width, height); + } + + gl.bindFramebuffer(gl.FRAMEBUFFER, this.#framebuffer); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this.#texture, 0); + gl.framebufferRenderbuffer( + gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, this.#depth + ); + + gl.bindTexture(gl.TEXTURE_2D, null); + } + + release() { + if (this.#texture) this.#gl.deleteTexture(this.#texture); + this.getVertexBuffer().release(); + } + + render(main) { + Shader[this.#shaderType].getOrCreate(this.#gl).draw(this, main); + } +} + +export default Rtt; diff --git a/src/drawables/Selection.js b/src/drawables/Selection.js deleted file mode 100644 index 8ae8ac4b..00000000 --- a/src/drawables/Selection.js +++ /dev/null @@ -1,178 +0,0 @@ -import { mat3, mat4, vec3 } from 'gl-matrix'; -import Buffer from '../render/Buffer'; -import ShaderLib from '../render/ShaderLib'; -import Enums from '../misc/Enums'; - -var _TMP_MATPV = mat4.create(); -var _TMP_MAT = mat4.create(); -var _TMP_VEC = [0.0, 0.0, 0.0]; -var _TMP_AXIS = [0.0, 0.0, 0.0]; -var _BASE = [0.0, 0.0, 1.0]; - -var DOT_RADIUS = 50.0; - -class Selection { - - constructor(gl) { - this._gl = gl; - - this._circleBuffer = new Buffer(gl, gl.ARRAY_BUFFER, gl.STATIC_DRAW); - this._dotBuffer = new Buffer(gl, gl.ARRAY_BUFFER, gl.STATIC_DRAW); - - this._cacheDotMVP = mat4.create(); - this._cacheDotSymMVP = mat4.create(); - this._cacheCircleMVP = mat4.create(); - this._color = new Float32Array([0.8, 0.0, 0.0]); - - this._offsetX = 0.0; // horizontal offset (when editing the radius) - this._isEditMode = false; - - this.init(); - } - - getGL() { - return this._gl; - } - - getCircleBuffer() { - return this._circleBuffer; - } - - getDotBuffer() { - return this._dotBuffer; - } - - getCircleMVP() { - return this._cacheCircleMVP; - } - - getDotMVP() { - return this._cacheDotMVP; - } - - getDotSymmetryMVP() { - return this._cacheDotSymMVP; - } - - getColor() { - return this._color; - } - - setIsEditMode(bool) { - this._isEditMode = bool; - } - - getIsEditMode() { - return this._isEditMode; - } - - setOffsetX(offset) { - this._offsetX = offset; - } - - getOffsetX() { - return this._offsetX; - } - - init() { - this.getCircleBuffer().update(this._getCircleVertices(1.0)); - this.getDotBuffer().update(this._getDotVertices(0.05, 10)); - } - - release() { - this.getCircleBuffer().release(); - this.getDotBuffer().release(); - } - - _getCircleVertices(radius = 1.0, nbVertices = 50, full = false) { - var arc = Math.PI * 2; - - var start = full ? 1 : 0; - var end = full ? nbVertices + 2 : nbVertices; - var vertices = new Float32Array(end * 3); - for (var i = start; i < end; ++i) { - var j = i * 3; - var segment = (arc * i) / nbVertices; - vertices[j] = Math.cos(segment) * radius; - vertices[j + 1] = Math.sin(segment) * radius; - } - return vertices; - } - - _getDotVertices(r, nb) { - return this._getCircleVertices(r, nb, true); - } - - _updateMatricesBackground(camera, main) { - - var screenRadius = main.getSculptManager().getCurrentTool().getScreenRadius(); - - var w = camera._width * 0.5; - var h = camera._height * 0.5; - // no need to recompute the ortho proj each time though - mat4.ortho(_TMP_MATPV, -w, w, -h, h, -10.0, 10.0); - - mat4.identity(_TMP_MAT); - mat4.translate(_TMP_MAT, _TMP_MAT, vec3.set(_TMP_VEC, -w + main._mouseX + this._offsetX, h - main._mouseY, 0.0)); - // circle mvp - mat4.scale(this._cacheCircleMVP, _TMP_MAT, vec3.set(_TMP_VEC, screenRadius, screenRadius, screenRadius)); - mat4.mul(this._cacheCircleMVP, _TMP_MATPV, this._cacheCircleMVP); - // dot mvp - mat4.scale(this._cacheDotMVP, _TMP_MAT, vec3.set(_TMP_VEC, DOT_RADIUS, DOT_RADIUS, DOT_RADIUS)); - mat4.mul(this._cacheDotMVP, _TMP_MATPV, this._cacheDotMVP); - // symmetry mvp - mat4.scale(this._cacheDotSymMVP, this._cacheDotSymMVP, [0.0, 0.0, 0.0]); - } - - _updateMatricesMesh(camera, main) { - var picking = main.getPicking(); - var pickingSym = main.getPickingSymmetry(); - var worldRadius = Math.sqrt(picking.computeWorldRadius2(true)); - var screenRadius = main.getSculptManager().getCurrentTool().getScreenRadius(); - - var mesh = picking.getMesh(); - var constRadius = DOT_RADIUS * (worldRadius / screenRadius); - - picking.polyLerp(mesh.getNormals(), _TMP_AXIS); - vec3.transformMat3(_TMP_AXIS, _TMP_AXIS, mat3.normalFromMat4(_TMP_MAT, mesh.getMatrix())); - vec3.normalize(_TMP_AXIS, _TMP_AXIS); - var rad = Math.acos(vec3.dot(_BASE, _TMP_AXIS)); - vec3.cross(_TMP_AXIS, _BASE, _TMP_AXIS); - - mat4.identity(_TMP_MAT); - mat4.translate(_TMP_MAT, _TMP_MAT, vec3.transformMat4(_TMP_VEC, picking.getIntersectionPoint(), mesh.getMatrix())); - mat4.rotate(_TMP_MAT, _TMP_MAT, rad, _TMP_AXIS); - - mat4.mul(_TMP_MATPV, camera.getProjection(), camera.getView()); - - // circle mvp - mat4.scale(this._cacheCircleMVP, _TMP_MAT, vec3.set(_TMP_VEC, worldRadius, worldRadius, worldRadius)); - mat4.mul(this._cacheCircleMVP, _TMP_MATPV, this._cacheCircleMVP); - // dot mvp - mat4.scale(this._cacheDotMVP, _TMP_MAT, vec3.set(_TMP_VEC, constRadius, constRadius, constRadius)); - mat4.mul(this._cacheDotMVP, _TMP_MATPV, this._cacheDotMVP); - // symmetry mvp - vec3.transformMat4(_TMP_VEC, pickingSym.getIntersectionPoint(), mesh.getMatrix()); - mat4.identity(_TMP_MAT); - mat4.translate(_TMP_MAT, _TMP_MAT, _TMP_VEC); - mat4.rotate(_TMP_MAT, _TMP_MAT, rad, _TMP_AXIS); - - mat4.scale(_TMP_MAT, _TMP_MAT, vec3.set(_TMP_VEC, constRadius, constRadius, constRadius)); - mat4.mul(this._cacheDotSymMVP, _TMP_MATPV, _TMP_MAT); - } - - render(main) { - // if there's an offset then it means we are editing the tool radius - var pickedMesh = main.getPicking().getMesh() && !this._isEditMode; - if (pickedMesh) this._updateMatricesMesh(main.getCamera(), main); - else this._updateMatricesBackground(main.getCamera(), main); - - var drawCircle = main._action === Enums.Action.NOTHING; - vec3.set(this._color, 0.8, drawCircle && pickedMesh ? 0.0 : 0.4, 0.0); - ShaderLib[Enums.Shader.SELECTION].getOrCreate(this._gl).draw(this, drawCircle, main.getSculptManager().getSymmetry()); - - this._isEditMode = false; - } -} - -export default Selection; diff --git a/src/drawables/Selection.ts b/src/drawables/Selection.ts new file mode 100644 index 00000000..1137d0e4 --- /dev/null +++ b/src/drawables/Selection.ts @@ -0,0 +1,223 @@ +import { mat3, mat4, vec3 } from 'gl-matrix'; +import Buffer from '../render/Buffer'; +import ShaderLib from '../render/ShaderLib'; +import Enums from '../misc/Enums'; + + + +/** Handles rendering the selection tool */ +class Selection { + + #gl; + + #circleBuffer; + #dotBuffer; + + #cacheDotMVP = mat4.create(); + #cacheDotSymMVP = mat4.create(); + #cacheCircleMVP = mat4.create(); + #color = new Float32Array([0.8, 0.0, 0.0]); + + // TODO: These are scratch variables and the names should be fixed up + #tmp_matpv = mat4.create(); + #tmp_mat = mat4.create(); + #tmp_mat3 = mat3.create(); + #tmp_vec = new Float32Array([0.0, 0.0, 0.0]); + #tmp_axis = new Float32Array([0.0, 0.0, 0.0]); + #base = new Float32Array([0.0, 0.0, 1.0]); + + #dot_radius = 50.0; + + /** horizontal offset (when editing the radius) */ + #offsetX = 0.0; + #isEditMode = false; + + constructor(gl) { + this.#gl = gl; + + this.#circleBuffer = new Buffer(gl, gl.ARRAY_BUFFER, gl.STATIC_DRAW); + this.#dotBuffer = new Buffer(gl, gl.ARRAY_BUFFER, gl.STATIC_DRAW); + + this.init(); + } + + getGL() { + return this.#gl; + } + + getCircleBuffer() { + return this.#circleBuffer; + } + + getDotBuffer() { + return this.#dotBuffer; + } + + getCircleMVP() { + return this.#cacheCircleMVP; + } + + getDotMVP() { + return this.#cacheDotMVP; + } + + getDotSymmetryMVP() { + return this.#cacheDotSymMVP; + } + + getColor() { + return this.#color; + } + + setIsEditMode(bool) { + this.#isEditMode = bool; + } + + getIsEditMode() { + return this.#isEditMode; + } + + setOffsetX(offset) { + this.#offsetX = offset; + } + + getOffsetX() { + return this.#offsetX; + } + + init() { + this.getCircleBuffer().update(this.#getCircleVertices(1.0)); + this.getDotBuffer().update(this.#getDotVertices(0.05, 10)); + } + + release() { + this.getCircleBuffer().release(); + this.getDotBuffer().release(); + } + + #getCircleVertices(radius = 1.0, nbVertices = 50, full = false) { + var arc = Math.PI * 2; + + var start = full ? 1 : 0; + var end = full ? nbVertices + 2 : nbVertices; + var vertices = new Float32Array(end * 3); + for (var i = start; i < end; ++i) { + var j = i * 3; + var segment = (arc * i) / nbVertices; + vertices[j] = Math.cos(segment) * radius; + vertices[j + 1] = Math.sin(segment) * radius; + } + return vertices; + } + + #getDotVertices(r, nb) { + return this.#getCircleVertices(r, nb, true); + } + + #updateMatricesBackground(camera, main) { + + var screenRadius = main.getSculptManager().getCurrentTool().getScreenRadius(); + + var w = camera._width * 0.5; + var h = camera._height * 0.5; + // no need to recompute the ortho proj each time though + mat4.ortho(this.#tmp_matpv, -w, w, -h, h, -10.0, 10.0); + + mat4.identity(this.#tmp_mat); + mat4.translate( + this.#tmp_mat, + this.#tmp_mat, + vec3.set(this.#tmp_vec, -w + main._mouseX + this.#offsetX, h - main._mouseY, 0.0) + ); + // circle mvp + mat4.scale( + this.#cacheCircleMVP, + this.#tmp_mat, + vec3.set(this.#tmp_vec, screenRadius, screenRadius, screenRadius) + ); + mat4.mul(this.#cacheCircleMVP, this.#tmp_matpv, this.#cacheCircleMVP); + // dot mvp + mat4.scale( + this.#cacheDotMVP, + this.#tmp_mat, + vec3.set(this.#tmp_vec, this.#dot_radius, this.#dot_radius, this.#dot_radius) + ); + mat4.mul(this.#cacheDotMVP, this.#tmp_matpv, this.#cacheDotMVP); + // symmetry mvp + mat4.scale(this.#cacheDotSymMVP, this.#cacheDotSymMVP, [0.0, 0.0, 0.0]); + } + + #updateMatricesMesh(camera, main) { + var picking = main.getPicking(); + var pickingSym = main.getPickingSymmetry(); + var worldRadius = Math.sqrt(picking.computeWorldRadius2(true)); + var screenRadius = main.getSculptManager().getCurrentTool().getScreenRadius(); + + var mesh = picking.getMesh(); + var constRadius = this.#dot_radius * (worldRadius / screenRadius); + + picking.polyLerp(mesh.getNormals(), this.#tmp_axis); + vec3.transformMat3( + this.#tmp_axis, + this.#tmp_axis, + mat3.normalFromMat4(this.#tmp_mat3, mesh.getMatrix()) + ); + vec3.normalize(this.#tmp_axis, this.#tmp_axis); + var rad = Math.acos(vec3.dot(this.#base, this.#tmp_axis)); + vec3.cross(this.#tmp_axis, this.#base, this.#tmp_axis); + + mat4.identity(this.#tmp_mat); + mat4.translate( + this.#tmp_mat, + this.#tmp_mat, + vec3.transformMat4(this.#tmp_vec, picking.getIntersectionPoint(), mesh.getMatrix()) + ); + mat4.rotate(this.#tmp_mat, this.#tmp_mat, rad, this.#tmp_axis); + + mat4.mul(this.#tmp_matpv, camera.getProjection(), camera.getView()); + + // circle mvp + mat4.scale( + this.#cacheCircleMVP, + this.#tmp_mat, + vec3.set(this.#tmp_vec, worldRadius, worldRadius, worldRadius) + ); + mat4.mul(this.#cacheCircleMVP, this.#tmp_matpv, this.#cacheCircleMVP); + // dot mvp + mat4.scale( + this.#cacheDotMVP, + this.#tmp_mat, + vec3.set(this.#tmp_vec, constRadius, constRadius, constRadius) + ); + mat4.mul(this.#cacheDotMVP, this.#tmp_matpv, this.#cacheDotMVP); + // symmetry mvp + vec3.transformMat4(this.#tmp_vec, pickingSym.getIntersectionPoint(), mesh.getMatrix()); + mat4.identity(this.#tmp_mat); + mat4.translate(this.#tmp_mat, this.#tmp_mat, this.#tmp_vec); + mat4.rotate(this.#tmp_mat, this.#tmp_mat, rad, this.#tmp_axis); + + mat4.scale( + this.#tmp_mat, + this.#tmp_mat, + vec3.set(this.#tmp_vec, constRadius, constRadius, constRadius) + ); + mat4.mul(this.#cacheDotSymMVP, this.#tmp_matpv, this.#tmp_mat); + } + + render(main) { + // if there's an offset then it means we are editing the tool radius + var pickedMesh = main.getPicking().getMesh() && !this.#isEditMode; + if (pickedMesh) this.#updateMatricesMesh(main.getCamera(), main); + else this.#updateMatricesBackground(main.getCamera(), main); + + var drawCircle = main._action === Enums.Action.NOTHING; + vec3.set(this.#color, 0.8, drawCircle && pickedMesh ? 0.0 : 0.4, 0.0); + ShaderLib[Enums.Shader.SELECTION] + .getOrCreate(this.#gl) + .draw(this, drawCircle, main.getSculptManager().getSymmetry()); + + this.#isEditMode = false; + } +} + +export default Selection; diff --git a/src/gui/GuiBackground.js b/src/gui/GuiBackground.js index c8d00242..964e48ae 100644 --- a/src/gui/GuiBackground.js +++ b/src/gui/GuiBackground.js @@ -16,13 +16,24 @@ class GuiBackground { var types = ['Image', 'Environment', 'Ambient env']; menu.addCombobox('Type', this._bg._type, this.onBackgroundType.bind(this), types); - this._ctrlBlur = menu.addSlider('Blur', this._bg._blur, this.onEnvBlur.bind(this), 0.0, 1.0, 0.01); + this._ctrlBlur = menu.addSlider( + 'Blur', + this._bg._blur, + this.onEnvBlur.bind(this), + 0.0, + 1.0, + 0.01 + ); this._ctrlBlur.setVisibility(this._bg._type === 1); menu.addTitle('Image'); menu.addButton(TR('backgroundReset'), this, 'resetBackground'); menu.addButton(TR('backgroundImport'), this, 'importBackground'); - menu.addCheckbox(TR('backgroundFill'), this._main.getBackground()._fill, this.updateFill.bind(this)); + menu.addCheckbox( + TR('backgroundFill'), + this._main.getBackground()._fill, + this.updateFill.bind(this) + ); } updateFill(val) { diff --git a/src/render/shaders/ShaderBackground.js b/src/render/shaders/ShaderBackground.js index 56b1170a..066fb201 100644 --- a/src/render/shaders/ShaderBackground.js +++ b/src/render/shaders/ShaderBackground.js @@ -11,7 +11,13 @@ ShaderBackground.vertexName = ShaderBackground.fragmentName = 'Background'; ShaderBackground.uniforms = {}; ShaderBackground.attributes = {}; -ShaderBackground.uniformNames = ['uTexture0', 'uBackgroundType', 'uIblTransform', 'uSPH', 'uBlur', 'uEnvSize']; +ShaderBackground.uniformNames = [ + 'uTexture0', + 'uBackgroundType', + 'uIblTransform', + 'uSPH', + 'uBlur', + 'uEnvSize']; ShaderBackground.vertex = [ 'attribute vec2 aVertex;', @@ -31,7 +37,7 @@ ShaderBackground.fragment = [ ].join('\n'); ShaderBackground.draw = function (bg) { - var gl = bg.getGL(); + var gl = bg.gl; gl.useProgram(this.program); this.bindAttributes(bg); this.updateUniforms(bg); @@ -45,21 +51,21 @@ ShaderBackground.initAttributes = function (gl) { }; ShaderBackground.bindAttributes = function (bg) { var attrs = ShaderBackground.attributes; - attrs.aVertex.bindToBuffer(bg.getVertexBuffer()); - attrs.aTexCoord.bindToBuffer(bg.getTexCoordBuffer()); + attrs.aVertex.bindToBuffer(bg.vertexBuffer); + attrs.aTexCoord.bindToBuffer(bg.texCoordBuffer); }; var uIBLTmp = mat3.create(); ShaderBackground.updateUniforms = function (bg) { var uniforms = this.uniforms; - var main = bg._main; + var main = bg.main; var env = ShaderPBR.environments[ShaderPBR.idEnv]; - var gl = bg.getGL(); - gl.uniform1i(uniforms.uBackgroundType, bg.getType()); + var gl = bg.gl; + gl.uniform1i(uniforms.uBackgroundType, bg.type); var tex; - if (bg.getType() === 0) tex = bg.getTexture(); + if (bg.type === 0) tex = bg.getTexture(); else tex = ShaderPBR.getOrCreateEnvironment(gl, main, env) || bg.getTexture(); gl.activeTexture(gl.TEXTURE0); gl.bindTexture(gl.TEXTURE_2D, tex); @@ -71,7 +77,7 @@ ShaderBackground.updateUniforms = function (bg) { gl.uniform3fv(uniforms.uSPH, env.sph); if (env.size) gl.uniform2fv(uniforms.uEnvSize, env.size); - gl.uniform1f(uniforms.uBlur, bg.getBlur()); + gl.uniform1f(uniforms.uBlur, bg.blur); }; export default ShaderBackground; diff --git a/src/worker/deflate.js b/src/worker/deflate.js index 4318138f..2e4c8551 100644 --- a/src/worker/deflate.js +++ b/src/worker/deflate.js @@ -33,8 +33,11 @@ * and contributors of zlib. */ +// Lots of large tables in here, turning off +/* eslint @stylistic/max-len: "off" */ + (function(global) { - "use strict"; + 'use strict'; // Global @@ -91,19 +94,19 @@ // see definition of array dist_code below var _dist_code = [ 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17, 18, 18, 19, 19, - 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, - 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 29, - 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 ]; + 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17, 18, 18, 19, 19, + 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 29, + 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, + 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 ]; function Tree() { var that = this; @@ -200,7 +203,7 @@ // method would use a table) // IN assertion: 1 <= len <= 15 function bi_reverse(code, // the value to invert - len // its bit length + len // its bit length ) { var res = 0; do { @@ -218,8 +221,8 @@ // OUT assertion: the field code is set for all tree elements of non // zero code length. function gen_codes(tree, // the tree to decorate - max_code, // largest code with non zero frequency - bl_count // number of codes at each bit length + max_code, // largest code with non zero frequency + bl_count // number of codes at each bit length ) { var next_code = []; // next code value for each // bit length @@ -337,17 +340,17 @@ } Tree._length_code = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, - 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 ]; + 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 ]; Tree.base_length = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 0 ]; Tree.base_dist = [ 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, - 24576 ]; + 24576 ]; // Mapping from a distance to a distance code. dist is the distance - 1 and // must not have side effects. _dist_code[256] and _dist_code[257] are never @@ -379,24 +382,24 @@ } StaticTree.static_ltree = [ 12, 8, 140, 8, 76, 8, 204, 8, 44, 8, 172, 8, 108, 8, 236, 8, 28, 8, 156, 8, 92, 8, 220, 8, 60, 8, 188, 8, 124, 8, 252, 8, 2, 8, - 130, 8, 66, 8, 194, 8, 34, 8, 162, 8, 98, 8, 226, 8, 18, 8, 146, 8, 82, 8, 210, 8, 50, 8, 178, 8, 114, 8, 242, 8, 10, 8, 138, 8, 74, 8, 202, 8, 42, - 8, 170, 8, 106, 8, 234, 8, 26, 8, 154, 8, 90, 8, 218, 8, 58, 8, 186, 8, 122, 8, 250, 8, 6, 8, 134, 8, 70, 8, 198, 8, 38, 8, 166, 8, 102, 8, 230, 8, - 22, 8, 150, 8, 86, 8, 214, 8, 54, 8, 182, 8, 118, 8, 246, 8, 14, 8, 142, 8, 78, 8, 206, 8, 46, 8, 174, 8, 110, 8, 238, 8, 30, 8, 158, 8, 94, 8, - 222, 8, 62, 8, 190, 8, 126, 8, 254, 8, 1, 8, 129, 8, 65, 8, 193, 8, 33, 8, 161, 8, 97, 8, 225, 8, 17, 8, 145, 8, 81, 8, 209, 8, 49, 8, 177, 8, 113, - 8, 241, 8, 9, 8, 137, 8, 73, 8, 201, 8, 41, 8, 169, 8, 105, 8, 233, 8, 25, 8, 153, 8, 89, 8, 217, 8, 57, 8, 185, 8, 121, 8, 249, 8, 5, 8, 133, 8, - 69, 8, 197, 8, 37, 8, 165, 8, 101, 8, 229, 8, 21, 8, 149, 8, 85, 8, 213, 8, 53, 8, 181, 8, 117, 8, 245, 8, 13, 8, 141, 8, 77, 8, 205, 8, 45, 8, - 173, 8, 109, 8, 237, 8, 29, 8, 157, 8, 93, 8, 221, 8, 61, 8, 189, 8, 125, 8, 253, 8, 19, 9, 275, 9, 147, 9, 403, 9, 83, 9, 339, 9, 211, 9, 467, 9, - 51, 9, 307, 9, 179, 9, 435, 9, 115, 9, 371, 9, 243, 9, 499, 9, 11, 9, 267, 9, 139, 9, 395, 9, 75, 9, 331, 9, 203, 9, 459, 9, 43, 9, 299, 9, 171, 9, - 427, 9, 107, 9, 363, 9, 235, 9, 491, 9, 27, 9, 283, 9, 155, 9, 411, 9, 91, 9, 347, 9, 219, 9, 475, 9, 59, 9, 315, 9, 187, 9, 443, 9, 123, 9, 379, - 9, 251, 9, 507, 9, 7, 9, 263, 9, 135, 9, 391, 9, 71, 9, 327, 9, 199, 9, 455, 9, 39, 9, 295, 9, 167, 9, 423, 9, 103, 9, 359, 9, 231, 9, 487, 9, 23, - 9, 279, 9, 151, 9, 407, 9, 87, 9, 343, 9, 215, 9, 471, 9, 55, 9, 311, 9, 183, 9, 439, 9, 119, 9, 375, 9, 247, 9, 503, 9, 15, 9, 271, 9, 143, 9, - 399, 9, 79, 9, 335, 9, 207, 9, 463, 9, 47, 9, 303, 9, 175, 9, 431, 9, 111, 9, 367, 9, 239, 9, 495, 9, 31, 9, 287, 9, 159, 9, 415, 9, 95, 9, 351, 9, - 223, 9, 479, 9, 63, 9, 319, 9, 191, 9, 447, 9, 127, 9, 383, 9, 255, 9, 511, 9, 0, 7, 64, 7, 32, 7, 96, 7, 16, 7, 80, 7, 48, 7, 112, 7, 8, 7, 72, 7, - 40, 7, 104, 7, 24, 7, 88, 7, 56, 7, 120, 7, 4, 7, 68, 7, 36, 7, 100, 7, 20, 7, 84, 7, 52, 7, 116, 7, 3, 8, 131, 8, 67, 8, 195, 8, 35, 8, 163, 8, - 99, 8, 227, 8 ]; + 130, 8, 66, 8, 194, 8, 34, 8, 162, 8, 98, 8, 226, 8, 18, 8, 146, 8, 82, 8, 210, 8, 50, 8, 178, 8, 114, 8, 242, 8, 10, 8, 138, 8, 74, 8, 202, 8, 42, + 8, 170, 8, 106, 8, 234, 8, 26, 8, 154, 8, 90, 8, 218, 8, 58, 8, 186, 8, 122, 8, 250, 8, 6, 8, 134, 8, 70, 8, 198, 8, 38, 8, 166, 8, 102, 8, 230, 8, + 22, 8, 150, 8, 86, 8, 214, 8, 54, 8, 182, 8, 118, 8, 246, 8, 14, 8, 142, 8, 78, 8, 206, 8, 46, 8, 174, 8, 110, 8, 238, 8, 30, 8, 158, 8, 94, 8, + 222, 8, 62, 8, 190, 8, 126, 8, 254, 8, 1, 8, 129, 8, 65, 8, 193, 8, 33, 8, 161, 8, 97, 8, 225, 8, 17, 8, 145, 8, 81, 8, 209, 8, 49, 8, 177, 8, 113, + 8, 241, 8, 9, 8, 137, 8, 73, 8, 201, 8, 41, 8, 169, 8, 105, 8, 233, 8, 25, 8, 153, 8, 89, 8, 217, 8, 57, 8, 185, 8, 121, 8, 249, 8, 5, 8, 133, 8, + 69, 8, 197, 8, 37, 8, 165, 8, 101, 8, 229, 8, 21, 8, 149, 8, 85, 8, 213, 8, 53, 8, 181, 8, 117, 8, 245, 8, 13, 8, 141, 8, 77, 8, 205, 8, 45, 8, + 173, 8, 109, 8, 237, 8, 29, 8, 157, 8, 93, 8, 221, 8, 61, 8, 189, 8, 125, 8, 253, 8, 19, 9, 275, 9, 147, 9, 403, 9, 83, 9, 339, 9, 211, 9, 467, 9, + 51, 9, 307, 9, 179, 9, 435, 9, 115, 9, 371, 9, 243, 9, 499, 9, 11, 9, 267, 9, 139, 9, 395, 9, 75, 9, 331, 9, 203, 9, 459, 9, 43, 9, 299, 9, 171, 9, + 427, 9, 107, 9, 363, 9, 235, 9, 491, 9, 27, 9, 283, 9, 155, 9, 411, 9, 91, 9, 347, 9, 219, 9, 475, 9, 59, 9, 315, 9, 187, 9, 443, 9, 123, 9, 379, + 9, 251, 9, 507, 9, 7, 9, 263, 9, 135, 9, 391, 9, 71, 9, 327, 9, 199, 9, 455, 9, 39, 9, 295, 9, 167, 9, 423, 9, 103, 9, 359, 9, 231, 9, 487, 9, 23, + 9, 279, 9, 151, 9, 407, 9, 87, 9, 343, 9, 215, 9, 471, 9, 55, 9, 311, 9, 183, 9, 439, 9, 119, 9, 375, 9, 247, 9, 503, 9, 15, 9, 271, 9, 143, 9, + 399, 9, 79, 9, 335, 9, 207, 9, 463, 9, 47, 9, 303, 9, 175, 9, 431, 9, 111, 9, 367, 9, 239, 9, 495, 9, 31, 9, 287, 9, 159, 9, 415, 9, 95, 9, 351, 9, + 223, 9, 479, 9, 63, 9, 319, 9, 191, 9, 447, 9, 127, 9, 383, 9, 255, 9, 511, 9, 0, 7, 64, 7, 32, 7, 96, 7, 16, 7, 80, 7, 48, 7, 112, 7, 8, 7, 72, 7, + 40, 7, 104, 7, 24, 7, 88, 7, 56, 7, 120, 7, 4, 7, 68, 7, 36, 7, 100, 7, 20, 7, 84, 7, 52, 7, 116, 7, 3, 8, 131, 8, 67, 8, 195, 8, 35, 8, 163, 8, + 99, 8, 227, 8 ]; StaticTree.static_dtree = [ 0, 5, 16, 5, 8, 5, 24, 5, 4, 5, 20, 5, 12, 5, 28, 5, 2, 5, 18, 5, 10, 5, 26, 5, 6, 5, 22, 5, 14, 5, 30, 5, 1, 5, 17, 5, 9, 5, - 25, 5, 5, 5, 21, 5, 13, 5, 29, 5, 3, 5, 19, 5, 11, 5, 27, 5, 7, 5, 23, 5 ]; + 25, 5, 5, 5, 21, 5, 13, 5, 29, 5, 3, 5, 19, 5, 11, 5, 27, 5, 7, 5, 23, 5 ]; StaticTree.static_l_desc = new StaticTree(StaticTree.static_ltree, Tree.extra_lbits, LITERALS + 1, L_CODES, MAX_BITS); @@ -422,20 +425,20 @@ var FAST = 1; var SLOW = 2; var config_table = [ new Config(0, 0, 0, 0, STORED), new Config(4, 4, 8, 4, FAST), new Config(4, 5, 16, 8, FAST), new Config(4, 6, 32, 32, FAST), - new Config(4, 4, 16, 16, SLOW), new Config(8, 16, 32, 32, SLOW), new Config(8, 16, 128, 128, SLOW), new Config(8, 32, 128, 256, SLOW), - new Config(32, 128, 258, 1024, SLOW), new Config(32, 258, 258, 4096, SLOW) ]; + new Config(4, 4, 16, 16, SLOW), new Config(8, 16, 32, 32, SLOW), new Config(8, 16, 128, 128, SLOW), new Config(8, 32, 128, 256, SLOW), + new Config(32, 128, 258, 1024, SLOW), new Config(32, 258, 258, 4096, SLOW) ]; - var z_errmsg = [ "need dictionary", // Z_NEED_DICT + var z_errmsg = [ 'need dictionary', // Z_NEED_DICT // 2 - "stream end", // Z_STREAM_END 1 - "", // Z_OK 0 - "", // Z_ERRNO (-1) - "stream error", // Z_STREAM_ERROR (-2) - "data error", // Z_DATA_ERROR (-3) - "", // Z_MEM_ERROR (-4) - "buffer error", // Z_BUF_ERROR (-5) - "",// Z_VERSION_ERROR (-6) - "" ]; + 'stream end', // Z_STREAM_END 1 + '', // Z_OK 0 + '', // Z_ERRNO (-1) + 'stream error', // Z_STREAM_ERROR (-2) + 'data error', // Z_DATA_ERROR (-3) + '', // Z_MEM_ERROR (-4) + 'buffer error', // Z_BUF_ERROR (-5) + '',// Z_VERSION_ERROR (-6) + '' ]; // block not completed, need more input or more output var NeedMore = 0; @@ -690,7 +693,7 @@ // when the heap property is re-established (each father smaller than its // two sons). that.pqdownheap = function(tree, // the tree to restore - k // node to move down + k // node to move down ) { var heap = that.heap; var v = heap[k]; @@ -716,7 +719,7 @@ // Scan a literal or distance tree to determine the frequencies of the codes // in the bit length tree. function scan_tree(tree,// the tree to be scanned - max_code // and its largest code of non zero frequency + max_code // and its largest code of non zero frequency ) { var n; // iterates over all tree elements var prevlen = -1; // last emitted length @@ -831,7 +834,7 @@ // Send a literal or distance tree in compressed form, using the codes in // bl_tree. function send_tree(tree,// the tree to be sent - max_code // and its largest code of non zero frequency + max_code // and its largest code of non zero frequency ) { var n; // iterates over all tree elements var prevlen = -1; // last emitted length @@ -943,7 +946,7 @@ // Save the match info and tally the frequency counts. Return true if // the current block must be flushed. function _tr_tally(dist, // distance of matched string - lc // match length-MIN_MATCH or unmatched char (if dist==0) + lc // match length-MIN_MATCH or unmatched char (if dist==0) ) { var out_length, in_length, dcode; that.pending_buf[d_buf + last_lit * 2] = (dist >>> 8) & 0xff; @@ -1042,8 +1045,8 @@ // Copy a stored block, storing first the length and its // one's complement if requested. function copy_block(buf, // the input data - len, // its length - header // true if block header must be written + len, // its length + header // true if block header must be written ) { bi_windup(); // align on byte boundary last_eob_len = 8; // enough lookahead for inflate @@ -1059,8 +1062,8 @@ // Send a stored block function _tr_stored_block(buf, // input block - stored_len, // length of input block - eof // true if this is the last block for a file + stored_len, // length of input block + eof // true if this is the last block for a file ) { send_bits((STORED_BLOCK << 1) + (eof ? 1 : 0), 3); // send block type copy_block(buf, stored_len, true); // with header @@ -1069,8 +1072,8 @@ // Determine the best encoding for the current block: dynamic trees, static // trees or store, and output the encoded block to the zip file. function _tr_flush_block(buf, // input block, or NULL if too old - stored_len, // length of input block - eof // true if this is the last block for a file + stored_len, // length of input block + eof // true if this is the last block for a file ) { var opt_lenb, static_lenb;// opt_len and static_len in bytes var max_blindex = 0; // index of last bit length code of non zero freq @@ -1822,16 +1825,16 @@ if (strm.avail_in !== 0 || lookahead !== 0 || (flush != Z_NO_FLUSH && status != FINISH_STATE)) { bstate = -1; switch (config_table[level].func) { - case STORED: - bstate = deflate_stored(flush); - break; - case FAST: - bstate = deflate_fast(flush); - break; - case SLOW: - bstate = deflate_slow(flush); - break; - default: + case STORED: + bstate = deflate_stored(flush); + break; + case FAST: + bstate = deflate_fast(flush); + break; + case SLOW: + bstate = deflate_slow(flush); + break; + default: } if (bstate == FinishStarted || bstate == FinishDone) { @@ -1996,7 +1999,7 @@ var flush = Z_NO_FLUSH; var buf = new Uint8Array(bufsize); var level = options ? options.level : Z_DEFAULT_COMPRESSION; - if (typeof level == "undefined") + if (typeof level == 'undefined') level = Z_DEFAULT_COMPRESSION; z.deflateInit(level); z.next_out = buf; @@ -2013,7 +2016,7 @@ z.avail_out = bufsize; err = z.deflate(flush); if (err != Z_OK) - throw new Error("deflating: " + z.msg); + throw new Error('deflating: ' + z.msg); if (z.next_out_index) if (z.next_out_index == bufsize) buffers.push(new Uint8Array(buf)); @@ -2039,7 +2042,7 @@ z.avail_out = bufsize; err = z.deflate(Z_FINISH); if (err != Z_STREAM_END && err != Z_OK) - throw new Error("deflating: " + z.msg); + throw new Error('deflating: ' + z.msg); if (bufsize - z.avail_out > 0) buffers.push(new Uint8Array(buf.subarray(0, z.next_out_index))); bufferSize += z.next_out_index; diff --git a/src/worker/z-worker.js b/src/worker/z-worker.js index a42c86b7..a5385226 100644 --- a/src/worker/z-worker.js +++ b/src/worker/z-worker.js @@ -1,12 +1,12 @@ /* jshint worker:true */ (function main(global) { - "use strict"; + 'use strict'; if (global.zWorkerInitialized) throw new Error('z-worker.js should be run only once'); global.zWorkerInitialized = true; - addEventListener("message", function(event) { + addEventListener('message', function(event) { var message = event.data, type = message.type, sn = message.sn; var handler = handlers[type]; if (handler) { diff --git a/yarn.lock b/yarn.lock index 9adb92b1..bd9e1f3a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -36,7 +36,7 @@ dependencies: commander "^2.15.1" -"@eslint-community/eslint-utils@^4.2.0": +"@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0": version "4.4.0" resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== @@ -176,12 +176,12 @@ "@nodelib/fs.stat" "2.0.5" run-parallel "^1.1.9" -"@nodelib/fs.stat@2.0.5": +"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": version "2.0.5" resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== -"@nodelib/fs.walk@^1.2.8": +"@nodelib/fs.walk@^1.2.3", "@nodelib/fs.walk@^1.2.8": version "1.2.8" resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== @@ -869,6 +869,50 @@ "@parcel/utils" "2.11.0" nullthrows "^1.1.1" +"@stylistic/eslint-plugin-js@1.6.0", "@stylistic/eslint-plugin-js@^1.6.0": + version "1.6.0" + resolved "https://registry.yarnpkg.com/@stylistic/eslint-plugin-js/-/eslint-plugin-js-1.6.0.tgz#c17a7e4b28bd6d8ba21ea240344eaa677e91ece2" + integrity sha512-qlBAu08fy4d5BEF+c31E5y0OvEOVZo3SfOOs2Qrb4/CwAaXrAch++axBWedzgR3n0XqkuXjr6dbexqrdOm92ag== + dependencies: + acorn "^8.11.3" + escape-string-regexp "^4.0.0" + eslint-visitor-keys "^3.4.3" + espree "^10.0.0" + +"@stylistic/eslint-plugin-jsx@1.6.0": + version "1.6.0" + resolved "https://registry.yarnpkg.com/@stylistic/eslint-plugin-jsx/-/eslint-plugin-jsx-1.6.0.tgz#4aad037bb680cad44b60c135f198494a7ced5651" + integrity sha512-MlRpiuNpanQrszotBlar77GDf71HjemJNNQBvLnsk/MHxo6fxbIcAyLSNSVQJhP14ah6PvpPFcExRK4Hj7MGeg== + dependencies: + "@stylistic/eslint-plugin-js" "^1.6.0" + estraverse "^5.3.0" + picomatch "^3.0.1" + +"@stylistic/eslint-plugin-plus@1.6.0": + version "1.6.0" + resolved "https://registry.yarnpkg.com/@stylistic/eslint-plugin-plus/-/eslint-plugin-plus-1.6.0.tgz#a9fc6296c8c758ead8292547a06ad9249567fa6c" + integrity sha512-XfLBBkKIERzMYGEX1A5RCe/gVe9pTdGuHC2xDzlEIs2npudMHxm304K7l2CqlAWGyJ/yP6wwrsSEHozQUIo/Og== + dependencies: + "@typescript-eslint/utils" "^6.20.0" + +"@stylistic/eslint-plugin-ts@1.6.0": + version "1.6.0" + resolved "https://registry.yarnpkg.com/@stylistic/eslint-plugin-ts/-/eslint-plugin-ts-1.6.0.tgz#c2d9a2e135bf0908315fd0ea441b2ee866ce05c9" + integrity sha512-qM9Vw8TfZeGmN8oreWwUIdEdCs/py9/X88O4ksJv0V/kDmaupVKL8Uu06IlphN2crN6SPU8ljv9rcGXZoxwvmA== + dependencies: + "@stylistic/eslint-plugin-js" "1.6.0" + "@typescript-eslint/utils" "^6.20.0" + +"@stylistic/eslint-plugin@^1.6.0": + version "1.6.0" + resolved "https://registry.yarnpkg.com/@stylistic/eslint-plugin/-/eslint-plugin-1.6.0.tgz#47c20059bb378f48d0bb603c17b4cdb9fe243ae7" + integrity sha512-Bdz9mFIvOkpM03QLoTSg7rTTYj+u3kokWIQ+nI5UFE+FkRQSVgvL41cwkdCebud/L4dMcItuBPA25h6XOuHFPA== + dependencies: + "@stylistic/eslint-plugin-js" "1.6.0" + "@stylistic/eslint-plugin-jsx" "1.6.0" + "@stylistic/eslint-plugin-plus" "1.6.0" + "@stylistic/eslint-plugin-ts" "1.6.0" + "@swc/core-darwin-arm64@1.4.0": version "1.4.0" resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.4.0.tgz#11abf23b884929a467ba270cf6789b9c50c4248b" @@ -960,11 +1004,69 @@ resolved "https://registry.yarnpkg.com/@trysound/sax/-/sax-0.2.0.tgz#cccaab758af56761eb7bf37af6f03f326dd798ad" integrity sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA== +"@types/json-schema@^7.0.12": + version "7.0.15" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" + integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== + "@types/json-schema@^7.0.6": version "7.0.7" resolved "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.7.tgz" integrity sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA== +"@types/semver@^7.5.0": + version "7.5.6" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.6.tgz#c65b2bfce1bec346582c07724e3f8c1017a20339" + integrity sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A== + +"@typescript-eslint/scope-manager@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz#ea8a9bfc8f1504a6ac5d59a6df308d3a0630a2b1" + integrity sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg== + dependencies: + "@typescript-eslint/types" "6.21.0" + "@typescript-eslint/visitor-keys" "6.21.0" + +"@typescript-eslint/types@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.21.0.tgz#205724c5123a8fef7ecd195075fa6e85bac3436d" + integrity sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg== + +"@typescript-eslint/typescript-estree@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz#c47ae7901db3b8bddc3ecd73daff2d0895688c46" + integrity sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ== + dependencies: + "@typescript-eslint/types" "6.21.0" + "@typescript-eslint/visitor-keys" "6.21.0" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + minimatch "9.0.3" + semver "^7.5.4" + ts-api-utils "^1.0.1" + +"@typescript-eslint/utils@^6.20.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.21.0.tgz#4714e7a6b39e773c1c8e97ec587f520840cd8134" + integrity sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ== + dependencies: + "@eslint-community/eslint-utils" "^4.4.0" + "@types/json-schema" "^7.0.12" + "@types/semver" "^7.5.0" + "@typescript-eslint/scope-manager" "6.21.0" + "@typescript-eslint/types" "6.21.0" + "@typescript-eslint/typescript-estree" "6.21.0" + semver "^7.5.4" + +"@typescript-eslint/visitor-keys@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz#87a99d077aa507e20e238b11d56cc26ade45fe47" + integrity sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A== + dependencies: + "@typescript-eslint/types" "6.21.0" + eslint-visitor-keys "^3.4.1" + "@ungap/structured-clone@^1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.0.tgz#756641adb587851b5ccb3e095daf27ae581c8406" @@ -980,7 +1082,7 @@ acorn-jsx@^5.3.2: resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== -acorn@^8.9.0: +acorn@^8.11.3, acorn@^8.9.0: version "8.11.3" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.3.tgz#71e0b14e13a4ec160724b38fb7b0f233b1b81d7a" integrity sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg== @@ -1024,6 +1126,11 @@ argparse@^2.0.1: resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== +array-union@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" + integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== + async@^2.6.4: version "2.6.4" resolved "https://registry.npmjs.org/async/-/async-2.6.4.tgz" @@ -1068,6 +1175,13 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" +brace-expansion@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" + integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== + dependencies: + balanced-match "^1.0.0" + braces@^3.0.2: version "3.0.2" resolved "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz" @@ -1243,7 +1357,7 @@ debug@^3.2.7: dependencies: ms "^2.1.1" -debug@^4.3.1, debug@^4.3.2: +debug@^4.3.1, debug@^4.3.2, debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== @@ -1265,6 +1379,13 @@ detect-libc@^2.0.1: resolved "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz" integrity sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw== +dir-glob@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" + integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== + dependencies: + path-type "^4.0.0" + doctrine@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" @@ -1416,6 +1537,15 @@ eslint@^8.56.0: strip-ansi "^6.0.1" text-table "^0.2.0" +espree@^10.0.0: + version "10.0.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-10.0.0.tgz#ce1411bb31a514797dbd29ee360e4f3404643096" + integrity sha512-gdlKrfXQWv/3vubKqeQIiBUoWeknNQVEDpKD7OD3bC53g5EKISTuhcIoA1H1e+zqIuosdKrKuTDMmj8eFfhOnA== + dependencies: + acorn "^8.11.3" + acorn-jsx "^5.3.2" + eslint-visitor-keys "^3.4.1" + espree@^9.6.0, espree@^9.6.1: version "9.6.1" resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f" @@ -1439,7 +1569,7 @@ esrecurse@^4.3.0: dependencies: estraverse "^5.2.0" -estraverse@^5.1.0, estraverse@^5.2.0: +estraverse@^5.1.0, estraverse@^5.2.0, estraverse@^5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== @@ -1464,6 +1594,17 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== +fast-glob@^3.2.9: + version "3.3.2" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" + integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow== + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.2" + merge2 "^1.3.0" + micromatch "^4.0.4" + fast-json-stable-stringify@^2.0.0: version "2.1.0" resolved "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz" @@ -1556,6 +1697,13 @@ gl-matrix@^3.1.0: resolved "https://registry.npmjs.org/gl-matrix/-/gl-matrix-3.3.0.tgz" integrity sha512-COb7LDz+SXaHtl/h4LeaFcNdJdAQSDeVqjiIihSXNrkWObZLhDI4hIkZC11Aeqp7bcE72clzB0BnDXr2SmslRA== +glob-parent@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" + integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== + dependencies: + is-glob "^4.0.1" + glob-parent@^6.0.2: version "6.0.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" @@ -1582,6 +1730,18 @@ globals@^13.19.0, globals@^13.2.0: dependencies: type-fest "^0.20.2" +globby@^11.1.0: + version "11.1.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" + integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== + dependencies: + array-union "^2.1.0" + dir-glob "^3.0.1" + fast-glob "^3.2.9" + ignore "^5.2.0" + merge2 "^1.4.1" + slash "^3.0.0" + glsl-inject-defines@^1.0.1: version "1.0.3" resolved "https://registry.npmjs.org/glsl-inject-defines/-/glsl-inject-defines-1.0.3.tgz" @@ -1844,7 +2004,7 @@ is-fullwidth-code-point@^3.0.0: resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== -is-glob@^4.0.0, is-glob@^4.0.3: +is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3: version "4.0.3" resolved "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz" integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== @@ -2058,7 +2218,12 @@ mdn-data@2.0.14: resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.0.14.tgz#7113fc4281917d63ce29b43446f701e68c25ba50" integrity sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow== -micromatch@^4.0.5: +merge2@^1.3.0, merge2@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" + integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== + +micromatch@^4.0.4, micromatch@^4.0.5: version "4.0.5" resolved "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz" integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== @@ -2071,6 +2236,13 @@ mime@^1.6.0: resolved "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz" integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== +minimatch@9.0.3: + version "9.0.3" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825" + integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg== + dependencies: + brace-expansion "^2.0.1" + minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" @@ -2292,6 +2464,11 @@ picomatch@^2.3.1: resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== +picomatch@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-3.0.1.tgz#817033161def55ec9638567a2f3bbc876b3e7516" + integrity sha512-I3EurrIQMlRc9IaAZnqRR044Phh2DXY+55o7uJ0V+hYZAcQYSuFWsc9q5PvyDHUSCe1Qxn/iBz+78s86zWnGag== + portfinder@^1.0.28: version "1.0.32" resolved "https://registry.npmjs.org/portfinder/-/portfinder-1.0.32.tgz" @@ -2468,6 +2645,13 @@ semver@^7.5.2: dependencies: lru-cache "^6.0.0" +semver@^7.5.4: + version "7.6.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.0.tgz#1a46a4db4bffcccd97b743b5005c8325f23d4e2d" + integrity sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg== + dependencies: + lru-cache "^6.0.0" + shallow-copy@0.0.1: version "0.0.1" resolved "https://registry.npmjs.org/shallow-copy/-/shallow-copy-0.0.1.tgz" @@ -2494,6 +2678,11 @@ side-channel@^1.0.4: get-intrinsic "^1.0.2" object-inspect "^1.9.0" +slash@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" + integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== + source-map@^0.6.1: version "0.6.1" resolved "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz" @@ -2592,6 +2781,11 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" +ts-api-utils@^1.0.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.2.1.tgz#f716c7e027494629485b21c0df6180f4d08f5e8b" + integrity sha512-RIYA36cJn2WiH9Hy77hdF9r7oEwxAtB/TS9/S4Qd90Ap4z5FSiin5zEiTL44OII1Y3IIlEvxwxFUVgrHSZ/UpA== + tslib@^2.4.0: version "2.6.2" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae"