From 00275677bef9c5848be5d873158afef875140bf2 Mon Sep 17 00:00:00 2001 From: wada Date: Tue, 21 Feb 2023 11:08:57 +0900 Subject: [PATCH] Update to Cubism 4 SDK for Web R6 --- CHANGELOG.md | 23 + README.ja.md | 9 +- README.md | 9 +- package-lock.json | 502 +++++++------ package.json | 14 +- src/live2dcubismframework.ts | 13 +- src/model/cubismmodel.ts | 131 +++- src/model/cubismusermodel.ts | 5 +- src/physics/cubismphysics.ts | 9 +- src/rendering/cubismrenderer.ts | 37 + src/rendering/cubismrenderer_webgl.ts | 998 ++++++++++++++++++++------ 11 files changed, 1255 insertions(+), 495 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5856cf..d02f52c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,28 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## [4-r.6] - 2023-02-21 + +### Added + +* Add support for high-precision masks. +* The number of render textures used can now be increased arbitrarily. + * The maximum number of masks when using multiple render textures has been increased to "number of render textures * 32". +* Add API to allow users to configure culling. + +### Changed + +* Change to not reference `CubismClippingManager_WebGL` on models that do not use clipping masks. + +### Fixed + +* Fix a crash when a `WebGLRenderingContext` is not registered with `Cubism Renderer_WebGL`. + * It now displays a warning and does not draw models. +* Fix a bug when displaying a model with culling set, some of the other drawn images are missing. +* Fix a bug that caused update information for some models not to be updated when multiple models are displayed. + * Call the function to extend the initial memory with CubismFramework.initialize(). See `CHANGELOG.md` in Core. + + ## [4-r.5] - 2022-09-08 ### Added @@ -126,6 +148,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). * Reformat code using Prettier and ESLint. +[4-r.6]: https://github.com/Live2D/CubismWebFramework/compare/4-r.5...4-r.6 [4-r.5]: https://github.com/Live2D/CubismWebFramework/compare/4-r.5-beta.5...4-r.5 [4-r.5-beta.5]: https://github.com/Live2D/CubismWebFramework/compare/4-r.5-beta.4...4-r.5-beta.5 [4-r.5-beta.4]: https://github.com/Live2D/CubismWebFramework/compare/4-r.5-beta.3...4-r.5-beta.4 diff --git a/README.ja.md b/README.ja.md index 58cc1b8..5a12bc5 100644 --- a/README.ja.md +++ b/README.ja.md @@ -21,14 +21,15 @@ Live2D Cubism 4 Editor で出力したモデルをアプリケーションで利 ### Node.js -* 18.8.0 -* 16.17.0 -* 14.20.0 +* 19.6.0 +* 18.14.0 +* 16.19.0 +* 14.21.2 ### TypeScript -4.8.2 +4.9.5 ## 開発環境構築 diff --git a/README.md b/README.md index a7152e1..d330a67 100644 --- a/README.md +++ b/README.md @@ -21,14 +21,15 @@ Please check the [license](LICENSE.md) before using this SDK. ### Node.js -* 18.8.0 -* 16.17.0 -* 14.20.0 +* 19.6.0 +* 18.14.0 +* 16.19.0 +* 14.21.2 ### TypeScript -4.8.2 +4.9.5 ## Development environment construction diff --git a/package-lock.json b/package-lock.json index 91631aa..7d27f8f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,30 +1,30 @@ { - "name": "SDKWebFrameWorkDev", + "name": "Framework", "lockfileVersion": 2, "requires": true, "packages": { "": { "devDependencies": { - "@typescript-eslint/eslint-plugin": "^5.35.1", - "@typescript-eslint/parser": "^5.35.1", - "eslint": "^8.23.0", - "eslint-config-prettier": "^8.5.0", + "@typescript-eslint/eslint-plugin": "^5.52.0", + "@typescript-eslint/parser": "^5.52.0", + "eslint": "^8.34.0", + "eslint-config-prettier": "^8.6.0", "eslint-plugin-prettier": "^4.2.1", - "prettier": "^2.7.1", - "rimraf": "^3.0.2", - "typescript": "^4.8.2" + "prettier": "^2.8.4", + "rimraf": "^4.1.2", + "typescript": "^4.9.5" } }, "node_modules/@eslint/eslintrc": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.1.tgz", - "integrity": "sha512-OhSY22oQQdw3zgPOOwdoj01l/Dzl1Z+xyUP33tkSN+aqyEhymJCcPHyXt+ylW8FSe0TfRC2VG+ROQOapD0aZSQ==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz", + "integrity": "sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==", "dev": true, "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", "espree": "^9.4.0", - "globals": "^13.15.0", + "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", @@ -39,29 +39,19 @@ } }, "node_modules/@humanwhocodes/config-array": { - "version": "0.10.4", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.10.4.tgz", - "integrity": "sha512-mXAIHxZT3Vcpg83opl1wGlVZ9xydbfZO3r5YfRSH6Gpp2J/PfdBP0wbDa2sO6/qRbcalpoevVyW6A/fI6LfeMw==", + "version": "0.11.8", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", + "integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==", "dev": true, "dependencies": { "@humanwhocodes/object-schema": "^1.2.1", "debug": "^4.1.1", - "minimatch": "^3.0.4" + "minimatch": "^3.0.5" }, "engines": { "node": ">=10.10.0" } }, - "node_modules/@humanwhocodes/gitignore-to-minimatch": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@humanwhocodes/gitignore-to-minimatch/-/gitignore-to-minimatch-1.0.2.tgz", - "integrity": "sha512-rSqmMJDdLFUsyxR6FMtD00nfQKKLFb1kv+qBbOVKqErvloEIJLo5bDTJTQNTYgeyp78JsA7u/NPi5jT1GR/MuA==", - "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, "node_modules/@humanwhocodes/module-importer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", @@ -122,18 +112,25 @@ "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", "dev": true }, + "node_modules/@types/semver": { + "version": "7.3.13", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", + "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", + "dev": true + }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.35.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.35.1.tgz", - "integrity": "sha512-RBZZXZlI4XCY4Wzgy64vB+0slT9+yAPQRjj/HSaRwUot33xbDjF1oN9BLwOLTewoOI0jothIltZRe9uJCHf8gg==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.52.0.tgz", + "integrity": "sha512-lHazYdvYVsBokwCdKOppvYJKaJ4S41CgKBcPvyd0xjZNbvQdhn/pnJlGtQksQ/NhInzdaeaSarlBjDXHuclEbg==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.35.1", - "@typescript-eslint/type-utils": "5.35.1", - "@typescript-eslint/utils": "5.35.1", + "@typescript-eslint/scope-manager": "5.52.0", + "@typescript-eslint/type-utils": "5.52.0", + "@typescript-eslint/utils": "5.52.0", "debug": "^4.3.4", - "functional-red-black-tree": "^1.0.1", + "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", + "natural-compare-lite": "^1.4.0", "regexpp": "^3.2.0", "semver": "^7.3.7", "tsutils": "^3.21.0" @@ -156,14 +153,14 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "5.35.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.35.1.tgz", - "integrity": "sha512-XL2TBTSrh3yWAsMYpKseBYTVpvudNf69rPOWXWVBI08My2JVT5jR66eTt4IgQFHA/giiKJW5dUD4x/ZviCKyGg==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.52.0.tgz", + "integrity": "sha512-e2KiLQOZRo4Y0D/b+3y08i3jsekoSkOYStROYmPUnGMEoA0h+k2qOH5H6tcjIc68WDvGwH+PaOrP1XRzLJ6QlA==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.35.1", - "@typescript-eslint/types": "5.35.1", - "@typescript-eslint/typescript-estree": "5.35.1", + "@typescript-eslint/scope-manager": "5.52.0", + "@typescript-eslint/types": "5.52.0", + "@typescript-eslint/typescript-estree": "5.52.0", "debug": "^4.3.4" }, "engines": { @@ -183,13 +180,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "5.35.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.35.1.tgz", - "integrity": "sha512-kCYRSAzIW9ByEIzmzGHE50NGAvAP3wFTaZevgWva7GpquDyFPFcmvVkFJGWJJktg/hLwmys/FZwqM9EKr2u24Q==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.52.0.tgz", + "integrity": "sha512-AR7sxxfBKiNV0FWBSARxM8DmNxrwgnYMPwmpkC1Pl1n+eT8/I2NAUPuwDy/FmDcC6F8pBfmOcaxcxRHspgOBMw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.35.1", - "@typescript-eslint/visitor-keys": "5.35.1" + "@typescript-eslint/types": "5.52.0", + "@typescript-eslint/visitor-keys": "5.52.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -200,12 +197,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.35.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.35.1.tgz", - "integrity": "sha512-8xT8ljvo43Mp7BiTn1vxLXkjpw8wS4oAc00hMSB4L1/jIiYbjjnc3Qp2GAUOG/v8zsNCd1qwcqfCQ0BuishHkw==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.52.0.tgz", + "integrity": "sha512-tEKuUHfDOv852QGlpPtB3lHOoig5pyFQN/cUiZtpw99D93nEBjexRLre5sQZlkMoHry/lZr8qDAt2oAHLKA6Jw==", "dev": true, "dependencies": { - "@typescript-eslint/utils": "5.35.1", + "@typescript-eslint/typescript-estree": "5.52.0", + "@typescript-eslint/utils": "5.52.0", "debug": "^4.3.4", "tsutils": "^3.21.0" }, @@ -226,9 +224,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "5.35.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.35.1.tgz", - "integrity": "sha512-FDaujtsH07VHzG0gQ6NDkVVhi1+rhq0qEvzHdJAQjysN+LHDCKDKCBRlZFFE0ec0jKxiv0hN63SNfExy0KrbQQ==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.52.0.tgz", + "integrity": "sha512-oV7XU4CHYfBhk78fS7tkum+/Dpgsfi91IIDy7fjCyq2k6KB63M6gMC0YIvy+iABzmXThCRI6xpCEyVObBdWSDQ==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -239,13 +237,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.35.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.35.1.tgz", - "integrity": "sha512-JUqE1+VRTGyoXlDWWjm6MdfpBYVq+hixytrv1oyjYIBEOZhBCwtpp5ZSvBt4wIA1MKWlnaC2UXl2XmYGC3BoQA==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.52.0.tgz", + "integrity": "sha512-WeWnjanyEwt6+fVrSR0MYgEpUAuROxuAH516WPjUblIrClzYJj0kBbjdnbQXLpgAN8qbEuGywiQsXUVDiAoEuQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.35.1", - "@typescript-eslint/visitor-keys": "5.35.1", + "@typescript-eslint/types": "5.52.0", + "@typescript-eslint/visitor-keys": "5.52.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -266,17 +264,19 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "5.35.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.35.1.tgz", - "integrity": "sha512-v6F8JNXgeBWI4pzZn36hT2HXXzoBBBJuOYvoQiaQaEEjdi5STzux3Yj8v7ODIpx36i/5s8TdzuQ54TPc5AITQQ==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.52.0.tgz", + "integrity": "sha512-As3lChhrbwWQLNk2HC8Ree96hldKIqk98EYvypd3It8Q1f8d5zWyIoaZEp2va5667M4ZyE7X8UUR+azXrFl+NA==", "dev": true, "dependencies": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.35.1", - "@typescript-eslint/types": "5.35.1", - "@typescript-eslint/typescript-estree": "5.35.1", + "@types/semver": "^7.3.12", + "@typescript-eslint/scope-manager": "5.52.0", + "@typescript-eslint/types": "5.52.0", + "@typescript-eslint/typescript-estree": "5.52.0", "eslint-scope": "^5.1.1", - "eslint-utils": "^3.0.0" + "eslint-utils": "^3.0.0", + "semver": "^7.3.7" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -290,12 +290,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.35.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.35.1.tgz", - "integrity": "sha512-cEB1DvBVo1bxbW/S5axbGPE6b7FIMAbo3w+AGq6zNDA7+NYJOIkKj/sInfTv4edxd4PxJSgdN4t6/pbvgA+n5g==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.52.0.tgz", + "integrity": "sha512-qMwpw6SU5VHCPr99y274xhbm+PRViK/NATY6qzt+Et7+mThGuFSl/ompj2/hrBlRP/kq+BFdgagnOSgw9TB0eA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.35.1", + "@typescript-eslint/types": "5.52.0", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -307,9 +307,9 @@ } }, "node_modules/acorn": { - "version": "8.8.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz", - "integrity": "sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==", + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -533,15 +533,15 @@ } }, "node_modules/eslint": { - "version": "8.23.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.23.0.tgz", - "integrity": "sha512-pBG/XOn0MsJcKcTRLr27S5HpzQo4kLr+HjLQIyK4EiCsijDl/TB+h5uEuJU6bQ8Edvwz1XWOjpaP2qgnXGpTcA==", + "version": "8.34.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.34.0.tgz", + "integrity": "sha512-1Z8iFsucw+7kSqXNZVslXS8Ioa4u2KM7GPwuKtkTFAqZ/cHMcEaR+1+Br0wLlot49cNxIiZk5wp8EAbPcYZxTg==", "dev": true, "dependencies": { - "@eslint/eslintrc": "^1.3.1", - "@humanwhocodes/config-array": "^0.10.4", - "@humanwhocodes/gitignore-to-minimatch": "^1.0.2", + "@eslint/eslintrc": "^1.4.1", + "@humanwhocodes/config-array": "^0.11.8", "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", @@ -557,15 +557,15 @@ "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", "find-up": "^5.0.0", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^6.0.1", - "globals": "^13.15.0", - "globby": "^11.1.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-sdsl": "^4.1.4", "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", @@ -589,9 +589,9 @@ } }, "node_modules/eslint-config-prettier": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.5.0.tgz", - "integrity": "sha512-obmWKLUNCnhtQRKc+tmnYuQl0pFU1ibYJQ5BGhTVB08bHe9wC8qUeG7c08dj9XX+AuPj1YSGSQIHl1pnDHZR0Q==", + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.6.0.tgz", + "integrity": "sha512-bAF0eLpLVqP5oEVUFKpMA+NnRFICwn9X8B5jrR9FcqnYBuPbqWEjTEspPWMj5ye6czoSLDweCzSo3Ko7gGrZaA==", "dev": true, "bin": { "eslint-config-prettier": "bin/cli.js" @@ -693,9 +693,9 @@ } }, "node_modules/espree": { - "version": "9.4.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.0.tgz", - "integrity": "sha512-DQmnRpLj7f6TgN/NYb0MTzJXL+vJF9h3pHy4JhCIs3zwcgez8xmGg3sXHcEO97BrmO2OSvCwMdfdlyl+E9KjOw==", + "version": "9.4.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.1.tgz", + "integrity": "sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==", "dev": true, "dependencies": { "acorn": "^8.8.0", @@ -782,9 +782,9 @@ "dev": true }, "node_modules/fast-glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", - "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", + "version": "3.2.12", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", "dev": true, "dependencies": { "@nodelib/fs.stat": "^2.0.2", @@ -822,9 +822,9 @@ "dev": true }, "node_modules/fastq": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", - "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", "dev": true, "dependencies": { "reusify": "^1.0.4" @@ -883,6 +883,21 @@ "node": "^10.12.0 || >=12.0.0" } }, + "node_modules/flat-cache/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/flatted": { "version": "3.2.7", "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", @@ -895,12 +910,6 @@ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, - "node_modules/functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==", - "dev": true - }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -934,9 +943,9 @@ } }, "node_modules/globals": { - "version": "13.17.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz", - "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==", + "version": "13.20.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", + "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", "dev": true, "dependencies": { "type-fest": "^0.20.2" @@ -1063,12 +1072,31 @@ "node": ">=0.12.0" } }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, + "node_modules/js-sdsl": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.3.0.tgz", + "integrity": "sha512-mifzlm2+5nZ+lEcLJMoBK0/IH/bDg8XnJfd/Wq6IP+xoCjLZsTOnV2QpxlVbX9bMnkl5PdEjNtBJ9Cj1NjifhQ==", + "dev": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/js-sdsl" + } + }, "node_modules/js-yaml": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", @@ -1185,6 +1213,12 @@ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, + "node_modules/natural-compare-lite": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", + "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", + "dev": true + }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -1311,9 +1345,9 @@ } }, "node_modules/prettier": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", - "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.4.tgz", + "integrity": "sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==", "dev": true, "bin": { "prettier": "bin-prettier.js" @@ -1338,9 +1372,9 @@ } }, "node_modules/punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", "dev": true, "engines": { "node": ">=6" @@ -1398,15 +1432,15 @@ } }, "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-4.1.2.tgz", + "integrity": "sha512-BlIbgFryTbw3Dz6hyoWFhKk+unCcHMSkZGrTFVAx2WmttdBSonsdtRlwiuTbDqTKr+UlXIUqJVS4QT5tUzGENQ==", "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, "bin": { - "rimraf": "bin.js" + "rimraf": "dist/cjs/src/bin.js" + }, + "engines": { + "node": ">=14" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -1580,9 +1614,9 @@ } }, "node_modules/typescript": { - "version": "4.8.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.2.tgz", - "integrity": "sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==", + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -1652,15 +1686,15 @@ }, "dependencies": { "@eslint/eslintrc": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.1.tgz", - "integrity": "sha512-OhSY22oQQdw3zgPOOwdoj01l/Dzl1Z+xyUP33tkSN+aqyEhymJCcPHyXt+ylW8FSe0TfRC2VG+ROQOapD0aZSQ==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz", + "integrity": "sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==", "dev": true, "requires": { "ajv": "^6.12.4", "debug": "^4.3.2", "espree": "^9.4.0", - "globals": "^13.15.0", + "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", @@ -1669,22 +1703,16 @@ } }, "@humanwhocodes/config-array": { - "version": "0.10.4", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.10.4.tgz", - "integrity": "sha512-mXAIHxZT3Vcpg83opl1wGlVZ9xydbfZO3r5YfRSH6Gpp2J/PfdBP0wbDa2sO6/qRbcalpoevVyW6A/fI6LfeMw==", + "version": "0.11.8", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", + "integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==", "dev": true, "requires": { "@humanwhocodes/object-schema": "^1.2.1", "debug": "^4.1.1", - "minimatch": "^3.0.4" + "minimatch": "^3.0.5" } }, - "@humanwhocodes/gitignore-to-minimatch": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@humanwhocodes/gitignore-to-minimatch/-/gitignore-to-minimatch-1.0.2.tgz", - "integrity": "sha512-rSqmMJDdLFUsyxR6FMtD00nfQKKLFb1kv+qBbOVKqErvloEIJLo5bDTJTQNTYgeyp78JsA7u/NPi5jT1GR/MuA==", - "dev": true - }, "@humanwhocodes/module-importer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", @@ -1729,70 +1757,78 @@ "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", "dev": true }, + "@types/semver": { + "version": "7.3.13", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", + "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", + "dev": true + }, "@typescript-eslint/eslint-plugin": { - "version": "5.35.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.35.1.tgz", - "integrity": "sha512-RBZZXZlI4XCY4Wzgy64vB+0slT9+yAPQRjj/HSaRwUot33xbDjF1oN9BLwOLTewoOI0jothIltZRe9uJCHf8gg==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.52.0.tgz", + "integrity": "sha512-lHazYdvYVsBokwCdKOppvYJKaJ4S41CgKBcPvyd0xjZNbvQdhn/pnJlGtQksQ/NhInzdaeaSarlBjDXHuclEbg==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.35.1", - "@typescript-eslint/type-utils": "5.35.1", - "@typescript-eslint/utils": "5.35.1", + "@typescript-eslint/scope-manager": "5.52.0", + "@typescript-eslint/type-utils": "5.52.0", + "@typescript-eslint/utils": "5.52.0", "debug": "^4.3.4", - "functional-red-black-tree": "^1.0.1", + "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", + "natural-compare-lite": "^1.4.0", "regexpp": "^3.2.0", "semver": "^7.3.7", "tsutils": "^3.21.0" } }, "@typescript-eslint/parser": { - "version": "5.35.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.35.1.tgz", - "integrity": "sha512-XL2TBTSrh3yWAsMYpKseBYTVpvudNf69rPOWXWVBI08My2JVT5jR66eTt4IgQFHA/giiKJW5dUD4x/ZviCKyGg==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.52.0.tgz", + "integrity": "sha512-e2KiLQOZRo4Y0D/b+3y08i3jsekoSkOYStROYmPUnGMEoA0h+k2qOH5H6tcjIc68WDvGwH+PaOrP1XRzLJ6QlA==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.35.1", - "@typescript-eslint/types": "5.35.1", - "@typescript-eslint/typescript-estree": "5.35.1", + "@typescript-eslint/scope-manager": "5.52.0", + "@typescript-eslint/types": "5.52.0", + "@typescript-eslint/typescript-estree": "5.52.0", "debug": "^4.3.4" } }, "@typescript-eslint/scope-manager": { - "version": "5.35.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.35.1.tgz", - "integrity": "sha512-kCYRSAzIW9ByEIzmzGHE50NGAvAP3wFTaZevgWva7GpquDyFPFcmvVkFJGWJJktg/hLwmys/FZwqM9EKr2u24Q==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.52.0.tgz", + "integrity": "sha512-AR7sxxfBKiNV0FWBSARxM8DmNxrwgnYMPwmpkC1Pl1n+eT8/I2NAUPuwDy/FmDcC6F8pBfmOcaxcxRHspgOBMw==", "dev": true, "requires": { - "@typescript-eslint/types": "5.35.1", - "@typescript-eslint/visitor-keys": "5.35.1" + "@typescript-eslint/types": "5.52.0", + "@typescript-eslint/visitor-keys": "5.52.0" } }, "@typescript-eslint/type-utils": { - "version": "5.35.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.35.1.tgz", - "integrity": "sha512-8xT8ljvo43Mp7BiTn1vxLXkjpw8wS4oAc00hMSB4L1/jIiYbjjnc3Qp2GAUOG/v8zsNCd1qwcqfCQ0BuishHkw==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.52.0.tgz", + "integrity": "sha512-tEKuUHfDOv852QGlpPtB3lHOoig5pyFQN/cUiZtpw99D93nEBjexRLre5sQZlkMoHry/lZr8qDAt2oAHLKA6Jw==", "dev": true, "requires": { - "@typescript-eslint/utils": "5.35.1", + "@typescript-eslint/typescript-estree": "5.52.0", + "@typescript-eslint/utils": "5.52.0", "debug": "^4.3.4", "tsutils": "^3.21.0" } }, "@typescript-eslint/types": { - "version": "5.35.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.35.1.tgz", - "integrity": "sha512-FDaujtsH07VHzG0gQ6NDkVVhi1+rhq0qEvzHdJAQjysN+LHDCKDKCBRlZFFE0ec0jKxiv0hN63SNfExy0KrbQQ==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.52.0.tgz", + "integrity": "sha512-oV7XU4CHYfBhk78fS7tkum+/Dpgsfi91IIDy7fjCyq2k6KB63M6gMC0YIvy+iABzmXThCRI6xpCEyVObBdWSDQ==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.35.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.35.1.tgz", - "integrity": "sha512-JUqE1+VRTGyoXlDWWjm6MdfpBYVq+hixytrv1oyjYIBEOZhBCwtpp5ZSvBt4wIA1MKWlnaC2UXl2XmYGC3BoQA==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.52.0.tgz", + "integrity": "sha512-WeWnjanyEwt6+fVrSR0MYgEpUAuROxuAH516WPjUblIrClzYJj0kBbjdnbQXLpgAN8qbEuGywiQsXUVDiAoEuQ==", "dev": true, "requires": { - "@typescript-eslint/types": "5.35.1", - "@typescript-eslint/visitor-keys": "5.35.1", + "@typescript-eslint/types": "5.52.0", + "@typescript-eslint/visitor-keys": "5.52.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1801,33 +1837,35 @@ } }, "@typescript-eslint/utils": { - "version": "5.35.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.35.1.tgz", - "integrity": "sha512-v6F8JNXgeBWI4pzZn36hT2HXXzoBBBJuOYvoQiaQaEEjdi5STzux3Yj8v7ODIpx36i/5s8TdzuQ54TPc5AITQQ==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.52.0.tgz", + "integrity": "sha512-As3lChhrbwWQLNk2HC8Ree96hldKIqk98EYvypd3It8Q1f8d5zWyIoaZEp2va5667M4ZyE7X8UUR+azXrFl+NA==", "dev": true, "requires": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.35.1", - "@typescript-eslint/types": "5.35.1", - "@typescript-eslint/typescript-estree": "5.35.1", + "@types/semver": "^7.3.12", + "@typescript-eslint/scope-manager": "5.52.0", + "@typescript-eslint/types": "5.52.0", + "@typescript-eslint/typescript-estree": "5.52.0", "eslint-scope": "^5.1.1", - "eslint-utils": "^3.0.0" + "eslint-utils": "^3.0.0", + "semver": "^7.3.7" } }, "@typescript-eslint/visitor-keys": { - "version": "5.35.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.35.1.tgz", - "integrity": "sha512-cEB1DvBVo1bxbW/S5axbGPE6b7FIMAbo3w+AGq6zNDA7+NYJOIkKj/sInfTv4edxd4PxJSgdN4t6/pbvgA+n5g==", + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.52.0.tgz", + "integrity": "sha512-qMwpw6SU5VHCPr99y274xhbm+PRViK/NATY6qzt+Et7+mThGuFSl/ompj2/hrBlRP/kq+BFdgagnOSgw9TB0eA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.35.1", + "@typescript-eslint/types": "5.52.0", "eslint-visitor-keys": "^3.3.0" } }, "acorn": { - "version": "8.8.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz", - "integrity": "sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==", + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", "dev": true }, "acorn-jsx": { @@ -1989,15 +2027,15 @@ "dev": true }, "eslint": { - "version": "8.23.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.23.0.tgz", - "integrity": "sha512-pBG/XOn0MsJcKcTRLr27S5HpzQo4kLr+HjLQIyK4EiCsijDl/TB+h5uEuJU6bQ8Edvwz1XWOjpaP2qgnXGpTcA==", + "version": "8.34.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.34.0.tgz", + "integrity": "sha512-1Z8iFsucw+7kSqXNZVslXS8Ioa4u2KM7GPwuKtkTFAqZ/cHMcEaR+1+Br0wLlot49cNxIiZk5wp8EAbPcYZxTg==", "dev": true, "requires": { - "@eslint/eslintrc": "^1.3.1", - "@humanwhocodes/config-array": "^0.10.4", - "@humanwhocodes/gitignore-to-minimatch": "^1.0.2", + "@eslint/eslintrc": "^1.4.1", + "@humanwhocodes/config-array": "^0.11.8", "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", @@ -2013,15 +2051,15 @@ "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", "find-up": "^5.0.0", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^6.0.1", - "globals": "^13.15.0", - "globby": "^11.1.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-sdsl": "^4.1.4", "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", @@ -2054,9 +2092,9 @@ } }, "eslint-config-prettier": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.5.0.tgz", - "integrity": "sha512-obmWKLUNCnhtQRKc+tmnYuQl0pFU1ibYJQ5BGhTVB08bHe9wC8qUeG7c08dj9XX+AuPj1YSGSQIHl1pnDHZR0Q==", + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.6.0.tgz", + "integrity": "sha512-bAF0eLpLVqP5oEVUFKpMA+NnRFICwn9X8B5jrR9FcqnYBuPbqWEjTEspPWMj5ye6czoSLDweCzSo3Ko7gGrZaA==", "dev": true, "requires": {} }, @@ -2103,9 +2141,9 @@ "dev": true }, "espree": { - "version": "9.4.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.0.tgz", - "integrity": "sha512-DQmnRpLj7f6TgN/NYb0MTzJXL+vJF9h3pHy4JhCIs3zwcgez8xmGg3sXHcEO97BrmO2OSvCwMdfdlyl+E9KjOw==", + "version": "9.4.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.1.tgz", + "integrity": "sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==", "dev": true, "requires": { "acorn": "^8.8.0", @@ -2172,9 +2210,9 @@ "dev": true }, "fast-glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", - "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", + "version": "3.2.12", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", "dev": true, "requires": { "@nodelib/fs.stat": "^2.0.2", @@ -2208,9 +2246,9 @@ "dev": true }, "fastq": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", - "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", "dev": true, "requires": { "reusify": "^1.0.4" @@ -2252,6 +2290,17 @@ "requires": { "flatted": "^3.1.0", "rimraf": "^3.0.2" + }, + "dependencies": { + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } } }, "flatted": { @@ -2266,12 +2315,6 @@ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, - "functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==", - "dev": true - }, "glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -2296,9 +2339,9 @@ } }, "globals": { - "version": "13.17.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz", - "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==", + "version": "13.20.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", + "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", "dev": true, "requires": { "type-fest": "^0.20.2" @@ -2389,12 +2432,24 @@ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true }, + "is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true + }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, + "js-sdsl": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.3.0.tgz", + "integrity": "sha512-mifzlm2+5nZ+lEcLJMoBK0/IH/bDg8XnJfd/Wq6IP+xoCjLZsTOnV2QpxlVbX9bMnkl5PdEjNtBJ9Cj1NjifhQ==", + "dev": true + }, "js-yaml": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", @@ -2487,6 +2542,12 @@ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, + "natural-compare-lite": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", + "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", + "dev": true + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -2574,9 +2635,9 @@ "dev": true }, "prettier": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", - "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.4.tgz", + "integrity": "sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==", "dev": true }, "prettier-linter-helpers": { @@ -2589,9 +2650,9 @@ } }, "punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", "dev": true }, "queue-microtask": { @@ -2619,13 +2680,10 @@ "dev": true }, "rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-4.1.2.tgz", + "integrity": "sha512-BlIbgFryTbw3Dz6hyoWFhKk+unCcHMSkZGrTFVAx2WmttdBSonsdtRlwiuTbDqTKr+UlXIUqJVS4QT5tUzGENQ==", + "dev": true }, "run-parallel": { "version": "1.2.0", @@ -2736,9 +2794,9 @@ "dev": true }, "typescript": { - "version": "4.8.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.2.tgz", - "integrity": "sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==", + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", "dev": true }, "uri-js": { diff --git a/package.json b/package.json index e91aa81..8b50149 100644 --- a/package.json +++ b/package.json @@ -8,13 +8,13 @@ "clean": "rimraf dist" }, "devDependencies": { - "@typescript-eslint/eslint-plugin": "^5.35.1", - "@typescript-eslint/parser": "^5.35.1", - "eslint": "^8.23.0", - "eslint-config-prettier": "^8.5.0", + "@typescript-eslint/eslint-plugin": "^5.52.0", + "@typescript-eslint/parser": "^5.52.0", + "eslint": "^8.34.0", + "eslint-config-prettier": "^8.6.0", "eslint-plugin-prettier": "^4.2.1", - "prettier": "^2.7.1", - "rimraf": "^3.0.2", - "typescript": "^4.8.2" + "prettier": "^2.8.4", + "rimraf": "^4.1.2", + "typescript": "^4.9.5" } } diff --git a/src/live2dcubismframework.ts b/src/live2dcubismframework.ts index e818b5b..b134b69 100644 --- a/src/live2dcubismframework.ts +++ b/src/live2dcubismframework.ts @@ -131,8 +131,13 @@ export class CubismFramework { /** * Cubism Framework内のリソースを初期化してモデルを表示可能な状態にします。
* 再度Initialize()するには先にDispose()を実行する必要があります。 + * + * @param memorySize 初期化時メモリ量 [byte(s)] + * 複数モデル表示時などにモデルが更新されない際に使用してください。 + * 指定する際は必ず1024*1024*16 byte(16MB)以上の値を指定してください。 + * それ以外はすべて1024*1024*16 byteに丸めます。 */ - public static initialize(): void { + public static initialize(memorySize = 0): void { CSM_ASSERT(s_isStarted); if (!s_isStarted) { CubismLogWarning('CubismFramework is not started.'); @@ -154,6 +159,12 @@ export class CubismFramework { s_cubismIdManager = new CubismIdManager(); + // --- HACK: 初期化時メモリ量の拡張(単位byte) --- + // 複数モデル表示時などにモデルが更新されない際に使用してください。 + // 指定する際は必ず1024*1024*16 byte(16MB)以上の値を指定してください。 + // それ以外はすべて1024*1024*16 byteに丸めます。 + Live2DCubismCore.Memory.initializeAmountOfMemory(memorySize); + s_isInitialized = true; CubismLogInfo('CubismFramework.initialize() is complete.'); diff --git a/src/model/cubismmodel.ts b/src/model/cubismmodel.ts index 46ea035..2b00596 100644 --- a/src/model/cubismmodel.ts +++ b/src/model/cubismmodel.ts @@ -24,6 +24,25 @@ export class DrawableColorData { Color: CubismTextureColor = new CubismTextureColor(); } +/** + * テクスチャのカリング設定を管理するための構造体 + */ +export class DrawableCullingData { + /** + * コンストラクタ + * + * @param isOverwritten + * @param isCulling + */ + public constructor(isOverwritten = false, isCulling = false) { + isOverwritten = this.isOverwritten; + isCulling = this.isCulling; + } + + public isOverwritten: boolean; + public isCulling: boolean; +} + /** * モデル * @@ -40,6 +59,18 @@ export class CubismModel { this._model.drawables.resetDynamicFlags(); } + /** + * PixelsPerUnitを取得する + * @returns PixelsPerUnit + */ + public getPixelsPerUnit(): number { + if (this._model == null) { + return 0.0; + } + + return this._model.canvasinfo.PixelsPerUnit; + } + /** * キャンバスの幅を取得する */ @@ -266,6 +297,79 @@ export class CubismModel { this._userScreenColors.at(drawableindex).isOverwritten = value; } + /** + * Drawableのカリング情報を取得する。 + * + * @param drawableIndex Drawableのインデックス + * @return Drawableのカリング情報 + */ + public getDrawableCulling(drawableIndex: number): boolean { + if ( + this.getOverwriteFlagForModelCullings() || + this.getOverwriteFlagForDrawableCullings(drawableIndex) + ) { + return this._userCullings.at(drawableIndex).isCulling; + } + + const constantFlags = this._model.drawables.constantFlags; + return !Live2DCubismCore.Utils.hasIsDoubleSidedBit( + constantFlags[drawableIndex] + ); + } + + /** + * Drawableのカリング情報を設定する。 + * + * @param drawableIndex Drawableのインデックス + * @param isCulling カリング情報 + */ + public setDrawableCulling(drawableIndex: number, isCulling: boolean): void { + this._userCullings.at(drawableIndex).isCulling = isCulling; + } + + /** + * SDKからモデル全体のカリング設定を上書きするか。 + * + * @retval true -> SDK上のカリング設定を使用 + * @retval false -> モデルのカリング設定を使用 + */ + public getOverwriteFlagForModelCullings(): boolean { + return this._isOverwrittenCullings; + } + + /** + * SDKからモデル全体のカリング設定を上書きするかを設定する。 + * + * @param isOverwrittenCullings SDK上のカリング設定を使うならtrue、モデルのカリング設定を使うならfalse + */ + public setOverwriteFlagForModelCullings( + isOverwrittenCullings: boolean + ): void { + this._isOverwrittenCullings = isOverwrittenCullings; + } + + /** + * + * @param drawableIndex Drawableのインデックス + * @retval true -> SDK上のカリング設定を使用 + * @retval false -> モデルのカリング設定を使用 + */ + public getOverwriteFlagForDrawableCullings(drawableIndex: number): boolean { + return this._userCullings.at(drawableIndex).isOverwritten; + } + + /** + * + * @param drawableIndex Drawableのインデックス + * @param isOverwrittenCullings SDK上のカリング設定を使うならtrue、モデルのカリング設定を使うならfalse + */ + public setOverwriteFlagForDrawableCullings( + drawableIndex: number, + isOverwrittenCullings: boolean + ): void { + this._userCullings.at(drawableIndex).isOverwritten = isOverwrittenCullings; + } + /** * モデルを取得 */ @@ -809,19 +913,6 @@ export class CubismModel { return this._model.drawables.parentPartIndices[drawableIndex]; } - /** - * Drawableのカリング情報の取得 - * @param drawableIndex Drawableのインデックス - * @return drawableのカリング情報 - */ - public getDrawableCulling(drawableIndex: number): boolean { - const constantFlags = this._model.drawables.constantFlags; - - return !Live2DCubismCore.Utils.hasIsDoubleSidedBit( - constantFlags[drawableIndex] - ); - } - /** * Drawableのブレンドモードを取得 * @param drawableIndex Drawableのインデックス @@ -1041,6 +1132,14 @@ export class CubismModel { this._userScreenColors = new csmVector(); this._userScreenColors.updateSize(drawableCount, DrawableColorData, true); + // カリング設定 + this._userCullings = new csmVector(); + this._userCullings.updateSize(drawableCount, DrawableCullingData, true); + const userCulling: DrawableCullingData = new DrawableCullingData( + false, + false + ); + this._drawableIds.prepareCapacity(drawableCount); for (let i = 0; i < drawableCount; ++i) { this._drawableIds.pushBack( @@ -1050,6 +1149,8 @@ export class CubismModel { // shaderに影響しない色で初期化 this.setMultiplyColorByRGBA(i, 1.0, 1.0, 1.0, 1.0); this.setScreenColorByRGBA(i, 0.0, 0.0, 0.0, 1.0); + + this._userCullings.pushBack(userCulling); } } } @@ -1070,6 +1171,7 @@ export class CubismModel { this._partIds = new csmVector(); this._isOverwrittenModelMultiplyColors = false; this._isOverwrittenModelScreenColors = false; + this._isOverwrittenCullings = false; this._userMultiplyColors = null; this._userScreenColors = null; @@ -1111,6 +1213,9 @@ export class CubismModel { private _parameterIds: csmVector; private _partIds: csmVector; private _drawableIds: csmVector; + + private _isOverwrittenCullings: boolean; // モデルのカリング設定をすべて上書きするか? + private _userCullings: csmVector; // カリング設定の配列 } // Namespace definition for compatibility. diff --git a/src/model/cubismusermodel.ts b/src/model/cubismusermodel.ts index 813ed24..fed0c47 100644 --- a/src/model/cubismusermodel.ts +++ b/src/model/cubismusermodel.ts @@ -277,14 +277,15 @@ export class CubismUserModel { /** * レンダラを作成して初期化を実行する + * @param maskBufferCount バッファの生成数 */ - public createRenderer(): void { + public createRenderer(maskBufferCount = 1): void { if (this._renderer) { this.deleteRenderer(); } this._renderer = new CubismRenderer_WebGL(); - this._renderer.initialize(this._model); + this._renderer.initialize(this._model, maskBufferCount); } /** diff --git a/src/physics/cubismphysics.ts b/src/physics/cubismphysics.ts index 48f3d1c..e4ef0e1 100644 --- a/src/physics/cubismphysics.ts +++ b/src/physics/cubismphysics.ts @@ -145,19 +145,22 @@ export class CubismPhysics { CubismPhysicsSource.CubismPhysicsSource_X; this._physicsRig.inputs.at( inputIndex + j - ).getNormalizedParameterValue = getInputTranslationXFromNormalizedParameterValue; + ).getNormalizedParameterValue = + getInputTranslationXFromNormalizedParameterValue; } else if (json.getInputType(i, j) == PhysicsTypeTagY) { this._physicsRig.inputs.at(inputIndex + j).type = CubismPhysicsSource.CubismPhysicsSource_Y; this._physicsRig.inputs.at( inputIndex + j - ).getNormalizedParameterValue = getInputTranslationYFromNormalizedParamterValue; + ).getNormalizedParameterValue = + getInputTranslationYFromNormalizedParamterValue; } else if (json.getInputType(i, j) == PhysicsTypeTagAngle) { this._physicsRig.inputs.at(inputIndex + j).type = CubismPhysicsSource.CubismPhysicsSource_Angle; this._physicsRig.inputs.at( inputIndex + j - ).getNormalizedParameterValue = getInputAngleFromNormalizedParameterValue; + ).getNormalizedParameterValue = + getInputAngleFromNormalizedParameterValue; } this._physicsRig.inputs.at(inputIndex + j).source.targetType = diff --git a/src/rendering/cubismrenderer.ts b/src/rendering/cubismrenderer.ts index 93b4632..d6da43e 100644 --- a/src/rendering/cubismrenderer.ts +++ b/src/rendering/cubismrenderer.ts @@ -45,7 +45,11 @@ export abstract class CubismRenderer { public drawModel(): void { if (this.getModel() == null) return; + this.saveProfile(); + this.doDrawModel(); + + this.restoreProfile(); } /** @@ -178,6 +182,27 @@ export abstract class CubismRenderer { return this._model; } + /** + * マスク描画の方式を変更する。 + * falseの場合、マスクを1枚のテクスチャに分割してレンダリングする(デフォルト) + * 高速だが、マスク個数の上限が36に限定され、質も荒くなる + * trueの場合、パーツ描画の前にその都度必要なマスクを描き直す + * レンダリング品質は高いが描画処理負荷は増す + * @param high 高精細マスクに切り替えるか? + */ + public useHighPrecisionMask(high: boolean): void { + this._useHighPrecisionMask = high; + } + + /** + * マスクの描画方式を取得する + * @return true 高精細方式 + * @return false デフォルト + */ + public isUsingHighPrecisionMask(): boolean { + return this._useHighPrecisionMask; + } + /** * コンストラクタ */ @@ -187,6 +212,7 @@ export abstract class CubismRenderer { this._anisotropy = 0.0; this._model = null; this._modelColor = new CubismTextureColor(); + this._useHighPrecisionMask = false; // 単位行列に初期化 this._mvpMatrix4x4 = new CubismMatrix44(); @@ -225,6 +251,16 @@ export abstract class CubismRenderer { invertedMask: boolean ): void; + /** + * モデル描画直前のレンダラのステートを保持する + */ + protected abstract saveProfile(): void; + + /** + * モデル描画直前のレンダラのステートを復帰する + */ + protected abstract restoreProfile(): void; + /** * レンダラが保持する静的なリソースを開放する */ @@ -236,6 +272,7 @@ export abstract class CubismRenderer { protected _isPremultipliedAlpha: boolean; // 乗算済みαならtrue protected _anisotropy: any; // テクスチャの異方性フィルタリングのパラメータ protected _model: CubismModel; // レンダリング対象のモデル + protected _useHighPrecisionMask: boolean; // falseの場合、マスクを纏めて描画する trueの場合、マスクはパーツ描画ごとに書き直す } export enum CubismBlendMode { diff --git a/src/rendering/cubismrenderer_webgl.ts b/src/rendering/cubismrenderer_webgl.ts index 12bd538..93590d1 100644 --- a/src/rendering/cubismrenderer_webgl.ts +++ b/src/rendering/cubismrenderer_webgl.ts @@ -11,7 +11,7 @@ import { CubismModel } from '../model/cubismmodel'; import { csmMap } from '../type/csmmap'; import { csmRect } from '../type/csmrectf'; import { csmVector } from '../type/csmvector'; -import { CubismLogError } from '../utils/cubismdebug'; +import { CubismLogError, CubismLogWarning } from '../utils/cubismdebug'; import { CubismBlendMode, CubismRenderer, @@ -19,8 +19,10 @@ import { } from './cubismrenderer'; const ColorChannelCount = 4; // 実験時に1チャンネルの場合は1、RGBだけの場合は3、アルファも含める場合は4 +const ClippingMaskMaxCountOnDefault = 36; // 通常のフレームバッファ一枚あたりのマスク最大数 +const ClippingMaskMaxCountOnMultiRenderTexture = 32; // フレームバッファが2枚以上ある場合のフレームバッファ一枚あたりのマスク最大数 -const shaderCount = 10; // シェーダーの数 = マスク生成用 + (通常用 + 加算 + 乗算) * (マスク無の乗算済アルファ対応版 + マスク有の乗算済アルファ対応版 + マスク有反転の乗算済アルファ対応版) +const ShaderCount = 10; // シェーダーの数 = マスク生成用 + (通常用 + 加算 + 乗算) * (マスク無の乗算済アルファ対応版 + マスク有の乗算済アルファ対応版 + マスク有反転の乗算済アルファ対応版) let s_instance: CubismShader_WebGL; let s_viewport: number[]; let s_fbo: WebGLFramebuffer; @@ -41,77 +43,90 @@ export class CubismClippingManager_WebGL { * テンポラリのレンダーテクスチャのアドレスを取得する * FrameBufferObjectが存在しない場合、新しく生成する * - * @return レンダーテクスチャのアドレス + * @return レンダーテクスチャの配列 */ - public getMaskRenderTexture(): WebGLFramebuffer { - let ret: WebGLFramebuffer = 0; - + public getMaskRenderTexture(): csmVector { // テンポラリのRenderTextureを取得する - if (this._maskTexture && this._maskTexture.texture != 0) { + if (this._maskTexture && this._maskTexture.textures != null) { // 前回使ったものを返す this._maskTexture.frameNo = this._currentFrameNo; - ret = this._maskTexture.texture; - } - - if (ret == 0) { + } else { // FrameBufferObjectが存在しない場合、新しく生成する + if (this._maskRenderTextures != null) { + this._maskRenderTextures.clear(); + } + this._maskRenderTextures = new csmVector(); + + // ColorBufferObjectが存在しない場合、新しく生成する + if (this._maskColorBuffers != null) { + this._maskColorBuffers.clear(); + } + this._maskColorBuffers = new csmVector(); // クリッピングバッファサイズを取得 const size: number = this._clippingMaskBufferSize; - this._colorBuffer = this.gl.createTexture(); - this.gl.bindTexture(this.gl.TEXTURE_2D, this._colorBuffer); - this.gl.texImage2D( - this.gl.TEXTURE_2D, - 0, - this.gl.RGBA, - size, - size, - 0, - this.gl.RGBA, - this.gl.UNSIGNED_BYTE, - null - ); - this.gl.texParameteri( - this.gl.TEXTURE_2D, - this.gl.TEXTURE_WRAP_S, - this.gl.CLAMP_TO_EDGE - ); - this.gl.texParameteri( - this.gl.TEXTURE_2D, - this.gl.TEXTURE_WRAP_T, - this.gl.CLAMP_TO_EDGE - ); - this.gl.texParameteri( - this.gl.TEXTURE_2D, - this.gl.TEXTURE_MIN_FILTER, - this.gl.LINEAR - ); - this.gl.texParameteri( - this.gl.TEXTURE_2D, - this.gl.TEXTURE_MAG_FILTER, - this.gl.LINEAR - ); - this.gl.bindTexture(this.gl.TEXTURE_2D, null); + for (let index = 0; index < this._renderTextureCount; index++) { + this._maskColorBuffers.pushBack(this.gl.createTexture()); // 直接代入 + this.gl.bindTexture( + this.gl.TEXTURE_2D, + this._maskColorBuffers.at(index) + ); + this.gl.texImage2D( + this.gl.TEXTURE_2D, + 0, + this.gl.RGBA, + size, + size, + 0, + this.gl.RGBA, + this.gl.UNSIGNED_BYTE, + null + ); + this.gl.texParameteri( + this.gl.TEXTURE_2D, + this.gl.TEXTURE_WRAP_S, + this.gl.CLAMP_TO_EDGE + ); + this.gl.texParameteri( + this.gl.TEXTURE_2D, + this.gl.TEXTURE_WRAP_T, + this.gl.CLAMP_TO_EDGE + ); + this.gl.texParameteri( + this.gl.TEXTURE_2D, + this.gl.TEXTURE_MIN_FILTER, + this.gl.LINEAR + ); + this.gl.texParameteri( + this.gl.TEXTURE_2D, + this.gl.TEXTURE_MAG_FILTER, + this.gl.LINEAR + ); + this.gl.bindTexture(this.gl.TEXTURE_2D, null); - ret = this.gl.createFramebuffer(); - this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, ret); - this.gl.framebufferTexture2D( - this.gl.FRAMEBUFFER, - this.gl.COLOR_ATTACHMENT0, - this.gl.TEXTURE_2D, - this._colorBuffer, - 0 - ); + this._maskRenderTextures.pushBack(this.gl.createFramebuffer()); + this.gl.bindFramebuffer( + this.gl.FRAMEBUFFER, + this._maskRenderTextures.at(index) + ); + this.gl.framebufferTexture2D( + this.gl.FRAMEBUFFER, + this.gl.COLOR_ATTACHMENT0, + this.gl.TEXTURE_2D, + this._maskColorBuffers.at(index), + 0 + ); + } this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, s_fbo); this._maskTexture = new CubismRenderTextureResource( this._currentFrameNo, - ret + this._maskRenderTextures ); } - return ret; + return this._maskTexture.textures; } /** @@ -158,8 +173,8 @@ export class CubismClippingManager_WebGL { let minX: number = Number.MAX_VALUE; let minY: number = Number.MAX_VALUE; - let maxX: number = Number.MIN_VALUE; - let maxY: number = Number.MIN_VALUE; + let maxX: number = -Number.MAX_VALUE; + let maxY: number = -Number.MAX_VALUE; const loop: number = drawableVertexCount * Constant.vertexStep; for ( @@ -225,9 +240,10 @@ export class CubismClippingManager_WebGL { * コンストラクタ */ public constructor() { - this._maskRenderTexture = null; - this._colorBuffer = null; + this._currentMaskRenderTexture = null; + this._maskColorBuffers = null; this._currentFrameNo = 0; + this._renderTextureCount = 0; this._clippingMaskBufferSize = 256; this._clippingContextListForMask = new csmVector(); this._clippingContextListForDraw = new csmVector(); @@ -287,7 +303,11 @@ export class CubismClippingManager_WebGL { this._clippingContextListForDraw = null; if (this._maskTexture) { - this.gl.deleteFramebuffer(this._maskTexture.texture); + for (let i = 0; i < this._maskTexture.textures.getSize(); i++) { + this.gl.deleteFramebuffer(this._maskTexture.textures.at(i)); + } + this._maskTexture.textures.clear(); + this._maskTexture.textures = null; this._maskTexture = null; } @@ -298,8 +318,23 @@ export class CubismClippingManager_WebGL { this._channelColors = null; // テクスチャ解放 - this.gl.deleteTexture(this._colorBuffer); - this._colorBuffer = null; + if (this._maskColorBuffers != null) { + for (let index = 0; index < this._maskColorBuffers.getSize(); index++) { + this.gl.deleteTexture(this._maskColorBuffers.at(index)); + } + this._maskColorBuffers.clear(); + } + this._maskColorBuffers = null; + + if (this._maskRenderTextures != null) { + this._maskRenderTextures.clear(); + } + this._maskRenderTextures = null; + + if (this._clearedFrameBufferflags != null) { + this._clearedFrameBufferflags.clear(); + } + this._clearedFrameBufferflags = null; } /** @@ -308,14 +343,37 @@ export class CubismClippingManager_WebGL { * @param model モデルのインスタンス * @param drawableCount 描画オブジェクトの数 * @param drawableMasks 描画オブジェクトをマスクする描画オブジェクトのインデックスのリスト - * @param drawableCounts 描画オブジェクトをマスクする描画オブジェクトの数 + * @param drawableMaskCounts 描画オブジェクトをマスクする描画オブジェクトの数 + * @param renderTextureCount バッファの生成数 */ public initialize( model: CubismModel, drawableCount: number, drawableMasks: Int32Array[], - drawableMaskCounts: Int32Array + drawableMaskCounts: Int32Array, + renderTextureCount: number ): void { + // レンダーテクスチャの合計枚数の設定 + // 1以上の整数でない場合はそれぞれ警告を出す + if (renderTextureCount % 1 != 0) { + CubismLogWarning( + 'The number of render textures must be specified as an integer. The decimal point is rounded down and corrected to an integer.' + ); + // 小数点以下を除去 + renderTextureCount = ~~renderTextureCount; + } + if (renderTextureCount < 1) { + CubismLogWarning( + 'The number of render textures must be an integer greater than or equal to 1. Set the number of render textures to 1.' + ); + } + // 負の値が使われている場合は強制的に1枚と設定する + this._renderTextureCount = renderTextureCount < 1 ? 1 : renderTextureCount; + + this._clearedFrameBufferflags = new csmVector( + this._renderTextureCount + ); + // クリッピングマスクを使う描画オブジェクトをすべて登録する // クリッピングマスクは、通常数個程度に限定して使うものとする for (let i = 0; i < drawableCount; i++) { @@ -379,33 +437,49 @@ export class CubismClippingManager_WebGL { // マスク作成処理 if (usingClipCount > 0) { - // 生成したFrameBufferと同じサイズでビューポートを設定 - this.gl.viewport( - 0, - 0, - this._clippingMaskBufferSize, - this._clippingMaskBufferSize + // 各マスクのレイアウトを決定していく + this.setupLayoutBounds( + renderer.isUsingHighPrecisionMask() ? 0 : usingClipCount ); - // マスクをactiveにする - this._maskRenderTexture = this.getMaskRenderTexture(); + if (!renderer.isUsingHighPrecisionMask()) { + // 生成したFrameBufferと同じサイズでビューポートを設定 + this.gl.viewport( + 0, + 0, + this._clippingMaskBufferSize, + this._clippingMaskBufferSize + ); - // モデル描画時にDrawMeshNowに渡される変換(モデルtoワールド座標変換) - const modelToWorldF: CubismMatrix44 = renderer.getMvpMatrix(); + // 後の計算のためにインデックスの最初をセット + this._currentMaskRenderTexture = this.getMaskRenderTexture().at(0); - renderer.preDraw(); // バッファをクリアする + renderer.preDraw(); // バッファをクリアする - // 各マスクのレイアウトを決定していく - this.setupLayoutBounds(usingClipCount); + // ---------- マスク描画処理 ---------- + // マスク用RenderTextureをactiveにセット + this.gl.bindFramebuffer( + this.gl.FRAMEBUFFER, + this._currentMaskRenderTexture + ); + } - // ---------- マスク描画処理 ---------- - // マスク用RenderTextureをactiveにセット - this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, this._maskRenderTexture); + // サイズがレンダーテクスチャの枚数と合わない場合は合わせる + if (this._clearedFrameBufferflags.getSize() != this._renderTextureCount) { + this._clearedFrameBufferflags.clear(); + this._clearedFrameBufferflags = new csmVector( + this._renderTextureCount + ); + } - // マスクをクリアする - // (仮仕様) 1が無効(描かれない)領域、0が有効(描かれる)領域。(シェーダーCd*Csで0に近い値をかけてマスクを作る。1をかけると何も起こらない) - this.gl.clearColor(1.0, 1.0, 1.0, 1.0); - this.gl.clear(this.gl.COLOR_BUFFER_BIT); + // マスクのクリアフラグを毎フレーム開始時に初期化 + for ( + let index = 0; + index < this._clearedFrameBufferflags.getSize(); + index++ + ) { + this._clearedFrameBufferflags[index] = false; + } // 実際にマスクを生成する // 全てのマスクをどのようにレイアウトして描くかを決定し、ClipContext, ClippedDrawContextに記憶する @@ -419,22 +493,72 @@ export class CubismClippingManager_WebGL { this._clippingContextListForMask.at(clipIndex); const allClipedDrawRect: csmRect = clipContext._allClippedDrawRect; // このマスクを使う、すべての描画オブジェクトの論理座標上の囲み矩形 const layoutBoundsOnTex01: csmRect = clipContext._layoutBounds; // この中にマスクを収める + const MARGIN = 0.05; // モデル座標上の矩形を、適宜マージンを付けて使う + let scaleX = 0; + let scaleY = 0; - // モデル座標上の矩形を、適宜マージンを付けて使う - const MARGIN = 0.05; - this._tmpBoundsOnModel.setRect(allClipedDrawRect); - this._tmpBoundsOnModel.expand( - allClipedDrawRect.width * MARGIN, - allClipedDrawRect.height * MARGIN + // clipContextに設定したレンダーテクスチャをインデックスで取得 + const clipContextRenderTexture = this.getMaskRenderTexture().at( + clipContext._bufferIndex ); - //########## 本来は割り当てられた領域の全体を使わず必要最低限のサイズがよい - // シェーダ用の計算式を求める。回転を考慮しない場合は以下のとおり - // movePeriod' = movePeriod * scaleX + offX [[ movePeriod' = (movePeriod - tmpBoundsOnModel.movePeriod)*scale + layoutBoundsOnTex01.movePeriod ]] - const scaleX: number = - layoutBoundsOnTex01.width / this._tmpBoundsOnModel.width; - const scaleY: number = - layoutBoundsOnTex01.height / this._tmpBoundsOnModel.height; + // 現在のレンダーテクスチャがclipContextのものと異なる場合 + if ( + this._currentMaskRenderTexture != clipContextRenderTexture && + !renderer.isUsingHighPrecisionMask() + ) { + this._currentMaskRenderTexture = clipContextRenderTexture; + renderer.preDraw(); // バッファをクリアする + // マスク用RenderTextureをactiveにセット + this.gl.bindFramebuffer( + this.gl.FRAMEBUFFER, + this._currentMaskRenderTexture + ); + } + + if (renderer.isUsingHighPrecisionMask()) { + const ppu: number = model.getPixelsPerUnit(); + const maskPixelSize: number = + clipContext.getClippingManager()._clippingMaskBufferSize; + const physicalMaskWidth: number = + layoutBoundsOnTex01.width * maskPixelSize; + const physicalMaskHeight: number = + layoutBoundsOnTex01.height * maskPixelSize; + + this._tmpBoundsOnModel.setRect(allClipedDrawRect); + + if (this._tmpBoundsOnModel.width * ppu > physicalMaskWidth) { + this._tmpBoundsOnModel.expand( + allClipedDrawRect.width * MARGIN, + 0.0 + ); + scaleX = layoutBoundsOnTex01.width / this._tmpBoundsOnModel.width; + } else { + scaleX = ppu / physicalMaskWidth; + } + + if (this._tmpBoundsOnModel.height * ppu > physicalMaskHeight) { + this._tmpBoundsOnModel.expand( + 0.0, + allClipedDrawRect.height * MARGIN + ); + scaleY = layoutBoundsOnTex01.height / this._tmpBoundsOnModel.height; + } else { + scaleY = ppu / physicalMaskHeight; + } + } else { + this._tmpBoundsOnModel.setRect(allClipedDrawRect); + this._tmpBoundsOnModel.expand( + allClipedDrawRect.width * MARGIN, + allClipedDrawRect.height * MARGIN + ); + //########## 本来は割り当てられた領域の全体を使わず必要最低限のサイズがよい + + // シェーダ用の計算式を求める。回転を考慮しない場合は以下のとおり + // movePeriod' = movePeriod * scaleX + offX [[ movePeriod' = (movePeriod - tmpBoundsOnModel.movePeriod)*scale + layoutBoundsOnTex01.movePeriod ]] + scaleX = layoutBoundsOnTex01.width / this._tmpBoundsOnModel.width; + scaleY = layoutBoundsOnTex01.height / this._tmpBoundsOnModel.height; + } // マスク生成時に使う行列を求める { @@ -483,50 +607,65 @@ export class CubismClippingManager_WebGL { clipContext._matrixForMask.setMatrix(this._tmpMatrixForMask.getArray()); clipContext._matrixForDraw.setMatrix(this._tmpMatrixForDraw.getArray()); - const clipDrawCount: number = clipContext._clippingIdCount; - for (let i = 0; i < clipDrawCount; i++) { - const clipDrawIndex: number = clipContext._clippingIdList[i]; + if (!renderer.isUsingHighPrecisionMask()) { + const clipDrawCount: number = clipContext._clippingIdCount; + for (let i = 0; i < clipDrawCount; i++) { + const clipDrawIndex: number = clipContext._clippingIdList[i]; - // 頂点情報が更新されておらず、信頼性がない場合は描画をパスする - if ( - !model.getDrawableDynamicFlagVertexPositionsDidChange(clipDrawIndex) - ) { - continue; + // 頂点情報が更新されておらず、信頼性がない場合は描画をパスする + if ( + !model.getDrawableDynamicFlagVertexPositionsDidChange( + clipDrawIndex + ) + ) { + continue; + } + + renderer.setIsCulling( + model.getDrawableCulling(clipDrawIndex) != false + ); + + // マスクがクリアされていないなら処理する + if (!this._clearedFrameBufferflags[clipContext._bufferIndex]) { + // マスクをクリアする + // (仮仕様) 1が無効(描かれない)領域、0が有効(描かれる)領域。(シェーダーCd*Csで0に近い値をかけてマスクを作る。1をかけると何も起こらない) + this.gl.clearColor(1.0, 1.0, 1.0, 1.0); + this.gl.clear(this.gl.COLOR_BUFFER_BIT); + this._clearedFrameBufferflags[clipContext._bufferIndex] = true; + } + + // 今回専用の変換を適用して描く + // チャンネルも切り替える必要がある(A,R,G,B) + renderer.setClippingContextBufferForMask(clipContext); + renderer.drawMesh( + model.getDrawableTextureIndex(clipDrawIndex), + model.getDrawableVertexIndexCount(clipDrawIndex), + model.getDrawableVertexCount(clipDrawIndex), + model.getDrawableVertexIndices(clipDrawIndex), + model.getDrawableVertices(clipDrawIndex), + model.getDrawableVertexUvs(clipDrawIndex), + model.getMultiplyColor(clipDrawIndex), + model.getScreenColor(clipDrawIndex), + model.getDrawableOpacity(clipDrawIndex), + CubismBlendMode.CubismBlendMode_Normal, // クリッピングは通常描画を強制 + false // マスク生成時はクリッピングの反転使用は全く関係がない + ); } - - renderer.setIsCulling( - model.getDrawableCulling(clipDrawIndex) != false - ); - - // 今回専用の変換を適用して描く - // チャンネルも切り替える必要がある(A,R,G,B) - renderer.setClippingContextBufferForMask(clipContext); - renderer.drawMesh( - model.getDrawableTextureIndex(clipDrawIndex), - model.getDrawableVertexIndexCount(clipDrawIndex), - model.getDrawableVertexCount(clipDrawIndex), - model.getDrawableVertexIndices(clipDrawIndex), - model.getDrawableVertices(clipDrawIndex), - model.getDrawableVertexUvs(clipDrawIndex), - model.getMultiplyColor(clipDrawIndex), - model.getScreenColor(clipDrawIndex), - model.getDrawableOpacity(clipDrawIndex), - CubismBlendMode.CubismBlendMode_Normal, // クリッピングは通常描画を強制 - false // マスク生成時はクリッピングの反転使用は全く関係がない - ); } } - // --- 後処理 --- - this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, s_fbo); // 描画対象を戻す - renderer.setClippingContextBufferForMask(null); + if (!renderer.isUsingHighPrecisionMask()) { + // --- 後処理 --- + this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, s_fbo); // 描画対象を戻す + renderer.setClippingContextBufferForMask(null); - this.gl.viewport( - s_viewport[0], - s_viewport[1], - s_viewport[2], - s_viewport[3] - ); + this.gl.viewport( + s_viewport[0], + s_viewport[1], + s_viewport[2], + s_viewport[3] + ); + } } } @@ -577,18 +716,60 @@ export class CubismClippingManager_WebGL { /** * クリッピングコンテキストを配置するレイアウト - * 一つのレンダーテクスチャを極力いっぱいに使ってマスクをレイアウトする + * 指定された数のレンダーテクスチャを極力いっぱいに使ってマスクをレイアウトする * マスクグループの数が4以下ならRGBA各チャンネルに一つずつマスクを配置し、5以上6以下ならRGBAを2,2,1,1と配置する。 * * @param usingClipCount 配置するクリッピングコンテキストの数 */ public setupLayoutBounds(usingClipCount: number): void { - // ひとつのRenderTextureを極力いっぱいに使ってマスクをレイアウトする + const useClippingMaskMaxCount = + this._renderTextureCount <= 1 + ? ClippingMaskMaxCountOnDefault + : ClippingMaskMaxCountOnMultiRenderTexture * this._renderTextureCount; + + if (usingClipCount <= 0 || usingClipCount > useClippingMaskMaxCount) { + if (usingClipCount > useClippingMaskMaxCount) { + // マスクの制限数の警告を出す + CubismLogError( + 'not supported mask count : {0}\n[Details] render texture count : {1}, mask count : {2}', + usingClipCount - useClippingMaskMaxCount, + this._renderTextureCount, + usingClipCount + ); + } + // この場合は一つのマスクターゲットを毎回クリアして使用する + for ( + let index = 0; + index < this._clippingContextListForMask.getSize(); + index++ + ) { + const clipContext: CubismClippingContext = + this._clippingContextListForMask.at(index); + clipContext._layoutChannelNo = 0; // どうせ毎回消すので固定 + clipContext._layoutBounds.x = 0.0; + clipContext._layoutBounds.y = 0.0; + clipContext._layoutBounds.width = 1.0; + clipContext._layoutBounds.height = 1.0; + clipContext._bufferIndex = 0; + } + return; + } + + // レンダーテクスチャが1枚なら9分割する(最大36枚) + const layoutCountMaxValue = this._renderTextureCount <= 1 ? 9 : 8; + + // 指定された数のレンダーテクスチャを極力いっぱいに使ってマスクをレイアウトする(デフォルトなら1) // マスクグループの数が4以下ならRGBA各チャンネルに1つずつマスクを配置し、5以上6以下ならRGBAを2,2,1,1と配置する + let countPerSheetDiv: number = usingClipCount / this._renderTextureCount; // レンダーテクスチャ1枚あたり何枚割り当てるか + let countPerSheetMod: number = usingClipCount % this._renderTextureCount; // この番号のレンダーテクスチャまでに一つずつ配分する + + // 小数点は切り捨てる + countPerSheetDiv = ~~countPerSheetDiv; + countPerSheetMod = ~~countPerSheetMod; // RGBAを順番に使っていく - let div: number = usingClipCount / ColorChannelCount; // 1チャンネルに配置する基本のマスク - let mod: number = usingClipCount % ColorChannelCount; // 余り、この番号のチャンネルまでに一つずつ配分する + let div: number = countPerSheetDiv / ColorChannelCount; // 1チャンネルに配置する基本のマスク + let mod: number = countPerSheetDiv % ColorChannelCount; // 余り、この番号のチャンネルまでに一つずつ配分する // 小数点は切り捨てる div = ~~div; @@ -597,95 +778,114 @@ export class CubismClippingManager_WebGL { // RGBAそれぞれのチャンネルを用意していく(0:R, 1:G, 2:B, 3:A) let curClipIndex = 0; // 順番に設定していく - for (let channelNo = 0; channelNo < ColorChannelCount; channelNo++) { - // このチャンネルにレイアウトする数 - const layoutCount: number = div + (channelNo < mod ? 1 : 0); + for ( + let renderTextureNo = 0; + renderTextureNo < this._renderTextureCount; + renderTextureNo++ + ) { + for (let channelNo = 0; channelNo < ColorChannelCount; channelNo++) { + // このチャンネルにレイアウトする数 + let layoutCount: number = div + (channelNo < mod ? 1 : 0); - // 分割方法を決定する - if (layoutCount == 0) { - // 何もしない - } else if (layoutCount == 1) { - // 全てをそのまま使う - const clipContext: CubismClippingContext = - this._clippingContextListForMask.at(curClipIndex++); - clipContext._layoutChannelNo = channelNo; - clipContext._layoutBounds.x = 0.0; - clipContext._layoutBounds.y = 0.0; - clipContext._layoutBounds.width = 1.0; - clipContext._layoutBounds.height = 1.0; - } else if (layoutCount == 2) { - for (let i = 0; i < layoutCount; i++) { - let xpos: number = i % 2; - - // 小数点は切り捨てる - xpos = ~~xpos; - - const cc: CubismClippingContext = this._clippingContextListForMask.at( - curClipIndex++ - ); - cc._layoutChannelNo = channelNo; - - cc._layoutBounds.x = xpos * 0.5; - cc._layoutBounds.y = 0.0; - cc._layoutBounds.width = 0.5; - cc._layoutBounds.height = 1.0; - // UVを2つに分解して使う + // このレンダーテクスチャにまだ割り当てられていなければ追加する + const checkChannelNo = mod + 1 >= ColorChannelCount ? 0 : mod + 1; + if (layoutCount < layoutCountMaxValue && channelNo == checkChannelNo) { + layoutCount += renderTextureNo < countPerSheetMod ? 1 : 0; } - } else if (layoutCount <= 4) { - // 4分割して使う - for (let i = 0; i < layoutCount; i++) { - let xpos: number = i % 2; - let ypos: number = i / 2; - // 小数点は切り捨てる - xpos = ~~xpos; - ypos = ~~ypos; + // 分割方法を決定する + if (layoutCount == 0) { + // 何もしない + } else if (layoutCount == 1) { + // 全てをそのまま使う + const clipContext: CubismClippingContext = + this._clippingContextListForMask.at(curClipIndex++); + clipContext._layoutChannelNo = channelNo; + clipContext._layoutBounds.x = 0.0; + clipContext._layoutBounds.y = 0.0; + clipContext._layoutBounds.width = 1.0; + clipContext._layoutBounds.height = 1.0; + clipContext._bufferIndex = renderTextureNo; + } else if (layoutCount == 2) { + for (let i = 0; i < layoutCount; i++) { + let xpos: number = i % 2; - const cc = this._clippingContextListForMask.at(curClipIndex++); - cc._layoutChannelNo = channelNo; + // 小数点は切り捨てる + xpos = ~~xpos; - cc._layoutBounds.x = xpos * 0.5; - cc._layoutBounds.y = ypos * 0.5; - cc._layoutBounds.width = 0.5; - cc._layoutBounds.height = 0.5; - } - } else if (layoutCount <= 9) { - // 9分割して使う - for (let i = 0; i < layoutCount; i++) { - let xpos = i % 3; - let ypos = i / 3; + const cc: CubismClippingContext = + this._clippingContextListForMask.at(curClipIndex++); + cc._layoutChannelNo = channelNo; - // 小数点は切り捨てる - xpos = ~~xpos; - ypos = ~~ypos; + // UVを2つに分解して使う + cc._layoutBounds.x = xpos * 0.5; + cc._layoutBounds.y = 0.0; + cc._layoutBounds.width = 0.5; + cc._layoutBounds.height = 1.0; + cc._bufferIndex = renderTextureNo; + } + } else if (layoutCount <= 4) { + // 4分割して使う + for (let i = 0; i < layoutCount; i++) { + let xpos: number = i % 2; + let ypos: number = i / 2; - const cc: CubismClippingContext = this._clippingContextListForMask.at( - curClipIndex++ - ); - cc._layoutChannelNo = channelNo; + // 小数点は切り捨てる + xpos = ~~xpos; + ypos = ~~ypos; - cc._layoutBounds.x = xpos / 3.0; - cc._layoutBounds.y = ypos / 3.0; - cc._layoutBounds.width = 1.0 / 3.0; - cc._layoutBounds.height = 1.0 / 3.0; - } - } else { - // マスクの制限枚数を超えた場合の処理 - CubismLogError('not supported mask count : {0}', layoutCount); + const cc = this._clippingContextListForMask.at(curClipIndex++); + cc._layoutChannelNo = channelNo; - // SetupShaderProgramでオーバーアクセスが発生するので仮で数値を入れる - // もちろん描画結果は正しいものではなくなる - for (let index = 0; index < layoutCount; index++) { - const cc: CubismClippingContext = this._clippingContextListForMask.at( - curClipIndex++ + cc._layoutBounds.x = xpos * 0.5; + cc._layoutBounds.y = ypos * 0.5; + cc._layoutBounds.width = 0.5; + cc._layoutBounds.height = 0.5; + cc._bufferIndex = renderTextureNo; + } + } else if (layoutCount <= layoutCountMaxValue) { + // 9分割して使う + for (let i = 0; i < layoutCount; i++) { + let xpos = i % 3; + let ypos = i / 3; + + // 小数点は切り捨てる + xpos = ~~xpos; + ypos = ~~ypos; + + const cc: CubismClippingContext = + this._clippingContextListForMask.at(curClipIndex++); + cc._layoutChannelNo = channelNo; + + cc._layoutBounds.x = xpos / 3.0; + cc._layoutBounds.y = ypos / 3.0; + cc._layoutBounds.width = 1.0 / 3.0; + cc._layoutBounds.height = 1.0 / 3.0; + cc._bufferIndex = renderTextureNo; + } + } else { + // マスクの制限枚数を超えた場合の処理 + CubismLogError( + 'not supported mask count : {0}\n[Details] render texture count : {1}, mask count : {2}', + usingClipCount - useClippingMaskMaxCount, + this._renderTextureCount, + usingClipCount ); - cc._layoutChannelNo = 0; + // SetupShaderProgramでオーバーアクセスが発生するので仮で数値を入れる + // もちろん描画結果は正しいものではなくなる + for (let index = 0; index < layoutCount; index++) { + const cc: CubismClippingContext = + this._clippingContextListForMask.at(curClipIndex++); - cc._layoutBounds.x = 0.0; - cc._layoutBounds.y = 0.0; - cc._layoutBounds.width = 1.0; - cc._layoutBounds.height = 1.0; + cc._layoutChannelNo = 0; + + cc._layoutBounds.x = 0.0; + cc._layoutBounds.y = 0.0; + cc._layoutBounds.width = 1.0; + cc._layoutBounds.height = 1.0; + cc._bufferIndex = 0; + } } } } @@ -695,8 +895,8 @@ export class CubismClippingManager_WebGL { * カラーバッファを取得する * @return カラーバッファ */ - public getColorBuffer(): WebGLTexture { - return this._colorBuffer; + public getColorBuffer(): csmVector { + return this._maskColorBuffers; } /** @@ -707,6 +907,14 @@ export class CubismClippingManager_WebGL { return this._clippingContextListForDraw; } + /** + * マスクの合計数をカウント + * @returns + */ + public getClippingMaskCount(): number { + return this._clippingContextListForMask.getSize(); + } + /** * クリッピングマスクバッファのサイズを設定する * @param size クリッピングマスクバッファのサイズ @@ -723,8 +931,17 @@ export class CubismClippingManager_WebGL { return this._clippingMaskBufferSize; } - public _maskRenderTexture: WebGLFramebuffer; // マスク用レンダーテクスチャのアドレス - public _colorBuffer: WebGLTexture; // マスク用カラーバッファーのアドレス + /** + * このバッファのレンダーテクスチャの枚数を取得する + * @return このバッファのレンダーテクスチャの枚数 + */ + public getRenderTextureCount(): number { + return this._renderTextureCount; + } + + public _currentMaskRenderTexture: WebGLFramebuffer; // マスク用レンダーテクスチャのアドレス + public _maskRenderTextures: csmVector; // レンダーテクスチャのリスト + public _maskColorBuffers: csmVector; // マスク用カラーバッファーのアドレスのリスト public _currentFrameNo: number; // マスクテクスチャに与えるフレーム番号 public _channelColors: csmVector; @@ -732,11 +949,13 @@ export class CubismClippingManager_WebGL { public _clippingContextListForMask: csmVector; // マスク用クリッピングコンテキストのリスト public _clippingContextListForDraw: csmVector; // 描画用クリッピングコンテキストのリスト public _clippingMaskBufferSize: number; // クリッピングマスクのバッファサイズ(初期値:256) + public _renderTextureCount: number; // 生成するレンダーテクスチャの枚数 private _tmpMatrix: CubismMatrix44; // マスク計算用の行列 private _tmpMatrixForMask: CubismMatrix44; // マスク計算用の行列 private _tmpMatrixForDraw: CubismMatrix44; // マスク計算用の行列 private _tmpBoundsOnModel: csmRect; // マスク配置計算用の矩形 + private _clearedFrameBufferflags: csmVector; //マスクのクリアフラグの配列 gl: WebGLRenderingContext; // WebGLレンダリングコンテキスト } @@ -751,13 +970,13 @@ export class CubismRenderTextureResource { * @param frameNo レンダラーのフレーム番号 * @param texture テクスチャのアドレス */ - public constructor(frameNo: number, texture: WebGLFramebuffer) { + public constructor(frameNo: number, texture: csmVector) { this.frameNo = frameNo; - this.texture = texture; + this.textures = texture; } public frameNo: number; // レンダラのフレーム番号 - public texture: WebGLFramebuffer; // テクスチャのアドレス + public textures: csmVector; // テクスチャのアドレス } /** @@ -787,6 +1006,8 @@ export class CubismClippingContext { this._matrixForMask = new CubismMatrix44(); this._matrixForDraw = new CubismMatrix44(); + + this._bufferIndex = 0; } /** @@ -836,10 +1057,173 @@ export class CubismClippingContext { public _matrixForMask: CubismMatrix44; // マスクの位置計算結果を保持する行列 public _matrixForDraw: CubismMatrix44; // 描画オブジェクトの位置計算結果を保持する行列 public _clippedDrawableIndexList: number[]; // このマスクにクリップされる描画オブジェクトのリスト + public _bufferIndex: number; // このマスクが割り当てられるレンダーテクスチャ(フレームバッファ)やカラーバッファのインデックス private _owner: CubismClippingManager_WebGL; // このマスクを管理しているマネージャのインスタンス } +export class CubismRendererProfile_WebGL { + private setGlEnable(index: GLenum, enabled: GLboolean): void { + if (enabled) this.gl.enable(index); + else this.gl.disable(index); + } + + private setGlEnableVertexAttribArray( + index: GLuint, + enabled: GLboolean + ): void { + if (enabled) this.gl.enableVertexAttribArray(index); + else this.gl.disableVertexAttribArray(index); + } + + public save(): void { + if (this.gl == null) { + CubismLogError( + "'gl' is null. WebGLRenderingContext is required.\nPlease call 'CubimRenderer_WebGL.startUp' function." + ); + return; + } + //-- push state -- + this._lastArrayBufferBinding = this.gl.getParameter( + this.gl.ARRAY_BUFFER_BINDING + ); + this._lastArrayBufferBinding = this.gl.getParameter( + this.gl.ELEMENT_ARRAY_BUFFER_BINDING + ); + this._lastProgram = this.gl.getParameter(this.gl.CURRENT_PROGRAM); + + this._lastActiveTexture = this.gl.getParameter(this.gl.ACTIVE_TEXTURE); + this.gl.activeTexture(this.gl.TEXTURE1); //テクスチャユニット1をアクティブに(以後の設定対象とする) + this._lastTexture1Binding2D = this.gl.getParameter( + this.gl.TEXTURE_BINDING_2D + ); + + this.gl.activeTexture(this.gl.TEXTURE0); //テクスチャユニット0をアクティブに(以後の設定対象とする) + this._lastTexture0Binding2D = this.gl.getParameter( + this.gl.TEXTURE_BINDING_2D + ); + + this._lastVertexAttribArrayEnabled[0] = this.gl.getVertexAttrib( + 0, + this.gl.VERTEX_ATTRIB_ARRAY_ENABLED + ); + this._lastVertexAttribArrayEnabled[1] = this.gl.getVertexAttrib( + 1, + this.gl.VERTEX_ATTRIB_ARRAY_ENABLED + ); + this._lastVertexAttribArrayEnabled[2] = this.gl.getVertexAttrib( + 2, + this.gl.VERTEX_ATTRIB_ARRAY_ENABLED + ); + this._lastVertexAttribArrayEnabled[3] = this.gl.getVertexAttrib( + 3, + this.gl.VERTEX_ATTRIB_ARRAY_ENABLED + ); + + this._lastScissorTest = this.gl.isEnabled(this.gl.SCISSOR_TEST); + this._lastStencilTest = this.gl.isEnabled(this.gl.STENCIL_TEST); + this._lastDepthTest = this.gl.isEnabled(this.gl.DEPTH_TEST); + this._lastCullFace = this.gl.isEnabled(this.gl.CULL_FACE); + this._lastBlend = this.gl.isEnabled(this.gl.BLEND); + + this._lastFrontFace = this.gl.getParameter(this.gl.FRONT_FACE); + + this._lastColorMask = this.gl.getParameter(this.gl.COLOR_WRITEMASK); + + // backup blending + this._lastBlending[0] = this.gl.getParameter(this.gl.BLEND_SRC_RGB); + this._lastBlending[1] = this.gl.getParameter(this.gl.BLEND_DST_RGB); + this._lastBlending[2] = this.gl.getParameter(this.gl.BLEND_SRC_ALPHA); + this._lastBlending[3] = this.gl.getParameter(this.gl.BLEND_DST_ALPHA); + + // モデル描画直前のFBOとビューポートを保存 + this._lastFBO = this.gl.getParameter(this.gl.FRAMEBUFFER_BINDING); + this._lastViewport = this.gl.getParameter(this.gl.VIEWPORT); + } + + public restore(): void { + if (this.gl == null) { + CubismLogError( + "'gl' is null. WebGLRenderingContext is required.\nPlease call 'CubimRenderer_WebGL.startUp' function." + ); + return; + } + this.gl.useProgram(this._lastProgram); + + this.setGlEnableVertexAttribArray(0, this._lastVertexAttribArrayEnabled[0]); + this.setGlEnableVertexAttribArray(1, this._lastVertexAttribArrayEnabled[1]); + this.setGlEnableVertexAttribArray(2, this._lastVertexAttribArrayEnabled[2]); + this.setGlEnableVertexAttribArray(3, this._lastVertexAttribArrayEnabled[3]); + + this.setGlEnable(this.gl.SCISSOR_TEST, this._lastScissorTest); + this.setGlEnable(this.gl.STENCIL_TEST, this._lastStencilTest); + this.setGlEnable(this.gl.DEPTH_TEST, this._lastDepthTest); + this.setGlEnable(this.gl.CULL_FACE, this._lastCullFace); + this.setGlEnable(this.gl.BLEND, this._lastBlend); + + this.gl.frontFace(this._lastFrontFace); + + this.gl.colorMask( + this._lastColorMask[0], + this._lastColorMask[1], + this._lastColorMask[2], + this._lastColorMask[3] + ); + + this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this._lastArrayBufferBinding); //前にバッファがバインドされていたら破棄する必要がある + this.gl.bindBuffer( + this.gl.ELEMENT_ARRAY_BUFFER, + this._lastElementArrayBufferBinding + ); + + this.gl.activeTexture(this.gl.TEXTURE1); //テクスチャユニット1を復元 + this.gl.bindTexture(this.gl.TEXTURE_2D, this._lastTexture1Binding2D); + + this.gl.activeTexture(this.gl.TEXTURE0); //テクスチャユニット0を復元 + this.gl.bindTexture(this.gl.TEXTURE_2D, this._lastTexture0Binding2D); + + this.gl.activeTexture(this._lastActiveTexture); + + this.gl.blendFuncSeparate( + this._lastBlending[0], + this._lastBlending[1], + this._lastBlending[2], + this._lastBlending[3] + ); + } + + public setGl(gl: WebGLRenderingContext): void { + this.gl = gl; + } + + constructor() { + this._lastVertexAttribArrayEnabled = new Array(4); + this._lastColorMask = new Array(4); + this._lastBlending = new Array(4); + this._lastViewport = new Array(4); + } + + private _lastArrayBufferBinding: GLint; ///< モデル描画直前の頂点バッファ + private _lastElementArrayBufferBinding: GLint; ///< モデル描画直前のElementバッファ + private _lastProgram: GLint; ///< モデル描画直前のシェーダプログラムバッファ + private _lastActiveTexture: GLint; ///< モデル描画直前のアクティブなテクスチャ + private _lastTexture0Binding2D: GLint; ///< モデル描画直前のテクスチャユニット0 + private _lastTexture1Binding2D: GLint; ///< モデル描画直前のテクスチャユニット1 + private _lastVertexAttribArrayEnabled: GLboolean[]; ///< モデル描画直前のテクスチャユニット1 + private _lastScissorTest: GLboolean; ///< モデル描画直前のGL_VERTEX_ATTRIB_ARRAY_ENABLEDパラメータ + private _lastBlend: GLboolean; ///< モデル描画直前のGL_SCISSOR_TESTパラメータ + private _lastStencilTest: GLboolean; ///< モデル描画直前のGL_STENCIL_TESTパラメータ + private _lastDepthTest: GLboolean; ///< モデル描画直前のGL_DEPTH_TESTパラメータ + private _lastCullFace: GLboolean; ///< モデル描画直前のGL_CULL_FACEパラメータ + private _lastFrontFace: GLint; ///< モデル描画直前のGL_CULL_FACEパラメータ + private _lastColorMask: GLboolean[]; ///< モデル描画直前のGL_COLOR_WRITEMASKパラメータ + private _lastBlending: GLint[]; ///< モデル描画直前のカラーブレンディングパラメータ + private _lastFBO: GLint; ///< モデル描画直前のフレームバッファ + private _lastViewport: GLint[]; ///< モデル描画直前のビューポート + + gl: WebGLRenderingContext; +} + /** * WebGL用のシェーダープログラムを生成・破棄するクラス * シングルトンなクラスであり、CubismShader_WebGL.getInstanceからアクセスする。 @@ -1116,7 +1500,8 @@ export class CubismShader_WebGL { const tex: WebGLTexture = renderer .getClippingContextBufferForDraw() .getClippingManager() - .getColorBuffer(); + .getColorBuffer() + .at(renderer.getClippingContextBufferForDraw()._bufferIndex); this.gl.bindTexture(this.gl.TEXTURE_2D, tex); this.gl.uniform1i(shaderSet.samplerTexture1Location, 1); @@ -1211,7 +1596,7 @@ export class CubismShader_WebGL { * @param fragShaderSrc フラグメントシェーダのソース */ public generateShaders(): void { - for (let i = 0; i < shaderCount; i++) { + for (let i = 0; i < ShaderCount; i++) { this._shaderSets.pushBack(new CubismShaderSet()); } @@ -1966,15 +2351,17 @@ export class CubismRenderer_WebGL extends CubismRenderer { * 引数に渡したモデルからレンダラの初期化処理に必要な情報を取り出すことができる * * @param model モデルのインスタンス + * @param maskBufferCount バッファの生成数 */ - public initialize(model: CubismModel): void { + public initialize(model: CubismModel, maskBufferCount = 1): void { if (model.isUsingMasking()) { this._clippingManager = new CubismClippingManager_WebGL(); // クリッピングマスク・バッファ前処理方式を初期化 this._clippingManager.initialize( model, model.getDrawableCount(), model.getDrawableMasks(), - model.getDrawableMaskCounts() + model.getDrawableMaskCounts(), + maskBufferCount ); } @@ -2007,6 +2394,15 @@ export class CubismRenderer_WebGL extends CubismRenderer { * @param size クリッピングマスクバッファのサイズ */ public setClippingMaskBufferSize(size: number) { + // クリッピングマスクを利用しない場合は早期リターン + if (!this._model.isUsingMasking()) { + return; + } + + // インスタンス破棄前にレンダーテクスチャの数を保存 + const renderTextureCount: number = + this._clippingManager.getRenderTextureCount(); + // FrameBufferのサイズを変更するためにインスタンスを破棄・再作成する this._clippingManager.release(); this._clippingManager = void 0; @@ -2020,7 +2416,8 @@ export class CubismRenderer_WebGL extends CubismRenderer { this.getModel(), this.getModel().getDrawableCount(), this.getModel().getDrawableMasks(), - this.getModel().getDrawableMaskCounts() + this.getModel().getDrawableMaskCounts(), + renderTextureCount // インスタンス破棄前に保存したレンダーテクスチャの数 ); } @@ -2029,7 +2426,19 @@ export class CubismRenderer_WebGL extends CubismRenderer { * @return クリッピングマスクバッファのサイズ */ public getClippingMaskBufferSize(): number { - return this._clippingManager.getClippingMaskBufferSize(); + return this._model.isUsingMasking() + ? this._clippingManager.getClippingMaskBufferSize() + : -1; + } + + /** + * レンダーテクスチャの枚数を取得する + * @return レンダーテクスチャの枚数 + */ + public getRenderTextureCount(): number { + return this._model.isUsingMasking() + ? this._clippingManager.getRenderTextureCount() + : -1; } /** @@ -2039,7 +2448,7 @@ export class CubismRenderer_WebGL extends CubismRenderer { super(); this._clippingContextBufferForMask = null; this._clippingContextBufferForDraw = null; - this._clippingManager = new CubismClippingManager_WebGL(); + this._rendererProfile = new CubismRendererProfile_WebGL(); this.firstDraw = true; this._textures = new csmMap(); this._sortedDrawableIndexList = new csmVector(); @@ -2057,10 +2466,15 @@ export class CubismRenderer_WebGL extends CubismRenderer { * デストラクタ相当の処理 */ public release(): void { - this._clippingManager.release(); - this._clippingManager = void 0; - this._clippingManager = null; + if (this._clippingManager) { + this._clippingManager.release(); + this._clippingManager = void 0; + this._clippingManager = null; + } + if (this.gl == null) { + return; + } this.gl.deleteBuffer(this._bufferData.vertex); this._bufferData.vertex = null; this.gl.deleteBuffer(this._bufferData.uv); @@ -2076,6 +2490,13 @@ export class CubismRenderer_WebGL extends CubismRenderer { * モデルを描画する実際の処理 */ public doDrawModel(): void { + if (this.gl == null) { + CubismLogError( + "'gl' is null. WebGLRenderingContext is required.\nPlease call 'CubimRenderer_WebGL.startUp' function." + ); + return; + } + //------------ クリッピングマスク・バッファ前処理方式の場合 ------------ if (this._clippingManager != null) { this.preDraw(); @@ -2103,14 +2524,99 @@ export class CubismRenderer_WebGL extends CubismRenderer { continue; } - // クリッピングマスクをセットする - this.setClippingContextBufferForDraw( + const clipContext = this._clippingManager != null ? this._clippingManager .getClippingContextListForDraw() .at(drawableIndex) - : null - ); + : null; + + if (clipContext != null && this.isUsingHighPrecisionMask()) { + // 描くことになっていた + if (clipContext._isUsing) { + // 生成したFrameBufferと同じサイズでビューポートを設定 + this.gl.viewport( + 0, + 0, + this._clippingManager.getClippingMaskBufferSize(), + this._clippingManager.getClippingMaskBufferSize() + ); + + this.preDraw(); // バッファをクリアする + + // ---------- マスク描画処理 ---------- + // マスク用RenderTextureをactiveにセット + this.gl.bindFramebuffer( + this.gl.FRAMEBUFFER, + clipContext + .getClippingManager() + .getMaskRenderTexture() + .at(clipContext._bufferIndex) + ); + + // マスクをクリアする + // (仮仕様) 1が無効(描かれない)領域、0が有効(描かれる)領域。(シェーダーCd*Csで0に近い値をかけてマスクを作る。1をかけると何も起こらない) + this.gl.clearColor(1.0, 1.0, 1.0, 1.0); + this.gl.clear(this.gl.COLOR_BUFFER_BIT); + } + + { + const clipDrawCount: number = clipContext._clippingIdCount; + + for (let index = 0; index < clipDrawCount; index++) { + const clipDrawIndex: number = clipContext._clippingIdList[index]; + + // 頂点情報が更新されておらず、信頼性がない場合は描画をパスする + if ( + !this._model.getDrawableDynamicFlagVertexPositionsDidChange( + clipDrawIndex + ) + ) { + continue; + } + + this.setIsCulling( + this._model.getDrawableCulling(clipDrawIndex) != false + ); + + // 今回専用の変換を適用して描く + // チャンネルも切り替える必要がある(A,R,G,B) + this.setClippingContextBufferForMask(clipContext); + + this.drawMesh( + this.getModel().getDrawableTextureIndex(clipDrawIndex), + this.getModel().getDrawableVertexIndexCount(clipDrawIndex), + this.getModel().getDrawableVertexCount(clipDrawIndex), + this.getModel().getDrawableVertexIndices(clipDrawIndex), + this.getModel().getDrawableVertices(clipDrawIndex), + this.getModel().getDrawableVertexUvs(clipDrawIndex), + this.getModel().getMultiplyColor(clipDrawIndex), + this.getModel().getScreenColor(clipDrawIndex), + this.getModel().getDrawableOpacity(clipDrawIndex), + CubismBlendMode.CubismBlendMode_Normal, // クリッピングは通常描画を強制 + false // マスク生成時はクリッピングの反転使用は全く関係がない + ); + } + } + + { + // --- 後処理 --- + this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, s_fbo); // 描画対象を戻す + this.setClippingContextBufferForMask(null); + + this.gl.viewport( + s_viewport[0], + s_viewport[1], + s_viewport[2], + s_viewport[3] + ); + + this.preDraw(); // バッファをクリアする + } + } + + // クリッピングマスクをセットする + this.setClippingContextBufferForDraw(clipContext); this.setIsCulling(this.getModel().getDrawableCulling(drawableIndex)); @@ -2220,6 +2726,14 @@ export class CubismRenderer_WebGL extends CubismRenderer { this.setClippingContextBufferForMask(null); } + protected saveProfile(): void { + this._rendererProfile.save(); + } + + protected restoreProfile(): void { + this._rendererProfile.restore(); + } + /** * レンダラが保持する静的なリソースを解放する * WebGLの静的なシェーダープログラムを解放する @@ -2308,8 +2822,13 @@ export class CubismRenderer_WebGL extends CubismRenderer { */ public startUp(gl: WebGLRenderingContext): void { this.gl = gl; - this._clippingManager.setGL(gl); + + if (this._clippingManager) { + this._clippingManager.setGL(gl); + } + CubismShader_WebGL.getInstance().setGl(gl); + this._rendererProfile.setGl(gl); // 異方性フィルタリングが使用できるかチェック this._extension = @@ -2323,6 +2842,7 @@ export class CubismRenderer_WebGL extends CubismRenderer { _clippingManager: CubismClippingManager_WebGL; // クリッピングマスク管理オブジェクト _clippingContextBufferForMask: CubismClippingContext; // マスクテクスチャに描画するためのクリッピングコンテキスト _clippingContextBufferForDraw: CubismClippingContext; // 画面上描画するためのクリッピングコンテキスト + _rendererProfile: CubismRendererProfile_WebGL; firstDraw: boolean; _bufferData: { vertex: WebGLBuffer;