language
stringclasses
1 value
owner
stringlengths
2
15
repo
stringlengths
2
21
sha
stringlengths
45
45
message
stringlengths
7
36.3k
path
stringlengths
1
199
patch
stringlengths
15
102k
is_multipart
bool
2 classes
Other
mrdoob
three.js
451d16f6787156568b5df26365425f71ab9fdb09.json
Fix missing return statement in copy functions
examples/jsm/nodes/utils/UVTransformNode.js
@@ -44,6 +44,8 @@ UVTransformNode.prototype.copy = function ( source ) { this.uv = source.uv; this.position = source.position; + return this; + }; UVTransformNode.prototype.toJSON = function ( meta ) {
true
Other
mrdoob
three.js
451d16f6787156568b5df26365425f71ab9fdb09.json
Fix missing return statement in copy functions
examples/jsm/nodes/utils/VelocityNode.js
@@ -152,6 +152,8 @@ VelocityNode.prototype.copy = function ( source ) { this.setParams( source.params ); + return this; + }; VelocityNode.prototype.toJSON = function ( meta ) {
true
Other
mrdoob
three.js
840057d7ccaa6ebac09a55bbf8b93c7c892d24bb.json
Fix viewports following #13593
examples/webgl_lines_fat_wireframe.html
@@ -144,9 +144,9 @@ renderer.setScissorTest( true ); - renderer.setScissor( 20, window.innerHeight - insetHeight - 20, insetWidth, insetHeight ); + renderer.setScissor( 20, 20, insetWidth, insetHeight ); - renderer.setViewport( 20, window.innerHeight - insetHeight - 20, insetWidth, insetHeight ); + renderer.setViewport( 20, 20, insetWidth, insetHeight ); camera2.position.copy( camera.position ); camera2.quaternion.copy( camera.quaternion ); @@ -217,7 +217,7 @@ } ); - gui.add( param, 'dash scale', 1, 8, 0.1 ).onChange( function ( val ) { + gui.add( param, 'dash scale', 0.5, 1, 0.1 ).onChange( function ( val ) { matLine.dashScale = val; matLineDashed.scale = val;
false
Other
mrdoob
three.js
b38125bbb4053d4667d1f5028a0bd29038bb9015.json
Upgrade dev dependencies
package-lock.json
@@ -1,22 +1,22 @@ { "name": "three", - "version": "0.105.1", + "version": "0.107.0", "lockfileVersion": 1, "requires": true, "dependencies": { "@babel/code-frame": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz", - "integrity": "sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA==", + "version": "7.5.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", + "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", "dev": true, "requires": { "@babel/highlight": "^7.0.0" } }, "@babel/highlight": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0.tgz", - "integrity": "sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz", + "integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==", "dev": true, "requires": { "chalk": "^2.0.0", @@ -36,55 +36,81 @@ "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", "dev": true }, + "@types/json-schema": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.3.tgz", + "integrity": "sha512-Il2DtDVRGDcqjDtE+rF8iqg1CArehSK84HZJCT7AMITlyXRBpuPhqGLDQMowraqqu1coEaimg4ZOqggt6L6L+A==", + "dev": true + }, "@types/node": { "version": "12.0.10", "resolved": "https://registry.npmjs.org/@types/node/-/node-12.0.10.tgz", "integrity": "sha512-LcsGbPomWsad6wmMNv7nBLw7YYYyfdYcz6xryKYQhx89c3XXan+8Q6AJ43G5XDIaklaVkK3mE4fCb0SBvMiPSQ==", "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-1.11.0.tgz", - "integrity": "sha512-mXv9ccCou89C8/4avKHuPB2WkSZyY/XcTQUXd5LFZAcLw1I3mWYVjUu6eS9Ja0QkP/ClolbcW9tb3Ov/pMdcqw==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.0.0.tgz", + "integrity": "sha512-Mo45nxTTELODdl7CgpZKJISvLb+Fu64OOO2ZFc2x8sYSnUpFrBUW3H+H/ZGYmEkfnL6VkdtOSxgdt+Av79j0sA==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "1.11.0", - "eslint-utils": "^1.3.1", + "@typescript-eslint/experimental-utils": "2.0.0", + "eslint-utils": "^1.4.0", "functional-red-black-tree": "^1.0.1", "regexpp": "^2.0.1", - "tsutils": "^3.7.0" + "tsutils": "^3.14.0" + }, + "dependencies": { + "eslint-utils": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.0.tgz", + "integrity": "sha512-7ehnzPaP5IIEh1r1tkjuIrxqhNkzUJa9z3R92tLJdZIVdWaczEhr3EbhGtsMrVxi1KeR8qA7Off6SWc5WNQqyQ==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.0.0" + } + } } }, "@typescript-eslint/experimental-utils": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-1.11.0.tgz", - "integrity": "sha512-7LbfaqF6B8oa8cp/315zxKk8FFzosRzzhF8Kn/ZRsRsnpm7Qcu25cR/9RnAQo5utZ2KIWVgaALr+ZmcbG47ruw==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.0.0.tgz", + "integrity": "sha512-XGJG6GNBXIEx/mN4eTRypN/EUmsd0VhVGQ1AG+WTgdvjHl0G8vHhVBHrd/5oI6RRYBRnedNymSYWW1HAdivtmg==", "dev": true, "requires": { - "@typescript-eslint/typescript-estree": "1.11.0", + "@types/json-schema": "^7.0.3", + "@typescript-eslint/typescript-estree": "2.0.0", "eslint-scope": "^4.0.0" } }, "@typescript-eslint/parser": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-1.11.0.tgz", - "integrity": "sha512-5xBExyXaxVyczrZvbRKEXvaTUFFq7gIM9BynXukXZE0zF3IQP/FxF4mPmmh3gJ9egafZFqByCpPTFm3dk4SY7Q==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.0.0.tgz", + "integrity": "sha512-ibyMBMr0383ZKserIsp67+WnNVoM402HKkxqXGlxEZsXtnGGurbnY90pBO3e0nBUM7chEEOcxUhgw9aPq7fEBA==", "dev": true, "requires": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "1.11.0", - "@typescript-eslint/typescript-estree": "1.11.0", + "@typescript-eslint/experimental-utils": "2.0.0", + "@typescript-eslint/typescript-estree": "2.0.0", "eslint-visitor-keys": "^1.0.0" } }, "@typescript-eslint/typescript-estree": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-1.11.0.tgz", - "integrity": "sha512-fquUHF5tAx1sM2OeRCC7wVxFd1iMELWMGCzOSmJ3pLzArj9+kRixdlC4d5MncuzXpjEqc6045p3KwM0o/3FuUA==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.0.0.tgz", + "integrity": "sha512-NXbmzA3vWrSgavymlzMWNecgNOuiMMp62MO3kI7awZRLRcsA1QrYWo6q08m++uuAGVbXH/prZi2y1AWuhSu63w==", "dev": true, "requires": { "lodash.unescape": "4.0.1", - "semver": "5.5.0" + "semver": "^6.2.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } } }, "acorn": { @@ -100,9 +126,9 @@ "dev": true }, "ajv": { - "version": "6.10.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.0.tgz", - "integrity": "sha512-nffhOpkymDECQyR0mnsUtoCE8RlX38G0rYP+wgLWFyZuUyuuojSSvi/+euOiQBIn63whYwYVIIH1TvE3tu4OEg==", + "version": "6.10.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz", + "integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==", "dev": true, "requires": { "fast-deep-equal": "^2.0.1", @@ -112,10 +138,13 @@ } }, "ansi-escapes": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz", - "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==", - "dev": true + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.2.1.tgz", + "integrity": "sha512-Cg3ymMAdN10wOk/VYfLV7KCQyv7EDirJ64500sU7n9UlmioEtDuU5Gd+hj73hXSU/ex7tHJSssmyftDdkMLO8Q==", + "dev": true, + "requires": { + "type-fest": "^0.5.2" + } }, "ansi-regex": { "version": "3.0.0", @@ -210,12 +239,12 @@ "dev": true }, "cli-cursor": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", - "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", "dev": true, "requires": { - "restore-cursor": "^2.0.0" + "restore-cursor": "^3.1.0" } }, "cli-width": { @@ -463,9 +492,9 @@ } }, "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, "end-of-stream": { @@ -499,9 +528,9 @@ "dev": true }, "eslint": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.0.1.tgz", - "integrity": "sha512-DyQRaMmORQ+JsWShYsSg4OPTjY56u1nCjAmICrE8vLWqyLKxhFXOthwMj1SA8xwfrv0CofLNVnqbfyhwCkaO0w==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.1.0.tgz", + "integrity": "sha512-QhrbdRD7ofuV09IuE2ySWBz0FyXCq0rriLTZXZqaWSI79CVtHVRdkFuFTViiqzZhkCgfOh9USpriuGN2gIpZDQ==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", @@ -510,43 +539,69 @@ "cross-spawn": "^6.0.5", "debug": "^4.0.1", "doctrine": "^3.0.0", - "eslint-scope": "^4.0.3", + "eslint-scope": "^5.0.0", "eslint-utils": "^1.3.1", "eslint-visitor-keys": "^1.0.0", "espree": "^6.0.0", "esquery": "^1.0.1", "esutils": "^2.0.2", "file-entry-cache": "^5.0.1", "functional-red-black-tree": "^1.0.1", - "glob-parent": "^3.1.0", + "glob-parent": "^5.0.0", "globals": "^11.7.0", "ignore": "^4.0.6", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", - "inquirer": "^6.2.2", + "inquirer": "^6.4.1", "is-glob": "^4.0.0", "js-yaml": "^3.13.1", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.3.0", - "lodash": "^4.17.11", + "lodash": "^4.17.14", "minimatch": "^3.0.4", "mkdirp": "^0.5.1", "natural-compare": "^1.4.0", "optionator": "^0.8.2", "progress": "^2.0.0", "regexpp": "^2.0.1", - "semver": "^5.5.1", - "strip-ansi": "^4.0.0", - "strip-json-comments": "^2.0.1", + "semver": "^6.1.2", + "strip-ansi": "^5.2.0", + "strip-json-comments": "^3.0.1", "table": "^5.2.3", - "text-table": "^0.2.0" + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" }, "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "eslint-scope": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz", + "integrity": "sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw==", + "dev": true, + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + }, "semver": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", - "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } } } }, @@ -629,9 +684,9 @@ "dev": true }, "esutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, "eventemitter3": { @@ -656,9 +711,9 @@ } }, "external-editor": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.0.3.tgz", - "integrity": "sha512-bn71H9+qWoOQKyZDo25mOMVpSmXROAsTJVVVYzrrtol3d4y+AsKjf4Iwl2Q+IuT0kFSQ1qo166UuIwqYq7mGnA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", "dev": true, "requires": { "chardet": "^0.7.0", @@ -694,9 +749,9 @@ "dev": true }, "figures": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", - "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.0.0.tgz", + "integrity": "sha512-HKri+WoWoUgr83pehn/SIgLOMZ9nAWC6dcGj26RY2R4F50u4+RTUz0RCrUlOV3nKRAICW1UGzyb+kcX2qK1S/g==", "dev": true, "requires": { "escape-string-regexp": "^1.0.5" @@ -799,24 +854,12 @@ } }, "glob-parent": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", - "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.0.0.tgz", + "integrity": "sha512-Z2RwiujPRGluePM6j699ktJYxmPpJKCfpGA13jz2hmFZC7gKetzrWvg5KN3+OsIFmydGyZ1AVwERCq1w/ZZwRg==", "dev": true, "requires": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" - }, - "dependencies": { - "is-glob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", - "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", - "dev": true, - "requires": { - "is-extglob": "^2.1.0" - } - } + "is-glob": "^4.0.1" } }, "globals": { @@ -826,17 +869,17 @@ "dev": true }, "google-closure-compiler": { - "version": "20190618.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler/-/google-closure-compiler-20190618.0.0.tgz", - "integrity": "sha512-f5zJQSWnlawuQlGo9TxcuprBGxIS5ksikj/pjDxdlRTXWt3dOKqEFA3CN8QshNYDl6oEjtO/ehiNx64fqEgkUA==", + "version": "20190729.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler/-/google-closure-compiler-20190729.0.0.tgz", + "integrity": "sha512-z+egAPJmOkEgop6ZUjrE+bIOKqbKdx57J+SAGVgq9DAQnr3yVxQ+h9b8PSLcpgzMw/Y0rMCHpM3HkCTE2Y1ePQ==", "dev": true, "requires": { "chalk": "2.x", - "google-closure-compiler-java": "^20190618.0.0", - "google-closure-compiler-js": "^20190618.0.0", - "google-closure-compiler-linux": "^20190618.0.0", - "google-closure-compiler-osx": "^20190618.0.0", - "google-closure-compiler-windows": "^20190618.0.0", + "google-closure-compiler-java": "^20190729.0.0", + "google-closure-compiler-js": "^20190729.0.0", + "google-closure-compiler-linux": "^20190729.0.0", + "google-closure-compiler-osx": "^20190729.0.0", + "google-closure-compiler-windows": "^20190729.0.0", "minimist": "1.x", "vinyl": "2.x", "vinyl-sourcemaps-apply": "^0.2.0" @@ -851,35 +894,35 @@ } }, "google-closure-compiler-java": { - "version": "20190618.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-java/-/google-closure-compiler-java-20190618.0.0.tgz", - "integrity": "sha512-y6gAyJHMH5k2SM0qj/lyErEjmFGMvcT3glcx5Lsrl99CGwImJY0gDi+Cy9S0pczZvLG+wUW33AEfEW9MtdRZ6A==", + "version": "20190729.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-java/-/google-closure-compiler-java-20190729.0.0.tgz", + "integrity": "sha512-SGStZiyasN31tlmKUMMzCNRXTZqeij5N7iEeHSIGOsUdlKw5Zj8VPbaqbCcHvfgpQaUbn29zCTgTYiYFJRkbwA==", "dev": true }, "google-closure-compiler-js": { - "version": "20190618.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-js/-/google-closure-compiler-js-20190618.0.0.tgz", - "integrity": "sha512-Xc/84uN00GLUzRwWx25Lg11VuSTz/1odWy0d+pM3F/26fXqi16ZhhkVoe6VVFklSSMVDyGTPAH0ZkyfZhinKhA==", + "version": "20190729.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-js/-/google-closure-compiler-js-20190729.0.0.tgz", + "integrity": "sha512-ZDJRK3eiNfKLsO1+uVxHnvB8RTQMLHlJNKouMBcPzPNOAurEFRboHf5nx/0llO+MXVWZDIPhxpbuuD3WnQsprA==", "dev": true }, "google-closure-compiler-linux": { - "version": "20190618.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-linux/-/google-closure-compiler-linux-20190618.0.0.tgz", - "integrity": "sha512-idWJ/sFmOSYfCmDbCVMcaBX2NCUCxukjt2UzT5PJmpoVLmJuwwoVbpQZVfvgRvEH4bLzvvcvJRfn5nIiODjjaQ==", + "version": "20190729.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-linux/-/google-closure-compiler-linux-20190729.0.0.tgz", + "integrity": "sha512-W4TRrQ1+FrCFu3yn4M0JTWTJCFsqLlBjkliB/xLFuWb5E7XQ8Xe/sPtkmeNzCo+ftd6B/KD7acaH2oMU0brMag==", "dev": true, "optional": true }, "google-closure-compiler-osx": { - "version": "20190618.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-osx/-/google-closure-compiler-osx-20190618.0.0.tgz", - "integrity": "sha512-OzXMW+hKq76NJt9MIRQhV7pHTzHISCXtg+LZUPcqNT+V/tcvOlrSaflokmvyJPzEVk889QArYp8JgZ7mqHuY5g==", + "version": "20190729.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-osx/-/google-closure-compiler-osx-20190729.0.0.tgz", + "integrity": "sha512-g3mLUVFD85nRwVyl8X6ywZ14YFP6fo+kXdIvrBGxxUkUU8VbeIgr6GlgtAUS0eZ0WVs2hr5w6kjk7+5kyeBSJg==", "dev": true, "optional": true }, "google-closure-compiler-windows": { - "version": "20190618.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-windows/-/google-closure-compiler-windows-20190618.0.0.tgz", - "integrity": "sha512-2qzY/fQneEg+zFvRGoNeJkAY6VU5OcmBT37l+xTBGQvy/AauCLWltSGcOYNEi7Qd3OEBVIcAJ+CzNOV9s3jfwA==", + "version": "20190729.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-windows/-/google-closure-compiler-windows-20190729.0.0.tgz", + "integrity": "sha512-tzFfu2ixOoAWJUcCsagNFE4o0xHV+LI4cD3AmI36ll2e0NW1aUjDPhiG5TSfAnMIvZwgkikG5tqnPnk8ljauAA==", "dev": true, "optional": true }, @@ -958,9 +1001,9 @@ "dev": true }, "import-fresh": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.0.0.tgz", - "integrity": "sha512-pOnA9tfM3Uwics+SaBLCNyZZZbK+4PTu0OPZtLlMIrv17EdBoC15S9Kn8ckJ9TZTyKb3ywNE5y1yeDxxGA7nTQ==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.1.0.tgz", + "integrity": "sha512-PpuksHKGt8rXfWEr9m9EHIpgyyaltBy8+eF6GJM0QCAxMgxCfucMF3mjecK2QsJr0amJW7gTqh5/wht0z2UhEQ==", "dev": true, "requires": { "parent-module": "^1.0.0", @@ -990,22 +1033,22 @@ "dev": true }, "inquirer": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.4.1.tgz", - "integrity": "sha512-/Jw+qPZx4EDYsaT6uz7F4GJRNFMRdKNeUZw3ZnKV8lyuUgz/YWRCSUAJMZSVhSq4Ec0R2oYnyi6b3d4JXcL5Nw==", + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.5.1.tgz", + "integrity": "sha512-uxNHBeQhRXIoHWTSNYUFhQVrHYFThIt6IVo2fFmSe8aBwdR3/w6b58hJpiL/fMukFkvGzjg+hSxFtwvVmKZmXw==", "dev": true, "requires": { - "ansi-escapes": "^3.2.0", + "ansi-escapes": "^4.2.1", "chalk": "^2.4.2", - "cli-cursor": "^2.1.0", + "cli-cursor": "^3.1.0", "cli-width": "^2.0.0", "external-editor": "^3.0.3", - "figures": "^2.0.0", - "lodash": "^4.17.11", - "mute-stream": "0.0.7", + "figures": "^3.0.0", + "lodash": "^4.17.15", + "mute-stream": "0.0.8", "run-async": "^2.2.0", "rxjs": "^6.4.0", - "string-width": "^2.1.0", + "string-width": "^4.1.0", "strip-ansi": "^5.1.0", "through": "^2.3.6" }, @@ -1016,6 +1059,29 @@ "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", "dev": true }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "dev": true + }, + "string-width": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.1.0.tgz", + "integrity": "sha512-NrX+1dVVh+6Y9dnQ19pR0pP4FiEIlUvdTGn8pw6CKTNq5sgib2nIhmUNT5TAmhWmvKr3WcxBcP3E8nWezuipuQ==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^5.2.0" + } + }, "strip-ansi": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", @@ -1214,7 +1280,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { @@ -1228,9 +1294,9 @@ "dev": true }, "mute-stream": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", - "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dev": true }, "natural-compare": { @@ -1288,20 +1354,12 @@ } }, "onetime": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", - "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", + "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", "dev": true, "requires": { - "mimic-fn": "^1.0.0" - }, - "dependencies": { - "mimic-fn": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", - "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", - "dev": true - } + "mimic-fn": "^2.1.0" } }, "opener": { @@ -1355,7 +1413,7 @@ }, "os-tmpdir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "resolved": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, @@ -1420,12 +1478,6 @@ "json-parse-better-errors": "^1.0.1" } }, - "path-dirname": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", - "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=", - "dev": true - }, "path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", @@ -1434,7 +1486,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, @@ -1622,12 +1674,12 @@ "dev": true }, "restore-cursor": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", - "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", "dev": true, "requires": { - "onetime": "^2.0.0", + "onetime": "^5.1.0", "signal-exit": "^3.0.2" } }, @@ -1756,7 +1808,7 @@ "spdx-expression-parse": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", - "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", + "integrity": "sha1-meEZt6XaAOBUkcn6M4t5BII7QdA=", "dev": true, "requires": { "spdx-exceptions": "^2.1.0", @@ -1810,9 +1862,9 @@ "dev": true }, "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", + "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==", "dev": true }, "supports-color": { @@ -1833,13 +1885,13 @@ } }, "table": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/table/-/table-5.4.1.tgz", - "integrity": "sha512-E6CK1/pZe2N75rGZQotFOdmzWQ1AILtgYbMAbAjvms0S1l5IDB47zG3nCnFGB/w+7nB3vKofbLXCH7HPBo864w==", + "version": "5.4.6", + "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", + "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==", "dev": true, "requires": { - "ajv": "^6.9.1", - "lodash": "^4.17.11", + "ajv": "^6.10.2", + "lodash": "^4.17.14", "slice-ansi": "^2.1.0", "string-width": "^3.0.0" }, @@ -1850,6 +1902,12 @@ "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", "dev": true }, + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, "string-width": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", @@ -1880,7 +1938,7 @@ }, "through": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, @@ -1906,9 +1964,9 @@ "dev": true }, "tsutils": { - "version": "3.14.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.14.0.tgz", - "integrity": "sha512-SmzGbB0l+8I0QwsPgjooFRaRvHLBLNYM8SeQ0k6rtNDru5sCGeLJcZdwilNndN+GysuFjF5EIYgN8GfFG6UeUw==", + "version": "3.17.1", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz", + "integrity": "sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==", "dev": true, "requires": { "tslib": "^1.8.1" @@ -1923,6 +1981,12 @@ "prelude-ls": "~1.1.2" } }, + "type-fest": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.5.2.tgz", + "integrity": "sha512-DWkS49EQKVX//Tbupb9TFa19c7+MK1XmzkrZUR8TAktmE/DizXoaoJV6TZ/tSIPXipqNiRI6CyAe7x69Jb6RSw==", + "dev": true + }, "typescript": { "version": "3.5.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.5.2.tgz", @@ -1959,6 +2023,12 @@ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, + "v8-compile-cache": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz", + "integrity": "sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g==", + "dev": true + }, "validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", @@ -2015,7 +2085,7 @@ }, "wrap-ansi": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": {
true
Other
mrdoob
three.js
b38125bbb4053d4667d1f5028a0bd29038bb9015.json
Upgrade dev dependencies
package.json
@@ -67,17 +67,17 @@ }, "homepage": "https://threejs.org/", "devDependencies": { - "@typescript-eslint/eslint-plugin": "^1.11.0", - "@typescript-eslint/parser": "^1.11.0", + "@typescript-eslint/eslint-plugin": "^2.0.0", + "@typescript-eslint/parser": "^2.0.0", "concurrently": "^4.1.1", - "eslint": "^6.0.1", + "eslint": "^6.1.0", "eslint-config-mdcs": "^4.2.3", "eslint-plugin-html": "^6.0.0", "failonlyreporter": "^1.0.0", - "google-closure-compiler": "20190618.0.0", + "google-closure-compiler": "20190729.0.0", "http-server": "^0.11.1", "qunit": "^2.9.2", - "rollup": "^1.16.2", + "rollup": "^1.19.4", "typescript": "^3.5.2" }, "jspm": {
true
Other
mrdoob
three.js
f5110b235bfb3b1473809a1d3880434daaae9b04.json
add clearCoatNormal context only to physical
src/renderers/shaders/ShaderChunk/common.glsl.js
@@ -39,7 +39,9 @@ struct GeometricContext { vec3 position; vec3 normal; vec3 viewDir; +#ifdef PHYSICAL vec3 clearCoatNormal; +#endif }; vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
false
Other
mrdoob
three.js
a19b279b8236e215c6f31d0b8c2ba18d3348e205.json
fix possible issue reflectnode with vertex shader
examples/jsm/nodes/accessors/ReflectNode.js
@@ -3,6 +3,8 @@ */ import { TempNode } from '../core/TempNode.js'; +import { PositionNode } from './PositionNode.js'; +import { NormalNode } from './NormalNode.js'; function ReflectNode( scope ) { @@ -44,7 +46,10 @@ ReflectNode.prototype.generate = function ( builder, output ) { case ReflectNode.VECTOR: - builder.addNodeCode( 'vec3 reflectVec = inverseTransformDirection( reflect( -normalize( vViewPosition ), normal ), viewMatrix );' ); + var viewNormal = new NormalNode().build( builder, 'v3' ); + var viewPosition = new PositionNode( PositionNode.VIEW ).build( builder, 'v3' ); + + builder.addNodeCode( 'vec3 reflectVec = inverseTransformDirection( reflect( -normalize( ' + viewPosition + ' ), ' + viewNormal + ' ), viewMatrix );' ); result = 'reflectVec';
false
Other
mrdoob
three.js
2a5e8f901d52c2f9afc2599f989609912eb75c09.json
fix vertex normal
examples/jsm/nodes/accessors/NormalNode.js
@@ -36,7 +36,8 @@ NormalNode.prototype.generate = function ( builder, output ) { case NormalNode.LOCAL: - result = 'geometryNormal'; + if ( builder.isShader( 'vertex' ) ) result = 'objectNormal'; + else result = 'geometryNormal'; break;
false
Other
mrdoob
three.js
29405750b95ea9d318ea3e90051966a1ea04ae1e.json
Add error if camera is null
src/objects/Sprite.js
@@ -60,6 +60,12 @@ Sprite.prototype = Object.assign( Object.create( Object3D.prototype ), { raycast: function ( raycaster, intersects ) { + if ( raycaster.camera === null ) { + + console.error( 'THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.' ); + + } + if ( _uvC === undefined ) { _intersectPoint = new Vector3();
false
Other
mrdoob
three.js
4f88d97af577e4b4f51e1943782e0380637e5233.json
add binding unittest
test/unit/src/math/Euler.tests.js
@@ -425,17 +425,22 @@ export default QUnit.module( 'Maths', () => { QUnit.test( "_onChangeCallback", ( assert ) => { + var b = false; + var a = new Euler( 11, 12, 13, "XYZ" ); var f = function () { - var b = true; + b = true; + assert.ok( a === this, "Passed!" ); }; - var a = new Euler( 11, 12, 13, "XYZ" ); a._onChangeCallback = f; assert.ok( a._onChangeCallback === f, "Passed!" ); + a._onChangeCallback(); + assert.ok( b, "Passed!" ); + } ); // OTHERS
true
Other
mrdoob
three.js
4f88d97af577e4b4f51e1943782e0380637e5233.json
add binding unittest
test/unit/src/math/Quaternion.tests.js
@@ -733,13 +733,14 @@ export default QUnit.module( 'Maths', () => { QUnit.test( "_onChangeCallback", ( assert ) => { var b = false; + var a = new Quaternion( 11, 12, 13, 1 ); var f = function () { b = true; + assert.ok( a === this, "Passed!" ); }; - var a = new Quaternion( 11, 12, 13, 1 ); a._onChangeCallback = f; assert.ok( a._onChangeCallback === f, "Passed!" );
true
Other
mrdoob
three.js
8f5415d65769b966192b7123e46cc81467a6adad.json
Wrap the Project child elements in Panel
editor/js/Sidebar.Project.js
@@ -19,8 +19,14 @@ Sidebar.Project = function ( editor ) { var container = new UI.Panel(); container.setBorderTop( '0' ); + container.setPadding( '0' ); container.setPaddingTop( '20px' ); + var projectsettings = new UI.Panel(); + projectsettings.setBorderTop( '0' ); + + container.add( projectsettings ); + // Title var titleRow = new UI.Row(); @@ -33,7 +39,7 @@ Sidebar.Project = function ( editor ) { titleRow.add( new UI.Text( strings.getKey( 'sidebar/project/title' ) ).setWidth( '90px' ) ); titleRow.add( title ); - container.add( titleRow ); + projectsettings.add( titleRow ); // Editable @@ -47,7 +53,7 @@ Sidebar.Project = function ( editor ) { editableRow.add( new UI.Text( strings.getKey( 'sidebar/project/editable' ) ).setWidth( '90px' ) ); editableRow.add( editable ); - container.add( editableRow ); + projectsettings.add( editableRow ); // VR @@ -61,7 +67,7 @@ Sidebar.Project = function ( editor ) { vrRow.add( new UI.Text( strings.getKey( 'sidebar/project/vr' ) ).setWidth( '90px' ) ); vrRow.add( vr ); - container.add( vrRow ); + projectsettings.add( vrRow ); // Renderer @@ -89,7 +95,7 @@ Sidebar.Project = function ( editor ) { rendererTypeRow.add( new UI.Text( strings.getKey( 'sidebar/project/renderer' ) ).setWidth( '90px' ) ); rendererTypeRow.add( rendererType ); - container.add( rendererTypeRow ); + projectsettings.add( rendererTypeRow ); if ( config.getKey( 'project/renderer' ) !== undefined ) { @@ -119,7 +125,7 @@ Sidebar.Project = function ( editor ) { } ); rendererPropertiesRow.add( rendererShadows ); - container.add( rendererPropertiesRow ); + projectsettings.add( rendererPropertiesRow ); //
false
Other
mrdoob
three.js
0f10beed950615f2a4430b8c8d317744143bfd93.json
Remove redundant styling for Panel
editor/css/dark.css
@@ -273,7 +273,6 @@ select { .Panel { color: #888; - border-top: 1px solid #222; } /* */
true
Other
mrdoob
three.js
0f10beed950615f2a4430b8c8d317744143bfd93.json
Remove redundant styling for Panel
editor/css/light.css
@@ -267,7 +267,6 @@ select { .Panel { color: #888; - border-top: 1px solid #ccc; } /* */
true
Other
mrdoob
three.js
685cc7d7571b7bf9a5c544ca887318ba16e710d9.json
Fix How-to-use-post-processing.html typo
docs/manual/en/introduction/How-to-use-post-processing.html
@@ -24,7 +24,7 @@ <h1>How to use post-processing</h1> <h2>Workflow</h2> <p> - The first step in the process is to import all necessary files from the examples directory. The guide assumes your are using the official + The first step in the process is to import all necessary files from the examples directory. The guide assumes you are using the official [link:https://www.npmjs.com/package/three npm package] of three.js. For our basic demo in this guide we need the following files. </p>
false
Other
mrdoob
three.js
b95ff4881678e6aca074c5377464a7a6845dde4a.json
Remove outdated ref to how Matrix4.compose works
docs/api/en/math/Matrix4.html
@@ -125,10 +125,7 @@ <h3>[method:Matrix4 clone]()</h3> <h3>[method:this compose]( [param:Vector3 position], [param:Quaternion quaternion], [param:Vector3 scale] )</h3> <p> Sets this matrix to the transformation composed of [page:Vector3 position], - [page:Quaternion quaternion] and [page:Vector3 scale]. Internally this calls - [page:.makeRotationFromQuaternion makeRotationFromQuaternion]( [page:Quaternion quaternion] ) - followed by [page:.scale scale]( [page:Vector3 scale] ), then finally - [page:.setPosition setPosition]( [page:Vector3 position] ). + [page:Quaternion quaternion] and [page:Vector3 scale]. </p> <h3>[method:this copy]( [param:Matrix4 m] )</h3>
false
Other
mrdoob
three.js
9c27acebf97605027a38ea06d0262a3523396100.json
fix import, taphos nomore :'(
src/renderers/webgl/WebGLMaterials.js
@@ -1,7 +1,7 @@ -import { BackSide } from "../../constants"; +import { BackSide } from "../../constants.js"; /** - * @author taphos / https://github.com/taphos + * @author mrdoob / http://mrdoob.com/ * * This is a helper which deals with webgl specific logic of builtin materials * i.e. uniforms refresh before material is being rendered
false
Other
mrdoob
three.js
34c999bff92d7c572eaeaee549eed5ce668bdef9.json
get first intersection not the last one
examples/js/controls/TransformControls.js
@@ -56,7 +56,7 @@ THREE.TransformControls = function ( camera, domElement ) { var allIntersections = raycaster.intersectObject( object, true ); - for ( var i = allIntersections.length; i --; ) { + for ( var i = 0; i < allIntersections.length; i ++ ) { if ( allIntersections[ i ].object.visible || includeInvisible ) {
true
Other
mrdoob
three.js
34c999bff92d7c572eaeaee549eed5ce668bdef9.json
get first intersection not the last one
examples/jsm/controls/TransformControls.js
@@ -79,7 +79,7 @@ var TransformControls = function ( camera, domElement ) { var allIntersections = raycaster.intersectObject( object, true ); - for ( var i = allIntersections.length; i --; ) { + for ( var i = 0; i < allIntersections.length; i ++ ) { if ( allIntersections[ i ].object.visible || includeInvisible ) {
true
Other
mrdoob
three.js
de5143943cadc49297fc61b0e271364b1dbaaaac.json
fix materials initialization
src/renderers/WebGLRenderer.js
@@ -282,7 +282,7 @@ function WebGLRenderer( parameters ) { objects = new WebGLObjects( _gl, geometries, attributes, info ); morphtargets = new WebGLMorphtargets( _gl ); programCache = new WebGLPrograms( _this, extensions, capabilities ); - materials = new WebGLMaterials(); + materials = new WebGLMaterials( properties ); renderLists = new WebGLRenderLists(); renderStates = new WebGLRenderStates();
false
Other
mrdoob
three.js
4ee8bbe7caed69104d90db30303051002407e511.json
add css stylesheet support for svg add "opacity" support
examples/js/loaders/SVGLoader.js
@@ -51,6 +51,10 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype case 'svg': break; + case 'style': + parseCSSStylesheet( node ); + break; + case 'g': style = parseStyle( node, style ); break; @@ -91,7 +95,7 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype break; default: - console.log( node ); + // console.log( node ); } @@ -103,6 +107,8 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype } + path.opacity = style.opacity || 1.0; + transformPath( path, currentTransform ); paths.push( path ); @@ -558,6 +564,34 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype } + function parseCSSStylesheet( node ) { + + if ( !node.sheet || !node.sheet.cssRules || !node.sheet.cssRules.length ) return; + + for ( var i = 0; i < node.sheet.cssRules.length; i ++ ) { + + var stylesheet = node.sheet.cssRules[ i ]; + + if ( stylesheet.type !== 1 ) continue; + + var selectorList = stylesheet.selectorText + .split( /,/gm ) + .filter( Boolean ) + .map( i => i.trim() ); + + for ( var j = 0; j < selectorList.length; j ++ ) { + + stylesheets[ selectorList[ j ] ] = Object.assign( + stylesheets[ selectorList[ j ] ] || {}, + stylesheet.style + ); + + } + + } + + } + /** * https://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes * https://mortoray.com/2017/02/16/rendering-an-svg-elliptical-arc-as-bezier-curves/ Appendix: Endpoint to center arc conversion @@ -794,6 +828,29 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype style = Object.assign( {}, style ); // clone style + var stylesheetStyles = {}; + + if ( node.hasAttribute( 'class' ) ) { + + var classSelectors = node.getAttribute( 'class' ) + .split( /\s/ ) + .filter( Boolean ) + .map( i => i.trim() ); + + for ( var i = 0; i < classSelectors.length; i ++ ) { + + stylesheetStyles = Object.assign( stylesheetStyles, stylesheets[ '.' + classSelectors[ i ] ] ); + + } + + } + + if ( node.hasAttribute( 'id' ) ) { + + stylesheetStyles = Object.assign( stylesheetStyles, stylesheets[ '#' + node.getAttribute( 'id' ) ] ); + + } + function addStyle( svgName, jsName, adjustFunction ) { if ( adjustFunction === undefined ) adjustFunction = function copy( v ) { @@ -803,6 +860,7 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype }; if ( node.hasAttribute( svgName ) ) style[ jsName ] = adjustFunction( node.getAttribute( svgName ) ); + if ( stylesheetStyles[ svgName ] ) style[ jsName ] = adjustFunction( stylesheetStyles[ svgName ] ); if ( node.style && node.style[ svgName ] !== '' ) style[ jsName ] = adjustFunction( node.style[ svgName ] ); } @@ -821,6 +879,7 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype addStyle( 'fill', 'fill' ); addStyle( 'fill-opacity', 'fillOpacity', clamp ); + addStyle( 'opacity', 'opacity', clamp ); addStyle( 'stroke', 'stroke' ); addStyle( 'stroke-opacity', 'strokeOpacity', clamp ); addStyle( 'stroke-width', 'strokeWidth', positive ); @@ -1233,6 +1292,7 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype // var paths = []; + var stylesheets = {}; var transformStack = [];
true
Other
mrdoob
three.js
4ee8bbe7caed69104d90db30303051002407e511.json
add css stylesheet support for svg add "opacity" support
src/extras/core/ShapePath.js
@@ -13,6 +13,7 @@ function ShapePath() { this.type = 'ShapePath'; this.color = new Color(); + this.opacity = 1.0; this.subPaths = []; this.currentPath = null;
true
Other
mrdoob
three.js
c04487106911dcea86e806e5e8dd01b87ddeb170.json
Fix winding order
examples/webgl_buffergeometry_instancing_interleaved.html
@@ -101,14 +101,14 @@ geometry.setAttribute( 'uv', uvs ); var indices = new Uint16Array( [ - 0, 1, 2, - 2, 1, 3, - 4, 5, 6, - 6, 5, 7, - 8, 9, 10, - 10, 9, 11, - 12, 13, 14, - 14, 13, 15, + 0, 2, 1, + 2, 3, 1, + 4, 6, 5, + 6, 7, 5, + 8, 10, 9, + 10, 11, 9, + 12, 14, 13, + 14, 15, 13, 16, 17, 18, 18, 17, 19, 20, 21, 22, @@ -121,7 +121,6 @@ var material = new THREE.MeshBasicMaterial(); material.map = new THREE.TextureLoader().load( 'textures/crate.gif' ); - material.side = THREE.DoubleSide; // per instance data
false
Other
mrdoob
three.js
a0535a3e1b4eeaacbf22f8bc7c9673efc885c785.json
Fix TransformControl zoom for OrthographicCamera
examples/js/controls/TransformControls.js
@@ -1166,6 +1166,10 @@ THREE.TransformControlsGizmo = function () { handle.position.copy( this.worldPosition ); var eyeDistance = this.worldPosition.distanceTo( this.cameraPosition ); + // Orthographic camera zoom doesn't depend on eyeDistance, but on camera zoom factor. + if (this.camera.type == "OrthographicCamera") { + eyeDistance = 1000 / this.camera.zoom; + } handle.scale.set( 1, 1, 1 ).multiplyScalar( eyeDistance * this.size / 7 ); // TODO: simplify helpers and consider decoupling from gizmo
true
Other
mrdoob
three.js
a0535a3e1b4eeaacbf22f8bc7c9673efc885c785.json
Fix TransformControl zoom for OrthographicCamera
examples/jsm/controls/TransformControls.js
@@ -1189,6 +1189,10 @@ var TransformControlsGizmo = function () { handle.position.copy( this.worldPosition ); var eyeDistance = this.worldPosition.distanceTo( this.cameraPosition ); + // Orthographic camera zoom doesn't depend on eyeDistance, but on camera zoom factor. + if (this.camera.type == "OrthographicCamera") { + eyeDistance = 1000 / this.camera.zoom; + } handle.scale.set( 1, 1, 1 ).multiplyScalar( eyeDistance * this.size / 7 ); // TODO: simplify helpers and consider decoupling from gizmo
true
Other
mrdoob
three.js
789268fde43aeab6adbeafb874bd4cbb1c218b71.json
Fix lint errors
src/renderers/shaders/UniformsUtils.d.ts
@@ -5,5 +5,5 @@ export namespace UniformsUtils { export { mergeUniforms as merge, cloneUniforms as clone, - } + }; }
true
Other
mrdoob
three.js
789268fde43aeab6adbeafb874bd4cbb1c218b71.json
Fix lint errors
src/renderers/webgl/WebGLRenderStates.d.ts
@@ -4,18 +4,22 @@ import { Light } from '../../lights/Light'; import { WebGLLights } from './WebGLLights'; interface WebGLRenderState { - init(): void; - state: { - lightsArray: Light[]; + + init(): void; + state: { + lightsArray: Light[]; shadowsArray: Light[]; lights: WebGLLights; - }; - setupLights( camera: Camera ): void; - pushLight( light: Light ): void; - pushShadow( shadowLight: Light ): void; + }; + setupLights( camera: Camera ): void; + pushLight( light: Light ): void; + pushShadow( shadowLight: Light ): void; + } export class WebGLRenderStates { - get( scene: Scene, camera: Camera ): WebGLRenderState; - dispose(): void; -} \ No newline at end of file + + get( scene: Scene, camera: Camera ): WebGLRenderState; + dispose(): void; + +}
true
Other
mrdoob
three.js
789268fde43aeab6adbeafb874bd4cbb1c218b71.json
Fix lint errors
src/renderers/webvr/WebXRManager.d.ts
@@ -1,15 +1,19 @@ import { Group } from '../../objects/Group'; import { Camera } from '../../cameras/Camera'; -export interface WebXRManager { +export class WebXRManager { + + constructor( renderer: any, gl: WebGLRenderingContext ); + enabled: boolean; - getController( id: number ): Group; - setFramebufferScaleFactor( value: number ): void; - setReferenceSpaceType( value: string ): void; - getSession(): any; - setSession( value: any ): void; - getCamera( camera: Camera ): Camera; - isPresenting: () => boolean; - setAnimationLoop( callback?: Function ): void; - dispose(): void; + getController( id: number ): Group; + setFramebufferScaleFactor( value: number ): void; + setReferenceSpaceType( value: string ): void; + getSession(): any; + setSession( value: any ): void; + getCamera( camera: Camera ): Camera; + isPresenting: () => boolean; + setAnimationLoop( callback?: Function ): void; + dispose(): void; + }
true
Other
mrdoob
three.js
06c46eba9341e88dc70da69d91e0463edc561af2.json
change threshold to 0.9999999
src/math/Euler.js
@@ -147,7 +147,7 @@ Object.assign( Euler.prototype, { this._y = Math.asin( clamp( m13, - 1, 1 ) ); - if ( Math.abs( m13 ) < 1 ) { + if ( Math.abs( m13 ) < 0.9999999 ) { this._x = Math.atan2( - m23, m33 ); this._z = Math.atan2( - m12, m11 ); @@ -163,7 +163,7 @@ Object.assign( Euler.prototype, { this._x = Math.asin( - clamp( m23, - 1, 1 ) ); - if ( Math.abs( m23 ) < 1 ) { + if ( Math.abs( m23 ) < 0.9999999 ) { this._y = Math.atan2( m13, m33 ); this._z = Math.atan2( m21, m22 ); @@ -179,7 +179,7 @@ Object.assign( Euler.prototype, { this._x = Math.asin( clamp( m32, - 1, 1 ) ); - if ( Math.abs( m32 ) < 1 ) { + if ( Math.abs( m32 ) < 0.9999999 ) { this._y = Math.atan2( - m31, m33 ); this._z = Math.atan2( - m12, m22 ); @@ -195,7 +195,7 @@ Object.assign( Euler.prototype, { this._y = Math.asin( - clamp( m31, - 1, 1 ) ); - if ( Math.abs( m31 ) < 1 ) { + if ( Math.abs( m31 ) < 0.9999999 ) { this._x = Math.atan2( m32, m33 ); this._z = Math.atan2( m21, m11 ); @@ -211,7 +211,7 @@ Object.assign( Euler.prototype, { this._z = Math.asin( clamp( m21, - 1, 1 ) ); - if ( Math.abs( m21 ) < 1 ) { + if ( Math.abs( m21 ) < 0.9999999 ) { this._x = Math.atan2( - m23, m22 ); this._y = Math.atan2( - m31, m11 ); @@ -227,7 +227,7 @@ Object.assign( Euler.prototype, { this._z = Math.asin( - clamp( m12, - 1, 1 ) ); - if ( Math.abs( m12 ) < 1 ) { + if ( Math.abs( m12 ) < 0.9999999 ) { this._x = Math.atan2( m32, m22 ); this._y = Math.atan2( m13, m11 );
false
Other
mrdoob
three.js
7b23555d862502aa7cb603ad51c80e30de445b64.json
Add missing instanced comment to example
examples/webgl_buffergeometry_instancing_lambert.html
@@ -84,6 +84,7 @@ ` #define LAMBERT + // instanced attribute vec3 instanceOffset; attribute vec3 instanceColor; attribute float instanceScale; @@ -128,8 +129,8 @@ #include <defaultnormal_vertex> #include <begin_vertex> - // position instanced + // position instanced transformed *= instanceScale; transformed = transformed + instanceOffset;
false
Other
mrdoob
three.js
4ed1865f6cfe813ea8088eb52d5ca5849e26ca4d.json
Remove unnecessary INSTANCED define
examples/webgl_buffergeometry_instancing_lambert.html
@@ -38,12 +38,8 @@ var customDepthVertexShader = ` // instanced - #ifdef INSTANCED - - attribute vec3 instanceOffset; - attribute float instanceScale; - - #endif + attribute vec3 instanceOffset; + attribute float instanceScale; #include <common> #include <uv_pars_vertex> @@ -70,12 +66,8 @@ #include <begin_vertex> // instanced - #ifdef INSTANCED - - transformed *= instanceScale; - transformed = transformed + instanceOffset; - - #endif + transformed *= instanceScale; + transformed = transformed + instanceOffset; #include <morphtarget_vertex> #include <skinning_vertex> @@ -92,11 +84,9 @@ ` #define LAMBERT - #ifdef INSTANCED - attribute vec3 instanceOffset; - attribute vec3 instanceColor; - attribute float instanceScale; - #endif + attribute vec3 instanceOffset; + attribute vec3 instanceColor; + attribute float instanceScale; varying vec3 vLightFront; varying vec3 vIndirectFront; @@ -127,10 +117,8 @@ #include <color_vertex> // vertex colors instanced - #ifdef INSTANCED - #ifdef USE_COLOR - vColor.xyz = instanceColor.xyz; - #endif + #ifdef USE_COLOR + vColor.xyz = instanceColor.xyz; #endif #include <beginnormal_vertex> @@ -142,10 +130,8 @@ #include <begin_vertex> // position instanced - #ifdef INSTANCED - transformed *= instanceScale; - transformed = transformed + instanceOffset; - #endif + transformed *= instanceScale; + transformed = transformed + instanceOffset; #include <morphtarget_vertex> #include <skinning_vertex> @@ -284,9 +270,6 @@ }; - material.defines = material.defines || {}; - material.defines[ 'INSTANCED' ] = ""; - // custom depth material - required for instanced shadows @@ -299,8 +282,6 @@ }; customDepthMaterial.depthPacking = THREE.RGBADepthPacking; - customDepthMaterial.defines = material.defines || {}; - customDepthMaterial.defines[ 'INSTANCED' ] = ""; //
false
Other
mrdoob
three.js
49bb5d1fb8ac3baf8ed27dc3a56c7a6c2f94158c.json
Set quaternion instead of rotation
examples/css3d_molecules.html
@@ -425,7 +425,7 @@ var objMatrix = new THREE.Matrix4().makeRotationAxis( axis.normalize(), radians ); object.matrix = objMatrix; - object.rotation.setFromRotationMatrix( object.matrix, object.rotation.order ); + object.quaternion.setFromRotationMatrix( object.matrix ); object.matrixAutoUpdate = false; object.updateMatrix(); @@ -445,7 +445,7 @@ joint.position.lerp( end, 0.5 ); joint.matrix.copy( objMatrix ); - joint.rotation.setFromRotationMatrix( joint.matrix, joint.rotation.order ); + joint.quaternion.setFromRotationMatrix( joint.matrix ); joint.matrixAutoUpdate = false; joint.updateMatrix();
true
Other
mrdoob
three.js
49bb5d1fb8ac3baf8ed27dc3a56c7a6c2f94158c.json
Set quaternion instead of rotation
examples/webgl_geometry_extrude_splines.html
@@ -323,7 +323,7 @@ if ( ! params.lookAhead ) lookAt.copy( pos ).add( dir ); splineCamera.matrix.lookAt( splineCamera.position, lookAt, normal ); - splineCamera.rotation.setFromRotationMatrix( splineCamera.matrix, splineCamera.rotation.order ); + splineCamera.quaternion.setFromRotationMatrix( splineCamera.matrix ); cameraHelper.update();
true
Other
mrdoob
three.js
d42d3e44b86df6d5bd3575fb65ae792cda4d1b2e.json
move example to jsfiddle
examples/gimbal_lock.html
@@ -1,172 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> - <head> - <title>three.js webgl - gimbal lock</title> - <meta charset="utf-8" /> - <meta - name="viewport" - content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" - /> - <style> - body { - color: #000; - font-family: Monospace; - font-size: 13px; - text-align: center; - font-weight: bold; - - background-color: #fff; - margin: 0px; - overflow: hidden; - } - - #info { - color: #000; - position: absolute; - top: 0px; - width: 100%; - padding: 5px; - } - - a { - color: red; - } - </style> - </head> - - <body> - <div id="container"></div> - <div id="info"> - <a href="http://threejs.org" target="_blank">three.js</a> - gimbal lock - example - <p> - The object slowly rotates back and forth; one of its Euler angle - components is close to pi/2. - </p> - <p> - Every frame, with probability 0.5, the orientation is transformed into a - quaternion then back into Euler angles. - </p> - <p> - This causes an observable glitch when the calculation is imprecise due - to gimbal lock. - </p> - </div> - - <script src="../build/three.js"></script> - - <script src="js/controls/OrbitControls.js"></script> - - <script src="js/libs/stats.min.js"></script> - - <script> - var stats; - - var camera, controls, scene, renderer, mesh; - - init(); - render(); // remove when using next line for animation loop (requestAnimationFrame) - animate(); - - function init() { - scene = new THREE.Scene(); - scene.fog = new THREE.FogExp2(0xcccccc, 0.002); - - renderer = new THREE.WebGLRenderer(); - renderer.setClearColor(scene.fog.color); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - - var container = document.getElementById('container'); - container.appendChild(renderer.domElement); - - camera = new THREE.PerspectiveCamera( - 60, - window.innerWidth / window.innerHeight, - 1, - 1000 - ); - camera.position.copy(new THREE.Vector3(-10, -22, 17)); - camera.rotation.copy(new THREE.Euler(0.9, -0.3, 0.4, 'XYZ')); - - controls = new THREE.OrbitControls(camera, renderer.domElement); - controls.addEventListener('change', render); // remove when using animation loop - // enable animation loop when using damping or autorotation - //controls.enableDamping = true; - //controls.dampingFactor = 0.25; - controls.enableZoom = false; - - // world - - var geometry = new THREE.CylinderGeometry(0, 10, 30, 16, 10); - var material = new THREE.MeshPhongMaterial({ - color: 0xffffff, - shading: THREE.FlatShading, - }); - - mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - // lights - - light = new THREE.DirectionalLight(0xffffff); - light.position.set(1, 1, 1); - scene.add(light); - - light = new THREE.DirectionalLight(0x002288); - light.position.set(-1, -1, -1); - scene.add(light); - - light = new THREE.AmbientLight(0x222222); - scene.add(light); - - // - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize, false); - } - - function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - } - - function animate() { - requestAnimationFrame(animate); - - controls.update(); // required if controls.enableDamping = true, or if controls.autoRotate = true - - stats.update(); - - render(); - } - - var startTime = Date.now(); - - function render() { - var timer = (Date.now() - startTime) * 0.00025; - var theta = Math.PI / 2 + Math.sin(timer) * 0.1; - // var theta = 1.575; - - var euler = new THREE.Euler(0.7, theta, 0.5, 'ZYX'); - - if (Math.random() < 0.5) { - let quat = new THREE.Quaternion().setFromEuler(euler); - let matrix = new THREE.Matrix4().makeRotationFromQuaternion(quat); - var newEuler = new THREE.Euler().setFromRotationMatrix(matrix, 'ZYX'); - - euler = newEuler; - } - mesh.setRotationFromEuler(euler); - - renderer.render(scene, camera); - } - </script> - </body> -</html>
false
Other
mrdoob
three.js
cc30de34720bd765b5c60efeb00874eb6de7ab3f.json
fix error due to imprecise clamping at gimbal lock
examples/gimbal_lock.html
@@ -0,0 +1,172 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <title>three.js webgl - gimbal lock</title> + <meta charset="utf-8" /> + <meta + name="viewport" + content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" + /> + <style> + body { + color: #000; + font-family: Monospace; + font-size: 13px; + text-align: center; + font-weight: bold; + + background-color: #fff; + margin: 0px; + overflow: hidden; + } + + #info { + color: #000; + position: absolute; + top: 0px; + width: 100%; + padding: 5px; + } + + a { + color: red; + } + </style> + </head> + + <body> + <div id="container"></div> + <div id="info"> + <a href="http://threejs.org" target="_blank">three.js</a> - gimbal lock + example + <p> + The object slowly rotates back and forth; one of its Euler angle + components is close to pi/2. + </p> + <p> + Every frame, with probability 0.5, the orientation is transformed into a + quaternion then back into Euler angles. + </p> + <p> + This causes an observable glitch when the calculation is imprecise due + to gimbal lock. + </p> + </div> + + <script src="../build/three.js"></script> + + <script src="js/controls/OrbitControls.js"></script> + + <script src="js/libs/stats.min.js"></script> + + <script> + var stats; + + var camera, controls, scene, renderer, mesh; + + init(); + render(); // remove when using next line for animation loop (requestAnimationFrame) + animate(); + + function init() { + scene = new THREE.Scene(); + scene.fog = new THREE.FogExp2(0xcccccc, 0.002); + + renderer = new THREE.WebGLRenderer(); + renderer.setClearColor(scene.fog.color); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + + var container = document.getElementById('container'); + container.appendChild(renderer.domElement); + + camera = new THREE.PerspectiveCamera( + 60, + window.innerWidth / window.innerHeight, + 1, + 1000 + ); + camera.position.copy(new THREE.Vector3(-10, -22, 17)); + camera.rotation.copy(new THREE.Euler(0.9, -0.3, 0.4, 'XYZ')); + + controls = new THREE.OrbitControls(camera, renderer.domElement); + controls.addEventListener('change', render); // remove when using animation loop + // enable animation loop when using damping or autorotation + //controls.enableDamping = true; + //controls.dampingFactor = 0.25; + controls.enableZoom = false; + + // world + + var geometry = new THREE.CylinderGeometry(0, 10, 30, 16, 10); + var material = new THREE.MeshPhongMaterial({ + color: 0xffffff, + shading: THREE.FlatShading, + }); + + mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + // lights + + light = new THREE.DirectionalLight(0xffffff); + light.position.set(1, 1, 1); + scene.add(light); + + light = new THREE.DirectionalLight(0x002288); + light.position.set(-1, -1, -1); + scene.add(light); + + light = new THREE.AmbientLight(0x222222); + scene.add(light); + + // + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize, false); + } + + function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + } + + function animate() { + requestAnimationFrame(animate); + + controls.update(); // required if controls.enableDamping = true, or if controls.autoRotate = true + + stats.update(); + + render(); + } + + var startTime = Date.now(); + + function render() { + var timer = (Date.now() - startTime) * 0.00025; + var theta = Math.PI / 2 + Math.sin(timer) * 0.1; + // var theta = 1.575; + + var euler = new THREE.Euler(0.7, theta, 0.5, 'ZYX'); + + if (Math.random() < 0.5) { + let quat = new THREE.Quaternion().setFromEuler(euler); + let matrix = new THREE.Matrix4().makeRotationFromQuaternion(quat); + var newEuler = new THREE.Euler().setFromRotationMatrix(matrix, 'ZYX'); + + euler = newEuler; + } + mesh.setRotationFromEuler(euler); + + renderer.render(scene, camera); + } + </script> + </body> +</html>
true
Other
mrdoob
three.js
cc30de34720bd765b5c60efeb00874eb6de7ab3f.json
fix error due to imprecise clamping at gimbal lock
src/math/Euler.js
@@ -23,9 +23,7 @@ Euler.RotationOrders = [ 'XYZ', 'YZX', 'ZXY', 'XZY', 'YXZ', 'ZYX' ]; Euler.DefaultOrder = 'XYZ'; Object.defineProperties( Euler.prototype, { - x: { - get: function () { return this._x; @@ -37,12 +35,10 @@ Object.defineProperties( Euler.prototype, { this._x = value; this._onChangeCallback(); - } - + }, }, y: { - get: function () { return this._y; @@ -54,12 +50,10 @@ Object.defineProperties( Euler.prototype, { this._y = value; this._onChangeCallback(); - } - + }, }, z: { - get: function () { return this._z; @@ -71,12 +65,10 @@ Object.defineProperties( Euler.prototype, { this._z = value; this._onChangeCallback(); - } - + }, }, order: { - get: function () { return this._order; @@ -88,14 +80,11 @@ Object.defineProperties( Euler.prototype, { this._order = value; this._onChangeCallback(); - } - - } - + }, + }, } ); Object.assign( Euler.prototype, { - isEuler: true, set: function ( x, y, z, order ) { @@ -137,17 +126,23 @@ Object.assign( Euler.prototype, { // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) var te = m.elements; - var m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ]; - var m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ]; - var m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ]; + var m11 = te[ 0 ], + m12 = te[ 4 ], + m13 = te[ 8 ]; + var m21 = te[ 1 ], + m22 = te[ 5 ], + m23 = te[ 9 ]; + var m31 = te[ 2 ], + m32 = te[ 6 ], + m33 = te[ 10 ]; order = order || this._order; if ( order === 'XYZ' ) { this._y = Math.asin( clamp( m13, - 1, 1 ) ); - if ( Math.abs( m13 ) < 0.99999 ) { + if ( Math.abs( m13 ) < 1 ) { this._x = Math.atan2( - m23, m33 ); this._z = Math.atan2( - m12, m11 ); @@ -163,7 +158,7 @@ Object.assign( Euler.prototype, { this._x = Math.asin( - clamp( m23, - 1, 1 ) ); - if ( Math.abs( m23 ) < 0.99999 ) { + if ( Math.abs( m23 ) < 1 ) { this._y = Math.atan2( m13, m33 ); this._z = Math.atan2( m21, m22 ); @@ -179,7 +174,7 @@ Object.assign( Euler.prototype, { this._x = Math.asin( clamp( m32, - 1, 1 ) ); - if ( Math.abs( m32 ) < 0.99999 ) { + if ( Math.abs( m32 ) < 1 ) { this._y = Math.atan2( - m31, m33 ); this._z = Math.atan2( - m12, m22 ); @@ -195,7 +190,7 @@ Object.assign( Euler.prototype, { this._y = Math.asin( - clamp( m31, - 1, 1 ) ); - if ( Math.abs( m31 ) < 0.99999 ) { + if ( Math.abs( m31 ) < 1 ) { this._x = Math.atan2( m32, m33 ); this._z = Math.atan2( m21, m11 ); @@ -211,7 +206,7 @@ Object.assign( Euler.prototype, { this._z = Math.asin( clamp( m21, - 1, 1 ) ); - if ( Math.abs( m21 ) < 0.99999 ) { + if ( Math.abs( m21 ) < 1 ) { this._x = Math.atan2( - m23, m22 ); this._y = Math.atan2( - m31, m11 ); @@ -227,7 +222,7 @@ Object.assign( Euler.prototype, { this._z = Math.asin( - clamp( m12, - 1, 1 ) ); - if ( Math.abs( m12 ) < 0.99999 ) { + if ( Math.abs( m12 ) < 1 ) { this._x = Math.atan2( m32, m22 ); this._y = Math.atan2( m13, m11 ); @@ -241,7 +236,10 @@ Object.assign( Euler.prototype, { } else { - console.warn( 'THREE.Euler: .setFromRotationMatrix() given unsupported order: ' + order ); + console.warn( + 'THREE.Euler: .setFromRotationMatrix() given unsupported order: ' + + order + ); } @@ -253,7 +251,7 @@ Object.assign( Euler.prototype, { }, - setFromQuaternion: function () { + setFromQuaternion: ( function () { var matrix = new Matrix4(); @@ -265,15 +263,15 @@ Object.assign( Euler.prototype, { }; - }(), + } )(), setFromVector3: function ( v, order ) { return this.set( v.x, v.y, v.z, order || this._order ); }, - reorder: function () { + reorder: ( function () { // WARNING: this discards revolution information -bhouston @@ -287,11 +285,16 @@ Object.assign( Euler.prototype, { }; - }(), + } )(), equals: function ( euler ) { - return ( euler._x === this._x ) && ( euler._y === this._y ) && ( euler._z === this._z ) && ( euler._order === this._order ); + return ( + euler._x === this._x && + euler._y === this._y && + euler._z === this._z && + euler._order === this._order + ); }, @@ -344,9 +347,7 @@ Object.assign( Euler.prototype, { }, - _onChangeCallback: function () {} - + _onChangeCallback: function () {}, } ); - export { Euler };
true
Other
mrdoob
three.js
83d283c12853088a33adecbdd15a589da6ccfd8b.json
fix description of the example
docs/manual/en/introduction/Loading-3D-models.html
@@ -100,7 +100,7 @@ <h2>Loading</h2> <p> Once you've imported a loader, you're ready to add a model to your scene. Syntax varies among different loaders — when using another format, check the examples and documentation for that - loader. For glTF, basic usage would be: + loader. For glTF, usage with global scripts would be: </p> <code>
false
Other
mrdoob
three.js
b9a1f6ded446746c7e0535bf05ed879911b1aea2.json
resolve package-lock.json changes
package-lock.json
@@ -1,6 +1,6 @@ { "name": "three", - "version": "0.106.2", + "version": "0.105.1", "lockfileVersion": 1, "requires": true, "dependencies": {
false
Other
mrdoob
three.js
377747780d3a5d481d52d6178e9ea7abe3cc908c.json
Remove unneeded changes on webglprogram
src/renderers/webgl/WebGLProgram.js
@@ -648,8 +648,11 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters, var vertexGlsl = prefixVertex + vertexShader; var fragmentGlsl = prefixFragment + fragmentShader; - var glVertexShader = WebGLShader( gl, gl.VERTEX_SHADER, vertexGlsl, renderer.debug.checkShaderErrors ); - var glFragmentShader = WebGLShader( gl, gl.FRAGMENT_SHADER, fragmentGlsl, renderer.debug.checkShaderErrors ); + // console.log( '*VERTEX*', vertexGlsl ); + // console.log( '*FRAGMENT*', fragmentGlsl ); + + var glVertexShader = WebGLShader( gl, gl.VERTEX_SHADER, vertexGlsl ); + var glFragmentShader = WebGLShader( gl, gl.FRAGMENT_SHADER, fragmentGlsl ); gl.attachShader( program, glVertexShader ); gl.attachShader( program, glFragmentShader );
false
Other
mrdoob
three.js
84c9f9249dff625b56871aa3f3600cba833f1529.json
Change webvr_multiview to use modules
examples/webvr_multiview.html
@@ -18,13 +18,12 @@ </style> </head> <body> + <script type="module"> - <script src="../build/three.js"></script> - <script src="js/vr/WebVR.js"></script> - - <script src="js/geometries/BoxLineGeometry.js"></script> - <script src="js/libs/stats.min.js"></script> - <script> + import * as THREE from '../build/three.module.js'; + import { BoxLineGeometry } from './jsm/geometries/BoxLineGeometry.js'; + import { WEBVR } from './jsm/vr/WebVR.js'; + import Stats from './jsm/libs/stats.module.js'; var container; var camera, scene, renderer; @@ -73,7 +72,7 @@ camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 0.1, 10 ); room = new THREE.LineSegments( - new THREE.BoxLineGeometry( 6, 6, 6, 10, 10, 10 ), + new BoxLineGeometry( 6, 6, 6, 10, 10, 10 ), new THREE.LineBasicMaterial( { color: renderer.multiview.isAvailable() ? 0x99ff99 : 0xff3333 } ) ); room.geometry.translate( 0, 3, 0 ); @@ -85,7 +84,7 @@ var geometry = new THREE.IcosahedronBufferGeometry( radius ); - for ( var i = 0; i < 20000; i ++ ) { + for ( var i = 0; i < 2000; i ++ ) { var object = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { color: Math.random() * 0xffffff } ) );
false
Other
mrdoob
three.js
d2bc4e1f35b317fc15efed5aaf83719b4efb8475.json
Fix lint issues and some minor changes
examples/webvr_multiview.html
@@ -85,7 +85,7 @@ var geometry = new THREE.IcosahedronBufferGeometry( radius ); - for ( var i = 0; i < 5000; i ++ ) { + for ( var i = 0; i < 20000; i ++ ) { var object = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { color: Math.random() * 0xffffff } ) );
true
Other
mrdoob
three.js
d2bc4e1f35b317fc15efed5aaf83719b4efb8475.json
Fix lint issues and some minor changes
src/renderers/WebGLRenderer.js
@@ -84,7 +84,7 @@ function WebGLRenderer( parameters ) { * Enables error checking and reporting when shader programs are being compiled * @type {boolean} */ - checkShaderErrors: false + checkShaderErrors: true }; // clearing
true
Other
mrdoob
three.js
d2bc4e1f35b317fc15efed5aaf83719b4efb8475.json
Fix lint issues and some minor changes
src/renderers/webgl/WebGLMultiview.js
@@ -52,7 +52,7 @@ function WebGLMultiview( renderer, gl, contextAttributes ) { function isAvailable() { - return capabilities.multiview && !contextAttributes.antialias; + return capabilities.multiview && ! contextAttributes.antialias; }
true
Other
mrdoob
three.js
4a8c807be38e862d92fc74c46f0a17b9950ec5b2.json
Remove webgl_multiple_views_multiple example
examples/files.js
@@ -206,7 +206,6 @@ var files = { "webgl_multiple_renderers", "webgl_multiple_scenes_comparison", "webgl_multiple_views", - "webgl_multiple_views_multiview", "webgl_nearestneighbour", "webgl_panorama_cube", "webgl_panorama_dualfisheye",
true
Other
mrdoob
three.js
4a8c807be38e862d92fc74c46f0a17b9950ec5b2.json
Remove webgl_multiple_views_multiple example
examples/webgl_multiple_views_multiview.html
@@ -1,325 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> - <head> - <title>three.js performance - animation</title> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> - <style> - body { - font-family: Monospace; - background-color: #000; - margin: 0px; - overflow: hidden; - } - #info { - position: absolute; - top: 10px; - width: 100%; - text-align: center; - z-index: 100; - display:block; - } - #info p { - max-width: 600px; - margin-left: auto; - margin-right: auto; - padding: 0 2em; - } - #info a { - color: #2fa1d6; - font-weight: bold; - } - .dg.ac { - z-index: 999 !important; - } - </style> - </head> - - <body> - - <div id="container"></div> - - <script src="../build/three.js"></script> - <script src="js/loaders/GLTFLoader.js"></script> - <script src="js/libs/stats.min.js"></script> - <script> - - var container, clock, stats, ms; - var camera, scene, renderer, panel, balls; - var radius = 0.08; - var AMOUNT = 2; - - var mixers = []; - var cameras = []; - - init(); - - function addNumLink( value ) { - - return `<a href="?num=${ value }">${ value }</a>`; - - } - - function init() { - - container = document.getElementById('container'); - - const urlParams = new URLSearchParams(window.location.search); - const multiview = urlParams.has('enableMultiview'); - - var ASPECT_RATIO = window.innerWidth / window.innerHeight; - var WIDTH = ( window.innerWidth / AMOUNT ) * window.devicePixelRatio; - var HEIGHT = ( window.innerHeight / AMOUNT ) * window.devicePixelRatio; - - for ( var y = 0; y < AMOUNT; y ++ ) { - - for ( var x = 0; x < AMOUNT; x ++ ) { - - var subcamera = new THREE.PerspectiveCamera( 40 + (x + y) * 20, ASPECT_RATIO, 0.25, 100 ); - subcamera.viewport = new THREE.Vector4( Math.floor( x * WIDTH ), Math.floor( y * HEIGHT ), Math.ceil( WIDTH ), Math.ceil( HEIGHT ) ); - - subcamera.position.x = ( x / AMOUNT ) * 5 - 0.5; - subcamera.position.y = ( y / AMOUNT ) * 5 + 1; - subcamera.position.z = 6; - subcamera.position.multiplyScalar( 1.5 ); - - subcamera.lookAt( 0, 2, 0 ); - subcamera.updateMatrixWorld(); - cameras.push( subcamera ); - - } - - } - - camera = new THREE.ArrayCamera( cameras ); - - // Needed to do the frustum culling - camera.fov = 180; - camera.position.set(0, 0, 6); - camera.aspect = ASPECT_RATIO; - camera.updateProjectionMatrix(); - - // - - scene = new THREE.Scene(); - scene.background = new THREE.Color( 0xe0e0e0 ); - scene.fog = new THREE.Fog( 0xe0e0e0, 20, 100 ); - - clock = new THREE.Clock(); - - // lights - - var light = new THREE.HemisphereLight( 0xffffff, 0x444444 ); - light.position.set( 0, 20, 0 ); - scene.add( light ); - - light = new THREE.DirectionalLight( 0xffffff ); - light.position.set( 0, 20, 10 ); - scene.add( light ); - - // ground - - var mesh = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2000, 2000 ), new THREE.MeshPhongMaterial( { color: 0x999999, depthWrite: false } ) ); - mesh.rotation.x = - Math.PI / 2; - scene.add( mesh ); - - var grid = new THREE.GridHelper( 200, 40, 0x000000, 0x000000 ); - grid.material.opacity = 0.2; - grid.material.transparent = true; - scene.add( grid ); - - // balls - balls = new THREE.Group(); - scene.add( balls ); - - var geometry = new THREE.IcosahedronBufferGeometry( radius, 2 ); - - var numObjects = urlParams.get('num') || 1000; - - for ( var i = 0; i < numObjects; i ++ ) { - - var object = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { color: Math.random() * 0xffffff } ) ); - - object.position.x = Math.random() * 20 - 10; - object.position.y = Math.random() * 10 + 5; - object.position.z = Math.random() * 20 - 10; - - object.userData.velocity = new THREE.Vector3(); - object.userData.velocity.x = Math.random() * 0.01 - 0.005; - object.userData.velocity.y = Math.random() * 0.01 - 0.005; - object.userData.velocity.z = Math.random() * 0.01 - 0.005; - - balls.add( object ); - - } - - - // model - - var loader = new THREE.GLTFLoader(); - - loader.load( 'models/gltf/RobotExpressive/RobotExpressive.glb', function( gltf ) { - - var model = gltf.scene; - var animations = gltf.animations; - - scene.add( model ); - - var mixer = new THREE.AnimationMixer( model ); - mixer.clipAction( animations[ 10 ] ).play(); - mixers.push( mixer ); - - animate(); - - }, undefined, function( e ) { - - console.error( e ); - - } ); - - var canvas = document.createElement( 'canvas' ); - var context = canvas.getContext( 'webgl2', { antialias: false } ); - renderer = new THREE.WebGLRenderer( { context: context, canvas: canvas, antialias: true, multiview: multiview } ); - renderer.setPixelRatio( window.devicePixelRatio ); - renderer.setSize( window.innerWidth, window.innerHeight ); - renderer.gammaOutput = true; - renderer.gammaFactor = 2.2; - container.appendChild( renderer.domElement ); - - console.log(renderer.multiview); - // - - function colorize( value ) { - return value ? '<b style="color:#3f3">true</b>' : '<b style="color:#f33">false</b>'; - } - - var info = document.createElement( 'div' ); - info.style.position = 'absolute'; - info.style.top = '10px'; - info.style.width = '100%'; - info.style.textAlign = 'center'; - container.appendChild(info); - - info.innerHTML = `<a href="http://threejs.org" target="_blank" rel="noopener">three.js</a> webgl - multiple views using multiview extension - by <a href="https://twitter.com/fernandojsg">fernandojsg</a><br/>`; - info.innerHTML += 'enabled: ' + colorize( renderer.multiview.isEnabled() ) + ` <a href="?num=${ numObjects }&${ multiview ? '' : 'enableMultiview' }">toggle</a>` - + `<br/>available: ${ colorize( renderer.multiview.isAvailable() ) }<br/>Number of balls: - ${addNumLink(200)} - ${addNumLink(500)} - ${addNumLink(1000)} - ${addNumLink(2500)} - ${addNumLink(5000)} - <br/><br/>`; - - ms = document.createElement('div'); - ms.innerHTML = ''; - info.appendChild(ms); - - stats = new Stats(); - document.body.appendChild( stats.dom ); - panel = stats.addPanel( new Stats.Panel( 'renderer.render()', '#ff8', '#221' ) ); - stats.showPanel( 3 ); - - window.addEventListener( 'resize', onWindowResize, false ); - - } - - function onWindowResize() { - - var ASPECT_RATIO = window.innerWidth / window.innerHeight; - var WIDTH = ( window.innerWidth / AMOUNT ) * window.devicePixelRatio; - var HEIGHT = ( window.innerHeight / AMOUNT ) * window.devicePixelRatio; - - camera.aspect = ASPECT_RATIO; - camera.updateProjectionMatrix(); - - for ( var y = 0; y < AMOUNT; y ++ ) { - - for ( var x = 0; x < AMOUNT; x ++ ) { - - var subcamera = camera.cameras[ AMOUNT * y + x ]; - subcamera.viewport.set( - Math.floor( x * WIDTH ), - Math.floor( y * HEIGHT ), - Math.ceil( WIDTH ), - Math.ceil( HEIGHT ) ); - subcamera.aspect = ASPECT_RATIO; - subcamera.updateProjectionMatrix(); - - } - - } - - renderer.setSize( window.innerWidth, window.innerHeight ); - - } - - // - - function animate() { - - requestAnimationFrame( animate ); - - var delta = clock.getDelta(); - var time = clock.getElapsedTime(); - - for ( var i = 0, il = mixers.length; i < il; i ++ ) { - - mixers[ i ].update( delta ); - - } - - // Update camera animations - cameras[ 0 ].position.y += Math.sin( time * 2 ) * 0.02; - cameras[ 0 ].updateMatrixWorld(); - - cameras[ 1 ].position.z += Math.sin( time ) * 0.1; - cameras[ 1 ].updateMatrixWorld(); - - cameras[ 3 ].position.x = Math.sin( time ) * Math.PI; - cameras[ 3 ].position.z = Math.cos( time ) * Math.PI; - cameras[ 3 ].lookAt( 0, 2, 0 ); - cameras[ 3 ].updateMatrixWorld(); - - // delta *=1000; - - delta *= 0.5; - - // Update balls - for ( var i = 0; i < balls.children.length; i ++ ) { - - var object = balls.children[ i ]; - - object.position.y += object.userData.velocity.y * delta; - - // keep objects inside room - if ( object.position.y < radius || object.position.y > 15 ) { - - object.position.y = Math.max( object.position.y, radius ); - - object.userData.velocity.y = - object.userData.velocity.y * 0.8; - - } - - object.userData.velocity.y -= 9.8 * delta; - - } - - // - - var t = performance.now(); - - renderer.render( scene, camera ); - - var trender = performance.now() - t; - ms.innerHTML = `renderer.render time: ${ trender.toFixed( 2 ) }ms`; - - panel.update(performance.now() - t, 460); - - stats.update(); - - } - - </script> - - </body> -</html> \ No newline at end of file
true
Other
mrdoob
three.js
16d6cc4bd60278b26324fffc1d0106a783859a0e.json
Detect antialias on multiview.isAvailable()
examples/webvr_multiview.html
@@ -23,16 +23,17 @@ <script src="js/vr/WebVR.js"></script> <script src="js/geometries/BoxLineGeometry.js"></script> - + <script src="js/libs/stats.min.js"></script> <script> var container; var camera, scene, renderer; var room; + var stats; var count = 0; - var radius = 0.08; + var radius = 0.02; var normal = new THREE.Vector3(); var relativeVelocity = new THREE.Vector3(); @@ -46,6 +47,18 @@ container = document.createElement( 'div' ); document.body.appendChild( container ); + // + + var canvas = document.createElement( 'canvas' ); + var context = canvas.getContext( 'webgl2', { antialias: false } ); + + renderer = new THREE.WebGLRenderer( { canvas: canvas, context: context } ); + + renderer.setPixelRatio( window.devicePixelRatio ); + renderer.setSize( window.innerWidth, window.innerHeight ); + renderer.vr.enabled = true; + container.appendChild( renderer.domElement ); + var info = document.createElement( 'div' ); info.style.position = 'absolute'; info.style.top = '10px'; @@ -61,7 +74,7 @@ room = new THREE.LineSegments( new THREE.BoxLineGeometry( 6, 6, 6, 10, 10, 10 ), - new THREE.LineBasicMaterial( { color: 0x808080 } ) + new THREE.LineBasicMaterial( { color: renderer.multiview.isAvailable() ? 0x99ff99 : 0xff3333 } ) ); room.geometry.translate( 0, 3, 0 ); scene.add( room ); @@ -72,7 +85,7 @@ var geometry = new THREE.IcosahedronBufferGeometry( radius ); - for ( var i = 0; i < 2000; i ++ ) { + for ( var i = 0; i < 5000; i ++ ) { var object = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { color: Math.random() * 0xffffff } ) ); @@ -91,22 +104,13 @@ // - var canvas = document.createElement( 'canvas' ); - var context = canvas.getContext( 'webgl2', { antialias: false } ); - - renderer = new THREE.WebGLRenderer( { canvas: canvas, context: context } ); - - renderer.setPixelRatio( window.devicePixelRatio ); - renderer.setSize( window.innerWidth, window.innerHeight ); - renderer.vr.enabled = true; - container.appendChild( renderer.domElement ); - - // - document.body.appendChild( WEBVR.createButton( renderer ) ); // + stats = new Stats(); + container.appendChild( stats.dom ); + window.addEventListener( 'resize', onWindowResize, false ); } @@ -131,6 +135,7 @@ function render() { // + stats.update(); var delta = clock.getDelta();
true
Other
mrdoob
three.js
16d6cc4bd60278b26324fffc1d0106a783859a0e.json
Detect antialias on multiview.isAvailable()
src/renderers/WebGLRenderer.js
@@ -317,7 +317,7 @@ function WebGLRenderer( parameters ) { // Multiview - var multiview = new WebGLMultiview( _this, _gl ); + var multiview = new WebGLMultiview( _this, _gl, _gl.getContextAttributes() ); this.multiview = multiview;
true
Other
mrdoob
three.js
16d6cc4bd60278b26324fffc1d0106a783859a0e.json
Detect antialias on multiview.isAvailable()
src/renderers/webgl/WebGLMultiview.js
@@ -8,7 +8,7 @@ import { Matrix3 } from '../../math/Matrix3.js'; import { Matrix4 } from '../../math/Matrix4.js'; import { Vector2 } from '../../math/Vector2.js'; -function WebGLMultiview( renderer, gl ) { +function WebGLMultiview( renderer, gl, contextAttributes ) { var DEFAULT_NUMVIEWS = 2; @@ -52,7 +52,7 @@ function WebGLMultiview( renderer, gl ) { function isAvailable() { - return capabilities.multiview; + return capabilities.multiview && !contextAttributes.antialias; } @@ -205,8 +205,6 @@ function WebGLMultiview( renderer, gl ) { if ( isAvailable() ) { - console.log('multiivew enabled!'); - renderTarget = new WebGLMultiviewRenderTarget( 0, 0, DEFAULT_NUMVIEWS ); renderSize = new Vector2();
true
Other
mrdoob
three.js
a2d01af5ca5e053438d0d0569661d976c1a84818.json
Add webvr_multiview example
examples/files.js
@@ -335,6 +335,7 @@ var files = { "webvr_cubes", "webvr_dragging", "webvr_lorenzattractor", + "webvr_multiview", "webvr_panorama", "webvr_paint", "webvr_rollercoaster",
true
Other
mrdoob
three.js
a2d01af5ca5e053438d0d0569661d976c1a84818.json
Add webvr_multiview example
examples/webvr_multiview.html
@@ -0,0 +1,178 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <title>three.js webvr - ball shooter</title> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> + <style> + body { + font-family: Monospace; + background-color: #101010; + color: #fff; + margin: 0px; + overflow: hidden; + } + a { + color: #48f; + } + </style> + </head> + <body> + + <script src="../build/three.js"></script> + <script src="js/vr/WebVR.js"></script> + + <script src="js/geometries/BoxLineGeometry.js"></script> + + <script> + + var container; + var camera, scene, renderer; + + var room; + + var count = 0; + var radius = 0.08; + var normal = new THREE.Vector3(); + var relativeVelocity = new THREE.Vector3(); + + var clock = new THREE.Clock(); + + init(); + animate(); + + function init() { + + container = document.createElement( 'div' ); + document.body.appendChild( container ); + + var info = document.createElement( 'div' ); + info.style.position = 'absolute'; + info.style.top = '10px'; + info.style.width = '100%'; + info.style.textAlign = 'center'; + info.innerHTML = '<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> webvr - ball shooter'; + container.appendChild( info ); + + scene = new THREE.Scene(); + scene.background = new THREE.Color( 0x505050 ); + + camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 0.1, 10 ); + + room = new THREE.LineSegments( + new THREE.BoxLineGeometry( 6, 6, 6, 10, 10, 10 ), + new THREE.LineBasicMaterial( { color: 0x808080 } ) + ); + room.geometry.translate( 0, 3, 0 ); + scene.add( room ); + + var light = new THREE.HemisphereLight( 0xffffff, 0x444444 ); + light.position.set( 1, 1, 1 ); + scene.add( light ); + + var geometry = new THREE.IcosahedronBufferGeometry( radius ); + + for ( var i = 0; i < 2000; i ++ ) { + + var object = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { color: Math.random() * 0xffffff } ) ); + + object.position.x = Math.random() * 4 - 2; + object.position.y = Math.random() * 4; + object.position.z = Math.random() * 4 - 2; + + object.userData.velocity = new THREE.Vector3(); + object.userData.velocity.x = 2 * Math.random() - 1; + object.userData.velocity.y = 2 * Math.random() - 1; + object.userData.velocity.z = 2 * Math.random() - 1; + + room.add( object ); + + } + + // + + var canvas = document.createElement( 'canvas' ); + var context = canvas.getContext( 'webgl2', { antialias: false } ); + + renderer = new THREE.WebGLRenderer( { canvas: canvas, context: context } ); + + renderer.setPixelRatio( window.devicePixelRatio ); + renderer.setSize( window.innerWidth, window.innerHeight ); + renderer.vr.enabled = true; + container.appendChild( renderer.domElement ); + + // + + document.body.appendChild( WEBVR.createButton( renderer ) ); + + // + + window.addEventListener( 'resize', onWindowResize, false ); + + } + + function onWindowResize() { + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize( window.innerWidth, window.innerHeight ); + + } + + // + + function animate() { + + renderer.setAnimationLoop( render ); + + } + + function render() { + + // + + var delta = clock.getDelta(); + + var range = 3 - radius; + + for ( var i = 0; i < room.children.length; i ++ ) { + + var object = room.children[ i ]; + + object.position.x += object.userData.velocity.x * delta; + object.position.y += object.userData.velocity.y * delta; + object.position.z += object.userData.velocity.z * delta; + + // keep objects inside room + + if ( object.position.x < - range || object.position.x > range ) { + + object.position.x = THREE.Math.clamp( object.position.x, - range, range ); + object.userData.velocity.x = - object.userData.velocity.x; + + } + + if ( object.position.y < radius || object.position.y > 6 ) { + + object.position.y = Math.max( object.position.y, radius ); + object.userData.velocity.y = - object.userData.velocity.y; + + } + + if ( object.position.z < - range || object.position.z > range ) { + + object.position.z = THREE.Math.clamp( object.position.z, - range, range ); + object.userData.velocity.z = - object.userData.velocity.z; + + } + + } + + renderer.render( scene, camera ); + + } + + </script> + </body> +</html>
true
Other
mrdoob
three.js
5d319675f8d99b44f5e59abe44ba74eb273110d8.json
Remove ballshooter_multiview from examples list
examples/files.js
@@ -332,7 +332,6 @@ var files = { ], "webvr": [ "webvr_ballshooter", - "webvr_ballshooter_multiview", "webvr_cubes", "webvr_dragging", "webvr_lorenzattractor",
false
Other
mrdoob
three.js
99e80892df567fbeabaedc3664aca786f55e27a9.json
remove two sentences
docs/api/en/renderers/WebGLRenderer.html
@@ -478,7 +478,7 @@ <h3>[method:null setOpaqueSort]( [param:Function method] )</h3> <h3>[method:null setTransparentSort]( [param:Function method] )</h3> <p> - Sets the custom transparent sort function for the WebGLRenderLists. Pass null to use the default reversePainterSortStable function. In some cases the transparent materials sort may get rendered in the wrong order. This issue may cause materials to rendere behind other materials instead of the front of them and vice versa. + Sets the custom transparent sort function for the WebGLRenderLists. Pass null to use the default reversePainterSortStable function. </p> <h3>[method:null setSize]( [param:Integer width], [param:Integer height], [param:Boolean updateStyle] )</h3>
false
Other
mrdoob
three.js
dc96a86c7cf4878f1f26a36bb14a412ac011af63.json
remove example changes
examples/webgl_lines_fat.html
@@ -31,7 +31,6 @@ var matLine, matLineBasic, matLineDashed; var stats; var gui; - var mouse, raycaster, raycastPoint; // viewport var insetWidth; @@ -124,14 +123,6 @@ window.addEventListener( 'resize', onWindowResize, false ); onWindowResize(); - mouse = new THREE.Vector2(); - raycaster = new THREE.Raycaster(); - raycastPoint = new THREE.Mesh( new THREE.SphereBufferGeometry( 1, 20, 10 ) ); - raycastPoint.material.color.set( 0xff0000 ); - raycastPoint.scale.setScalar( 0.25 ); - scene.add( raycastPoint ); - document.addEventListener( 'mousemove', onMouseMove, false ); - stats = new Stats(); document.body.appendChild( stats.dom ); @@ -154,33 +145,6 @@ } - function onMouseMove( e ) { - - e.preventDefault(); - - mouse.x = ( e.clientX / window.innerWidth ) * 2 - 1; - mouse.y = - ( e.clientY / window.innerHeight ) * 2 + 1; - - } - - function doRaycast() { - - camera.updateMatrixWorld(); - raycaster.setFromCamera( mouse, camera ); - var intersects = raycaster.intersectObjects( [ line, line1 ] ); - if ( intersects.length !== 0 ) { - - raycastPoint.position.copy( intersects[ 0 ].point ); - raycastPoint.visible = true; - - } else { - - raycastPoint.visible = false; - - } - - } - function animate() { requestAnimationFrame( animate ); @@ -196,10 +160,6 @@ // renderer will set this eventually matLine.resolution.set( window.innerWidth, window.innerHeight ); // resolution of the viewport - // perform raycast after the resolution has been updated for the camera - // view we care about - doRaycast(); - renderer.render( scene, camera ); // inset scene
false
Other
mrdoob
three.js
eb0b88689f438069e140c4b1b001c722683c588d.json
Remove flags used to toggle shadows in shaders The shaders only contain code for active shadows, so they don't need a separate flag to determine whether the shadow is enabled.
src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js
@@ -44,7 +44,7 @@ IncidentLight directLight; #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) pointLightShadow = pointLightShadows[ i ]; - directLight.color *= all( bvec3( pointLightShadow.shadow, directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; #endif RE_Direct( directLight, geometry, material, reflectedLight ); @@ -69,7 +69,7 @@ IncidentLight directLight; #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) spotLightShadow = spotLightShadows[ i ]; - directLight.color *= all( bvec3( spotLightShadow.shadow, directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0; + directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometry, material, reflectedLight ); @@ -94,7 +94,7 @@ IncidentLight directLight; #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) directionalLightShadow = directionalLightShadows[ i ]; - directLight.color *= all( bvec3( directionalLightShadow.shadow, directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometry, material, reflectedLight );
true
Other
mrdoob
three.js
eb0b88689f438069e140c4b1b001c722683c588d.json
Remove flags used to toggle shadows in shaders The shaders only contain code for active shadows, so they don't need a separate flag to determine whether the shadow is enabled.
src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js
@@ -66,7 +66,6 @@ vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 struct DirectionalLightShadow { - int shadow; float shadowBias; float shadowRadius; vec2 shadowMapSize; @@ -102,7 +101,6 @@ vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 struct PointLightShadow { - int shadow; float shadowBias; float shadowRadius; vec2 shadowMapSize; @@ -148,7 +146,6 @@ vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 struct SpotLightShadow { - int shadow; float shadowBias; float shadowRadius; vec2 shadowMapSize;
true
Other
mrdoob
three.js
eb0b88689f438069e140c4b1b001c722683c588d.json
Remove flags used to toggle shadows in shaders The shaders only contain code for active shadows, so they don't need a separate flag to determine whether the shadow is enabled.
src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js
@@ -13,7 +13,7 @@ float getShadowMask() { for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { directionalLight = directionalLightShadows[ i ]; - shadow *= all( bvec2( directionalLight.shadow, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; } @@ -27,7 +27,7 @@ float getShadowMask() { for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { spotLight = spotLightShadows[ i ]; - shadow *= all( bvec2( spotLight.shadow, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0; } @@ -41,7 +41,7 @@ float getShadowMask() { for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { pointLight = pointLightShadows[ i ]; - shadow *= all( bvec2( pointLight.shadow, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; }
true
Other
mrdoob
three.js
eb0b88689f438069e140c4b1b001c722683c588d.json
Remove flags used to toggle shadows in shaders The shaders only contain code for active shadows, so they don't need a separate flag to determine whether the shadow is enabled.
src/renderers/shaders/UniformsLib.d.ts
@@ -72,7 +72,6 @@ export let UniformsLib: { directionalLightShadows: { value: any[]; properties: { - shadow: {}; shadowBias: {}; shadowRadius: {}; shadowMapSize: {}; @@ -95,7 +94,6 @@ export let UniformsLib: { spotLightShadows: { value: any[]; properties: { - shadow: {}; shadowBias: {}; shadowRadius: {}; shadowMapSize: {}; @@ -115,7 +113,6 @@ export let UniformsLib: { pointLightShadows: { value: any[]; properties: { - shadow: {}; shadowBias: {}; shadowRadius: {}; shadowMapSize: {};
true
Other
mrdoob
three.js
eb0b88689f438069e140c4b1b001c722683c588d.json
Remove flags used to toggle shadows in shaders The shaders only contain code for active shadows, so they don't need a separate flag to determine whether the shadow is enabled.
src/renderers/shaders/UniformsLib.js
@@ -118,7 +118,6 @@ var UniformsLib = { } }, directionalLightShadows: { value: [], properties: { - shadow: {}, shadowBias: {}, shadowRadius: {}, shadowMapSize: {} @@ -138,7 +137,6 @@ var UniformsLib = { } }, spotLightShadows: { value: [], properties: { - shadow: {}, shadowBias: {}, shadowRadius: {}, shadowMapSize: {} @@ -155,7 +153,6 @@ var UniformsLib = { } }, pointLightShadows: { value: [], properties: { - shadow: {}, shadowBias: {}, shadowRadius: {}, shadowMapSize: {},
true
Other
mrdoob
three.js
eb0b88689f438069e140c4b1b001c722683c588d.json
Remove flags used to toggle shadows in shaders The shaders only contain code for active shadows, so they don't need a separate flag to determine whether the shadow is enabled.
src/renderers/webgl/WebGLLights.js
@@ -102,7 +102,6 @@ function ShadowUniformsCache() { case 'DirectionalLight': uniforms = { - shadow: false, shadowBias: 0, shadowRadius: 1, shadowMapSize: new Vector2() @@ -111,7 +110,6 @@ function ShadowUniformsCache() { case 'SpotLight': uniforms = { - shadow: false, shadowBias: 0, shadowRadius: 1, shadowMapSize: new Vector2() @@ -120,7 +118,6 @@ function ShadowUniformsCache() { case 'PointLight': uniforms = { - shadow: false, shadowBias: 0, shadowRadius: 1, shadowMapSize: new Vector2(), @@ -260,7 +257,6 @@ function WebGLLights() { var shadowUniforms = shadowCache.get( light ); - shadowUniforms.shadow = light.castShadow; shadowUniforms.shadowBias = shadow.bias; shadowUniforms.shadowRadius = shadow.radius; shadowUniforms.shadowMapSize = shadow.mapSize; @@ -302,7 +298,6 @@ function WebGLLights() { var shadowUniforms = shadowCache.get( light ); - shadowUniforms.shadow = light.castShadow; shadowUniforms.shadowBias = shadow.bias; shadowUniforms.shadowRadius = shadow.radius; shadowUniforms.shadowMapSize = shadow.mapSize; @@ -368,7 +363,6 @@ function WebGLLights() { var shadowUniforms = shadowCache.get( light ); - shadowUniforms.shadow = light.castShadow; shadowUniforms.shadowBias = shadow.bias; shadowUniforms.shadowRadius = shadow.radius; shadowUniforms.shadowMapSize = shadow.mapSize;
true
Other
mrdoob
three.js
96e61e337a633d19a56afac0394ac7a278aa994f.json
Add optionalTarget in CatmullRomCurve3.getPoint() CatmullRomCurve3.getPoint() should accept an [optional Vector3 target](https://github.com/mrdoob/three.js/blob/master/src/extras/curves/CatmullRomCurve3.js#L104) argument. It's missing in the TypeScript declaration file, which leads to compiler errors if users try to use this option.
src/extras/curves/CatmullRomCurve3.d.ts
@@ -43,6 +43,6 @@ export class CatmullRomCurve3 extends Curve<Vector3> { points: Vector3[]; - getPoint( t: number ): Vector3; + getPoint( t: number, optionalTarget?: Vector3 ): Vector3; }
false
Other
mrdoob
three.js
2b52a5409ed3ba1898d9f50a873f8e1626a371e6.json
Add helio polyfill to editor
editor/index.html
@@ -42,6 +42,7 @@ <script src="js/libs/ternjs/doc_comment.js"></script> <script src="js/libs/tern-threejs/threejs.js"></script> <script src="js/libs/signals.min.js"></script> + <script src="../examples/js/vr/HelioWebXRPolyfill.js"></script> <script type="module">
true
Other
mrdoob
three.js
2b52a5409ed3ba1898d9f50a873f8e1626a371e6.json
Add helio polyfill to editor
editor/js/Menubar.File.js
@@ -417,7 +417,14 @@ var MenubarFile = function ( editor ) { } ); loader.load( '../examples/jsm/webxr/VRButton.js', function ( content ) { + zip.file( 'js/VRButton.js', content ); + + } ); + loader.load( '../examples/js/vr/HelioWebXRPolyfill.js', function ( content ) { + + zip.file( 'js/HelioWebXRPolyfill.js', content ); + } ); } );
true
Other
mrdoob
three.js
2b52a5409ed3ba1898d9f50a873f8e1626a371e6.json
Add helio polyfill to editor
editor/js/libs/app/index.html
@@ -16,6 +16,7 @@ </style> </head> <body ontouchstart=""> + <script src="../examples/js/vr/HelioWebXRPolyfill.js"></script> <script type="module">
true
Other
mrdoob
three.js
5473f78bd42a8e4ecafc07c87d4b19889531d886.json
Add VR support to publish zip
editor/js/Menubar.File.js
@@ -416,6 +416,9 @@ var MenubarFile = function ( editor ) { zip.file( 'js/three.module.js', content ); } ); + loader.load( '../examples/jsm/webxr/VRButton.js', function ( content ) { + zip.file( 'js/VRButton.js', content ); + } ); } ); options.add( option );
true
Other
mrdoob
three.js
5473f78bd42a8e4ecafc07c87d4b19889531d886.json
Add VR support to publish zip
editor/js/libs/app/index.html
@@ -21,8 +21,10 @@ import * as THREE from './js/three.module.js'; import { APP } from './js/app.js'; + import { VRButton } from './js/VRButton.js'; window.THREE = THREE; // Used by APP Scripts. + window.VRButton = VRButton; // Used by APP Scripts. var loader = new THREE.FileLoader(); loader.load( 'app.json', function ( text ) {
true
Other
mrdoob
three.js
ba0980bdafc62ae66e9d30d17b89083fb694cb6d.json
Add VR configuration option
editor/index.html
@@ -54,6 +54,7 @@ import { Player } from './js/Player.js'; import { Sidebar } from './js/Sidebar.js'; import { Menubar } from './js/Menubar.js'; + import { VRButton } from '../examples/jsm/webxr/VRButton.js'; window.URL = window.URL || window.webkitURL; window.BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder; @@ -70,6 +71,7 @@ window.editor = editor; // Expose editor to Console window.THREE = THREE; // Expose THREE to APP Scripts and Console + window.VRButton = VRButton; // Expose VRButton to APP Scripts var viewport = new Viewport( editor ); document.body.appendChild( viewport.dom );
true
Other
mrdoob
three.js
ba0980bdafc62ae66e9d30d17b89083fb694cb6d.json
Add VR configuration option
editor/js/Config.js
@@ -13,6 +13,7 @@ var Config = function () { 'project/title': '', 'project/editable': false, + 'project/webvr': false, 'project/renderer/antialias': true, 'project/renderer/shadows': true,
true
Other
mrdoob
three.js
ba0980bdafc62ae66e9d30d17b89083fb694cb6d.json
Add VR configuration option
editor/js/Sidebar.Project.js
@@ -54,6 +54,20 @@ var SidebarProject = function ( editor ) { projectsettings.add( editableRow ); + // WebVR + + var vrRow = new UIRow(); + var vr = new UICheckbox( config.getKey( 'project/vr' ) ).setLeft( '100px' ).onChange( function() { + + config.setKey( 'project/vr', this.getValue() ); + + } ); + + vrRow.add( new UIText( strings.getKey( 'sidebar/project/vr' ) ).setWidth( '90px' ) ); + vrRow.add( vr ); + + projectsettings.add( vrRow ); + // Renderer var rendererPanel = new UIPanel();
true
Other
mrdoob
three.js
ba0980bdafc62ae66e9d30d17b89083fb694cb6d.json
Add VR configuration option
editor/js/libs/app.js
@@ -1,3 +1,4 @@ + /** * @author mrdoob / http://mrdoob.com/ */ @@ -12,6 +13,11 @@ var APP = { var loader = new THREE.ObjectLoader(); var camera, scene; + // If VR support is turned on, this button will display + // when the player is running. + var vrButton; + // Returns true if VR support is enabled. + var vrEnabled; var events = {}; @@ -27,8 +33,13 @@ var APP = { var project = json.project; + vrEnabled = () => project.vr; + if ( project.shadows ) renderer.shadowMap.enabled = true; - if ( project.vr ) renderer.xr.enabled = true; + if ( project.vr ) { + renderer.xr.enabled = true; + vrButton = VRButton.createButton( renderer ); + }; this.setScene( loader.parse( json.scene ) ); this.setCamera( loader.parse( json.camera ) ); @@ -170,6 +181,10 @@ var APP = { this.play = function () { + if ( vrEnabled() ) { + document.body.append( vrButton ); + } + prevTime = performance.now(); document.addEventListener( 'keydown', onDocumentKeyDown ); @@ -189,6 +204,10 @@ var APP = { this.stop = function () { + if ( vrEnabled() ) { + vrButton.remove(); + } + document.removeEventListener( 'keydown', onDocumentKeyDown ); document.removeEventListener( 'keyup', onDocumentKeyUp ); document.removeEventListener( 'mousedown', onDocumentMouseDown );
true
Other
mrdoob
three.js
853a1812a8cbc1cea83f54f2861d83e4a7ff112a.json
handle normal matrix for InstancedMesh
src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js
@@ -3,7 +3,14 @@ vec3 transformedNormal = objectNormal; #ifdef USE_INSTANCING - transformedNormal = mat3( instanceMatrix ) * transformedNormal; + // this is in lieu of a per-instance normal-matrix + // shear transforms in the instance matrix are not supported + + mat3 m = mat3( instanceMatrix ); + + transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) ); + + transformedNormal = m * transformedNormal; #endif
false
Other
mrdoob
three.js
a5c9edd6864bf7b0b0be4644c5388271f39f0d5d.json
Add missing ParameterNames
src/renderers/webgl/WebGLPrograms.js
@@ -35,15 +35,16 @@ function WebGLPrograms( renderer, extensions, capabilities ) { }; var parameterNames = [ - "precision", "supportsVertexTextures", "instancing", - "map", "mapEncoding", "matcap", "matcapEncoding", "envMap", "envMapMode", "envMapEncoding", + "precision", "isWebGL2", "supportsVertexTextures", "outputEncoding", "instancing", + "map", "mapEncoding", "matcap", "matcapEncoding", "envMap", "envMapMode", "envMapEncoding", "envMapCubeUV", "lightMap", "aoMap", "emissiveMap", "emissiveMapEncoding", "bumpMap", "normalMap", "objectSpaceNormalMap", "tangentSpaceNormalMap", "clearcoatNormalMap", "displacementMap", "specularMap", "roughnessMap", "metalnessMap", "gradientMap", - "alphaMap", "combine", "vertexColors", "vertexTangents", "fog", "useFog", "fogExp2", + "alphaMap", "combine", "vertexColors", "vertexTangents", "vertexUvs", "fog", "useFog", "fogExp2", "flatShading", "sizeAttenuation", "logarithmicDepthBuffer", "skinning", "maxBones", "useVertexTexture", "morphTargets", "morphNormals", "maxMorphTargets", "maxMorphNormals", "premultipliedAlpha", "numDirLights", "numPointLights", "numSpotLights", "numHemiLights", "numRectAreaLights", + "numDirLightShadows", "numPointLightShadows", "numSpotLightShadows", "shadowMapEnabled", "shadowMapType", "toneMapping", 'physicallyCorrectLights', "alphaTest", "doubleSided", "flipSided", "numClippingPlanes", "numClipIntersection", "depthPacking", "dithering", "sheen"
false
Other
mrdoob
three.js
95c1ca3777626e7d0a0d83c8185e73e101eba194.json
remove material.combine from WebGLProgram
src/renderers/webgl/WebGLProgram.js
@@ -349,13 +349,13 @@ function generateEnvMapModeDefine( parameters ) { } -function generateEnvMapBlendingDefine( parameters, material ) { +function generateEnvMapBlendingDefine( parameters ) { var envMapBlendingDefine = 'ENVMAP_BLENDING_MULTIPLY'; if ( parameters.envMap ) { - switch ( material.combine ) { + switch ( parameters.combine ) { case MultiplyOperation: envMapBlendingDefine = 'ENVMAP_BLENDING_MULTIPLY'; @@ -388,7 +388,7 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters var shadowMapTypeDefine = generateShadowMapTypeDefine( parameters ); var envMapTypeDefine = generateEnvMapTypeDefine( parameters ); var envMapModeDefine = generateEnvMapModeDefine( parameters ); - var envMapBlendingDefine = generateEnvMapBlendingDefine( parameters, material ); + var envMapBlendingDefine = generateEnvMapBlendingDefine( parameters ); var gammaFactorDefine = ( renderer.gammaFactor > 0 ) ? renderer.gammaFactor : 1.0;
false
Other
mrdoob
three.js
30050632a7cee49038fd65fe3d5208cc94b32c46.json
Add renderer variable to type definition
examples/jsm/loaders/EquirectangularToCubeGenerator.d.ts
@@ -23,6 +23,7 @@ export interface EquirectangularToCubeGeneratorOptions { export class CubemapGenerator { constructor( renderer: WebGLRenderer ); + renderer: WebGLRenderer; fromEquirectangular( texture: Texture, options?: CubemapGeneratorOptions ): WebGLRenderTargetCube;
false
Other
mrdoob
three.js
4ef5ee3f8830286caf753aada75f5f43f7275e4f.json
Fix basisFile.transcodeImage parameters
examples/js/loaders/BasisTextureLoader.js
@@ -476,8 +476,8 @@ THREE.BasisTextureLoader.BasisWorker = function () { 0, mip, config.format, - hasAlpha, - 0 + 0, + hasAlpha ); if ( ! status ) {
true
Other
mrdoob
three.js
4ef5ee3f8830286caf753aada75f5f43f7275e4f.json
Fix basisFile.transcodeImage parameters
examples/jsm/loaders/BasisTextureLoader.js
@@ -489,8 +489,8 @@ BasisTextureLoader.BasisWorker = function () { 0, mip, config.format, - hasAlpha, - 0 + 0, + hasAlpha ); if ( ! status ) {
true
Other
mrdoob
three.js
65089d82e7e5e5ac78d53efc5dbb206dbf590fcf.json
fix empty name problem in GLTFLoader
examples/js/loaders/GLTFLoader.js
@@ -1826,7 +1826,7 @@ THREE.GLTFLoader = ( function () { texture.flipY = false; - if ( textureDef.name !== undefined ) texture.name = textureDef.name; + if ( textureDef.name ) texture.name = textureDef.name; // Ignore unknown mime types, like DDS files. if ( source.mimeType in MIME_TYPE_FORMATS ) { @@ -2163,7 +2163,7 @@ THREE.GLTFLoader = ( function () { } - if ( materialDef.name !== undefined ) material.name = materialDef.name; + if ( materialDef.name ) material.name = materialDef.name; // baseColorTexture, emissiveTexture, and specularGlossinessTexture use sRGB encoding. if ( material.map ) material.map.encoding = THREE.sRGBEncoding; @@ -2654,7 +2654,7 @@ THREE.GLTFLoader = ( function () { } - if ( cameraDef.name !== undefined ) camera.name = cameraDef.name; + if ( cameraDef.name ) camera.name = cameraDef.name; assignExtrasToUserData( camera, cameraDef ); @@ -2875,7 +2875,7 @@ THREE.GLTFLoader = ( function () { } - var name = animationDef.name !== undefined ? animationDef.name : 'animation_' + animationIndex; + var name = animationDef.name ? animationDef.name : 'animation_' + animationIndex; return new THREE.AnimationClip( name, undefined, tracks ); @@ -2994,7 +2994,7 @@ THREE.GLTFLoader = ( function () { } - if ( nodeDef.name !== undefined ) { + if ( nodeDef.name ) { node.userData.name = nodeDef.name; node.name = THREE.PropertyBinding.sanitizeNodeName( nodeDef.name ); @@ -3152,7 +3152,7 @@ THREE.GLTFLoader = ( function () { var parser = this; var scene = new THREE.Scene(); - if ( sceneDef.name !== undefined ) scene.name = sceneDef.name; + if ( sceneDef.name ) scene.name = sceneDef.name; assignExtrasToUserData( scene, sceneDef );
true
Other
mrdoob
three.js
65089d82e7e5e5ac78d53efc5dbb206dbf590fcf.json
fix empty name problem in GLTFLoader
examples/jsm/loaders/GLTFLoader.js
@@ -1891,7 +1891,7 @@ var GLTFLoader = ( function () { texture.flipY = false; - if ( textureDef.name !== undefined ) texture.name = textureDef.name; + if ( textureDef.name ) texture.name = textureDef.name; // Ignore unknown mime types, like DDS files. if ( source.mimeType in MIME_TYPE_FORMATS ) { @@ -2228,7 +2228,7 @@ var GLTFLoader = ( function () { } - if ( materialDef.name !== undefined ) material.name = materialDef.name; + if ( materialDef.name ) material.name = materialDef.name; // baseColorTexture, emissiveTexture, and specularGlossinessTexture use sRGB encoding. if ( material.map ) material.map.encoding = sRGBEncoding; @@ -2719,7 +2719,7 @@ var GLTFLoader = ( function () { } - if ( cameraDef.name !== undefined ) camera.name = cameraDef.name; + if ( cameraDef.name ) camera.name = cameraDef.name; assignExtrasToUserData( camera, cameraDef ); @@ -2940,7 +2940,7 @@ var GLTFLoader = ( function () { } - var name = animationDef.name !== undefined ? animationDef.name : 'animation_' + animationIndex; + var name = animationDef.name ? animationDef.name : 'animation_' + animationIndex; return new AnimationClip( name, undefined, tracks ); @@ -3059,7 +3059,7 @@ var GLTFLoader = ( function () { } - if ( nodeDef.name !== undefined ) { + if ( nodeDef.name ) { node.userData.name = nodeDef.name; node.name = PropertyBinding.sanitizeNodeName( nodeDef.name ); @@ -3217,7 +3217,7 @@ var GLTFLoader = ( function () { var parser = this; var scene = new Scene(); - if ( sceneDef.name !== undefined ) scene.name = sceneDef.name; + if ( sceneDef.name ) scene.name = sceneDef.name; assignExtrasToUserData( scene, sceneDef );
true
Other
mrdoob
three.js
4f7d05ff2b12ec9f9f568f4d4fd32df239a817b8.json
Use BufferGeometry for frustum helper
examples/jsm/csm/CSM.js
@@ -265,45 +265,55 @@ export default class CSM { helper( cameraMatrix ) { let frustum; - let geometry; + let geometry, vertices; const material = new THREE.LineBasicMaterial( { color: 0xffffff } ); const object = new THREE.Object3D(); for ( let i = 0; i < this.frustums.length; i ++ ) { frustum = this.frustums[ i ].toSpace( cameraMatrix ); - geometry = new THREE.Geometry(); + geometry = new THREE.BufferGeometry(); + vertices = []; + for ( let i = 0; i < 5; i ++ ) { const point = frustum.vertices.near[ i === 4 ? 0 : i ]; - geometry.vertices.push( new THREE.Vector3( point.x, point.y, point.z ) ); + vertices.push( point.x, point.y, point.z ); } + + geometry.setAttribute( 'position', new THREE.BufferAttribute( new Float32Array( vertices ), 3 ) ); object.add( new THREE.Line( geometry, material ) ); - geometry = new THREE.Geometry(); + geometry = new THREE.BufferGeometry(); + vertices = []; for ( let i = 0; i < 5; i ++ ) { const point = frustum.vertices.far[ i === 4 ? 0 : i ]; - geometry.vertices.push( new THREE.Vector3( point.x, point.y, point.z ) ); + vertices.push( point.x, point.y, point.z ); } + + geometry.setAttribute( 'position', new THREE.BufferAttribute( new Float32Array( vertices ), 3 ) ); object.add( new THREE.Line( geometry, material ) ); for ( let i = 0; i < 4; i ++ ) { - geometry = new THREE.Geometry(); + geometry = new THREE.BufferGeometry(); + vertices = []; const near = frustum.vertices.near[ i ]; const far = frustum.vertices.far[ i ]; - geometry.vertices.push( new THREE.Vector3( near.x, near.y, near.z ) ); - geometry.vertices.push( new THREE.Vector3( far.x, far.y, far.z ) ); + vertices.push( near.x, near.y, near.z ); + vertices.push( far.x, far.y, far.z ); + + geometry.setAttribute( 'position', new THREE.BufferAttribute( new Float32Array( vertices ), 3 ) ); object.add( new THREE.Line( geometry, material ) );
false
Other
mrdoob
three.js
87df048a6b3cc39c5cbd91c8e27cc23a111018e3.json
Allow leading whitespace in declaration regexp leading whitespace is common in copy-paste situations or when using multi-line template literals; this change allows (and ignores) leading whitespace when looking for glsl function declarations
examples/jsm/nodes/core/FunctionNode.js
@@ -6,7 +6,7 @@ import { TempNode } from './TempNode.js'; import { NodeLib } from './NodeLib.js'; -var declarationRegexp = /^([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i, +var declarationRegexp = /^\s*([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i, propertiesRegexp = /[a-z_0-9]+/ig; function FunctionNode( src, includes, extensions, keywords, type ) {
false
Other
mrdoob
three.js
7de2e8d459b2c57842641d011596436f4ee98457.json
update nodematerial prem #18004
examples/jsm/nodes/accessors/ReflectNode.js
@@ -54,7 +54,7 @@ ReflectNode.prototype.generate = function ( builder, output ) { case ReflectNode.VECTOR: - var viewNormalNode = builder.context.viewNormal || new NormalNode(); + var viewNormalNode = builder.context.viewNormal || new NormalNode( NormalNode.VIEW ); var roughnessNode = builder.context.roughness; var viewNormal = viewNormalNode.build( builder, 'v3' ); @@ -63,7 +63,7 @@ ReflectNode.prototype.generate = function ( builder, output ) { var method = `reflect( -normalize( ${viewPosition} ), ${viewNormal} )`; - if ( viewNormalNode && roughness ) { + if ( roughness ) { // Mixing the reflection with the normal is more accurate and keeps rough objects from gathering light from behind their tangent plane. method = `normalize( mix( ${method}, ${viewNormal}, ${roughness} * ${roughness} ) )`;
true
Other
mrdoob
three.js
7de2e8d459b2c57842641d011596436f4ee98457.json
update nodematerial prem #18004
examples/jsm/nodes/misc/TextureCubeNode.js
@@ -10,72 +10,31 @@ import { ReflectNode } from '../accessors/ReflectNode.js'; import { NormalNode } from '../accessors/NormalNode.js'; import { ColorSpaceNode } from '../utils/ColorSpaceNode.js'; -function TextureCubeNode( value, textureSize, uv, bias ) { +function TextureCubeNode( value, uv, bias ) { TempNode.call( this, 'v4' ); this.value = value; - textureSize = textureSize || new FloatNode( 1024 ); - - this.radianceCache = { uv: new TextureCubeUVNode( + this.radianceNode = new TextureCubeUVNode( + this.value, uv || new ReflectNode( ReflectNode.VECTOR ), - textureSize, // bias should be replaced in builder.context in build process bias - ) }; + ); - this.irradianceCache = { uv: new TextureCubeUVNode( + this.irradianceNode = new TextureCubeUVNode( + this.value, new NormalNode( NormalNode.WORLD ), - textureSize, new FloatNode( 1 ).setReadonly( true ) - ) }; + ); } TextureCubeNode.prototype = Object.create( TempNode.prototype ); TextureCubeNode.prototype.constructor = TextureCubeNode; TextureCubeNode.prototype.nodeType = "TextureCube"; -TextureCubeNode.prototype.generateTextureCubeUV = function ( builder, cache ) { - - var uv_10 = cache.uv.build( builder ) + '.uv_10', - uv_20 = cache.uv.build( builder ) + '.uv_20', - t = cache.uv.build( builder ) + '.t'; - - var color10 = 'texture2D( ' + this.value.build( builder, 'sampler2D' ) + ', ' + uv_10 + ' )', - color20 = 'texture2D( ' + this.value.build( builder, 'sampler2D' ) + ', ' + uv_20 + ' )'; - - // add a custom context for fix incompatibility with the core - // include ColorSpace function only for vertex shader (in fragment shader color space functions is added automatically by core) - // this should be removed in the future - // context.include =: is used to include or not functions if used FunctionNode - // context.ignoreCache =: not create temp variables nodeT0..9 to optimize the code - var context = { include: builder.isShader( 'vertex' ), ignoreCache: true }; - var outputType = this.getType( builder ); - - builder.addContext( context ); - - cache.colorSpace10 = cache.colorSpace10 || new ColorSpaceNode( new ExpressionNode( '', outputType ) ); - cache.colorSpace10.fromDecoding( builder.getTextureEncodingFromMap( this.value.value ) ); - cache.colorSpace10.input.parse( color10 ); - - color10 = cache.colorSpace10.build( builder, outputType ); - - cache.colorSpace20 = cache.colorSpace20 || new ColorSpaceNode( new ExpressionNode( '', outputType ) ); - cache.colorSpace20.fromDecoding( builder.getTextureEncodingFromMap( this.value.value ) ); - cache.colorSpace20.input.parse( color20 ); - - color20 = cache.colorSpace20.build( builder, outputType ); - - // end custom context - - builder.removeContext(); - - return 'mix( ' + color10 + ', ' + color20 + ', ' + t + ' ).rgb'; - -}; - TextureCubeNode.prototype.generate = function ( builder, output ) { if ( builder.isShader( 'fragment' ) ) { @@ -88,10 +47,9 @@ TextureCubeNode.prototype.generate = function ( builder, output ) { } - var cache = builder.slot === 'irradiance' ? this.irradianceCache : this.radianceCache; - var result = this.generateTextureCubeUV( builder, cache ); + var scopeNode = builder.slot === 'irradiance' ? this.irradianceNode : this.radianceNode; - return builder.format( 'vec4( ' + result + ', 1.0 )', this.getType( builder ), output ); + return scopeNode.build( builder, output ); } else {
true
Other
mrdoob
three.js
7de2e8d459b2c57842641d011596436f4ee98457.json
update nodematerial prem #18004
examples/jsm/nodes/misc/TextureCubeUVNode.js
@@ -6,157 +6,159 @@ import { TempNode } from '../core/TempNode.js'; import { ConstNode } from '../core/ConstNode.js'; import { StructNode } from '../core/StructNode.js'; import { FunctionNode } from '../core/FunctionNode.js'; +import { FunctionCallNode } from '../core/FunctionCallNode.js'; +import { ExpressionNode } from '../core/ExpressionNode.js'; +import { ReflectNode } from '../accessors/ReflectNode.js'; +import { FloatNode } from '../inputs/FloatNode.js'; +import { OperatorNode } from '../math/OperatorNode.js'; +import { MathNode } from '../math/MathNode.js'; +import { CondNode } from '../math/CondNode.js'; +import { ColorSpaceNode } from '../utils/ColorSpaceNode.js'; -function TextureCubeUVNode( uv, textureSize, bias ) { +function TextureCubeUVNode( value, uv, bias ) { - TempNode.call( this, 'TextureCubeUVData' ); // TextureCubeUVData is type as StructNode + TempNode.call( this, 'v4' ); + this.value = value, this.uv = uv; - this.textureSize = textureSize; this.bias = bias; } TextureCubeUVNode.Nodes = ( function () { - var TextureCubeUVData = new StructNode( [ - "struct TextureCubeUVData {", - " vec2 uv_10;", - " vec2 uv_20;", - " float t;", - "}" - ].join( "\n" ) ); - - var getFaceFromDirection = new FunctionNode( [ - "int getFaceFromDirection(vec3 direction) {", - " vec3 absDirection = abs(direction);", - " int face = -1;", - " if( absDirection.x > absDirection.z ) {", - " if(absDirection.x > absDirection.y )", - " face = direction.x > 0.0 ? 0 : 3;", - " else", - " face = direction.y > 0.0 ? 1 : 4;", - " }", - " else {", - " if(absDirection.z > absDirection.y )", - " face = direction.z > 0.0 ? 2 : 5;", - " else", - " face = direction.y > 0.0 ? 1 : 4;", - " }", - " return face;", - "}" - ].join( "\n" ) ); - - var cubeUV_maxLods1 = new ConstNode( "#define cubeUV_maxLods1 ( log2( cubeUV_textureSize * 0.25 ) - 1.0 )" ); - var cubeUV_rangeClamp = new ConstNode( "#define cubeUV_rangeClamp ( exp2( ( 6.0 - 1.0 ) * 2.0 ) )" ); - - var MipLevelInfo = new FunctionNode( [ - "vec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness, in float cubeUV_textureSize ) {", - " float scale = exp2(cubeUV_maxLods1 - roughnessLevel);", - " float dxRoughness = dFdx(roughness);", - " float dyRoughness = dFdy(roughness);", - " vec3 dx = dFdx( vec * scale * dxRoughness );", - " vec3 dy = dFdy( vec * scale * dyRoughness );", - " float d = max( dot( dx, dx ), dot( dy, dy ) );", - // Clamp the value to the max mip level counts. hard coded to 6 mips" - " d = clamp(d, 1.0, cubeUV_rangeClamp);", - " float mipLevel = 0.5 * log2(d);", - " return vec2(floor(mipLevel), fract(mipLevel));", - "}" - ].join( "\n" ), [ cubeUV_maxLods1, cubeUV_rangeClamp ], { derivatives: true } ); - - var cubeUV_maxLods2 = new ConstNode( "#define cubeUV_maxLods2 ( log2( cubeUV_textureSize * 0.25 ) - 2.0 )" ); - var cubeUV_rcpTextureSize = new ConstNode( "#define cubeUV_rcpTextureSize ( 1.0 / cubeUV_textureSize )" ); - - var getCubeUV = new FunctionNode( [ - "vec2 getCubeUV( vec3 direction, float roughnessLevel, float mipLevel, in float cubeUV_textureSize ) {", - " mipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;", - " float a = 16.0 * cubeUV_rcpTextureSize;", - "", - " vec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );", - " vec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;", - // float powScale = exp2(roughnessLevel + mipLevel);" - " float powScale = exp2_packed.x * exp2_packed.y;", - // float scale = 1.0 / exp2(roughnessLevel + 2.0 + mipLevel);" - " float scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;", - // float mipOffset = 0.75*(1.0 - 1.0/exp2(mipLevel))/exp2(roughnessLevel);" - " float mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;", - "", - " bool bRes = mipLevel == 0.0;", - " scale = bRes && (scale < a) ? a : scale;", - "", - " vec3 r;", - " vec2 offset;", - " int face = getFaceFromDirection(direction);", - "", - " float rcpPowScale = 1.0 / powScale;", - "", - " if( face == 0) {", - " r = vec3(direction.x, -direction.z, direction.y);", - " offset = vec2(0.0+mipOffset,0.75 * rcpPowScale);", - " offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;", - " }", - " else if( face == 1) {", - " r = vec3(direction.y, direction.x, direction.z);", - " offset = vec2(scale+mipOffset, 0.75 * rcpPowScale);", - " offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;", - " }", - " else if( face == 2) {", - " r = vec3(direction.z, direction.x, direction.y);", - " offset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);", - " offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;", - " }", - " else if( face == 3) {", - " r = vec3(direction.x, direction.z, direction.y);", - " offset = vec2(0.0+mipOffset,0.5 * rcpPowScale);", - " offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;", - " }", - " else if( face == 4) {", - " r = vec3(direction.y, direction.x, -direction.z);", - " offset = vec2(scale+mipOffset, 0.5 * rcpPowScale);", - " offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;", - " }", - " else {", - " r = vec3(direction.z, -direction.x, direction.y);", - " offset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);", - " offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;", - " }", - " r = normalize(r);", - " float texelOffset = 0.5 * cubeUV_rcpTextureSize;", - " vec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;", - " vec2 base = offset + vec2( texelOffset );", - " return base + s * ( scale - 2.0 * texelOffset );", - "}" - ].join( "\n" ), [ cubeUV_maxLods2, cubeUV_rcpTextureSize, getFaceFromDirection ] ); - - var cubeUV_maxLods3 = new ConstNode( "#define cubeUV_maxLods3 ( log2( cubeUV_textureSize * 0.25 ) - 3.0 )" ); - - var textureCubeUV = new FunctionNode( [ - "TextureCubeUVData textureCubeUV( vec3 reflectedDirection, float roughness, in float cubeUV_textureSize ) {", - " float roughnessVal = roughness * cubeUV_maxLods3;", - " float r1 = floor(roughnessVal);", - " float r2 = r1 + 1.0;", - " float t = fract(roughnessVal);", - " vec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness, cubeUV_textureSize);", - " float s = mipInfo.y;", - " float level0 = mipInfo.x;", - " float level1 = level0 + 1.0;", - " level1 = level1 > 5.0 ? 5.0 : level1;", - "", - // round to nearest mipmap if we are not interpolating." - " level0 += min( floor( s + 0.5 ), 5.0 );", - "", - // Tri linear interpolation." - " vec2 uv_10 = getCubeUV(reflectedDirection, r1, level0, cubeUV_textureSize);", - " vec2 uv_20 = getCubeUV(reflectedDirection, r2, level0, cubeUV_textureSize);", - "", - " return TextureCubeUVData(uv_10, uv_20, t);", - "}" - ].join( "\n" ), [ TextureCubeUVData, cubeUV_maxLods3, MipLevelInfo, getCubeUV ] ); + var TextureCubeUVData = new StructNode( +`struct TextureCubeUVData { + vec4 tl; + vec4 tr; + vec4 br; + vec4 bl; + vec2 f; +}` ); + + var cubeUV_maxMipLevel = new ConstNode( `float cubeUV_maxMipLevel 8.0`, true ); + var cubeUV_minMipLevel = new ConstNode( `float cubeUV_minMipLevel 4.0`, true ); + var cubeUV_maxTileSize = new ConstNode( `float cubeUV_maxTileSize 256.0`, true ); + var cubeUV_minTileSize = new ConstNode( `float cubeUV_minTileSize 16.0`, true ); + + // These shader functions convert between the UV coordinates of a single face of + // a cubemap, the 0-5 integer index of a cube face, and the direction vector for + // sampling a textureCube (not generally normalized). + + var getFace = new FunctionNode( +`float getFace(vec3 direction) { + vec3 absDirection = abs(direction); + float face = -1.0; + if (absDirection.x > absDirection.z) { + if (absDirection.x > absDirection.y) + face = direction.x > 0.0 ? 0.0 : 3.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } else { + if (absDirection.z > absDirection.y) + face = direction.z > 0.0 ? 2.0 : 5.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } + return face; +}` ); + getFace.useKeywords = false; + + var getUV = new FunctionNode( +`vec2 getUV(vec3 direction, float face) { + vec2 uv; + if (face == 0.0) { + uv = vec2(-direction.z, direction.y) / abs(direction.x); + } else if (face == 1.0) { + uv = vec2(direction.x, -direction.z) / abs(direction.y); + } else if (face == 2.0) { + uv = direction.xy / abs(direction.z); + } else if (face == 3.0) { + uv = vec2(direction.z, direction.y) / abs(direction.x); + } else if (face == 4.0) { + uv = direction.xz / abs(direction.y); + } else { + uv = vec2(-direction.x, direction.y) / abs(direction.z); + } + return 0.5 * (uv + 1.0); +}` ); + getUV.useKeywords = false; + + var bilinearCubeUV = new FunctionNode( +`TextureCubeUVData bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) { + float face = getFace(direction); + float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0); + mipInt = max(mipInt, cubeUV_minMipLevel); + float faceSize = exp2(mipInt); + float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize); + vec2 uv = getUV(direction, face) * (faceSize - 1.0); + vec2 f = fract(uv); + uv += 0.5 - f; + if (face > 2.0) { + uv.y += faceSize; + face -= 3.0; + } + uv.x += face * faceSize; + if(mipInt < cubeUV_maxMipLevel){ + uv.y += 2.0 * cubeUV_maxTileSize; + } + uv.y += filterInt * 2.0 * cubeUV_minTileSize; + uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize); + uv *= texelSize; + vec4 tl = texture2D(envMap, uv); + uv.x += texelSize; + vec4 tr = texture2D(envMap, uv); + uv.y += texelSize; + vec4 br = texture2D(envMap, uv); + uv.x -= texelSize; + vec4 bl = texture2D(envMap, uv); + + return TextureCubeUVData( tl, tr, br, bl, f ); +}`, [ TextureCubeUVData, getFace, getUV, cubeUV_maxMipLevel, cubeUV_minMipLevel, cubeUV_maxTileSize, cubeUV_minTileSize ] ); + bilinearCubeUV.useKeywords = false; + + // These defines must match with PMREMGenerator + + var r0 = new ConstNode( `float r0 1.0`, true ); + var v0 = new ConstNode( `float v0 0.339`, true ); + var m0 = new ConstNode( `float m0 -2.0`, true ); + var r1 = new ConstNode( `float r1 0.8`, true ); + var v1 = new ConstNode( `float v1 0.276`, true ); + var m1 = new ConstNode( `float m1 -1.0`, true ); + var r4 = new ConstNode( `float r4 0.4`, true ); + var v4 = new ConstNode( `float v4 0.046`, true ); + var m4 = new ConstNode( `float m4 2.0`, true ); + var r5 = new ConstNode( `float r5 0.305`, true ); + var v5 = new ConstNode( `float v5 0.016`, true ); + var m5 = new ConstNode( `float m5 3.0`, true ); + var r6 = new ConstNode( `float r6 0.21`, true ); + var v6 = new ConstNode( `float v6 0.0038`, true ); + var m6 = new ConstNode( `float m6 4.0`, true ); + + var defines = [ r0, v0, m0, r1, v1, m1, r4, v4, m4, r5, v5, m5, r6, v6, m6 ]; + + var roughnessToMip = new FunctionNode( +`float roughnessToMip(float roughness) { + float mip = 0.0; + if (roughness >= r1) { + mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0; + } else if (roughness >= r4) { + mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1; + } else if (roughness >= r5) { + mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4; + } else if (roughness >= r6) { + mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5; + } else { + mip = -2.0 * log2(1.16 * roughness);// 1.16 = 1.79^0.25 + } + return mip; +}`, defines ); return { - TextureCubeUVData: TextureCubeUVData, - textureCubeUV: textureCubeUV + bilinearCubeUV: bilinearCubeUV, + roughnessToMip: roughnessToMip, + m0: m0, + cubeUV_maxMipLevel: cubeUV_maxMipLevel }; } )(); @@ -165,17 +167,92 @@ TextureCubeUVNode.prototype = Object.create( TempNode.prototype ); TextureCubeUVNode.prototype.constructor = TextureCubeUVNode; TextureCubeUVNode.prototype.nodeType = "TextureCubeUV"; +TextureCubeUVNode.prototype.bilinearCubeUV = function ( builder, texture, uv, mipInt ) { + + var bilinearCubeUV = new FunctionCallNode( TextureCubeUVNode.Nodes.bilinearCubeUV, [ texture, uv, mipInt ] ); + + this.colorSpaceTL = this.colorSpaceTL || new ColorSpaceNode( new ExpressionNode( '', 'v4' ) ); + this.colorSpaceTL.fromDecoding( builder.getTextureEncodingFromMap( this.value.value ) ); + this.colorSpaceTL.input.parse( bilinearCubeUV.build( builder ) + '.tl' ); + + this.colorSpaceTR = this.colorSpaceTR || new ColorSpaceNode( new ExpressionNode( '', 'v4' ) ); + this.colorSpaceTR.fromDecoding( builder.getTextureEncodingFromMap( this.value.value ) ); + this.colorSpaceTR.input.parse( bilinearCubeUV.build( builder ) + '.tr' ); + + this.colorSpaceBL = this.colorSpaceBL || new ColorSpaceNode( new ExpressionNode( '', 'v4' ) ); + this.colorSpaceBL.fromDecoding( builder.getTextureEncodingFromMap( this.value.value ) ); + this.colorSpaceBL.input.parse( bilinearCubeUV.build( builder ) + '.bl' ); + + this.colorSpaceBR = this.colorSpaceBR || new ColorSpaceNode( new ExpressionNode( '', 'v4' ) ); + this.colorSpaceBR.fromDecoding( builder.getTextureEncodingFromMap( this.value.value ) ); + this.colorSpaceBR.input.parse( bilinearCubeUV.build( builder ) + '.br' ); + + var f = bilinearCubeUV.build( builder ) + '.f'; + + // add a custom context for fix incompatibility with the core + // include ColorSpace function only for vertex shader (in fragment shader color space functions is added automatically by core) + // this should be removed in the future + // context.include =: is used to include or not functions if used FunctionNode + // context.ignoreCache =: not create temp variables nodeT0..9 to optimize the code + var context = { include: builder.isShader( 'vertex' ), ignoreCache: true }; + + builder.addContext( context ); + + this.colorSpaceTLExp = new ExpressionNode( this.colorSpaceTL.build( builder, 'v4' ), 'v4' ); + this.colorSpaceTRExp = new ExpressionNode( this.colorSpaceTR.build( builder, 'v4' ), 'v4' ); + this.colorSpaceBLExp = new ExpressionNode( this.colorSpaceBL.build( builder, 'v4' ), 'v4' ); + this.colorSpaceBRExp = new ExpressionNode( this.colorSpaceBR.build( builder, 'v4' ), 'v4' ); + + // end custom context + + builder.removeContext(); + + // -- + + var output = new ExpressionNode(`mix( mix( cubeUV_TL, cubeUV_TR, cubeUV.f.x ), mix( cubeUV_BL, cubeUV_BR, cubeUV.f.x ), cubeUV.f.y )`, 'v4' ); + output.keywords['cubeUV_TL'] = this.colorSpaceTLExp; + output.keywords['cubeUV_TR'] = this.colorSpaceTRExp; + output.keywords['cubeUV_BL'] = this.colorSpaceBLExp; + output.keywords['cubeUV_BR'] = this.colorSpaceBRExp; + output.keywords['cubeUV'] = bilinearCubeUV; + + return output; + +}; + TextureCubeUVNode.prototype.generate = function ( builder, output ) { if ( builder.isShader( 'fragment' ) ) { - var textureCubeUV = builder.include( TextureCubeUVNode.Nodes.textureCubeUV ); + var uv = this.uv; + var bias = this.bias || builder.context.roughness; + + var mipV = new FunctionCallNode( TextureCubeUVNode.Nodes.roughnessToMip, [ bias ] ); + var mip = new MathNode( mipV, TextureCubeUVNode.Nodes.m0, TextureCubeUVNode.Nodes.cubeUV_maxMipLevel, MathNode.CLAMP ); + var mipInt = new MathNode( mip, MathNode.FLOOR ); + var mipF = new MathNode( mip, MathNode.FRACT ); + + var color0 = this.bilinearCubeUV( builder, this.value, uv, mipInt ); + var color1 = this.bilinearCubeUV( builder, this.value, uv, new OperatorNode( + mipInt, + new FloatNode( 1 ).setReadonly( true ), + OperatorNode.ADD + ) ); + + var color1Mix = new MathNode( color0, color1, mipF, MathNode.MIX ); - var biasNode = this.bias || builder.context.roughness; +/* + // TODO: Optimize this in the future + var cond = new CondNode( + mipF, + new FloatNode( 0 ).setReadonly( true ), + CondNode.EQUAL, + color0, // if + color1Mix // else + ); +*/ - return builder.format( textureCubeUV + '( ' + this.uv.build( builder, 'v3' ) + ', ' + - biasNode.build( builder, 'f' ) + ', ' + - this.textureSize.build( builder, 'f' ) + ' )', this.getType( builder ), output ); + return builder.format( color1Mix.build( builder ), 'v4', output ); } else { @@ -195,9 +272,9 @@ TextureCubeUVNode.prototype.toJSON = function ( meta ) { data = this.createJSONNode( meta ); + data.value = this.value.toJSON( meta ).uuid; data.uv = this.uv.toJSON( meta ).uuid; - data.textureSize = this.textureSize.toJSON( meta ).uuid; - data.blinnExponentToRoughness = this.blinnExponentToRoughness.toJSON( meta ).uuid; + data.bias = this.bias.toJSON( meta ).uuid; }
true
Other
mrdoob
three.js
7de2e8d459b2c57842641d011596436f4ee98457.json
update nodematerial prem #18004
examples/webgl_materials_envmaps_hdr_nodes.html
@@ -1,35 +1,18 @@ <!DOCTYPE html> <html lang="en"> <head> - <title>threejs webgl - node material - hdr environment mapping</title> + <title>threejs webgl - materials - hdr environment mapping</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> - <style> - body { - color: #fff; - font-family:Monospace; - font-size:13px; - text-align:center; - - background-color: #000; - - margin: 0px; - overflow: hidden; - } - a { color: #00f } - - #info { - position: absolute; - top: 0px; width: 100%; - padding: 5px; - } - </style> + <link type="text/css" rel="stylesheet" href="main.css"> </head> <body> <div id="container"></div> - <div id="info"><a href="http://threejs.org" target="_blank" rel="noopener">threejs</a> - High dynamic range (RGBE) Image-based Lighting (IBL)<br />using run-time generated pre-filtered roughness mipmaps (PMREM)<br/> - Created by Prashant Sharma and <a href="http://clara.io/" target="_blank" rel="noopener">Ben Houston</a>.</div> + <div id="info"> + <a href="http://threejs.org" target="_blank" rel="noopener">threejs</a> - High dynamic range (RGBE) Image-based Lighting (IBL)<br />using run-time generated pre-filtered roughness mipmaps (PMREM)<br/> + Created by Prashant Sharma and <a href="http://clara.io/" target="_blank" rel="noopener">Ben Houston</a>. + </div> <script type="module"> @@ -41,6 +24,7 @@ import { OrbitControls } from './jsm/controls/OrbitControls.js'; import { HDRCubeTextureLoader } from './jsm/loaders/HDRCubeTextureLoader.js'; import { PMREMGenerator } from './jsm/pmrem/PMREMGenerator.js'; + import { MeshStandardNodeMaterial } from './jsm/nodes/Nodes.js'; var params = { @@ -50,18 +34,53 @@ exposure: 1.0, nodes: true, animate: true, - debug: false, + debug: false }; var container, stats; var camera, scene, renderer, controls; var torusMesh, torusMeshNode, planeMesh; - var ldrCubeRenderTarget, hdrCubeRenderTarget, rgbmCubeRenderTarget; + var generatedCubeRenderTarget, ldrCubeRenderTarget, hdrCubeRenderTarget, rgbmCubeRenderTarget; var ldrCubeMap, hdrCubeMap, rgbmCubeMap; init(); animate(); + function getEnvScene() { + + var envScene = new THREE.Scene(); + + var geometry = new THREE.BoxBufferGeometry(); + geometry.deleteAttribute('uv'); + var roomMaterial = new THREE.MeshStandardMaterial({metalness: 0, side: THREE.BackSide}); + var room = new THREE.Mesh(geometry, roomMaterial); + room.scale.setScalar(10); + envScene.add(room); + + var mainLight = new THREE.PointLight(0xffffff, 50, 0, 2); + envScene.add(mainLight); + + var lightMaterial = new THREE.MeshLambertMaterial( { color: 0x000000, emissive: 0xffffff, emissiveIntensity: 10 } ); + + var light1 = new THREE.Mesh(geometry, lightMaterial); + light1.position.set(-5, 2, 0); + light1.scale.set(0.1, 1, 1); + envScene.add(light1); + + var light2 = new THREE.Mesh(geometry, lightMaterial); + light2.position.set(0, 5, 0); + light2.scale.set(1, 0.1, 1); + envScene.add(light2); + + var light2 = new THREE.Mesh(geometry, lightMaterial); + light2.position.set(2, 1, 5); + light2.scale.set(1.5, 2, 0.1); + envScene.add(light2); + + return envScene; + + } + function init() { container = document.createElement( 'div' ); @@ -74,6 +93,7 @@ scene.background = new THREE.Color( 0x000000 ); renderer = new THREE.WebGLRenderer(); + renderer.physicallyCorrectLights = true; renderer.toneMapping = THREE.LinearToneMapping; // @@ -97,7 +117,10 @@ torusMeshNode = new THREE.Mesh( geometry, material ); scene.add( torusMeshNode ); - planeMesh = new THREE.Mesh( new THREE.PlaneBufferGeometry( 200, 200 ), new THREE.MeshBasicMaterial() ); + var geometry = new THREE.PlaneBufferGeometry( 200, 200 ); + var material = new THREE.MeshBasicMaterial(); + + planeMesh = new THREE.Mesh( geometry, material ); planeMesh.position.y = - 50; planeMesh.rotation.x = - Math.PI * 0.5; scene.add( planeMesh ); @@ -109,6 +132,9 @@ } + var envScene = getEnvScene(); + generatedCubeRenderTarget = pmremGenerator.fromScene( envScene, 0.04 ); + var hdrUrls = [ 'px.hdr', 'nx.hdr', 'py.hdr', 'ny.hdr', 'pz.hdr', 'nz.hdr' ]; hdrCubeMap = new HDRCubeTextureLoader() .setPath( './textures/cube/pisaHDR/' ) @@ -153,7 +179,7 @@ renderer.setSize( window.innerWidth, window.innerHeight ); container.appendChild( renderer.domElement ); - //renderer.toneMapping = THREE.ReinhardToneMapping; + //renderer.toneMapping = ReinhardToneMapping; renderer.outputEncoding = THREE.sRGBEncoding; stats = new Stats(); @@ -167,7 +193,7 @@ var gui = new GUI(); - gui.add( params, 'envMap', [ 'LDR', 'HDR', 'RGBM16' ] ); + gui.add( params, 'envMap', [ 'Generated', 'LDR', 'HDR', 'RGBM16' ] ); gui.add( params, 'roughness', 0, 1, 0.01 ); gui.add( params, 'metalness', 0, 1, 0.01 ); gui.add( params, 'exposure', 0, 2, 0.01 ); @@ -202,19 +228,23 @@ function render() { + torusMesh.visible = ! params.nodes; + torusMeshNode.visible = params.nodes; + torusMesh.material.roughness = params.roughness; torusMesh.material.metalness = params.metalness; torusMeshNode.material.roughness = params.roughness; torusMeshNode.material.metalness = params.metalness; - torusMesh.visible = ! params.nodes; - torusMeshNode.visible = params.nodes; - var renderTarget, cubeMap; switch ( params.envMap ) { + case 'Generated': + renderTarget = generatedCubeRenderTarget; + cubeMap = generatedCubeRenderTarget.texture; + break; case 'LDR': renderTarget = ldrCubeRenderTarget; cubeMap = ldrCubeMap;
true
Other
mrdoob
three.js
7de2e8d459b2c57842641d011596436f4ee98457.json
update nodematerial prem #18004
examples/webgl_materials_envmaps_pmrem_nodes.html
@@ -51,7 +51,6 @@ } from './jsm/nodes/Nodes.js'; var params = { - textureSize: 1024, roughness: 0.0, metalness: 0.0, exposure: 1.0, @@ -62,16 +61,14 @@ var container, stats; var camera, scene, renderer, controls; - var nodeMaterial, nodeTexture, nodeTextureSize, nodeTextureIntensity, torusMesh, planeMesh; + var nodeMaterial, nodeTexture, nodeTextureIntensity, torusMesh, planeMesh; var hdrCubeRenderTarget; var hdrCubeMap; init(); animate(); - function generate( textureSize ) { - - nodeTextureSize.value = textureSize; + function generate() { var pmremGenerator = new PMREMGenerator( renderer ); hdrCubeRenderTarget = pmremGenerator.fromCubemap( hdrCubeMap ); @@ -112,10 +109,9 @@ nodeMaterial.visible = false; nodeTexture = new TextureNode(); - nodeTextureSize = new FloatNode( 1024 ); nodeTextureIntensity = new FloatNode( 1 ); - nodeMaterial.environment = new OperatorNode( new TextureCubeNode( nodeTexture, nodeTextureSize ), nodeTextureIntensity, OperatorNode.MUL ); + nodeMaterial.environment = new OperatorNode( new TextureCubeNode( nodeTexture ), nodeTextureIntensity, OperatorNode.MUL ); torusMesh = new THREE.Mesh( geometry, nodeMaterial ); scene.add( torusMesh ); @@ -131,7 +127,7 @@ .setDataType( THREE.UnsignedByteType ) .load( hdrUrls, function () { - generate( params.textureSize ); + generate(); nodeMaterial.visible = true; @@ -155,7 +151,6 @@ var gui = new GUI(); - gui.add( params, 'textureSize', [ 128, 256, 512, 1024, 2048, 4096 ] ); gui.add( params, 'roughness', 0, 1, 0.01 ); gui.add( params, 'metalness', 0, 1, 0.01 ); gui.add( params, 'exposure', 0, 2, 0.01 ); @@ -195,12 +190,6 @@ nodeTextureIntensity.value = params.intensity; - if ( nodeTextureSize.value !== params.textureSize ) { - - generate( params.textureSize ); - - } - if ( params.animate ) { torusMesh.rotation.y += 0.005;
true
Other
mrdoob
three.js
2a5b77170ad453da5ba1addb8665fdc1e1fc7274.json
Update jsm files.
examples/jsm/postprocessing/EffectComposer.js
@@ -294,6 +294,12 @@ Pass.FullScreenQuad = ( function () { Object.assign( FullScreenQuad.prototype, { + dispose: function () { + + this._mesh.geometry.dispose(); + + }, + render: function ( renderer ) { renderer.render( this._mesh, camera );
true
Other
mrdoob
three.js
2a5b77170ad453da5ba1addb8665fdc1e1fc7274.json
Update jsm files.
examples/jsm/renderers/CSS3DRenderer.js
@@ -16,6 +16,7 @@ var CSS3DObject = function ( element ) { this.element = element; this.element.style.position = 'absolute'; + this.element.style.pointerEvents = 'auto'; this.addEventListener( 'removed', function () { @@ -68,6 +69,7 @@ var CSS3DRenderer = function () { cameraElement.style.WebkitTransformStyle = 'preserve-3d'; cameraElement.style.transformStyle = 'preserve-3d'; + cameraElement.style.pointerEvents = 'none'; domElement.appendChild( cameraElement );
true
Other
mrdoob
three.js
d8d0bdd512bb642b2118784375b38b2c1c9ee8d8.json
Use new .applyMatrix4() method
src/core/BufferGeometry.js
@@ -129,7 +129,8 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy if ( position !== undefined ) { - matrix.applyToBufferAttribute( position ); + position.applyMatrix4( matrix ); + position.needsUpdate = true; }
false
Other
mrdoob
three.js
4c3419040361c3ef57453c222d5c29a6aaa764be.json
Remove unused xr.submitFrame()
src/renderers/WebGLRenderer.js
@@ -1244,8 +1244,6 @@ function WebGLRenderer( parameters ) { } - xr.submitFrame(); - } // _gl.finish();
false
Other
mrdoob
three.js
f0ca50e72c5451c1677b5cc9d0b44700b6154c01.json
pass tests by removing trailing space
src/materials/Material.d.ts
@@ -128,7 +128,7 @@ export class Material extends EventDispatcher { colorWrite: boolean; /** - * Custom defines to be injected into the shader. These are passed in form of an object literal, with key/value pairs. { MY_CUSTOM_DEFINE: '' , PI2: Math.PI * 2 }. + * Custom defines to be injected into the shader. These are passed in form of an object literal, with key/value pairs. { MY_CUSTOM_DEFINE: '' , PI2: Math.PI * 2 }. * The pairs are defined in both vertex and fragment shaders. Default is undefined. */ defines: any;
false
Other
mrdoob
three.js
19ef82b9430d1967e93fc601672803053883d89e.json
Add defines to material types
src/materials/Material.d.ts
@@ -30,6 +30,7 @@ export interface MaterialParameters { clippingPlanes?: Plane[]; clipShadows?: boolean; colorWrite?: boolean; + defines?: any; depthFunc?: DepthModes; depthTest?: boolean; depthWrite?: boolean; @@ -125,6 +126,12 @@ export class Material extends EventDispatcher { * Whether to render the material's color. This can be used in conjunction with a mesh's .renderOrder property to create invisible objects that occlude other objects. Default is true. */ colorWrite: boolean; + + /** + * Custom defines to be injected into the shader. These are passed in form of an object literal, with key/value pairs. { MY_CUSTOM_DEFINE: '' , PI2: Math.PI * 2 }. + * The pairs are defined in both vertex and fragment shaders. Default is undefined. + */ + defines: any; /** * Which depth function to use. Default is {@link LessEqualDepth}. See the depth mode constants for all possible values.
false
Other
mrdoob
three.js
8aeac464bf796f15bd17b46312c3e5436b939d43.json
Remove non-breaking space from code.
editor/js/Menubar.Help.js
@@ -48,4 +48,4 @@ var MenubarHelp = function ( editor ) { }; -export { MenubarHelp }; +export { MenubarHelp };
true
Other
mrdoob
three.js
8aeac464bf796f15bd17b46312c3e5436b939d43.json
Remove non-breaking space from code.
editor/js/commands/SetMaterialCommand.js
@@ -78,4 +78,4 @@ SetMaterialCommand.prototype = { }; -export { SetMaterialCommand }; +export { SetMaterialCommand };
true
Other
mrdoob
three.js
8aeac464bf796f15bd17b46312c3e5436b939d43.json
Remove non-breaking space from code.
editor/js/commands/SetMaterialMapCommand.js
@@ -134,4 +134,4 @@ SetMaterialMapCommand.prototype = { }; -export { SetMaterialMapCommand }; +export { SetMaterialMapCommand };
true
Other
mrdoob
three.js
8aeac464bf796f15bd17b46312c3e5436b939d43.json
Remove non-breaking space from code.
examples/js/loaders/VRMLLoader.js
@@ -2035,7 +2035,7 @@ THREE.VRMLLoader = ( function () { // materials can be influenced by the geometry (e.g. vertex normals). cloning is necessary to avoid // any side effects - return ( build.isObject3D || build.isMaterial ) ? build.clone() : build; + return ( build.isObject3D || build.isMaterial ) ? build.clone() : build; }
true
Other
mrdoob
three.js
8aeac464bf796f15bd17b46312c3e5436b939d43.json
Remove non-breaking space from code.
examples/jsm/controls/TransformControls.d.ts
@@ -13,7 +13,7 @@ export class TransformControls extends Object3D { // API camera: Camera; - object: Object3D | undefined; + object: Object3D | undefined; enabled: boolean; axis: string | null; mode: string;
true
Other
mrdoob
three.js
8aeac464bf796f15bd17b46312c3e5436b939d43.json
Remove non-breaking space from code.
examples/jsm/exporters/PLYExporter.d.ts
@@ -9,6 +9,6 @@ export class PLYExporter { constructor(); - parse( object: Object3D, onDone: ( res: string ) => void, options: PLYExporterOptions ): string | null; + parse( object: Object3D, onDone: ( res: string ) => void, options: PLYExporterOptions ): string | null; }
true
Other
mrdoob
three.js
8aeac464bf796f15bd17b46312c3e5436b939d43.json
Remove non-breaking space from code.
examples/jsm/lines/WireframeGeometry2.d.ts
@@ -7,7 +7,7 @@ import { LineSegmentsGeometry } from './LineSegmentsGeometry'; export class WireframeGeometry2 extends LineSegmentsGeometry { - constructor( geometry: Geometry | BufferGeometry ); + constructor( geometry: Geometry | BufferGeometry ); isWireframeGeometry2: boolean; }
true
Other
mrdoob
three.js
8aeac464bf796f15bd17b46312c3e5436b939d43.json
Remove non-breaking space from code.
examples/jsm/loaders/BasisTextureLoader.d.ts
@@ -8,7 +8,7 @@ import { export class BasisTextureLoader extends Loader { constructor( manager?: LoadingManager ); - transcoderBinary: ArrayBuffer | null; + transcoderBinary: ArrayBuffer | null; transcoderPath: string; transcoderPending: Promise<void> | null;
true
Other
mrdoob
three.js
8aeac464bf796f15bd17b46312c3e5436b939d43.json
Remove non-breaking space from code.
examples/jsm/loaders/GLTFLoader.d.ts
@@ -29,8 +29,8 @@ export interface GLTF { export class GLTFLoader extends Loader { constructor( manager?: LoadingManager ); - dracoLoader: DRACOLoader | null; - ddsLoader: DDSLoader | null; + dracoLoader: DRACOLoader | null; + ddsLoader: DDSLoader | null; load( url: string, onLoad: ( gltf: GLTF ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void; setDRACOLoader( dracoLoader: DRACOLoader ): GLTFLoader;
true
Other
mrdoob
three.js
8aeac464bf796f15bd17b46312c3e5436b939d43.json
Remove non-breaking space from code.
examples/jsm/loaders/VRMLLoader.js
@@ -2072,7 +2072,7 @@ var VRMLLoader = ( function () { // materials can be influenced by the geometry (e.g. vertex normals). cloning is necessary to avoid // any side effects - return ( build.isObject3D || build.isMaterial ) ? build.clone() : build; + return ( build.isObject3D || build.isMaterial ) ? build.clone() : build; }
true