From 2d9b09088e44d7d5db476a9b0b406bd2d478e435 Mon Sep 17 00:00:00 2001 From: Deveshi Dwivedi Date: Fri, 19 Jan 2024 01:52:45 +0530 Subject: [PATCH 01/24] separate model and view matrices --- package-lock.json | 666 +++++++++++++++++++++++++--- package.json | 1 + src/webgl/3d_primitives.js | 24 +- src/webgl/GeometryBuilder.js | 4 +- src/webgl/interaction.js | 4 +- src/webgl/p5.Camera.js | 15 +- src/webgl/p5.Framebuffer.js | 7 +- src/webgl/p5.RendererGL.Retained.js | 5 +- src/webgl/p5.RendererGL.js | 23 +- src/webgl/p5.Shader.js | 9 +- 10 files changed, 660 insertions(+), 98 deletions(-) diff --git a/package-lock.json b/package-lock.json index a3c4bccc55..d1671f9cc4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -47,6 +47,7 @@ "lint-staged": "^4.3.0", "marked": "^4.0.10", "mocha": "^10.2.0", + "mocha-chrome": "^2.2.0", "np": "^8.0.4", "omggif": "^1.0.10", "open": "^7.0.3", @@ -2692,6 +2693,15 @@ "node": ">=0.10.0" } }, + "node_modules/array-find-index": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha512-M1HQyIXcBGtVywBt8WVdim+lrNaK7VHp99Qt5pSNziXznKHViIBbXWtfRTpEFpF/c4FdfxNAsCCwPp5phBYJtw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", @@ -4013,6 +4023,94 @@ "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", "dev": true }, + "node_modules/chrome-launcher": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/chrome-launcher/-/chrome-launcher-0.11.2.tgz", + "integrity": "sha512-jx0kJDCXdB2ARcDMwNCtrf04oY1Up4rOmVu+fqJ5MTPOOIG8EhRcEU9NZfXZc6dMw9FU8o1r21PNp8V2M0zQ+g==", + "dev": true, + "dependencies": { + "@types/node": "*", + "is-wsl": "^2.1.0", + "lighthouse-logger": "^1.0.0", + "mkdirp": "0.5.1", + "rimraf": "^2.6.1" + } + }, + "node_modules/chrome-launcher/node_modules/is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "dev": true, + "dependencies": { + "is-docker": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chrome-launcher/node_modules/minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha512-miQKw5Hv4NS1Psg2517mV4e4dYNaO3++hjAvLOAzKqZ61rH8NS1SK+vbfBWZ5PY/Me/bEWhUwqMghEW5Fb9T7Q==", + "dev": true + }, + "node_modules/chrome-launcher/node_modules/mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha512-SknJC52obPfGQPnjIkXbmA6+5H15E+fR+E4iR2oQ3zzCLbd7/ONua69R/Gw7AgkTLsRG+r5fzksYwWe1AgTyWA==", + "deprecated": "Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)", + "dev": true, + "dependencies": { + "minimist": "0.0.8" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/chrome-remote-interface": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/chrome-remote-interface/-/chrome-remote-interface-0.28.2.tgz", + "integrity": "sha512-F7mjof7rWvRNsJqhVXuiFU/HWySCxTA9tzpLxUJxVfdLkljwFJ1aMp08AnwXRmmP7r12/doTDOMwaNhFCJsacw==", + "dev": true, + "dependencies": { + "commander": "2.11.x", + "ws": "^7.2.0" + }, + "bin": { + "chrome-remote-interface": "bin/client.js" + } + }, + "node_modules/chrome-remote-interface/node_modules/ws": { + "version": "7.5.9", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", + "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", + "dev": true, + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/chrome-unmirror": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/chrome-unmirror/-/chrome-unmirror-0.1.0.tgz", + "integrity": "sha512-HmQgCN2UTpcrP85oOGnKpkGJFyOUwjsjnPBZlE8MkG0i+NoynGIkuPDZFKh+K4NLQlPiKKde16FAQ98JC1j8ew==", + "dev": true, + "engines": { + "node": ">=0.10.0", + "npm": ">=2.0.0" + } + }, "node_modules/ci-info": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", @@ -4282,16 +4380,10 @@ } }, "node_modules/commander": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", - "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", - "dev": true, - "dependencies": { - "graceful-readlink": ">= 1.0.0" - }, - "engines": { - "node": ">= 0.6.x" - } + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", + "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", + "dev": true }, "node_modules/commander-version": { "version": "1.1.0", @@ -4750,6 +4842,18 @@ "node": ">= 0.4" } }, + "node_modules/currently-unhandled": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", + "integrity": "sha512-/fITjgjGU50vjQ4FH6eUoYu+iUoUKIXws2hL15JJpIR+BbTxaXQsMuuyjtNh2WqsSBS5nsaZHFsFecyw5CCAng==", + "dev": true, + "dependencies": { + "array-find-index": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/d": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", @@ -4867,6 +4971,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/deep-assign": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/deep-assign/-/deep-assign-3.0.0.tgz", + "integrity": "sha512-YX2i9XjJ7h5q/aQ/IM9PEwEnDqETAIYbggmdDB3HLTlSgo1CxPsj6pvhPG68rq6SVE0+p+6Ywsm5fTYNrYtBWw==", + "deprecated": "Check out `lodash.merge` or `merge-options` instead.", + "dev": true, + "dependencies": { + "is-obj": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/deep-eql": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz", @@ -4949,15 +5066,6 @@ "node": ">=4" } }, - "node_modules/default-require-extensions/node_modules/strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/defaults": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", @@ -7212,12 +7320,6 @@ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, - "node_modules/graceful-readlink": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", - "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=", - "dev": true - }, "node_modules/grapheme-splitter": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", @@ -10006,6 +10108,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/lighthouse-logger": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/lighthouse-logger/-/lighthouse-logger-1.4.2.tgz", + "integrity": "sha512-gPWxznF6TKmUHrOQjlVo2UbaL2EJ71mb2CCeRs/2qBpi4L/g4LUVc9+3lKQ6DTUZwJswfM7ainGrLO1+fOqa2g==", + "dev": true, + "dependencies": { + "debug": "^2.6.9", + "marky": "^1.2.2" + } + }, "node_modules/lines-and-columns": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", @@ -10346,6 +10458,43 @@ "integrity": "sha512-j1R0/FeGa64Y+NmqfZhyoVRzcFlOZ8sNlKzHjh4VvLULFACZhn68XrX5DFg2FhMvSMJmROuFxRSa560ECWKBMg==", "dev": true }, + "node_modules/load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/load-json-file/node_modules/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", + "dev": true, + "dependencies": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/load-json-file/node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/locate-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", @@ -10478,6 +10627,19 @@ "node": ">=0.10.0" } }, + "node_modules/loglevel": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.8.1.tgz", + "integrity": "sha512-tCRIJM51SHjAayKwC+QAg8hT8vg6z7GSgLJKGvzuPb1Wc+hLzqtuVLxp6/HzSPOozuK+8ErAhy7U/sVzw8Dgfg==", + "dev": true, + "engines": { + "node": ">= 0.6.0" + }, + "funding": { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/loglevel" + } + }, "node_modules/loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", @@ -10490,6 +10652,19 @@ "loose-envify": "cli.js" } }, + "node_modules/loud-rejection": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", + "integrity": "sha512-RPNliZOFkqFumDhvYqOaNY4Uz9oJM2K9tC6JWsJJsNdhuONW4LQHRBpb0qf4pJApVffI5N39SwzWZJuEhfd7eQ==", + "dev": true, + "dependencies": { + "currently-unhandled": "^0.4.1", + "signal-exit": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/lowercase-keys": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", @@ -10570,6 +10745,12 @@ "node": ">= 12" } }, + "node_modules/marky": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/marky/-/marky-1.2.5.tgz", + "integrity": "sha512-q9JtQJKjpsVxCRVgQ+WapguSbKC3SQ5HEzFGPAJMStgh3QjCawp00UKv3MTTAArTmGmmPUvllHZoNbZ3gs0I+Q==", + "dev": true + }, "node_modules/maxmin": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/maxmin/-/maxmin-2.1.0.tgz", @@ -11025,6 +11206,344 @@ "url": "https://opencollective.com/mochajs" } }, + "node_modules/mocha-chrome": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/mocha-chrome/-/mocha-chrome-2.2.0.tgz", + "integrity": "sha512-RXP6Q2mlM2X+eO2Z8gribmiH4J9x5zu/JcTZ3deQSwiC5260BzizOc0eD1NWP3JuypGCKRwReicv4KCNIFtTZQ==", + "dev": true, + "dependencies": { + "chalk": "^2.0.1", + "chrome-launcher": "^0.11.2", + "chrome-remote-interface": "^0.28.0", + "chrome-unmirror": "^0.1.0", + "debug": "^4.1.1", + "deep-assign": "^3.0.0", + "import-local": "^2.0.0", + "loglevel": "^1.4.1", + "meow": "^5.0.0", + "nanobus": "^4.2.0" + }, + "bin": { + "mocha-chrome": "cli.js" + }, + "engines": { + "node": ">= 8.0.0" + } + }, + "node_modules/mocha-chrome/node_modules/camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha512-FxAv7HpHrXbh3aPo4o2qxHay2lkLY3x5Mw3KeE4KQE8ysVfziWeRZDwcjauvwBSGEC/nXUPzZy8zeh4HokqOnw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/mocha-chrome/node_modules/camelcase-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-4.2.0.tgz", + "integrity": "sha512-Ej37YKYbFUI8QiYlvj9YHb6/Z60dZyPJW0Cs8sFilMbd2lP0bw3ylAq9yJkK4lcTA2dID5fG8LjmJYbO7kWb7Q==", + "dev": true, + "dependencies": { + "camelcase": "^4.1.0", + "map-obj": "^2.0.0", + "quick-lru": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mocha-chrome/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/mocha-chrome/node_modules/decamelize-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.1.tgz", + "integrity": "sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==", + "dev": true, + "dependencies": { + "decamelize": "^1.1.0", + "map-obj": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mocha-chrome/node_modules/decamelize-keys/node_modules/map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/mocha-chrome/node_modules/find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==", + "dev": true, + "dependencies": { + "locate-path": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mocha-chrome/node_modules/import-local": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-2.0.0.tgz", + "integrity": "sha512-b6s04m3O+s3CGSbqDIyP4R6aAwAeYlVq9+WUWep6iHa8ETRf9yei1U48C5MmfJmV9AiLYYBKPMq/W+/WRpQmCQ==", + "dev": true, + "dependencies": { + "pkg-dir": "^3.0.0", + "resolve-cwd": "^2.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/mocha-chrome/node_modules/indent-string": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", + "integrity": "sha512-BYqTHXTGUIvg7t1r4sJNKcbDZkL92nkXA8YtRpbjFHRHGDL/NtUeiBJMeE60kIFN/Mg8ESaWQvftaYMGJzQZCQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/mocha-chrome/node_modules/locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==", + "dev": true, + "dependencies": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mocha-chrome/node_modules/map-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-2.0.0.tgz", + "integrity": "sha512-TzQSV2DiMYgoF5RycneKVUzIa9bQsj/B3tTgsE3dOGqlzHnGIDaC7XBE7grnA+8kZPnfqSGFe95VHc2oc0VFUQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/mocha-chrome/node_modules/meow": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-5.0.0.tgz", + "integrity": "sha512-CbTqYU17ABaLefO8vCU153ZZlprKYWDljcndKKDCFcYQITzWCXZAVk4QMFZPgvzrnUQ3uItnIE/LoUOwrT15Ig==", + "dev": true, + "dependencies": { + "camelcase-keys": "^4.0.0", + "decamelize-keys": "^1.0.0", + "loud-rejection": "^1.0.0", + "minimist-options": "^3.0.1", + "normalize-package-data": "^2.3.4", + "read-pkg-up": "^3.0.0", + "redent": "^2.0.0", + "trim-newlines": "^2.0.0", + "yargs-parser": "^10.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/mocha-chrome/node_modules/minimist-options": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-3.0.2.tgz", + "integrity": "sha512-FyBrT/d0d4+uiZRbqznPXqw3IpZZG3gl3wKWiX784FycUKVwBt0uLBFkQrtE4tZOrgo78nZp2jnKz3L65T5LdQ==", + "dev": true, + "dependencies": { + "arrify": "^1.0.1", + "is-plain-obj": "^1.1.0" + }, + "engines": { + "node": ">= 4" + } + }, + "node_modules/mocha-chrome/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/mocha-chrome/node_modules/p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "dependencies": { + "p-try": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mocha-chrome/node_modules/p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==", + "dev": true, + "dependencies": { + "p-limit": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mocha-chrome/node_modules/p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/mocha-chrome/node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/mocha-chrome/node_modules/path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "dependencies": { + "pify": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mocha-chrome/node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/mocha-chrome/node_modules/quick-lru": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-1.1.0.tgz", + "integrity": "sha512-tRS7sTgyxMXtLum8L65daJnHUhfDUgboRdcWW2bR9vBfrj2+O5HSMbQOJfJJjIVSPFqbBCF37FpwWXGitDc5tA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/mocha-chrome/node_modules/read-pkg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha512-BLq/cCO9two+lBgiTYNqD6GdtK8s4NpaWrl6/rCO9w0TUS8oJl7cmToOZfRYllKTISY6nt1U7jQ53brmKqY6BA==", + "dev": true, + "dependencies": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mocha-chrome/node_modules/read-pkg-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-3.0.0.tgz", + "integrity": "sha512-YFzFrVvpC6frF1sz8psoHDBGF7fLPc+llq/8NB43oagqWkx8ar5zYtsTORtOjw9W2RHLpWP+zTWwBvf1bCmcSw==", + "dev": true, + "dependencies": { + "find-up": "^2.0.0", + "read-pkg": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mocha-chrome/node_modules/redent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-2.0.0.tgz", + "integrity": "sha512-XNwrTx77JQCEMXTeb8movBKuK75MgH0RZkujNuDKCezemx/voapl9i2gCSi8WWm8+ox5ycJi1gxF22fR7c0Ciw==", + "dev": true, + "dependencies": { + "indent-string": "^3.0.0", + "strip-indent": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mocha-chrome/node_modules/resolve-cwd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz", + "integrity": "sha512-ccu8zQTrzVr954472aUVPLEcB3YpKSYR3cg/3lo1okzobPBM+1INXBbBZlDbnI/hbEocnf8j0QVo43hQKrbchg==", + "dev": true, + "dependencies": { + "resolve-from": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mocha-chrome/node_modules/strip-indent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-2.0.0.tgz", + "integrity": "sha512-RsSNPLpq6YUL7QYy44RnPVTn/lcVZtb48Uof3X5JLbF4zD/Gs7ZFDv2HWol+leoQN2mT86LAzSshGfkTlSOpsA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/mocha-chrome/node_modules/trim-newlines": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-2.0.0.tgz", + "integrity": "sha512-MTBWv3jhVjTU7XR3IQHllbiJs8sc75a80OEhB6or/q7pLTWgQ0bMGQXXYQSrSuXe6WiKWDZ5txXY5P59a/coVA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/mocha-chrome/node_modules/yargs-parser": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz", + "integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==", + "dev": true, + "dependencies": { + "camelcase": "^4.1.0" + } + }, "node_modules/mocha/node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -11485,6 +12004,23 @@ "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dev": true }, + "node_modules/nanoassert": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/nanoassert/-/nanoassert-1.1.0.tgz", + "integrity": "sha512-C40jQ3NzfkP53NsO8kEOFd79p4b9kDXQMwgiY1z8ZwrDZgUyom0AHwGegF4Dm99L+YoYhuaB0ceerUcXmqr1rQ==", + "dev": true + }, + "node_modules/nanobus": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/nanobus/-/nanobus-4.5.0.tgz", + "integrity": "sha512-7sBZo9wthqNJ7QXnfVXZL7fkKJLN55GLOdX+RyZT34UOvxxnFtJe/c7K0ZRLAKOvaY1xJThFFn0Usw2H9R6Frg==", + "dev": true, + "dependencies": { + "nanoassert": "^1.1.0", + "nanotiming": "^7.2.0", + "remove-array-items": "^1.0.0" + } + }, "node_modules/nanoid": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", @@ -11497,6 +12033,25 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, + "node_modules/nanoscheduler": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/nanoscheduler/-/nanoscheduler-1.0.3.tgz", + "integrity": "sha512-jBbrF3qdU9321r8n9X7yu18DjP31Do2ItJm3mWrt90wJTrnDO+HXpoV7ftaUglAtjgj9s+OaCxGufbvx6pvbEQ==", + "dev": true, + "dependencies": { + "nanoassert": "^1.1.0" + } + }, + "node_modules/nanotiming": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/nanotiming/-/nanotiming-7.3.1.tgz", + "integrity": "sha512-l3lC7v/PfOuRWQa8vV29Jo6TG10wHtnthLElFXs4Te4Aas57Fo4n1Q8LH9n+NDh9riOzTVvb2QNBhTS4JUKNjw==", + "dev": true, + "dependencies": { + "nanoassert": "^1.1.0", + "nanoscheduler": "^1.0.2" + } + }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -15145,6 +15700,12 @@ "node": ">=4" } }, + "node_modules/remove-array-items": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/remove-array-items/-/remove-array-items-1.1.1.tgz", + "integrity": "sha512-MXW/jtHyl5F1PZI7NbpS8SOtympdLuF20aoWJT5lELR1p/HJDd5nqW8Eu9uLh/hCRY3FgvrIT5AwDCgBODklcA==", + "dev": true + }, "node_modules/repeating": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", @@ -15237,6 +15798,15 @@ "node": ">=0.10.0" } }, + "node_modules/resolve-from": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", + "integrity": "sha512-GnlH6vxLymXJNMBo7XP1fJIzBFbdYt49CuTwmB/6N53t+kMPRMFKz783LlQ4tv28XoQfMWinAJX6WCGf2IlaIw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/responselike": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.1.tgz", @@ -16216,6 +16786,15 @@ "node": ">=0.10.0" } }, + "node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/strip-eof": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", @@ -16487,34 +17066,6 @@ "node": ">=6" } }, - "node_modules/test-exclude/node_modules/load-json-file": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", - "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", - "dev": true, - "dependencies": { - "graceful-fs": "^4.1.2", - "parse-json": "^4.0.0", - "pify": "^3.0.0", - "strip-bom": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/test-exclude/node_modules/parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", - "dev": true, - "dependencies": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/test-exclude/node_modules/path-type": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", @@ -16563,15 +17114,6 @@ "node": ">=6" } }, - "node_modules/test-exclude/node_modules/strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", diff --git a/package.json b/package.json index dd19d7972e..a7dcc02e2a 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,7 @@ "lint-staged": "^4.3.0", "marked": "^4.0.10", "mocha": "^10.2.0", + "mocha-chrome": "^2.2.0", "np": "^8.0.4", "omggif": "^1.0.10", "open": "^7.0.3", diff --git a/src/webgl/3d_primitives.js b/src/webgl/3d_primitives.js index f5bd16fd17..71013efa73 100644 --- a/src/webgl/3d_primitives.js +++ b/src/webgl/3d_primitives.js @@ -1246,7 +1246,7 @@ p5.RendererGL.prototype.triangle = function(args) { // this matrix multiplication transforms those two unit vectors // onto the required vector prior to rendering, and moves the // origin appropriately. - const uMVMatrix = this.uMVMatrix.copy(); + const uModelMatrix = this._renderer.uModelMatrix.copy(); try { // triangle orientation. const orientation = Math.sign(x1*y2-x2*y1 + x2*y3-x3*y2 + x3*y1-x1*y3); @@ -1255,13 +1255,13 @@ p5.RendererGL.prototype.triangle = function(args) { x3 - x1, y3 - y1, 0, 0, // the resulting unit Y-axis 0, 0, orientation, 0, // the resulting unit Z-axis (Reflect the specified order of vertices) x1, y1, 0, 1 // the resulting origin - ]).mult(this.uMVMatrix); + ]).mult(this._renderer.uModelMatrix); - this.uMVMatrix = mult; + this._renderer.uModelMatrix = mult; this.drawBuffers(gId); } finally { - this.uMVMatrix = uMVMatrix; + this._renderer.uModelMatrix = uModelMatrix; } return this; @@ -1383,15 +1383,15 @@ p5.RendererGL.prototype.arc = function(args) { this.createBuffers(gId, arcGeom); } - const uMVMatrix = this.uMVMatrix.copy(); + const uModelMatrix = this._renderer.uModelMatrix.copy(); try { - this.uMVMatrix.translate([x, y, 0]); - this.uMVMatrix.scale(width, height, 1); + this._renderer.uModelMatrix.translate([x, y, 0]); + this._renderer.uModelMatrix.scale(width, height, 1); this.drawBuffers(gId); } finally { - this.uMVMatrix = uMVMatrix; + this._renderer.uModelMatrix = uModelMatrix; } return this; @@ -1443,14 +1443,14 @@ p5.RendererGL.prototype.rect = function(args) { // opposite corners at (0,0) & (1,1). // // before rendering, this square is scaled & moved to the required location. - const uMVMatrix = this.uMVMatrix.copy(); + const uModelMatrix = this._renderer.uModelMatrix.copy(); try { - this.uMVMatrix.translate([x, y, 0]); - this.uMVMatrix.scale(width, height, 1); + this._renderer.uModelMatrix.translate([x, y, 0]); + this._renderer.uModelMatrix.scale(width, height, 1); this.drawBuffers(gId); } finally { - this.uMVMatrix = uMVMatrix; + this._renderer.uModelMatrix = uModelMatrix; } } else { // Use Immediate mode to round the rectangle corner, diff --git a/src/webgl/GeometryBuilder.js b/src/webgl/GeometryBuilder.js index 502f4b2bee..6b7c96047c 100644 --- a/src/webgl/GeometryBuilder.js +++ b/src/webgl/GeometryBuilder.js @@ -11,7 +11,7 @@ class GeometryBuilder { this.renderer = renderer; renderer._pInst.push(); this.identityMatrix = new p5.Matrix(); - renderer.uMVMatrix = new p5.Matrix(); + renderer.uModelMatrix = new p5.Matrix(); this.geometry = new p5.Geometry(); this.geometry.gid = `_p5_GeometryBuilder_${GeometryBuilder.nextGeometryId}`; GeometryBuilder.nextGeometryId++; @@ -25,7 +25,7 @@ class GeometryBuilder { transformVertices(vertices) { if (!this.hasTransform) return vertices; - return vertices.map(v => this.renderer.uMVMatrix.multiplyPoint(v)); + return vertices.map(v => this.renderer.uModelMatrix.multiplyPoint(v)); } /** diff --git a/src/webgl/interaction.js b/src/webgl/interaction.js index bc1df2badc..fc52063842 100644 --- a/src/webgl/interaction.js +++ b/src/webgl/interaction.js @@ -686,7 +686,7 @@ p5.prototype._grid = function(size, numDivs, xOff, yOff, zOff) { this._renderer.curStrokeColor[1] * 255, this._renderer.curStrokeColor[2] * 255 ); - this._renderer.uMVMatrix.set(this._renderer._curCamera.cameraMatrix); + this._renderer.uMVMatrix.set(this._renderer.uViewMatrix); // Lines along X axis for (let q = 0; q <= numDivs; q++) { @@ -733,7 +733,7 @@ p5.prototype._axesIcon = function(size, xOff, yOff, zOff) { return function() { this.push(); - this._renderer.uMVMatrix.set(this._renderer._curCamera.cameraMatrix); + this._renderer.uMVMatrix.set(this._renderer.uViewMatrix); // X axis this.strokeWeight(2); diff --git a/src/webgl/p5.Camera.js b/src/webgl/p5.Camera.js index a661c357b0..fedf882a70 100644 --- a/src/webgl/p5.Camera.js +++ b/src/webgl/p5.Camera.js @@ -1597,12 +1597,21 @@ p5.Camera = class Camera { this[keyName] = cam[keyName]; } - this.cameraMatrix = cam.cameraMatrix.copy(); - this.projMatrix = cam.projMatrix.copy(); + this.modelMatrix = cam.modelMatrix.copy(); // If the target camera is active, update uMVMatrix and uPMatrix. if (this._isActive()) { - this._renderer.uMVMatrix.mat4 = this.cameraMatrix.mat4.slice(); + this._renderer.uModelMatrix.mat4 = this.modelMatrix.mat4.slice(); + } + + this.viewMatrix = cam.viewMatrix.copy(); + + if (this._isActive()) { + this._renderer.uViewMatrix.mat4 = this.viewMatrix.mat4.slice(); + } + + this.projMatrix = cam.projMatrix.copy(); + if (this._isActive()) { this._renderer.uPMatrix.mat4 = this.projMatrix.mat4.slice(); } } diff --git a/src/webgl/p5.Framebuffer.js b/src/webgl/p5.Framebuffer.js index 55585a5e17..103ac2da67 100644 --- a/src/webgl/p5.Framebuffer.js +++ b/src/webgl/p5.Framebuffer.js @@ -842,9 +842,10 @@ class Framebuffer { // RendererGL.reset() does, but this does not try to clear any buffers; // it only sets the camera. this.target.setCamera(this.defaultCamera); - this.target._renderer.uMVMatrix.set( - this.target._renderer._curCamera.cameraMatrix - ); + this.target._renderer.uViewMatrix.mat4 = + this.target._renderer._curCamera.cameraMatrix.mat4.slice(); + this.target._renderer.uModelMatrix.mat4 = + this.target.modelMatrix.mat4.slice(); } /** diff --git a/src/webgl/p5.RendererGL.Retained.js b/src/webgl/p5.RendererGL.Retained.js index d278d51428..6ad07f5d28 100644 --- a/src/webgl/p5.RendererGL.Retained.js +++ b/src/webgl/p5.RendererGL.Retained.js @@ -189,12 +189,13 @@ p5.RendererGL.prototype.drawBuffersScaled = function( scaleY, scaleZ ) { - const uMVMatrix = this.uMVMatrix.copy(); + const uModelMatrix = this.uModelMatrix.copy(); + this.uModelMatrix.scale(scaleX, scaleY, scaleZ); try { this.uMVMatrix.scale(scaleX, scaleY, scaleZ); this.drawBuffers(gId); } finally { - this.uMVMatrix = uMVMatrix; + this.uModelMatrix = uModelMatrix; } }; diff --git a/src/webgl/p5.RendererGL.js b/src/webgl/p5.RendererGL.js index 097c9ab8c1..39a50ceba2 100644 --- a/src/webgl/p5.RendererGL.js +++ b/src/webgl/p5.RendererGL.js @@ -526,7 +526,8 @@ p5.RendererGL = class RendererGL extends p5.Renderer { * model view, projection, & normal * matrices */ - this.uMVMatrix = new p5.Matrix(); + this.uModelMatrix = new p5.Matrix(); + this.uViewMatrix = new p5.Matrix(); this.uPMatrix = new p5.Matrix(); this.uNMatrix = new p5.Matrix('mat3'); @@ -850,7 +851,7 @@ p5.RendererGL = class RendererGL extends p5.Renderer { _update() { // reset model view and apply initial camera transform // (containing only look at info; no projection). - this.uMVMatrix.set(this._curCamera.cameraMatrix); + this.uViewMatrix.set(this._curCamera.cameraMatrix); // reset light data for new frame. @@ -1482,9 +1483,9 @@ p5.RendererGL = class RendererGL extends p5.Renderer { applyMatrix(a, b, c, d, e, f) { if (arguments.length === 16) { - p5.Matrix.prototype.apply.apply(this.uMVMatrix, arguments); + p5.Matrix.prototype.apply.apply(this.uModelMatrix, arguments); } else { - this.uMVMatrix.apply([ + this.uModelMatrix.apply([ a, b, 0, 0, c, d, 0, 0, 0, 0, 1, 0, @@ -1508,7 +1509,7 @@ p5.RendererGL = class RendererGL extends p5.Renderer { y = x.y; x = x.x; } - this.uMVMatrix.translate([x, y, z]); + this.uModelMatrix.translate([x, y, z]); return this; } @@ -1521,7 +1522,7 @@ p5.RendererGL = class RendererGL extends p5.Renderer { * @chainable */ scale(x, y, z) { - this.uMVMatrix.scale(x, y, z); + this.uModelMatrix.scale(x, y, z); return this; } @@ -1529,7 +1530,7 @@ p5.RendererGL = class RendererGL extends p5.Renderer { if (typeof axis === 'undefined') { return this.rotateZ(rad); } - p5.Matrix.prototype.rotate.apply(this.uMVMatrix, arguments); + p5.Matrix.prototype.rotate.apply(this.uModelMatrix, arguments); return this; } @@ -1555,10 +1556,13 @@ p5.RendererGL = class RendererGL extends p5.Renderer { // add webgl-specific style properties const properties = style.properties; - properties.uMVMatrix = this.uMVMatrix.copy(); + properties.uModelMatrix = this.uModelMatrix.copy(); + properties.uViewMatrix = this.uViewMatrix.copy(); properties.uPMatrix = this.uPMatrix.copy(); properties._curCamera = this._curCamera; + this.uViewMatrix.set(this._curCamera.cameraMatrix); + // make a copy of the current camera for the push state // this preserves any references stored using 'createCamera' this._curCamera = this._curCamera.copy(); @@ -1641,7 +1645,8 @@ p5.RendererGL = class RendererGL extends p5.Renderer { } } resetMatrix() { - this.uMVMatrix.set(this._curCamera.cameraMatrix); + this.uModelMatrix.set(); + this.uViewMatrix.set(this._curCamera.cameraMatrix); return this; } diff --git a/src/webgl/p5.Shader.js b/src/webgl/p5.Shader.js index 3bb6c63a1a..8b3eefe10c 100644 --- a/src/webgl/p5.Shader.js +++ b/src/webgl/p5.Shader.js @@ -316,9 +316,11 @@ p5.Shader = class { } _setMatrixUniforms() { - const viewMatrix = this._renderer._curCamera.cameraMatrix; + const viewMatrix = this._renderer.uViewMatrix; const projectionMatrix = this._renderer.uPMatrix; - const modelViewMatrix = this._renderer.uMVMatrix; + const modelMatrix = this._renderer.uModelMatrix; + const modelViewMatrix = modelMatrix.copy(); + modelViewMatrix.mult(viewMatrix); const modelViewProjectionMatrix = modelViewMatrix.copy(); modelViewProjectionMatrix.mult(projectionMatrix); @@ -334,13 +336,14 @@ p5.Shader = class { } this.setUniform('uViewMatrix', viewMatrix.mat4); this.setUniform('uProjectionMatrix', projectionMatrix.mat4); + this.setUniform('uModelMatrix', modelMatrix.mat4); this.setUniform('uModelViewMatrix', modelViewMatrix.mat4); this.setUniform( 'uModelViewProjectionMatrix', modelViewProjectionMatrix.mat4 ); if (this.uniforms.uNormalMatrix) { - this._renderer.uNMatrix.inverseTranspose(this._renderer.uMVMatrix); + this._renderer.uNMatrix.inverseTranspose(modelMatrix); this.setUniform('uNormalMatrix', this._renderer.uNMatrix.mat3); } } From 7267e590b0ee0ae5655fcd23f5ebb3125bffd8e4 Mon Sep 17 00:00:00 2001 From: Deveshi Dwivedi <120312681+deveshidwivedi@users.noreply.github.com> Date: Fri, 19 Jan 2024 02:34:13 +0530 Subject: [PATCH 02/24] Update package.json --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index a7dcc02e2a..dd19d7972e 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,6 @@ "lint-staged": "^4.3.0", "marked": "^4.0.10", "mocha": "^10.2.0", - "mocha-chrome": "^2.2.0", "np": "^8.0.4", "omggif": "^1.0.10", "open": "^7.0.3", From c1d972fbfd7df3c0377a13efd2684639e2f2591c Mon Sep 17 00:00:00 2001 From: Deveshi Dwivedi <120312681+deveshidwivedi@users.noreply.github.com> Date: Sun, 21 Jan 2024 15:52:59 +0530 Subject: [PATCH 03/24] Update p5.Shader.js --- src/webgl/p5.Shader.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/webgl/p5.Shader.js b/src/webgl/p5.Shader.js index 8add1d2878..dca1d46d78 100644 --- a/src/webgl/p5.Shader.js +++ b/src/webgl/p5.Shader.js @@ -316,11 +316,10 @@ p5.Shader = class { } _setMatrixUniforms() { - const viewMatrix = this._renderer.uViewMatrix; - const projectionMatrix = this._renderer.uPMatrix; const modelMatrix = this._renderer.uModelMatrix; - const modelViewMatrix = modelMatrix.copy(); - modelViewMatrix.mult(viewMatrix); + const viewMatrix = this._renderer._curCamera.cameraMatrix; + const projectionMatrix = this._renderer.uPMatrix; + const modelViewMatrix = (modelMatrix.copy()).mult(viewMatrix); const modelViewProjectionMatrix = modelViewMatrix.copy(); modelViewProjectionMatrix.mult(projectionMatrix); From ee1962a4e597850fffb3d8bb7beacf34bd747007 Mon Sep 17 00:00:00 2001 From: Deveshi Dwivedi <120312681+deveshidwivedi@users.noreply.github.com> Date: Mon, 22 Jan 2024 03:50:25 +0530 Subject: [PATCH 04/24] Update p5.Camera.js --- src/webgl/p5.Camera.js | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/webgl/p5.Camera.js b/src/webgl/p5.Camera.js index fedf882a70..9797553fd2 100644 --- a/src/webgl/p5.Camera.js +++ b/src/webgl/p5.Camera.js @@ -1597,25 +1597,15 @@ p5.Camera = class Camera { this[keyName] = cam[keyName]; } - this.modelMatrix = cam.modelMatrix.copy(); + this.cameraMatrix = cam.cameraMatrix.copy(); + this.projMatrix = cam.projMatrix.copy(); - // If the target camera is active, update uMVMatrix and uPMatrix. if (this._isActive()) { this._renderer.uModelMatrix.mat4 = this.modelMatrix.mat4.slice(); - } - - this.viewMatrix = cam.viewMatrix.copy(); - - if (this._isActive()) { this._renderer.uViewMatrix.mat4 = this.viewMatrix.mat4.slice(); - } - - this.projMatrix = cam.projMatrix.copy(); - if (this._isActive()) { this._renderer.uPMatrix.mat4 = this.projMatrix.mat4.slice(); } } - /** * For the cameras cam0 and cam1 with the given arguments, their view are combined * with the parameter amt that represents the quantity, and the obtained view is applied. From 35b51336049a321b344f596039a9ac27d1685057 Mon Sep 17 00:00:00 2001 From: Deveshi Dwivedi <120312681+deveshidwivedi@users.noreply.github.com> Date: Mon, 22 Jan 2024 03:52:03 +0530 Subject: [PATCH 05/24] Update p5.Framebuffer.js --- src/webgl/p5.Framebuffer.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/webgl/p5.Framebuffer.js b/src/webgl/p5.Framebuffer.js index 103ac2da67..df58c3fd55 100644 --- a/src/webgl/p5.Framebuffer.js +++ b/src/webgl/p5.Framebuffer.js @@ -842,6 +842,7 @@ class Framebuffer { // RendererGL.reset() does, but this does not try to clear any buffers; // it only sets the camera. this.target.setCamera(this.defaultCamera); + this.target.resetMatrix(); this.target._renderer.uViewMatrix.mat4 = this.target._renderer._curCamera.cameraMatrix.mat4.slice(); this.target._renderer.uModelMatrix.mat4 = From 639c8cfe1447dc3884c514518ff10f669f32489c Mon Sep 17 00:00:00 2001 From: Deveshi Dwivedi <120312681+deveshidwivedi@users.noreply.github.com> Date: Mon, 22 Jan 2024 03:53:19 +0530 Subject: [PATCH 06/24] Update p5.RendererGL.js --- src/webgl/p5.RendererGL.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webgl/p5.RendererGL.js b/src/webgl/p5.RendererGL.js index cfc3d29435..4a7cdce5a5 100644 --- a/src/webgl/p5.RendererGL.js +++ b/src/webgl/p5.RendererGL.js @@ -1652,7 +1652,7 @@ p5.RendererGL = class RendererGL extends p5.Renderer { } } resetMatrix() { - this.uModelMatrix.set(); + this.uModelMatrix.reset(); this.uViewMatrix.set(this._curCamera.cameraMatrix); return this; } From 85fff060b0c1acba4cc4b94a1afb059fc1622ba4 Mon Sep 17 00:00:00 2001 From: Deveshi Dwivedi <120312681+deveshidwivedi@users.noreply.github.com> Date: Mon, 22 Jan 2024 03:54:23 +0530 Subject: [PATCH 07/24] Update p5.Shader.js --- src/webgl/p5.Shader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webgl/p5.Shader.js b/src/webgl/p5.Shader.js index dca1d46d78..ceb7fc5585 100644 --- a/src/webgl/p5.Shader.js +++ b/src/webgl/p5.Shader.js @@ -342,7 +342,7 @@ p5.Shader = class { modelViewProjectionMatrix.mat4 ); if (this.uniforms.uNormalMatrix) { - this._renderer.uNMatrix.inverseTranspose(modelMatrix); + this._renderer.uNMatrix.inverseTranspose(this._renderer.uMVMatrix); this.setUniform('uNormalMatrix', this._renderer.uNMatrix.mat3); } if (this.uniforms.uCameraRotation) { From d1d429dfaf77be33b51aadf5a0a70bdf285420a3 Mon Sep 17 00:00:00 2001 From: Deveshi Dwivedi <120312681+deveshidwivedi@users.noreply.github.com> Date: Mon, 22 Jan 2024 03:56:13 +0530 Subject: [PATCH 08/24] reset method created --- src/webgl/p5.Matrix.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/webgl/p5.Matrix.js b/src/webgl/p5.Matrix.js index 9e2a096f5d..da664bd9ec 100644 --- a/src/webgl/p5.Matrix.js +++ b/src/webgl/p5.Matrix.js @@ -47,6 +47,15 @@ p5.Matrix = class { return this; } + reset() { + if (this.mat3) { + this.mat3.set([1, 0, 0, 0, 1, 0, 0, 0, 1]); + } else if (this.mat4) { + this.mat4.set([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]); + } + return this; + } + /** * Replace the entire contents of a 4x4 matrix. * If providing an array or a p5.Matrix, the values will be copied without From 5dc6ccfae24d131a0aa5e590cc31057bea543e91 Mon Sep 17 00:00:00 2001 From: Deveshi Dwivedi <120312681+deveshidwivedi@users.noreply.github.com> Date: Wed, 24 Jan 2024 18:37:13 +0530 Subject: [PATCH 09/24] use .set method for matrix updates --- src/webgl/p5.Camera.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/webgl/p5.Camera.js b/src/webgl/p5.Camera.js index 9797553fd2..3d3afc57e0 100644 --- a/src/webgl/p5.Camera.js +++ b/src/webgl/p5.Camera.js @@ -1601,9 +1601,9 @@ p5.Camera = class Camera { this.projMatrix = cam.projMatrix.copy(); if (this._isActive()) { - this._renderer.uModelMatrix.mat4 = this.modelMatrix.mat4.slice(); - this._renderer.uViewMatrix.mat4 = this.viewMatrix.mat4.slice(); - this._renderer.uPMatrix.mat4 = this.projMatrix.mat4.slice(); + this._renderer.uModelMatrix.set(this.modelMatrix); + this._renderer.uViewMatrix.set(this.viewMatrix); + this._renderer.uPMatrix.set(this.projMatrix); } } /** From 7605bd30608aa4a413d6519ee0637fd4812f95ee Mon Sep 17 00:00:00 2001 From: Deveshi Dwivedi <120312681+deveshidwivedi@users.noreply.github.com> Date: Wed, 24 Jan 2024 18:47:34 +0530 Subject: [PATCH 10/24] use .set method for matrix updates --- src/webgl/p5.Framebuffer.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/webgl/p5.Framebuffer.js b/src/webgl/p5.Framebuffer.js index df58c3fd55..0d9698fc95 100644 --- a/src/webgl/p5.Framebuffer.js +++ b/src/webgl/p5.Framebuffer.js @@ -843,10 +843,9 @@ class Framebuffer { // it only sets the camera. this.target.setCamera(this.defaultCamera); this.target.resetMatrix(); - this.target._renderer.uViewMatrix.mat4 = - this.target._renderer._curCamera.cameraMatrix.mat4.slice(); - this.target._renderer.uModelMatrix.mat4 = - this.target.modelMatrix.mat4.slice(); + this.target._renderer.uViewMatrix + .set(this.target._renderer._curCamera.cameraMatrix); + this.target._renderer.uModelMatrix.set(this.target.modelMatrix); } /** From 1a4209146cf5c38f438211c162ecb2e181909cac Mon Sep 17 00:00:00 2001 From: Deveshi Dwivedi <120312681+deveshidwivedi@users.noreply.github.com> Date: Wed, 24 Jan 2024 18:48:54 +0530 Subject: [PATCH 11/24] Update p5.RendererGL.Retained.js --- src/webgl/p5.RendererGL.Retained.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/webgl/p5.RendererGL.Retained.js b/src/webgl/p5.RendererGL.Retained.js index 6ad07f5d28..c9302f83ac 100644 --- a/src/webgl/p5.RendererGL.Retained.js +++ b/src/webgl/p5.RendererGL.Retained.js @@ -189,9 +189,8 @@ p5.RendererGL.prototype.drawBuffersScaled = function( scaleY, scaleZ ) { - const uModelMatrix = this.uModelMatrix.copy(); - this.uModelMatrix.scale(scaleX, scaleY, scaleZ); try { + this.uModelMatrix.scale(scaleX, scaleY, scaleZ); this.uMVMatrix.scale(scaleX, scaleY, scaleZ); this.drawBuffers(gId); } finally { From 84800e24a0be15bf1987f711f46bb12a82aaf164 Mon Sep 17 00:00:00 2001 From: Deveshi Dwivedi Date: Fri, 26 Jan 2024 02:05:44 +0530 Subject: [PATCH 12/24] Revert "Update package.json" This reverts commit 7267e590b0ee0ae5655fcd23f5ebb3125bffd8e4. --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index dad6ecd8c6..efa67c1e5e 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,7 @@ "lint-staged": "^4.3.0", "marked": "^4.0.10", "mocha": "^10.2.0", + "mocha-chrome": "^2.2.0", "np": "^8.0.4", "omggif": "^1.0.10", "open": "^7.0.3", From 6571b077d62f3b55a7adf50b8e069afd9fc80cab Mon Sep 17 00:00:00 2001 From: Deveshi Dwivedi <120312681+deveshidwivedi@users.noreply.github.com> Date: Fri, 26 Jan 2024 14:09:04 +0530 Subject: [PATCH 13/24] Update package.json --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index efa67c1e5e..dad6ecd8c6 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,6 @@ "lint-staged": "^4.3.0", "marked": "^4.0.10", "mocha": "^10.2.0", - "mocha-chrome": "^2.2.0", "np": "^8.0.4", "omggif": "^1.0.10", "open": "^7.0.3", From 2d9d70e1eeaea3126b0e39b590a4ddd1bd3e8c41 Mon Sep 17 00:00:00 2001 From: Deveshi Dwivedi Date: Fri, 26 Jan 2024 14:19:55 +0530 Subject: [PATCH 14/24] updated files --- src/webgl/3d_primitives.js | 2 +- src/webgl/interaction.js | 4 ++-- src/webgl/p5.Camera.js | 4 ++-- src/webgl/p5.RendererGL.js | 1 + 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/webgl/3d_primitives.js b/src/webgl/3d_primitives.js index 71013efa73..75bfafdf84 100644 --- a/src/webgl/3d_primitives.js +++ b/src/webgl/3d_primitives.js @@ -1246,7 +1246,7 @@ p5.RendererGL.prototype.triangle = function(args) { // this matrix multiplication transforms those two unit vectors // onto the required vector prior to rendering, and moves the // origin appropriately. - const uModelMatrix = this._renderer.uModelMatrix.copy(); + const uModelMatrix = this.uModelMatrix.copy(); try { // triangle orientation. const orientation = Math.sign(x1*y2-x2*y1 + x2*y3-x3*y2 + x3*y1-x1*y3); diff --git a/src/webgl/interaction.js b/src/webgl/interaction.js index fc52063842..d31101e8fc 100644 --- a/src/webgl/interaction.js +++ b/src/webgl/interaction.js @@ -686,7 +686,7 @@ p5.prototype._grid = function(size, numDivs, xOff, yOff, zOff) { this._renderer.curStrokeColor[1] * 255, this._renderer.curStrokeColor[2] * 255 ); - this._renderer.uMVMatrix.set(this._renderer.uViewMatrix); + this._renderer.uMVMatrix.reset(); // Lines along X axis for (let q = 0; q <= numDivs; q++) { @@ -733,7 +733,7 @@ p5.prototype._axesIcon = function(size, xOff, yOff, zOff) { return function() { this.push(); - this._renderer.uMVMatrix.set(this._renderer.uViewMatrix); + this._renderer.uMVMatrix.reset(); // X axis this.strokeWeight(2); diff --git a/src/webgl/p5.Camera.js b/src/webgl/p5.Camera.js index 3d3afc57e0..3990586243 100644 --- a/src/webgl/p5.Camera.js +++ b/src/webgl/p5.Camera.js @@ -1601,8 +1601,8 @@ p5.Camera = class Camera { this.projMatrix = cam.projMatrix.copy(); if (this._isActive()) { - this._renderer.uModelMatrix.set(this.modelMatrix); - this._renderer.uViewMatrix.set(this.viewMatrix); + this._renderer.uModelMatrix.reset(); + this._renderer.uViewMatrix.set(this.cameraMatrix); this._renderer.uPMatrix.set(this.projMatrix); } } diff --git a/src/webgl/p5.RendererGL.js b/src/webgl/p5.RendererGL.js index 4a7cdce5a5..d246446717 100644 --- a/src/webgl/p5.RendererGL.js +++ b/src/webgl/p5.RendererGL.js @@ -856,6 +856,7 @@ p5.RendererGL = class RendererGL extends p5.Renderer { _update() { // reset model view and apply initial camera transform // (containing only look at info; no projection). + this.uModelMatrix.reset(); this.uViewMatrix.set(this._curCamera.cameraMatrix); // reset light data for new frame. From 87bcde22e9c0567889ff84ccf6a28c6a9f4bc35e Mon Sep 17 00:00:00 2001 From: Deveshi Dwivedi Date: Fri, 26 Jan 2024 14:42:33 +0530 Subject: [PATCH 15/24] updated this._renderer. to this. --- src/webgl/3d_primitives.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/webgl/3d_primitives.js b/src/webgl/3d_primitives.js index 75bfafdf84..4afc8f74e8 100644 --- a/src/webgl/3d_primitives.js +++ b/src/webgl/3d_primitives.js @@ -1255,13 +1255,13 @@ p5.RendererGL.prototype.triangle = function(args) { x3 - x1, y3 - y1, 0, 0, // the resulting unit Y-axis 0, 0, orientation, 0, // the resulting unit Z-axis (Reflect the specified order of vertices) x1, y1, 0, 1 // the resulting origin - ]).mult(this._renderer.uModelMatrix); + ]).mult(this.uModelMatrix); - this._renderer.uModelMatrix = mult; + this.uModelMatrix = mult; this.drawBuffers(gId); } finally { - this._renderer.uModelMatrix = uModelMatrix; + this.uModelMatrix = uModelMatrix; } return this; @@ -1383,15 +1383,15 @@ p5.RendererGL.prototype.arc = function(args) { this.createBuffers(gId, arcGeom); } - const uModelMatrix = this._renderer.uModelMatrix.copy(); + const uModelMatrix = this.uModelMatrix.copy(); try { - this._renderer.uModelMatrix.translate([x, y, 0]); - this._renderer.uModelMatrix.scale(width, height, 1); + this.uModelMatrix.translate([x, y, 0]); + this.uModelMatrix.scale(width, height, 1); this.drawBuffers(gId); } finally { - this._renderer.uModelMatrix = uModelMatrix; + this.uModelMatrix = uModelMatrix; } return this; @@ -1443,14 +1443,14 @@ p5.RendererGL.prototype.rect = function(args) { // opposite corners at (0,0) & (1,1). // // before rendering, this square is scaled & moved to the required location. - const uModelMatrix = this._renderer.uModelMatrix.copy(); + const uModelMatrix = this.uModelMatrix.copy(); try { - this._renderer.uModelMatrix.translate([x, y, 0]); - this._renderer.uModelMatrix.scale(width, height, 1); + this.uModelMatrix.translate([x, y, 0]); + this.uModelMatrix.scale(width, height, 1); this.drawBuffers(gId); } finally { - this._renderer.uModelMatrix = uModelMatrix; + this.uModelMatrix = uModelMatrix; } } else { // Use Immediate mode to round the rectangle corner, From 2ceca4ec656f4d137390c3554b3bd085d698ed60 Mon Sep 17 00:00:00 2001 From: Deveshi Dwivedi Date: Sat, 27 Jan 2024 12:23:46 +0530 Subject: [PATCH 16/24] undo changes to package-lock.json --- package-lock.json | 668 +++++----------------------------------------- 1 file changed, 63 insertions(+), 605 deletions(-) diff --git a/package-lock.json b/package-lock.json index ee4f0486d5..56c67e3517 100644 --- a/package-lock.json +++ b/package-lock.json @@ -47,7 +47,6 @@ "lint-staged": "^4.3.0", "marked": "^4.0.10", "mocha": "^10.2.0", - "mocha-chrome": "^2.2.0", "np": "^8.0.4", "omggif": "^1.0.10", "open": "^7.0.3", @@ -2693,15 +2692,6 @@ "node": ">=0.10.0" } }, - "node_modules/array-find-index": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", - "integrity": "sha512-M1HQyIXcBGtVywBt8WVdim+lrNaK7VHp99Qt5pSNziXznKHViIBbXWtfRTpEFpF/c4FdfxNAsCCwPp5phBYJtw==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", @@ -4023,94 +4013,6 @@ "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", "dev": true }, - "node_modules/chrome-launcher": { - "version": "0.11.2", - "resolved": "https://registry.npmjs.org/chrome-launcher/-/chrome-launcher-0.11.2.tgz", - "integrity": "sha512-jx0kJDCXdB2ARcDMwNCtrf04oY1Up4rOmVu+fqJ5MTPOOIG8EhRcEU9NZfXZc6dMw9FU8o1r21PNp8V2M0zQ+g==", - "dev": true, - "dependencies": { - "@types/node": "*", - "is-wsl": "^2.1.0", - "lighthouse-logger": "^1.0.0", - "mkdirp": "0.5.1", - "rimraf": "^2.6.1" - } - }, - "node_modules/chrome-launcher/node_modules/is-wsl": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", - "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", - "dev": true, - "dependencies": { - "is-docker": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/chrome-launcher/node_modules/minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha512-miQKw5Hv4NS1Psg2517mV4e4dYNaO3++hjAvLOAzKqZ61rH8NS1SK+vbfBWZ5PY/Me/bEWhUwqMghEW5Fb9T7Q==", - "dev": true - }, - "node_modules/chrome-launcher/node_modules/mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha512-SknJC52obPfGQPnjIkXbmA6+5H15E+fR+E4iR2oQ3zzCLbd7/ONua69R/Gw7AgkTLsRG+r5fzksYwWe1AgTyWA==", - "deprecated": "Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)", - "dev": true, - "dependencies": { - "minimist": "0.0.8" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/chrome-remote-interface": { - "version": "0.28.2", - "resolved": "https://registry.npmjs.org/chrome-remote-interface/-/chrome-remote-interface-0.28.2.tgz", - "integrity": "sha512-F7mjof7rWvRNsJqhVXuiFU/HWySCxTA9tzpLxUJxVfdLkljwFJ1aMp08AnwXRmmP7r12/doTDOMwaNhFCJsacw==", - "dev": true, - "dependencies": { - "commander": "2.11.x", - "ws": "^7.2.0" - }, - "bin": { - "chrome-remote-interface": "bin/client.js" - } - }, - "node_modules/chrome-remote-interface/node_modules/ws": { - "version": "7.5.9", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", - "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", - "dev": true, - "engines": { - "node": ">=8.3.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, - "node_modules/chrome-unmirror": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/chrome-unmirror/-/chrome-unmirror-0.1.0.tgz", - "integrity": "sha512-HmQgCN2UTpcrP85oOGnKpkGJFyOUwjsjnPBZlE8MkG0i+NoynGIkuPDZFKh+K4NLQlPiKKde16FAQ98JC1j8ew==", - "dev": true, - "engines": { - "node": ">=0.10.0", - "npm": ">=2.0.0" - } - }, "node_modules/ci-info": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", @@ -4380,10 +4282,16 @@ } }, "node_modules/commander": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", - "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", - "dev": true + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", + "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", + "dev": true, + "dependencies": { + "graceful-readlink": ">= 1.0.0" + }, + "engines": { + "node": ">= 0.6.x" + } }, "node_modules/commander-version": { "version": "1.1.0", @@ -4842,18 +4750,6 @@ "node": ">= 0.4" } }, - "node_modules/currently-unhandled": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", - "integrity": "sha512-/fITjgjGU50vjQ4FH6eUoYu+iUoUKIXws2hL15JJpIR+BbTxaXQsMuuyjtNh2WqsSBS5nsaZHFsFecyw5CCAng==", - "dev": true, - "dependencies": { - "array-find-index": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/d": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", @@ -4971,19 +4867,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/deep-assign": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/deep-assign/-/deep-assign-3.0.0.tgz", - "integrity": "sha512-YX2i9XjJ7h5q/aQ/IM9PEwEnDqETAIYbggmdDB3HLTlSgo1CxPsj6pvhPG68rq6SVE0+p+6Ywsm5fTYNrYtBWw==", - "deprecated": "Check out `lodash.merge` or `merge-options` instead.", - "dev": true, - "dependencies": { - "is-obj": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/deep-eql": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz", @@ -5066,6 +4949,15 @@ "node": ">=4" } }, + "node_modules/default-require-extensions/node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/defaults": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", @@ -7320,6 +7212,12 @@ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, + "node_modules/graceful-readlink": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", + "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=", + "dev": true + }, "node_modules/grapheme-splitter": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", @@ -10108,16 +10006,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/lighthouse-logger": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/lighthouse-logger/-/lighthouse-logger-1.4.2.tgz", - "integrity": "sha512-gPWxznF6TKmUHrOQjlVo2UbaL2EJ71mb2CCeRs/2qBpi4L/g4LUVc9+3lKQ6DTUZwJswfM7ainGrLO1+fOqa2g==", - "dev": true, - "dependencies": { - "debug": "^2.6.9", - "marky": "^1.2.2" - } - }, "node_modules/lines-and-columns": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", @@ -10458,43 +10346,6 @@ "integrity": "sha512-j1R0/FeGa64Y+NmqfZhyoVRzcFlOZ8sNlKzHjh4VvLULFACZhn68XrX5DFg2FhMvSMJmROuFxRSa560ECWKBMg==", "dev": true }, - "node_modules/load-json-file": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", - "integrity": "sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.1.2", - "parse-json": "^4.0.0", - "pify": "^3.0.0", - "strip-bom": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/load-json-file/node_modules/parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", - "dev": true, - "dependencies": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/load-json-file/node_modules/pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/locate-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", @@ -10627,19 +10478,6 @@ "node": ">=0.10.0" } }, - "node_modules/loglevel": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.8.1.tgz", - "integrity": "sha512-tCRIJM51SHjAayKwC+QAg8hT8vg6z7GSgLJKGvzuPb1Wc+hLzqtuVLxp6/HzSPOozuK+8ErAhy7U/sVzw8Dgfg==", - "dev": true, - "engines": { - "node": ">= 0.6.0" - }, - "funding": { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/loglevel" - } - }, "node_modules/loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", @@ -10652,19 +10490,6 @@ "loose-envify": "cli.js" } }, - "node_modules/loud-rejection": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", - "integrity": "sha512-RPNliZOFkqFumDhvYqOaNY4Uz9oJM2K9tC6JWsJJsNdhuONW4LQHRBpb0qf4pJApVffI5N39SwzWZJuEhfd7eQ==", - "dev": true, - "dependencies": { - "currently-unhandled": "^0.4.1", - "signal-exit": "^3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/lowercase-keys": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", @@ -10745,12 +10570,6 @@ "node": ">= 12" } }, - "node_modules/marky": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/marky/-/marky-1.2.5.tgz", - "integrity": "sha512-q9JtQJKjpsVxCRVgQ+WapguSbKC3SQ5HEzFGPAJMStgh3QjCawp00UKv3MTTAArTmGmmPUvllHZoNbZ3gs0I+Q==", - "dev": true - }, "node_modules/maxmin": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/maxmin/-/maxmin-2.1.0.tgz", @@ -11206,344 +11025,6 @@ "url": "https://opencollective.com/mochajs" } }, - "node_modules/mocha-chrome": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/mocha-chrome/-/mocha-chrome-2.2.0.tgz", - "integrity": "sha512-RXP6Q2mlM2X+eO2Z8gribmiH4J9x5zu/JcTZ3deQSwiC5260BzizOc0eD1NWP3JuypGCKRwReicv4KCNIFtTZQ==", - "dev": true, - "dependencies": { - "chalk": "^2.0.1", - "chrome-launcher": "^0.11.2", - "chrome-remote-interface": "^0.28.0", - "chrome-unmirror": "^0.1.0", - "debug": "^4.1.1", - "deep-assign": "^3.0.0", - "import-local": "^2.0.0", - "loglevel": "^1.4.1", - "meow": "^5.0.0", - "nanobus": "^4.2.0" - }, - "bin": { - "mocha-chrome": "cli.js" - }, - "engines": { - "node": ">= 8.0.0" - } - }, - "node_modules/mocha-chrome/node_modules/camelcase": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", - "integrity": "sha512-FxAv7HpHrXbh3aPo4o2qxHay2lkLY3x5Mw3KeE4KQE8ysVfziWeRZDwcjauvwBSGEC/nXUPzZy8zeh4HokqOnw==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/mocha-chrome/node_modules/camelcase-keys": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-4.2.0.tgz", - "integrity": "sha512-Ej37YKYbFUI8QiYlvj9YHb6/Z60dZyPJW0Cs8sFilMbd2lP0bw3ylAq9yJkK4lcTA2dID5fG8LjmJYbO7kWb7Q==", - "dev": true, - "dependencies": { - "camelcase": "^4.1.0", - "map-obj": "^2.0.0", - "quick-lru": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/mocha-chrome/node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/mocha-chrome/node_modules/decamelize-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.1.tgz", - "integrity": "sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==", - "dev": true, - "dependencies": { - "decamelize": "^1.1.0", - "map-obj": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/mocha-chrome/node_modules/decamelize-keys/node_modules/map-obj": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", - "integrity": "sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/mocha-chrome/node_modules/find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==", - "dev": true, - "dependencies": { - "locate-path": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/mocha-chrome/node_modules/import-local": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/import-local/-/import-local-2.0.0.tgz", - "integrity": "sha512-b6s04m3O+s3CGSbqDIyP4R6aAwAeYlVq9+WUWep6iHa8ETRf9yei1U48C5MmfJmV9AiLYYBKPMq/W+/WRpQmCQ==", - "dev": true, - "dependencies": { - "pkg-dir": "^3.0.0", - "resolve-cwd": "^2.0.0" - }, - "bin": { - "import-local-fixture": "fixtures/cli.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/mocha-chrome/node_modules/indent-string": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", - "integrity": "sha512-BYqTHXTGUIvg7t1r4sJNKcbDZkL92nkXA8YtRpbjFHRHGDL/NtUeiBJMeE60kIFN/Mg8ESaWQvftaYMGJzQZCQ==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/mocha-chrome/node_modules/locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==", - "dev": true, - "dependencies": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/mocha-chrome/node_modules/map-obj": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-2.0.0.tgz", - "integrity": "sha512-TzQSV2DiMYgoF5RycneKVUzIa9bQsj/B3tTgsE3dOGqlzHnGIDaC7XBE7grnA+8kZPnfqSGFe95VHc2oc0VFUQ==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/mocha-chrome/node_modules/meow": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/meow/-/meow-5.0.0.tgz", - "integrity": "sha512-CbTqYU17ABaLefO8vCU153ZZlprKYWDljcndKKDCFcYQITzWCXZAVk4QMFZPgvzrnUQ3uItnIE/LoUOwrT15Ig==", - "dev": true, - "dependencies": { - "camelcase-keys": "^4.0.0", - "decamelize-keys": "^1.0.0", - "loud-rejection": "^1.0.0", - "minimist-options": "^3.0.1", - "normalize-package-data": "^2.3.4", - "read-pkg-up": "^3.0.0", - "redent": "^2.0.0", - "trim-newlines": "^2.0.0", - "yargs-parser": "^10.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/mocha-chrome/node_modules/minimist-options": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-3.0.2.tgz", - "integrity": "sha512-FyBrT/d0d4+uiZRbqznPXqw3IpZZG3gl3wKWiX784FycUKVwBt0uLBFkQrtE4tZOrgo78nZp2jnKz3L65T5LdQ==", - "dev": true, - "dependencies": { - "arrify": "^1.0.1", - "is-plain-obj": "^1.1.0" - }, - "engines": { - "node": ">= 4" - } - }, - "node_modules/mocha-chrome/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "node_modules/mocha-chrome/node_modules/p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", - "dev": true, - "dependencies": { - "p-try": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/mocha-chrome/node_modules/p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==", - "dev": true, - "dependencies": { - "p-limit": "^1.1.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/mocha-chrome/node_modules/p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/mocha-chrome/node_modules/path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/mocha-chrome/node_modules/path-type": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", - "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", - "dev": true, - "dependencies": { - "pify": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/mocha-chrome/node_modules/pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/mocha-chrome/node_modules/quick-lru": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-1.1.0.tgz", - "integrity": "sha512-tRS7sTgyxMXtLum8L65daJnHUhfDUgboRdcWW2bR9vBfrj2+O5HSMbQOJfJJjIVSPFqbBCF37FpwWXGitDc5tA==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/mocha-chrome/node_modules/read-pkg": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", - "integrity": "sha512-BLq/cCO9two+lBgiTYNqD6GdtK8s4NpaWrl6/rCO9w0TUS8oJl7cmToOZfRYllKTISY6nt1U7jQ53brmKqY6BA==", - "dev": true, - "dependencies": { - "load-json-file": "^4.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/mocha-chrome/node_modules/read-pkg-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-3.0.0.tgz", - "integrity": "sha512-YFzFrVvpC6frF1sz8psoHDBGF7fLPc+llq/8NB43oagqWkx8ar5zYtsTORtOjw9W2RHLpWP+zTWwBvf1bCmcSw==", - "dev": true, - "dependencies": { - "find-up": "^2.0.0", - "read-pkg": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/mocha-chrome/node_modules/redent": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/redent/-/redent-2.0.0.tgz", - "integrity": "sha512-XNwrTx77JQCEMXTeb8movBKuK75MgH0RZkujNuDKCezemx/voapl9i2gCSi8WWm8+ox5ycJi1gxF22fR7c0Ciw==", - "dev": true, - "dependencies": { - "indent-string": "^3.0.0", - "strip-indent": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/mocha-chrome/node_modules/resolve-cwd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz", - "integrity": "sha512-ccu8zQTrzVr954472aUVPLEcB3YpKSYR3cg/3lo1okzobPBM+1INXBbBZlDbnI/hbEocnf8j0QVo43hQKrbchg==", - "dev": true, - "dependencies": { - "resolve-from": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/mocha-chrome/node_modules/strip-indent": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-2.0.0.tgz", - "integrity": "sha512-RsSNPLpq6YUL7QYy44RnPVTn/lcVZtb48Uof3X5JLbF4zD/Gs7ZFDv2HWol+leoQN2mT86LAzSshGfkTlSOpsA==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/mocha-chrome/node_modules/trim-newlines": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-2.0.0.tgz", - "integrity": "sha512-MTBWv3jhVjTU7XR3IQHllbiJs8sc75a80OEhB6or/q7pLTWgQ0bMGQXXYQSrSuXe6WiKWDZ5txXY5P59a/coVA==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/mocha-chrome/node_modules/yargs-parser": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz", - "integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==", - "dev": true, - "dependencies": { - "camelcase": "^4.1.0" - } - }, "node_modules/mocha/node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -12004,23 +11485,6 @@ "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dev": true }, - "node_modules/nanoassert": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/nanoassert/-/nanoassert-1.1.0.tgz", - "integrity": "sha512-C40jQ3NzfkP53NsO8kEOFd79p4b9kDXQMwgiY1z8ZwrDZgUyom0AHwGegF4Dm99L+YoYhuaB0ceerUcXmqr1rQ==", - "dev": true - }, - "node_modules/nanobus": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/nanobus/-/nanobus-4.5.0.tgz", - "integrity": "sha512-7sBZo9wthqNJ7QXnfVXZL7fkKJLN55GLOdX+RyZT34UOvxxnFtJe/c7K0ZRLAKOvaY1xJThFFn0Usw2H9R6Frg==", - "dev": true, - "dependencies": { - "nanoassert": "^1.1.0", - "nanotiming": "^7.2.0", - "remove-array-items": "^1.0.0" - } - }, "node_modules/nanoid": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", @@ -12033,25 +11497,6 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, - "node_modules/nanoscheduler": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/nanoscheduler/-/nanoscheduler-1.0.3.tgz", - "integrity": "sha512-jBbrF3qdU9321r8n9X7yu18DjP31Do2ItJm3mWrt90wJTrnDO+HXpoV7ftaUglAtjgj9s+OaCxGufbvx6pvbEQ==", - "dev": true, - "dependencies": { - "nanoassert": "^1.1.0" - } - }, - "node_modules/nanotiming": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/nanotiming/-/nanotiming-7.3.1.tgz", - "integrity": "sha512-l3lC7v/PfOuRWQa8vV29Jo6TG10wHtnthLElFXs4Te4Aas57Fo4n1Q8LH9n+NDh9riOzTVvb2QNBhTS4JUKNjw==", - "dev": true, - "dependencies": { - "nanoassert": "^1.1.0", - "nanoscheduler": "^1.0.2" - } - }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -15700,12 +15145,6 @@ "node": ">=4" } }, - "node_modules/remove-array-items": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/remove-array-items/-/remove-array-items-1.1.1.tgz", - "integrity": "sha512-MXW/jtHyl5F1PZI7NbpS8SOtympdLuF20aoWJT5lELR1p/HJDd5nqW8Eu9uLh/hCRY3FgvrIT5AwDCgBODklcA==", - "dev": true - }, "node_modules/repeating": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", @@ -15798,15 +15237,6 @@ "node": ">=0.10.0" } }, - "node_modules/resolve-from": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", - "integrity": "sha512-GnlH6vxLymXJNMBo7XP1fJIzBFbdYt49CuTwmB/6N53t+kMPRMFKz783LlQ4tv28XoQfMWinAJX6WCGf2IlaIw==", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/responselike": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.1.tgz", @@ -16786,15 +16216,6 @@ "node": ">=0.10.0" } }, - "node_modules/strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/strip-eof": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", @@ -17066,6 +16487,34 @@ "node": ">=6" } }, + "node_modules/test-exclude/node_modules/load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/test-exclude/node_modules/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "dev": true, + "dependencies": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/test-exclude/node_modules/path-type": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", @@ -17114,6 +16563,15 @@ "node": ">=6" } }, + "node_modules/test-exclude/node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -18340,4 +17798,4 @@ } } } -} +} \ No newline at end of file From f5baf367c2fb413ed2f1923912b185971c52e717 Mon Sep 17 00:00:00 2001 From: Deveshi Dwivedi Date: Thu, 1 Feb 2024 14:23:47 +0530 Subject: [PATCH 17/24] updated to separate model and view --- src/webgl/GeometryBuilder.js | 2 ++ src/webgl/interaction.js | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/webgl/GeometryBuilder.js b/src/webgl/GeometryBuilder.js index 6b7c96047c..f0cdee133b 100644 --- a/src/webgl/GeometryBuilder.js +++ b/src/webgl/GeometryBuilder.js @@ -46,6 +46,8 @@ class GeometryBuilder { * transformations. */ addGeometry(input) { + this.renderer.uMVMatrix = + this.renderer.uModelMatrix.multiply(this.renderer.uViewMatrix); this.hasTransform = !this.renderer.uMVMatrix.mat4 .every((v, i) => v === this.identityMatrix.mat4[i]); diff --git a/src/webgl/interaction.js b/src/webgl/interaction.js index d31101e8fc..4dbf0e07ed 100644 --- a/src/webgl/interaction.js +++ b/src/webgl/interaction.js @@ -686,7 +686,7 @@ p5.prototype._grid = function(size, numDivs, xOff, yOff, zOff) { this._renderer.curStrokeColor[1] * 255, this._renderer.curStrokeColor[2] * 255 ); - this._renderer.uMVMatrix.reset(); + this._renderer.uModelMatrix.reset(); // Lines along X axis for (let q = 0; q <= numDivs; q++) { @@ -733,7 +733,7 @@ p5.prototype._axesIcon = function(size, xOff, yOff, zOff) { return function() { this.push(); - this._renderer.uMVMatrix.reset(); + this._renderer.uModelMatrix.reset(); // X axis this.strokeWeight(2); From f851186435b135ce71e27089c5ae0fa827159324 Mon Sep 17 00:00:00 2001 From: Deveshi Dwivedi Date: Fri, 2 Feb 2024 23:29:16 +0530 Subject: [PATCH 18/24] updated files --- src/webgl/GeometryBuilder.js | 2 +- src/webgl/p5.Camera.js | 3 ++- src/webgl/p5.RendererGL.js | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/webgl/GeometryBuilder.js b/src/webgl/GeometryBuilder.js index f0cdee133b..1dbd4bacef 100644 --- a/src/webgl/GeometryBuilder.js +++ b/src/webgl/GeometryBuilder.js @@ -47,7 +47,7 @@ class GeometryBuilder { */ addGeometry(input) { this.renderer.uMVMatrix = - this.renderer.uModelMatrix.multiply(this.renderer.uViewMatrix); + this.renderer.uModelMatrix.mult(this.renderer.uViewMatrix); this.hasTransform = !this.renderer.uMVMatrix.mat4 .every((v, i) => v === this.identityMatrix.mat4[i]); diff --git a/src/webgl/p5.Camera.js b/src/webgl/p5.Camera.js index 3990586243..6dc0be1e97 100644 --- a/src/webgl/p5.Camera.js +++ b/src/webgl/p5.Camera.js @@ -1391,7 +1391,8 @@ p5.Camera = class Camera { this.cameraMatrix.translate([tx, ty, tz]); if (this._isActive()) { - this._renderer.uMVMatrix.set(this.cameraMatrix); + this._renderer.uModelMatrix.set(this.modelMatrix); + this._renderer.uViewMatrix.set(this.viewMatrix); } return this; } diff --git a/src/webgl/p5.RendererGL.js b/src/webgl/p5.RendererGL.js index d246446717..3f1c2cc437 100644 --- a/src/webgl/p5.RendererGL.js +++ b/src/webgl/p5.RendererGL.js @@ -532,6 +532,7 @@ p5.RendererGL = class RendererGL extends p5.Renderer { */ this.uModelMatrix = new p5.Matrix(); this.uViewMatrix = new p5.Matrix(); + this.uMVMatrix = new p5.Matrix(); this.uPMatrix = new p5.Matrix(); this.uNMatrix = new p5.Matrix('mat3'); this.curMatrix = new p5.Matrix('mat3'); From 3fd2f4c28f2fb7fb41e551bd776c4c8bdb04f81e Mon Sep 17 00:00:00 2001 From: Deveshi Dwivedi <120312681+deveshidwivedi@users.noreply.github.com> Date: Sat, 3 Feb 2024 00:29:12 +0530 Subject: [PATCH 19/24] Update p5.RendererGL.Retained.js --- src/webgl/p5.RendererGL.Retained.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/webgl/p5.RendererGL.Retained.js b/src/webgl/p5.RendererGL.Retained.js index c9302f83ac..bfeb562450 100644 --- a/src/webgl/p5.RendererGL.Retained.js +++ b/src/webgl/p5.RendererGL.Retained.js @@ -189,15 +189,16 @@ p5.RendererGL.prototype.drawBuffersScaled = function( scaleY, scaleZ ) { + let originalModelMatrix = this.uModelMatrix.copy(); try { this.uModelMatrix.scale(scaleX, scaleY, scaleZ); - this.uMVMatrix.scale(scaleX, scaleY, scaleZ); + this.drawBuffers(gId); } finally { - this.uModelMatrix = uModelMatrix; + + this.uModelMatrix = originalModelMatrix; } }; - p5.RendererGL.prototype._drawArrays = function(drawMode, gId) { this.GL.drawArrays( drawMode, From ac8bd07ace20e8eb9dec5997cfdfc7b200d1fc80 Mon Sep 17 00:00:00 2001 From: Deveshi Dwivedi Date: Wed, 7 Feb 2024 23:58:21 +0530 Subject: [PATCH 20/24] fix errors --- src/webgl/GeometryBuilder.js | 6 +----- src/webgl/p5.RendererGL.Retained.js | 6 ++++-- test/unit/webgl/p5.Camera.js | 6 +++--- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/webgl/GeometryBuilder.js b/src/webgl/GeometryBuilder.js index 1dbd4bacef..f001a03be5 100644 --- a/src/webgl/GeometryBuilder.js +++ b/src/webgl/GeometryBuilder.js @@ -46,13 +46,9 @@ class GeometryBuilder { * transformations. */ addGeometry(input) { - this.renderer.uMVMatrix = - this.renderer.uModelMatrix.mult(this.renderer.uViewMatrix); - this.hasTransform = !this.renderer.uMVMatrix.mat4 - .every((v, i) => v === this.identityMatrix.mat4[i]); if (this.hasTransform) { - this.renderer.uNMatrix.inverseTranspose(this.renderer.uMVMatrix); + this.renderer.uNMatrix.inverseTranspose(this.renderer.uModelMatrix); } let startIdx = this.geometry.vertices.length; diff --git a/src/webgl/p5.RendererGL.Retained.js b/src/webgl/p5.RendererGL.Retained.js index c9302f83ac..ce8cc00f67 100644 --- a/src/webgl/p5.RendererGL.Retained.js +++ b/src/webgl/p5.RendererGL.Retained.js @@ -189,12 +189,14 @@ p5.RendererGL.prototype.drawBuffersScaled = function( scaleY, scaleZ ) { + let originalModelMatrix = this.uModelMatrix.copy(); try { this.uModelMatrix.scale(scaleX, scaleY, scaleZ); - this.uMVMatrix.scale(scaleX, scaleY, scaleZ); + this.drawBuffers(gId); } finally { - this.uModelMatrix = uModelMatrix; + + this.uModelMatrix = originalModelMatrix; } }; diff --git a/test/unit/webgl/p5.Camera.js b/test/unit/webgl/p5.Camera.js index aa682d0c11..1a7643311b 100644 --- a/test/unit/webgl/p5.Camera.js +++ b/test/unit/webgl/p5.Camera.js @@ -386,13 +386,13 @@ suite('p5.Camera', function() { // Confirmation that the argument camera and the matrix of the camera // that received set() match - assert.deepEqual(copyCam.cameraMatrix.mat4, myCam.cameraMatrix.mat4); + assert.deepEqual(copyCam.modelMatrix.mat4, myCam.modelMatrix.mat4); assert.deepEqual(copyCam.projMatrix.mat4, myCam.projMatrix.mat4); // If the set()ed camera is active, // the renderer's matrix will also change. assert.deepEqual( - copyCam.cameraMatrix.mat4, - myp5._renderer.uMVMatrix.mat4 + copyCam.modelMatrix.mat4, + myp5._renderer.uModelMatrix.mat4 ); assert.deepEqual( copyCam.projMatrix.mat4, From b9828a71c63204c08e4e7c6435995f9603ed3044 Mon Sep 17 00:00:00 2001 From: Deveshi Dwivedi Date: Fri, 16 Feb 2024 01:23:32 +0530 Subject: [PATCH 21/24] updated tests --- test/unit/webgl/p5.RendererGL.js | 16 +++++++++++++--- test/unit/webgl/p5.Shader.js | 12 ++++++++---- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/test/unit/webgl/p5.RendererGL.js b/test/unit/webgl/p5.RendererGL.js index e747b12d36..1cda05622c 100644 --- a/test/unit/webgl/p5.RendererGL.js +++ b/test/unit/webgl/p5.RendererGL.js @@ -593,13 +593,23 @@ suite('p5.RendererGL', function() { suite('push() and pop() work in WEBGL Mode', function() { test('push/pop and translation works as expected in WEBGL Mode', function(done) { myp5.createCanvas(100, 100, myp5.WEBGL); - var modelView = myp5._renderer.uMVMatrix.copy(); + var modelMatrixBefore = myp5._renderer.uModelMatrix.copy(); + var viewMatrixBefore = myp5._renderer.uViewMatrix.copy(); + myp5.push(); myp5.rotateX(Math.random(0, 100)); myp5.translate(20, 100, 5); - assert.notEqual(modelView.mat4, myp5._renderer.uMVMatrix.mat4); + // Check if the model matrix has changed + assert.notDeepEqual(modelMatrixBefore.mat4, + myp5._renderer.uModelMatrix.mat4); + // Check if the view matrix has changed + assert.deepEqual(viewMatrixBefore.mat4, + myp5._renderer.uViewMatrix.mat4); myp5.pop(); - assert.deepEqual(modelView.mat4, myp5._renderer.uMVMatrix.mat4); + // Check if both the model and view matrices are restored after popping + assert.deepEqual(modelMatrixBefore.mat4, + myp5._renderer.uModelMatrix.mat4); + assert.deepEqual(viewMatrixBefore.mat4, myp5._renderer.uViewMatrix.mat4); done(); }); diff --git a/test/unit/webgl/p5.Shader.js b/test/unit/webgl/p5.Shader.js index 7c729e2a51..3222f684d1 100644 --- a/test/unit/webgl/p5.Shader.js +++ b/test/unit/webgl/p5.Shader.js @@ -67,7 +67,8 @@ suite('p5.Shader', function() { var expectedAttributes = ['aPosition', 'aNormal', 'aTexCoord']; var expectedUniforms = [ - 'uModelViewMatrix', + 'uModelMatrix', + 'uViewMatrix', 'uProjectionMatrix', 'uNormalMatrix', 'uAmbientLightCount', @@ -108,7 +109,8 @@ suite('p5.Shader', function() { var expectedAttributes = ['aPosition']; var expectedUniforms = [ - 'uModelViewMatrix', + 'uModelMatrix', + 'uViewMatrix', 'uProjectionMatrix', 'uMaterialColor' ]; @@ -124,7 +126,8 @@ suite('p5.Shader', function() { var expectedAttributes = ['aPosition', 'aVertexColor']; var expectedUniforms = [ - 'uModelViewMatrix', + 'uModelMatrix', + 'uViewMatrix', 'uProjectionMatrix', /*'uResolution',*/ 'uPointSize' @@ -141,7 +144,8 @@ suite('p5.Shader', function() { var expectedAttributes = ['aPosition', 'aNormal']; var expectedUniforms = [ - 'uModelViewMatrix', + 'uModelMatrix', + 'uViewMatrix', 'uProjectionMatrix', 'uNormalMatrix' ]; From c97433a472db6dc5b13bb1f0f1d86cdeb77eb46d Mon Sep 17 00:00:00 2001 From: Deveshi Dwivedi Date: Sat, 17 Feb 2024 03:47:52 +0530 Subject: [PATCH 22/24] updated files for failing tests --- src/webgl/GeometryBuilder.js | 2 ++ test/unit/webgl/p5.Camera.js | 6 +++--- test/unit/webgl/p5.RendererGL.js | 2 +- test/unit/webgl/p5.Shader.js | 12 ++++-------- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/webgl/GeometryBuilder.js b/src/webgl/GeometryBuilder.js index f001a03be5..ac78ec7e94 100644 --- a/src/webgl/GeometryBuilder.js +++ b/src/webgl/GeometryBuilder.js @@ -46,6 +46,8 @@ class GeometryBuilder { * transformations. */ addGeometry(input) { + this.hasTransform = !this.renderer.uModelMatrix.mat4 + .every((v, i) => v === this.identityMatrix.mat4[i]); if (this.hasTransform) { this.renderer.uNMatrix.inverseTranspose(this.renderer.uModelMatrix); diff --git a/test/unit/webgl/p5.Camera.js b/test/unit/webgl/p5.Camera.js index 1a7643311b..96a5165d14 100644 --- a/test/unit/webgl/p5.Camera.js +++ b/test/unit/webgl/p5.Camera.js @@ -386,13 +386,13 @@ suite('p5.Camera', function() { // Confirmation that the argument camera and the matrix of the camera // that received set() match - assert.deepEqual(copyCam.modelMatrix.mat4, myCam.modelMatrix.mat4); + assert.deepEqual(copyCam.cameraMatrix.mat4, myCam.cameraMatrix.mat4); assert.deepEqual(copyCam.projMatrix.mat4, myCam.projMatrix.mat4); // If the set()ed camera is active, // the renderer's matrix will also change. assert.deepEqual( - copyCam.modelMatrix.mat4, - myp5._renderer.uModelMatrix.mat4 + copyCam.cameraMatrix.mat4, + myp5._renderer.uViewMatrix.mat4 ); assert.deepEqual( copyCam.projMatrix.mat4, diff --git a/test/unit/webgl/p5.RendererGL.js b/test/unit/webgl/p5.RendererGL.js index 1cda05622c..1b00ee4d94 100644 --- a/test/unit/webgl/p5.RendererGL.js +++ b/test/unit/webgl/p5.RendererGL.js @@ -603,7 +603,7 @@ suite('p5.RendererGL', function() { assert.notDeepEqual(modelMatrixBefore.mat4, myp5._renderer.uModelMatrix.mat4); // Check if the view matrix has changed - assert.deepEqual(viewMatrixBefore.mat4, + assert.notDeepEqual(viewMatrixBefore.mat4, myp5._renderer.uViewMatrix.mat4); myp5.pop(); // Check if both the model and view matrices are restored after popping diff --git a/test/unit/webgl/p5.Shader.js b/test/unit/webgl/p5.Shader.js index 3222f684d1..7c729e2a51 100644 --- a/test/unit/webgl/p5.Shader.js +++ b/test/unit/webgl/p5.Shader.js @@ -67,8 +67,7 @@ suite('p5.Shader', function() { var expectedAttributes = ['aPosition', 'aNormal', 'aTexCoord']; var expectedUniforms = [ - 'uModelMatrix', - 'uViewMatrix', + 'uModelViewMatrix', 'uProjectionMatrix', 'uNormalMatrix', 'uAmbientLightCount', @@ -109,8 +108,7 @@ suite('p5.Shader', function() { var expectedAttributes = ['aPosition']; var expectedUniforms = [ - 'uModelMatrix', - 'uViewMatrix', + 'uModelViewMatrix', 'uProjectionMatrix', 'uMaterialColor' ]; @@ -126,8 +124,7 @@ suite('p5.Shader', function() { var expectedAttributes = ['aPosition', 'aVertexColor']; var expectedUniforms = [ - 'uModelMatrix', - 'uViewMatrix', + 'uModelViewMatrix', 'uProjectionMatrix', /*'uResolution',*/ 'uPointSize' @@ -144,8 +141,7 @@ suite('p5.Shader', function() { var expectedAttributes = ['aPosition', 'aNormal']; var expectedUniforms = [ - 'uModelMatrix', - 'uViewMatrix', + 'uModelViewMatrix', 'uProjectionMatrix', 'uNormalMatrix' ]; From 0de03bb8f67354686c9e0a0912185b5d1b1ae6ba Mon Sep 17 00:00:00 2001 From: Deveshi Dwivedi Date: Sat, 30 Mar 2024 11:36:14 +0530 Subject: [PATCH 23/24] update to fix failing tests --- src/webgl/p5.Camera.js | 4 ++-- src/webgl/p5.Framebuffer.js | 2 +- src/webgl/p5.RendererGL.js | 2 -- src/webgl/p5.Shader.js | 6 +++--- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/webgl/p5.Camera.js b/src/webgl/p5.Camera.js index de47f93cdf..bb70860532 100644 --- a/src/webgl/p5.Camera.js +++ b/src/webgl/p5.Camera.js @@ -1500,8 +1500,8 @@ p5.Camera = class Camera { this.cameraMatrix.translate([tx, ty, tz]); if (this._isActive()) { - this._renderer.uModelMatrix.set(this.modelMatrix); - this._renderer.uViewMatrix.set(this.viewMatrix); + this._renderer.uModelMatrix.reset(); + this._renderer.uViewMatrix.set(this.cameraMatrix); } return this; } diff --git a/src/webgl/p5.Framebuffer.js b/src/webgl/p5.Framebuffer.js index 5fa9eba45c..6f2d44c29c 100644 --- a/src/webgl/p5.Framebuffer.js +++ b/src/webgl/p5.Framebuffer.js @@ -849,7 +849,7 @@ class Framebuffer { this.target.resetMatrix(); this.target._renderer.uViewMatrix .set(this.target._renderer._curCamera.cameraMatrix); - this.target._renderer.uModelMatrix.set(this.target.modelMatrix); + this.target._renderer.uModelMatrix.reset(); } /** diff --git a/src/webgl/p5.RendererGL.js b/src/webgl/p5.RendererGL.js index e5eb4e00d0..5816d2c61c 100644 --- a/src/webgl/p5.RendererGL.js +++ b/src/webgl/p5.RendererGL.js @@ -1609,8 +1609,6 @@ p5.RendererGL = class RendererGL extends p5.Renderer { properties.uPMatrix = this.uPMatrix.copy(); properties._curCamera = this._curCamera; - this.uViewMatrix.set(this._curCamera.cameraMatrix); - // make a copy of the current camera for the push state // this preserves any references stored using 'createCamera' this._curCamera = this._curCamera.copy(); diff --git a/src/webgl/p5.Shader.js b/src/webgl/p5.Shader.js index ff42b1a054..42255d7f1c 100644 --- a/src/webgl/p5.Shader.js +++ b/src/webgl/p5.Shader.js @@ -317,9 +317,10 @@ p5.Shader = class { _setMatrixUniforms() { const modelMatrix = this._renderer.uModelMatrix; - const viewMatrix = this._renderer._curCamera.cameraMatrix; + const viewMatrix = this._renderer.uViewMatrix; const projectionMatrix = this._renderer.uPMatrix; const modelViewMatrix = (modelMatrix.copy()).mult(viewMatrix); + this._renderer.uMVMatrix = modelViewMatrix; const modelViewProjectionMatrix = modelViewMatrix.copy(); modelViewProjectionMatrix.mult(projectionMatrix); @@ -340,8 +341,7 @@ p5.Shader = class { this.setUniform('uNormalMatrix', this._renderer.uNMatrix.mat3); } if (this.uniforms.uCameraRotation) { - this._renderer.curMatrix.inverseTranspose(this._renderer. - _curCamera.cameraMatrix); + this._renderer.curMatrix.inverseTranspose(this._renderer.uViewMatrix); this.setUniform('uCameraRotation', this._renderer.curMatrix.mat3); } } From 9f2cdd17749c887272a3837b6039311e30b291ff Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Tue, 21 May 2024 10:15:18 -0400 Subject: [PATCH 24/24] Fix test --- test/unit/webgl/p5.RendererGL.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/unit/webgl/p5.RendererGL.js b/test/unit/webgl/p5.RendererGL.js index a71acc0fe8..ec80d71c0a 100644 --- a/test/unit/webgl/p5.RendererGL.js +++ b/test/unit/webgl/p5.RendererGL.js @@ -597,6 +597,9 @@ suite('p5.RendererGL', function() { var viewMatrixBefore = myp5._renderer.uViewMatrix.copy(); myp5.push(); + // Change view + myp5.camera(0, 0, -500); + // Change model myp5.rotateX(Math.random(0, 100)); myp5.translate(20, 100, 5); // Check if the model matrix has changed