@laplace.live/pixijs-live2d 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["Live2DCubismFramework","$.CubismId","Live2DCubismFramework","$.CubismIdManager","Live2DCubismFramework","$.CubismVector2","Live2DCubismFramework","$.CubismMath","Live2DCubismFramework","$.CubismMatrix44","Live2DCubismFramework","$.csmRect","Live2DCubismFramework","$.CubismDebug","Live2DCubismFramework","$.CubismBlendMode","$.CubismRenderer","$.CubismTextureColor","Value","Live2DCubismFramework","$.CubismJson","$.JsonArray","$.JsonBoolean","$.JsonError","$.JsonFloat","$.JsonMap","$.JsonNullvalue","$.JsonString","$.Value","Live2DCubismFramework","$.Constant","$.csmDelete","$.CubismFramework","CubismFrameworkConfig","TAG","candidate","TAG","clamp","tempMatrix","Id","Live2DCubismFramework","$.CubismPose","$.PartData","Live2DCubismFramework","$.CubismModel","Live2DCubismFramework","$.CubismMoc","Live2DCubismFramework","$.CubismPhysicsInput","$.CubismPhysicsNormalization","$.CubismPhysicsOutput","$.CubismPhysicsParameter","$.CubismPhysicsParticle","$.CubismPhysicsRig","$.CubismPhysicsSource","$.CubismPhysicsSubRig","$.CubismPhysicsTargetType","$.PhysicsJsonEffectiveForces","Id","Meta","Fps","Live2DCubismFramework","$.CubismPhysicsJson","Live2DCubismFramework","$.CubismPhysics","$.Options","Live2DCubismFramework","Live2DCubismFramework","$.BreathParameterData","$.CubismBreath","Live2DCubismFramework","$.CubismEyeBlink","$.EyeState","Live2DCubismFramework","$.CubismRenderTarget_WebGL","Live2DCubismFramework","$.CubismShaderSet","$.CubismShader_WebGL","$.CubismShaderManager_WebGL","$.ShaderNames","Live2DCubismFramework","$.CubismClippingContext_WebGL","$.CubismClippingManager_WebGL","$.CubismRenderer_WebGL","Live2DCubismFramework","$.ACubismMotion","Live2DCubismFramework","$.CubismMotionCurve","$.CubismMotionCurveTarget","$.CubismMotionData","$.CubismMotionEvent","$.CubismMotionPoint","$.CubismMotionSegment","$.CubismMotionSegmentType","Live2DCubismFramework","$.CubismMotionJson","Live2DCubismFramework","$.CubismMotion","Live2DCubismFramework","$.CubismMotionQueueEntry","Live2DCubismFramework","$.CubismMotionQueueManager","Live2DCubismFramework","$.CubismExpressionMotion","$.ExpressionBlendType","$.ExpressionParameter","getCurveId","vertShaderSrc","vertShaderSrcMasked","vertShaderSrcSetupMask","fragShaderSrcSetupMask","fragShaderSrcPremultipliedAlpha","fragShaderSrcMaskPremultipliedAlpha","fragShaderSrcMaskInvertedPremultipliedAlpha","vertShaderSrcCopy","fragShaderSrcCopy","fragShaderSrcColorBlend","fragShaderSrcAlphaBlend","vertShaderSrcBlend","fragShaderSrcBlend","Live2DCubismFramework","$.ICubismModelSetting","$.CubismModelSettingJson","$.FrequestNode"],"sources":["../vendor/cubism/src/id/cubismid.ts","../vendor/cubism/src/id/cubismidmanager.ts","../vendor/cubism/src/math/cubismvector2.ts","../vendor/cubism/src/math/cubismmath.ts","../vendor/cubism/src/math/cubismmatrix44.ts","../vendor/cubism/src/type/csmrectf.ts","../vendor/cubism/src/cubismframeworkconfig.ts","../vendor/cubism/src/utils/cubismdebug.ts","../vendor/cubism/src/rendering/cubismrenderer.ts","../vendor/cubism/src/utils/cubismjsonextension.ts","../vendor/cubism/src/utils/cubismjson.ts","../vendor/cubism/src/live2dcubismframework.ts","../src/config.ts","../src/cubism-common/constants.ts","../src/utils/array.ts","../src/utils/log.ts","../src/utils/math.ts","../src/utils/obj.ts","../src/utils/string.ts","../src/utils/url.ts","../src/cubism-common/ExpressionManager.ts","../src/cubism-common/FocusController.ts","../src/cubism-common/layout.ts","../src/cubism-common/InternalModel.ts","../src/cubism-common/ModelSettings.ts","../src/cubism-common/MotionState.ts","../src/cubism-common/SoundManager.ts","../src/cubism-common/MotionManager.ts","../src/factory/FileLoader.ts","../src/utils/middleware.ts","../src/factory/XHRLoader.ts","../src/factory/Live2DLoader.ts","../src/factory/texture-lod.ts","../src/factory/texture.ts","../src/factory/model-middlewares.ts","../src/factory/Live2DFactory.ts","../src/Automator.ts","../src/Live2DTransform.ts","../src/Live2DModel.ts","../src/cubism/check-runtime.ts","../vendor/cubism/src/effect/cubismpose.ts","../vendor/cubism/src/model/cubismmodelmultiplyandscreencolor.ts","../vendor/cubism/src/model/cubismmodel.ts","../vendor/cubism/src/model/cubismmoc.ts","../vendor/cubism/src/utils/cubismarrayutils.ts","../vendor/cubism/src/physics/cubismphysicsinternal.ts","../vendor/cubism/src/physics/cubismphysicsjson.ts","../vendor/cubism/src/physics/cubismphysics.ts","../vendor/cubism/src/cubismdefaultparameterid.ts","../vendor/cubism/src/effect/cubismbreath.ts","../vendor/cubism/src/effect/cubismeyeblink.ts","../vendor/cubism/src/rendering/cubismclippingmanager.ts","../vendor/cubism/src/rendering/cubismrendertarget_webgl.ts","../vendor/cubism/src/rendering/cubismshader_webgl.ts","../vendor/cubism/src/rendering/cubismoffscreenmanager.ts","../vendor/cubism/src/rendering/cubismoffscreenrendertarget_webgl.ts","../vendor/cubism/src/rendering/cubismrenderer_webgl.ts","../vendor/cubism/src/motion/acubismmotion.ts","../vendor/cubism/src/motion/cubismmotioninternal.ts","../vendor/cubism/src/motion/cubismmotionjson.ts","../vendor/cubism/src/motion/cubismmotion.ts","../vendor/cubism/src/motion/cubismmotionqueueentry.ts","../vendor/cubism/src/motion/cubismmotionqueuemanager.ts","../vendor/cubism/src/motion/cubismexpressionmotion.ts","../src/cubism/CubismExpressionManager.ts","../src/cubism/MotionSkipLastFrameHelper.ts","../src/cubism/CubismMotionManager.ts","../src/cubism-common/ParallelMotionManager.ts","../src/cubism/CubismParallelMotionManager.ts","../src/cubism/offscreen-pool.ts","../vendor/cubism/Shaders/WebGL/fragshadersrcalphablend.frag?raw","../vendor/cubism/Shaders/WebGL/fragshadersrccolorblend.frag?raw","../vendor/cubism/Shaders/WebGL/fragshadersrccopy.frag?raw","../vendor/cubism/Shaders/WebGL/fragshadersrcmaskinvertedpremultipliedalpha.frag?raw","../vendor/cubism/Shaders/WebGL/fragshadersrcmaskpremultipliedalpha.frag?raw","../vendor/cubism/Shaders/WebGL/fragshadersrcpremultipliedalpha.frag?raw","../vendor/cubism/Shaders/WebGL/fragshadersrcpremultipliedalphablend.frag?raw","../vendor/cubism/Shaders/WebGL/fragshadersrcsetupmask.frag?raw","../vendor/cubism/Shaders/WebGL/vertshadersrc.vert?raw","../vendor/cubism/Shaders/WebGL/vertshadersrcblend.vert?raw","../vendor/cubism/Shaders/WebGL/vertshadersrccopy.vert?raw","../vendor/cubism/Shaders/WebGL/vertshadersrcmasked.vert?raw","../vendor/cubism/Shaders/WebGL/vertshadersrcsetupmask.vert?raw","../src/cubism/shaders.ts","../src/cubism/CubismInternalModel.ts","../vendor/cubism/src/icubismmodelsetting.ts","../vendor/cubism/src/cubismmodelsettingjson.ts","../src/cubism/CubismModelSettings.ts","../src/cubism/setup.ts","../src/cubism/factory.ts"],"sourcesContent":["/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\n/**\n * パラメータ名・パーツ名・Drawable名を保持\n *\n * パラメータ名・パーツ名・Drawable名を保持するクラス。\n *\n * @note 指定したID文字列からCubismIdを取得する際はこのクラスの生成メソッドを呼ばず、\n * CubismIdManager().getId(id)を使用してください\n */\nexport class CubismId {\n /**\n * 内部で使用するCubismIdクラス生成メソッド\n *\n * @param id ID文字列\n * @return CubismId\n * @note 指定したID文字列からCubismIdを取得する際は\n * CubismIdManager().getId(id)を使用してください\n */\n public static createIdInternal(id: string) {\n return new CubismId(id);\n }\n\n /**\n * ID名を取得する\n */\n public getString() {\n return this._id;\n }\n\n /**\n * idを比較\n * @param c 比較するid\n * @return 同じならばtrue,異なっていればfalseを返す\n */\n public isEqual(c: string | CubismId): boolean {\n if (typeof c === 'string') {\n return this._id == c;\n } else if (c instanceof CubismId) {\n return this._id == c._id;\n }\n return false;\n }\n\n /**\n * idを比較\n * @param c 比較するid\n * @return 同じならばtrue,異なっていればfalseを返す\n */\n public isNotEqual(c: string | CubismId): boolean {\n if (typeof c == 'string') {\n return !(this._id == c);\n } else if (c instanceof CubismId) {\n return !(this._id == c._id);\n }\n return false;\n }\n\n /**\n * プライベートコンストラクタ\n *\n * @note ユーザーによる生成は許可しません\n */\n private constructor(id: string) {\n this._id = id;\n }\n\n private _id: string; // ID名\n}\n\nexport declare type CubismIdHandle = CubismId;\n\n// Namespace definition for compatibility.\nimport * as $ from './cubismid';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const CubismId = $.CubismId;\n export type CubismId = $.CubismId;\n export type CubismIdHandle = $.CubismIdHandle;\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport { CubismId } from './cubismid';\n\n/**\n * ID名の管理\n *\n * ID名を管理する。\n */\nexport class CubismIdManager {\n /**\n * コンストラクタ\n */\n public constructor() {\n this._ids = new Array<CubismId>();\n }\n\n /**\n * デストラクタ相当の処理\n */\n public release(): void {\n for (let i = 0; i < this._ids.length; ++i) {\n this._ids[i] = void 0;\n }\n this._ids = null;\n }\n\n /**\n * ID名をリストから登録\n *\n * @param ids ID名リスト\n * @param count IDの個数\n */\n public registerIds(ids: string[]): void {\n for (let i = 0; i < ids.length; i++) {\n this.registerId(ids[i]);\n }\n }\n\n /**\n * ID名を登録\n *\n * @param id ID名\n */\n public registerId(id: string): CubismId {\n let result: CubismId = null;\n\n if ('string' == typeof id) {\n if ((result = this.findId(id)) != null) {\n return result;\n }\n\n result = CubismId.createIdInternal(id);\n this._ids.push(result);\n } else {\n return this.registerId(id);\n }\n\n return result;\n }\n\n /**\n * ID名からIDを取得する\n *\n * @param id ID名\n */\n public getId(id: string): CubismId {\n return this.registerId(id);\n }\n\n /**\n * ID名からIDの確認\n *\n * @return true 存在する\n * @return false 存在しない\n */\n public isExist(id: string): boolean {\n if ('string' == typeof id) {\n return this.findId(id) != null;\n }\n return this.isExist(id);\n }\n\n /**\n * ID名からIDを検索する。\n *\n * @param id ID名\n * @return 登録されているID。なければNULL。\n */\n private findId(id: string): CubismId {\n for (let i = 0; i < this._ids.length; ++i) {\n if (this._ids[i].getString() == id) {\n return this._ids[i];\n }\n }\n\n return null;\n }\n\n private _ids: Array<CubismId>; // 登録されているIDのリスト\n}\n\n// Namespace definition for compatibility.\nimport * as $ from './cubismidmanager';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const CubismIdManager = $.CubismIdManager;\n export type CubismIdManager = $.CubismIdManager;\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\n/**\n * 2次元ベクトル型\n *\n * 2次元ベクトル型の機能を提供する。\n */\nexport class CubismVector2 {\n /**\n * コンストラクタ\n */\n public constructor(\n public x?: number,\n public y?: number\n ) {\n this.x = x == undefined ? 0.0 : x;\n\n this.y = y == undefined ? 0.0 : y;\n }\n\n /**\n * ベクトルの加算\n *\n * @param vector2 加算するベクトル値\n * @return 加算結果 ベクトル値\n */\n public add(vector2: CubismVector2): CubismVector2 {\n const ret: CubismVector2 = new CubismVector2(0.0, 0.0);\n ret.x = this.x + vector2.x;\n ret.y = this.y + vector2.y;\n return ret;\n }\n\n /**\n * ベクトルの減算\n *\n * @param vector2 減算するベクトル値\n * @return 減算結果 ベクトル値\n */\n public substract(vector2: CubismVector2): CubismVector2 {\n const ret: CubismVector2 = new CubismVector2(0.0, 0.0);\n ret.x = this.x - vector2.x;\n ret.y = this.y - vector2.y;\n return ret;\n }\n\n /**\n * ベクトルの乗算\n *\n * @param vector2 乗算するベクトル値\n * @return 乗算結果 ベクトル値\n */\n public multiply(vector2: CubismVector2): CubismVector2 {\n const ret: CubismVector2 = new CubismVector2(0.0, 0.0);\n ret.x = this.x * vector2.x;\n ret.y = this.y * vector2.y;\n return ret;\n }\n\n /**\n * ベクトルの乗算(スカラー)\n *\n * @param scalar 乗算するスカラー値\n * @return 乗算結果 ベクトル値\n */\n public multiplyByScaler(scalar: number): CubismVector2 {\n return this.multiply(new CubismVector2(scalar, scalar));\n }\n\n /**\n * ベクトルの除算\n *\n * @param vector2 除算するベクトル値\n * @return 除算結果 ベクトル値\n */\n public division(vector2: CubismVector2): CubismVector2 {\n const ret: CubismVector2 = new CubismVector2(0.0, 0.0);\n ret.x = this.x / vector2.x;\n ret.y = this.y / vector2.y;\n return ret;\n }\n\n /**\n * ベクトルの除算(スカラー)\n *\n * @param scalar 除算するスカラー値\n * @return 除算結果 ベクトル値\n */\n public divisionByScalar(scalar: number): CubismVector2 {\n return this.division(new CubismVector2(scalar, scalar));\n }\n\n /**\n * ベクトルの長さを取得する\n *\n * @return ベクトルの長さ\n */\n public getLength(): number {\n return Math.sqrt(this.x * this.x + this.y * this.y);\n }\n\n /**\n * ベクトルの距離の取得\n *\n * @param a 点\n * @return ベクトルの距離\n */\n public getDistanceWith(a: CubismVector2): number {\n return Math.sqrt(\n (this.x - a.x) * (this.x - a.x) + (this.y - a.y) * (this.y - a.y)\n );\n }\n\n /**\n * ドット積の計算\n *\n * @param a 値\n * @return 結果\n */\n public dot(a: CubismVector2): number {\n return this.x * a.x + this.y * a.y;\n }\n\n /**\n * 正規化の適用\n */\n public normalize(): void {\n const length: number = Math.pow(this.x * this.x + this.y * this.y, 0.5);\n\n this.x = this.x / length;\n this.y = this.y / length;\n }\n\n /**\n * 等しさの確認(等しいか?)\n *\n * 値が等しいか?\n *\n * @param rhs 確認する値\n * @return true 値は等しい\n * @return false 値は等しくない\n */\n public isEqual(rhs: CubismVector2): boolean {\n return this.x == rhs.x && this.y == rhs.y;\n }\n\n /**\n * 等しさの確認(等しくないか?)\n *\n * 値が等しくないか?\n *\n * @param rhs 確認する値\n * @return true 値は等しくない\n * @return false 値は等しい\n */\n public isNotEqual(rhs: CubismVector2): boolean {\n return !this.isEqual(rhs);\n }\n}\n\n// Namespace definition for compatibility.\nimport * as $ from './cubismvector2';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const CubismVector2 = $.CubismVector2;\n export type CubismVector2 = $.CubismVector2;\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport { CubismVector2 } from './cubismvector2';\n\n/**\n * 数値計算などに使用するユーティリティクラス\n */\nexport class CubismMath {\n static readonly Epsilon: number = 0.00001;\n\n /**\n * 第一引数の値を最小値と最大値の範囲に収めた値を返す\n *\n * @param value 収められる値\n * @param min 範囲の最小値\n * @param max 範囲の最大値\n * @return 最小値と最大値の範囲に収めた値\n */\n static range(value: number, min: number, max: number): number {\n if (value < min) {\n value = min;\n } else if (value > max) {\n value = max;\n }\n\n return value;\n }\n\n /**\n * サイン関数の値を求める\n *\n * @param x 角度値(ラジアン)\n * @return サイン関数sin(x)の値\n */\n static sin(x: number): number {\n return Math.sin(x);\n }\n\n /**\n * コサイン関数の値を求める\n *\n * @param x 角度値(ラジアン)\n * @return コサイン関数cos(x)の値\n */\n static cos(x: number): number {\n return Math.cos(x);\n }\n\n /**\n * 値の絶対値を求める\n *\n * @param x 絶対値を求める値\n * @return 値の絶対値\n */\n static abs(x: number): number {\n return Math.abs(x);\n }\n\n /**\n * 平方根(ルート)を求める\n * @param x -> 平方根を求める値\n * @return 値の平方根\n */\n static sqrt(x: number): number {\n return Math.sqrt(x);\n }\n\n /**\n * 立方根を求める\n * @param x -> 立方根を求める値\n * @return 値の立方根\n */\n static cbrt(x: number): number {\n if (x === 0) {\n return x;\n }\n\n let cx: number = x;\n const isNegativeNumber: boolean = cx < 0;\n\n if (isNegativeNumber) {\n cx = -cx;\n }\n\n let ret: number;\n if (cx === Infinity) {\n ret = Infinity;\n } else {\n ret = Math.exp(Math.log(cx) / 3);\n ret = (cx / (ret * ret) + 2 * ret) / 3;\n }\n return isNegativeNumber ? -ret : ret;\n }\n\n /**\n * イージング処理されたサインを求める\n * フェードイン・アウト時のイージングに利用できる\n *\n * @param value イージングを行う値\n * @return イージング処理されたサイン値\n */\n static getEasingSine(value: number): number {\n if (value < 0.0) {\n return 0.0;\n } else if (value > 1.0) {\n return 1.0;\n }\n\n return 0.5 - 0.5 * this.cos(value * Math.PI);\n }\n\n /**\n * 大きい方の値を返す\n *\n * @param left 左辺の値\n * @param right 右辺の値\n * @return 大きい方の値\n */\n static max(left: number, right: number): number {\n return left > right ? left : right;\n }\n\n /**\n * 小さい方の値を返す\n *\n * @param left 左辺の値\n * @param right 右辺の値\n * @return 小さい方の値\n */\n static min(left: number, right: number): number {\n return left > right ? right : left;\n }\n\n public static clamp(val: number, min: number, max: number): number {\n if (val < min) {\n return min;\n } else if (max < val) {\n return max;\n }\n return val;\n }\n\n /**\n * 角度値をラジアン値に変換する\n *\n * @param degrees 角度値\n * @return 角度値から変換したラジアン値\n */\n static degreesToRadian(degrees: number): number {\n return (degrees / 180.0) * Math.PI;\n }\n\n /**\n * ラジアン値を角度値に変換する\n *\n * @param radian ラジアン値\n * @return ラジアン値から変換した角度値\n */\n static radianToDegrees(radian: number): number {\n return (radian * 180.0) / Math.PI;\n }\n\n /**\n * 2つのベクトルからラジアン値を求める\n *\n * @param from 始点ベクトル\n * @param to 終点ベクトル\n * @return ラジアン値から求めた方向ベクトル\n */\n static directionToRadian(from: CubismVector2, to: CubismVector2): number {\n const q1: number = Math.atan2(to.y, to.x);\n const q2: number = Math.atan2(from.y, from.x);\n\n let ret: number = q1 - q2;\n\n while (ret < -Math.PI) {\n ret += Math.PI * 2.0;\n }\n\n while (ret > Math.PI) {\n ret -= Math.PI * 2.0;\n }\n\n return ret;\n }\n\n /**\n * 2つのベクトルから角度値を求める\n *\n * @param from 始点ベクトル\n * @param to 終点ベクトル\n * @return 角度値から求めた方向ベクトル\n */\n static directionToDegrees(from: CubismVector2, to: CubismVector2): number {\n const radian: number = this.directionToRadian(from, to);\n let degree: number = this.radianToDegrees(radian);\n\n if (to.x - from.x > 0.0) {\n degree = -degree;\n }\n\n return degree;\n }\n\n /**\n * ラジアン値を方向ベクトルに変換する。\n *\n * @param totalAngle ラジアン値\n * @return ラジアン値から変換した方向ベクトル\n */\n\n static radianToDirection(totalAngle: number): CubismVector2 {\n const ret: CubismVector2 = new CubismVector2();\n\n ret.x = this.sin(totalAngle);\n ret.y = this.cos(totalAngle);\n\n return ret;\n }\n\n /**\n * 三次方程式の三次項の係数が0になったときに補欠的に二次方程式の解をもとめる。\n * a * x^2 + b * x + c = 0\n *\n * @param a -> 二次項の係数値\n * @param b -> 一次項の係数値\n * @param c -> 定数項の値\n * @return 二次方程式の解\n */\n static quadraticEquation(a: number, b: number, c: number): number {\n if (this.abs(a) < CubismMath.Epsilon) {\n if (this.abs(b) < CubismMath.Epsilon) {\n return -c;\n }\n return -c / b;\n }\n\n return -(b + this.sqrt(b * b - 4.0 * a * c)) / (2.0 * a);\n }\n\n /**\n * カルダノの公式によってベジェのt値に該当する3次方程式の解を求める。\n * 重解になったときには0.0~1.0の値になる解を返す。\n *\n * a * x^3 + b * x^2 + c * x + d = 0\n *\n * @param a -> 三次項の係数値\n * @param b -> 二次項の係数値\n * @param c -> 一次項の係数値\n * @param d -> 定数項の値\n * @return 0.0~1.0の間にある解\n */\n static cardanoAlgorithmForBezier(\n a: number,\n b: number,\n c: number,\n d: number\n ): number {\n if (this.abs(a) < CubismMath.Epsilon) {\n return this.range(this.quadraticEquation(b, c, d), 0.0, 1.0);\n }\n\n const ba: number = b / a;\n const ca: number = c / a;\n const da: number = d / a;\n\n const p: number = (3.0 * ca - ba * ba) / 3.0;\n const p3: number = p / 3.0;\n const q: number = (2.0 * ba * ba * ba - 9.0 * ba * ca + 27.0 * da) / 27.0;\n const q2: number = q / 2.0;\n const discriminant: number = q2 * q2 + p3 * p3 * p3;\n\n const center = 0.5;\n const threshold: number = center + 0.01;\n\n if (discriminant < 0.0) {\n const mp3: number = -p / 3.0;\n const mp33: number = mp3 * mp3 * mp3;\n const r: number = this.sqrt(mp33);\n const t: number = -q / (2.0 * r);\n const cosphi: number = this.range(t, -1.0, 1.0);\n const phi: number = Math.acos(cosphi);\n const crtr: number = this.cbrt(r);\n const t1: number = 2.0 * crtr;\n\n const root1: number = t1 * this.cos(phi / 3.0) - ba / 3.0;\n if (this.abs(root1 - center) < threshold) {\n return this.range(root1, 0.0, 1.0);\n }\n\n const root2: number =\n t1 * this.cos((phi + 2.0 * Math.PI) / 3.0) - ba / 3.0;\n if (this.abs(root2 - center) < threshold) {\n return this.range(root2, 0.0, 1.0);\n }\n\n const root3: number =\n t1 * this.cos((phi + 4.0 * Math.PI) / 3.0) - ba / 3.0;\n return this.range(root3, 0.0, 1.0);\n }\n\n if (discriminant == 0.0) {\n let u1: number;\n if (q2 < 0.0) {\n u1 = this.cbrt(-q2);\n } else {\n u1 = -this.cbrt(q2);\n }\n\n const root1: number = 2.0 * u1 - ba / 3.0;\n if (this.abs(root1 - center) < threshold) {\n return this.range(root1, 0.0, 1.0);\n }\n\n const root2: number = -u1 - ba / 3.0;\n return this.range(root2, 0.0, 1.0);\n }\n\n const sd: number = this.sqrt(discriminant);\n const u1: number = this.cbrt(sd - q2);\n const v1: number = this.cbrt(sd + q2);\n const root1: number = u1 - v1 - ba / 3.0;\n return this.range(root1, 0.0, 1.0);\n }\n\n /**\n * 浮動小数点の余りを求める。\n *\n * @param dividend 被除数(割られる値)\n * @param divisor 除数(割る値)\n * @return 余り\n */\n static mod(dividend: number, divisor: number): number {\n if (\n !isFinite(dividend) ||\n divisor === 0 ||\n isNaN(dividend) ||\n isNaN(divisor)\n ) {\n console.warn(\n `divided: ${dividend}, divisor: ${divisor} mod() returns 'NaN'.`\n );\n return NaN;\n }\n\n // 絶対値に変換する。\n const absDividend = Math.abs(dividend);\n const absDivisor = Math.abs(divisor);\n\n // 絶対値で割り算する。\n let result =\n absDividend - Math.floor(absDividend / absDivisor) * absDivisor;\n\n // 符号を被除数のものに指定する。\n result *= Math.sign(dividend);\n return result;\n }\n\n /**\n * コンストラクタ\n */\n private constructor() {}\n}\n\n// Namespace definition for compatibility.\nimport * as $ from './cubismmath';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const CubismMath = $.CubismMath;\n export type CubismMath = $.CubismMath;\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport { CubismMath } from './cubismmath';\n\n/**\n * 4x4の行列\n *\n * 4x4行列の便利クラス。\n */\nexport class CubismMatrix44 {\n /**\n * コンストラクタ\n */\n public constructor() {\n this._tr = new Float32Array(16); // 4 * 4のサイズ\n this.loadIdentity();\n }\n\n /**\n * 受け取った2つの行列の乗算を行う。\n *\n * @param a 行列a\n * @param b 行列b\n *\n * @return 乗算結果の行列\n */\n public static multiply(\n a: Float32Array,\n b: Float32Array,\n dst: Float32Array\n ): void {\n const c: Float32Array = new Float32Array([\n 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,\n 0.0\n ]);\n\n const n = 4;\n\n for (let i = 0; i < n; ++i) {\n for (let j = 0; j < n; ++j) {\n for (let k = 0; k < n; ++k) {\n c[j + i * 4] += a[k + i * 4] * b[j + k * 4];\n }\n }\n }\n\n for (let i = 0; i < 16; ++i) {\n dst[i] = c[i];\n }\n }\n\n /**\n * 単位行列に初期化する\n */\n public loadIdentity(): void {\n const c: Float32Array = new Float32Array([\n 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0,\n 1.0\n ]);\n\n this.setMatrix(c);\n }\n\n /**\n * 行列を設定\n *\n * @param tr 16個の浮動小数点数で表される4x4の行列\n */\n public setMatrix(tr: Float32Array): void {\n for (let i = 0; i < 16; ++i) {\n this._tr[i] = tr[i];\n }\n }\n\n /**\n * 行列を浮動小数点数の配列で取得\n *\n * @return 16個の浮動小数点数で表される4x4の行列\n */\n public getArray(): Float32Array {\n return this._tr;\n }\n\n /**\n * X軸の拡大率を取得\n *\n * @return X軸の拡大率\n */\n public getScaleX(): number {\n return this._tr[0];\n }\n\n /**\n * Y軸の拡大率を取得する\n *\n * @return Y軸の拡大率\n */\n public getScaleY(): number {\n return this._tr[5];\n }\n\n /**\n * X軸の移動量を取得\n *\n * @return X軸の移動量\n */\n public getTranslateX(): number {\n return this._tr[12];\n }\n\n /**\n * Y軸の移動量を取得\n *\n * @return Y軸の移動量\n */\n public getTranslateY(): number {\n return this._tr[13];\n }\n\n /**\n * X軸の値を現在の行列で計算\n *\n * @param src X軸の値\n *\n * @return 現在の行列で計算されたX軸の値\n */\n public transformX(src: number): number {\n return this._tr[0] * src + this._tr[12];\n }\n\n /**\n * Y軸の値を現在の行列で計算\n *\n * @param src Y軸の値\n *\n * @return 現在の行列で計算されたY軸の値\n */\n public transformY(src: number): number {\n return this._tr[5] * src + this._tr[13];\n }\n\n /**\n * X軸の値を現在の行列で逆計算\n */\n public invertTransformX(src: number): number {\n return (src - this._tr[12]) / this._tr[0];\n }\n\n /**\n * Y軸の値を現在の行列で逆計算\n */\n public invertTransformY(src: number): number {\n return (src - this._tr[13]) / this._tr[5];\n }\n\n /**\n * 現在の行列の位置を起点にして移動\n *\n * 現在の行列の位置を起点にして相対的に移動する。\n *\n * @param x X軸の移動量\n * @param y Y軸の移動量\n */\n public translateRelative(x: number, y: number): void {\n const tr1: Float32Array = new Float32Array([\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.0,\n 0.0,\n x,\n y,\n 0.0,\n 1.0\n ]);\n\n CubismMatrix44.multiply(tr1, this._tr, this._tr);\n }\n\n /**\n * 現在の行列の位置を移動\n *\n * 現在の行列の位置を指定した位置へ移動する\n *\n * @param x X軸の移動量\n * @param y y軸の移動量\n */\n public translate(x: number, y: number): void {\n this._tr[12] = x;\n this._tr[13] = y;\n }\n\n /**\n * 現在の行列のX軸の位置を指定した位置へ移動する\n *\n * @param x X軸の移動量\n */\n public translateX(x: number): void {\n this._tr[12] = x;\n }\n\n /**\n * 現在の行列のY軸の位置を指定した位置へ移動する\n *\n * @param y Y軸の移動量\n */\n public translateY(y: number): void {\n this._tr[13] = y;\n }\n\n /**\n * 現在の行列の拡大率を相対的に設定する\n *\n * @param x X軸の拡大率\n * @param y Y軸の拡大率\n */\n public scaleRelative(x: number, y: number): void {\n const tr1: Float32Array = new Float32Array([\n x,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n y,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1.0\n ]);\n\n CubismMatrix44.multiply(tr1, this._tr, this._tr);\n }\n\n /**\n * 現在の行列の拡大率を指定した倍率に設定する\n *\n * @param x X軸の拡大率\n * @param y Y軸の拡大率\n */\n public scale(x: number, y: number): void {\n this._tr[0] = x;\n this._tr[5] = y;\n }\n\n /**\n * 引数で与えられた行列にこの行列を乗算する。\n * (引数で与えられた行列) * (この行列)\n *\n * @note 関数名と実際の計算内容に乖離があるため、今後計算順が修正される可能性があります。\n * @param m 行列\n */\n public multiplyByMatrix(m: CubismMatrix44): void {\n CubismMatrix44.multiply(m.getArray(), this._tr, this._tr);\n }\n\n /**\n * 現在の行列の逆行列を求める。\n *\n * @return 現在の行列で計算された逆行列の値を返す\n */\n public getInvert(): CubismMatrix44 {\n const r00 = this._tr[0];\n const r10 = this._tr[1];\n const r20 = this._tr[2];\n const r01 = this._tr[4];\n const r11 = this._tr[5];\n const r21 = this._tr[6];\n const r02 = this._tr[8];\n const r12 = this._tr[9];\n const r22 = this._tr[10];\n\n const tx = this._tr[12];\n const ty = this._tr[13];\n const tz = this._tr[14];\n\n const det =\n r00 * (r11 * r22 - r12 * r21) -\n r01 * (r10 * r22 - r12 * r20) +\n r02 * (r10 * r21 - r11 * r20);\n\n const dst = new CubismMatrix44();\n\n if (CubismMath.abs(det) < CubismMath.Epsilon) {\n dst.loadIdentity();\n return dst;\n }\n\n const invDet = 1.0 / det;\n\n const inv00 = (r11 * r22 - r12 * r21) * invDet;\n const inv01 = -(r01 * r22 - r02 * r21) * invDet;\n const inv02 = (r01 * r12 - r02 * r11) * invDet;\n const inv10 = -(r10 * r22 - r12 * r20) * invDet;\n const inv11 = (r00 * r22 - r02 * r20) * invDet;\n const inv12 = -(r00 * r12 - r02 * r10) * invDet;\n const inv20 = (r10 * r21 - r11 * r20) * invDet;\n const inv21 = -(r00 * r21 - r01 * r20) * invDet;\n const inv22 = (r00 * r11 - r01 * r10) * invDet;\n\n dst._tr[0] = inv00;\n dst._tr[1] = inv10;\n dst._tr[2] = inv20;\n dst._tr[3] = 0.0;\n dst._tr[4] = inv01;\n dst._tr[5] = inv11;\n dst._tr[6] = inv21;\n dst._tr[7] = 0.0;\n dst._tr[8] = inv02;\n dst._tr[9] = inv12;\n dst._tr[10] = inv22;\n dst._tr[11] = 0.0;\n\n dst._tr[12] = -(inv00 * tx + inv01 * ty + inv02 * tz);\n dst._tr[13] = -(inv10 * tx + inv11 * ty + inv12 * tz);\n dst._tr[14] = -(inv20 * tx + inv21 * ty + inv22 * tz);\n dst._tr[15] = 1.0;\n\n return dst;\n }\n\n /**\n * オブジェクトのコピーを生成する\n */\n public clone(): CubismMatrix44 {\n const cloneMatrix: CubismMatrix44 = new CubismMatrix44();\n\n for (let i = 0; i < this._tr.length; i++) {\n cloneMatrix._tr[i] = this._tr[i];\n }\n\n return cloneMatrix;\n }\n\n protected _tr: Float32Array; // 4x4行列データ\n}\n\n// Namespace definition for compatibility.\nimport * as $ from './cubismmatrix44';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const CubismMatrix44 = $.CubismMatrix44;\n export type CubismMatrix44 = $.CubismMatrix44;\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\n/**\n * 矩形形状(座標・長さはfloat値)を定義するクラス\n */\nexport class csmRect {\n /**\n * コンストラクタ\n * @param x 左端X座標\n * @param y 上端Y座標\n * @param w 幅\n * @param h 高さ\n */\n public constructor(x?: number, y?: number, w?: number, h?: number) {\n this.x = x;\n this.y = y;\n this.width = w;\n this.height = h;\n }\n\n /**\n * 矩形中央のX座標を取得する\n */\n public getCenterX(): number {\n return this.x + 0.5 * this.width;\n }\n\n /**\n * 矩形中央のY座標を取得する\n */\n public getCenterY(): number {\n return this.y + 0.5 * this.height;\n }\n\n /**\n * 右側のX座標を取得する\n */\n public getRight(): number {\n return this.x + this.width;\n }\n\n /**\n * 下端のY座標を取得する\n */\n public getBottom(): number {\n return this.y + this.height;\n }\n\n /**\n * 矩形に値をセットする\n * @param r 矩形のインスタンス\n */\n public setRect(r: csmRect): void {\n this.x = r.x;\n this.y = r.y;\n this.width = r.width;\n this.height = r.height;\n }\n\n /**\n * 矩形中央を軸にして縦横を拡縮する\n * @param w 幅方向に拡縮する量\n * @param h 高さ方向に拡縮する量\n */\n public expand(w: number, h: number) {\n this.x -= w;\n this.y -= h;\n this.width += w * 2.0;\n this.height += h * 2.0;\n }\n\n public x: number; // 左端X座標\n public y: number; // 上端Y座標\n public width: number; // 幅\n public height: number; // 高さ\n}\n\n// Namespace definition for compatibility.\nimport * as $ from './csmrectf';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const csmRect = $.csmRect;\n export type csmRect = $.csmRect;\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\n//========================================================\n// ログ出力関数の設定\n//========================================================\n\n//---------- ログ出力レベル 選択項目 定義 ----------\n// 詳細ログ出力設定\nexport const CSM_LOG_LEVEL_VERBOSE = 0;\n// デバッグログ出力設定\nexport const CSM_LOG_LEVEL_DEBUG = 1;\n// Infoログ出力設定\nexport const CSM_LOG_LEVEL_INFO = 2;\n// 警告ログ出力設定\nexport const CSM_LOG_LEVEL_WARNING = 3;\n// エラーログ出力設定\nexport const CSM_LOG_LEVEL_ERROR = 4;\n// ログ出力オフ設定\nexport const CSM_LOG_LEVEL_OFF = 5;\n\n/**\n * ログ出力レベル設定。\n *\n * 強制的にログ出力レベルを変える時に定義を有効にする。\n * CSM_LOG_LEVEL_VERBOSE ~ CSM_LOG_LEVEL_OFF を選択する。\n */\nexport const CSM_LOG_LEVEL: number = CSM_LOG_LEVEL_VERBOSE;\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport {\n CSM_LOG_LEVEL,\n CSM_LOG_LEVEL_DEBUG,\n CSM_LOG_LEVEL_ERROR,\n CSM_LOG_LEVEL_INFO,\n CSM_LOG_LEVEL_VERBOSE,\n CSM_LOG_LEVEL_WARNING\n} from '../cubismframeworkconfig';\nimport { CubismFramework, LogLevel } from '../live2dcubismframework';\n\nexport const CubismLogPrint = (level: LogLevel, fmt: string, args: any[]) => {\n CubismDebug.print(level, '[CSM]' + fmt, args);\n};\n\nexport const CubismLogPrintIn = (level: LogLevel, fmt: string, args: any[]) => {\n CubismLogPrint(level, fmt + '\\n', args);\n};\n\nexport const CSM_ASSERT = (expr: any) => {\n console.assert(expr);\n};\n\nexport let CubismLogVerbose: (fmt: string, ...args: any[]) => void;\nexport let CubismLogDebug: (fmt: string, ...args: any[]) => void;\nexport let CubismLogInfo: (fmt: string, ...args: any[]) => void;\nexport let CubismLogWarning: (fmt: string, ...args: any[]) => void;\nexport let CubismLogError: (fmt: string, ...args: any[]) => void;\n\nif (CSM_LOG_LEVEL <= CSM_LOG_LEVEL_VERBOSE) {\n CubismLogVerbose = (fmt: string, ...args: any[]) => {\n CubismLogPrintIn(LogLevel.LogLevel_Verbose, '[V]' + fmt, args);\n };\n\n CubismLogDebug = (fmt: string, ...args: any[]) => {\n CubismLogPrintIn(LogLevel.LogLevel_Debug, '[D]' + fmt, args);\n };\n\n CubismLogInfo = (fmt: string, ...args: any[]) => {\n CubismLogPrintIn(LogLevel.LogLevel_Info, '[I]' + fmt, args);\n };\n\n CubismLogWarning = (fmt: string, ...args: any[]) => {\n CubismLogPrintIn(LogLevel.LogLevel_Warning, '[W]' + fmt, args);\n };\n\n CubismLogError = (fmt: string, ...args: any[]) => {\n CubismLogPrintIn(LogLevel.LogLevel_Error, '[E]' + fmt, args);\n };\n} else if (CSM_LOG_LEVEL == CSM_LOG_LEVEL_DEBUG) {\n CubismLogDebug = (fmt: string, ...args: any[]) => {\n CubismLogPrintIn(LogLevel.LogLevel_Debug, '[D]' + fmt, args);\n };\n\n CubismLogInfo = (fmt: string, ...args: any[]) => {\n CubismLogPrintIn(LogLevel.LogLevel_Info, '[I]' + fmt, args);\n };\n\n CubismLogWarning = (fmt: string, ...args: any[]) => {\n CubismLogPrintIn(LogLevel.LogLevel_Warning, '[W]' + fmt, args);\n };\n\n CubismLogError = (fmt: string, ...args: any[]) => {\n CubismLogPrintIn(LogLevel.LogLevel_Error, '[E]' + fmt, args);\n };\n} else if (CSM_LOG_LEVEL == CSM_LOG_LEVEL_INFO) {\n CubismLogInfo = (fmt: string, ...args: any[]) => {\n CubismLogPrintIn(LogLevel.LogLevel_Info, '[I]' + fmt, args);\n };\n\n CubismLogWarning = (fmt: string, ...args: any[]) => {\n CubismLogPrintIn(LogLevel.LogLevel_Warning, '[W]' + fmt, args);\n };\n\n CubismLogError = (fmt: string, ...args: any[]) => {\n CubismLogPrintIn(LogLevel.LogLevel_Error, '[E]' + fmt, args);\n };\n} else if (CSM_LOG_LEVEL == CSM_LOG_LEVEL_WARNING) {\n CubismLogWarning = (fmt: string, ...args: any[]) => {\n CubismLogPrintIn(LogLevel.LogLevel_Warning, '[W]' + fmt, args);\n };\n\n CubismLogError = (fmt: string, ...args: any[]) => {\n CubismLogPrintIn(LogLevel.LogLevel_Error, '[E]' + fmt, args);\n };\n} else if (CSM_LOG_LEVEL == CSM_LOG_LEVEL_ERROR) {\n CubismLogError = (fmt: string, ...args: any[]) => {\n CubismLogPrintIn(LogLevel.LogLevel_Error, '[E]' + fmt, args);\n };\n}\n\n/**\n * デバッグ用のユーティリティクラス。\n * ログの出力、バイトのダンプなど\n */\nexport class CubismDebug {\n /**\n * ログを出力する。第一引数にログレベルを設定する。\n * CubismFramework.initialize()時にオプションで設定されたログ出力レベルを下回る場合はログに出さない。\n *\n * @param logLevel ログレベルの設定\n * @param format 書式付き文字列\n * @param args 可変長引数\n */\n public static print(logLevel: LogLevel, format: string, args?: any[]): void {\n // オプションで設定されたログ出力レベルを下回る場合はログに出さない\n if (logLevel < CubismFramework.getLoggingLevel()) {\n return;\n }\n\n const logPrint: Live2DCubismCore.csmLogFunction =\n CubismFramework.coreLogFunction;\n\n if (!logPrint) return;\n\n const buffer: string = format.replace(/\\{(\\d+)\\}/g, (m, k) => {\n return args[k];\n });\n logPrint(buffer);\n }\n\n /**\n * データから指定した長さだけダンプ出力する。\n * CubismFramework.initialize()時にオプションで設定されたログ出力レベルを下回る場合はログに出さない。\n *\n * @param logLevel ログレベルの設定\n * @param data ダンプするデータ\n * @param length ダンプする長さ\n */\n public static dumpBytes(\n logLevel: LogLevel,\n data: Uint8Array,\n length: number\n ): void {\n for (let i = 0; i < length; i++) {\n if (i % 16 == 0 && i > 0) this.print(logLevel, '\\n');\n else if (i % 8 == 0 && i > 0) this.print(logLevel, ' ');\n this.print(logLevel, '{0} ', [data[i] & 0xff]);\n }\n\n this.print(logLevel, '\\n');\n }\n\n /**\n * private コンストラクタ\n */\n private constructor() {}\n}\n\n// Namespace definition for compatibility.\nimport * as $ from './cubismdebug';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const CubismDebug = $.CubismDebug;\n export type CubismDebug = $.CubismDebug;\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport { CubismMath } from '../math/cubismmath';\nimport { CubismMatrix44 } from '../math/cubismmatrix44';\nimport { CubismModel } from '../model/cubismmodel';\nimport { csmRect } from '../type/csmrectf';\nimport { ICubismClippingManager } from './cubismclippingmanager';\nimport { CubismLogInfo } from '../utils/cubismdebug';\n\n/**\n * モデル描画を処理するレンダラ\n *\n * サブクラスに環境依存の描画命令を記述する。\n */\nexport abstract class CubismRenderer {\n /**\n * レンダラのインスタンスを生成して取得する\n *\n * @return レンダラのインスタンス\n */\n public static create(): CubismRenderer {\n return null;\n }\n\n /**\n * レンダラのインスタンスを解放する\n */\n public static delete(renderer: CubismRenderer): void {\n renderer = null;\n }\n\n /**\n * レンダラの初期化処理を実行する\n * 引数に渡したモデルからレンダラの初期化処理に必要な情報を取り出すことができる\n *\n * @param model モデルのインスタンス\n */\n public initialize(model: CubismModel): void {\n this._model = model;\n\n // ブレンドモード使用時は必ず高精細にする\n if (model.isBlendModeEnabled()) {\n this.useHighPrecisionMask(true);\n CubismLogInfo(\n 'This model uses a high-resolution mask because it operates in blend mode.'\n );\n }\n }\n\n /**\n * モデルを描画する\n * @param shaderPath ブレンドモード用シェーダのパス\n */\n public drawModel(shaderPath: string = null): void {\n if (this.getModel() == null) return;\n\n // NOTE: WebGL最適化のため、デフォルトではコメントアウト\n //this.saveProfile();\n\n this.doDrawModel(shaderPath);\n\n // NOTE: WebGL最適化のため、デフォルトではコメントアウト\n //this.restoreProfile();\n }\n\n /**\n * Model-View-Projection 行列をセットする\n * 配列は複製されるので、元の配列は外で破棄して良い\n *\n * @param matrix44 Model-View-Projection 行列\n */\n public setMvpMatrix(matrix44: CubismMatrix44): void {\n this._mvpMatrix4x4.setMatrix(matrix44.getArray());\n }\n\n /**\n * Model-View-Projection 行列を取得する\n *\n * @return Model-View-Projection 行列\n */\n public getMvpMatrix(): CubismMatrix44 {\n return this._mvpMatrix4x4;\n }\n\n /**\n * モデルの色をセットする\n * 各色0.0~1.0の間で指定する(1.0が標準の状態)\n *\n * @param red 赤チャンネルの値\n * @param green 緑チャンネルの値\n * @param blue 青チャンネルの値\n * @param alpha αチャンネルの値\n */\n public setModelColor(\n red: number,\n green: number,\n blue: number,\n alpha: number\n ): void {\n this._modelColor.r = CubismMath.clamp(red, 0.0, 1.0);\n this._modelColor.g = CubismMath.clamp(green, 0.0, 1.0);\n this._modelColor.b = CubismMath.clamp(blue, 0.0, 1.0);\n this._modelColor.a = CubismMath.clamp(alpha, 0.0, 1.0);\n }\n\n /**\n * モデルの色を取得する\n * 各色0.0~1.0の間で指定する(1.0が標準の状態)\n *\n * @return RGBAのカラー情報\n */\n public getModelColor(): CubismTextureColor {\n return JSON.parse(JSON.stringify(this._modelColor));\n }\n\n /**\n * 透明度を考慮したモデルの色を計算する。\n *\n * @param opacity 透明度\n *\n * @return RGBAのカラー情報\n */\n getModelColorWithOpacity(opacity: number): CubismTextureColor {\n const modelColorRGBA: CubismTextureColor = this.getModelColor();\n modelColorRGBA.a *= opacity;\n if (this.isPremultipliedAlpha()) {\n modelColorRGBA.r *= modelColorRGBA.a;\n modelColorRGBA.g *= modelColorRGBA.a;\n modelColorRGBA.b *= modelColorRGBA.a;\n }\n return modelColorRGBA;\n }\n\n /**\n * 乗算済みαの有効・無効をセットする\n * 有効にするならtrue、無効にするならfalseをセットする\n */\n public setIsPremultipliedAlpha(enable: boolean): void {\n this._isPremultipliedAlpha = enable;\n }\n\n /**\n * 乗算済みαの有効・無効を取得する\n * @return true 乗算済みのα有効\n * false 乗算済みのα無効\n */\n public isPremultipliedAlpha(): boolean {\n return this._isPremultipliedAlpha;\n }\n\n /**\n * カリング(片面描画)の有効・無効をセットする。\n * 有効にするならtrue、無効にするならfalseをセットする\n */\n public setIsCulling(culling: boolean): void {\n this._isCulling = culling;\n }\n\n /**\n * カリング(片面描画)の有効・無効を取得する。\n *\n * @return true カリング有効\n * false カリング無効\n */\n public isCulling(): boolean {\n return this._isCulling;\n }\n\n /**\n * テクスチャの異方性フィルタリングのパラメータをセットする\n * パラメータ値の影響度はレンダラの実装に依存する\n *\n * @param n パラメータの値\n */\n public setAnisotropy(n: number): void {\n this._anisotropy = n;\n }\n\n /**\n * テクスチャの異方性フィルタリングのパラメータをセットする\n *\n * @return 異方性フィルタリングのパラメータ\n */\n public getAnisotropy(): number {\n return this._anisotropy;\n }\n\n /**\n * レンダリングするモデルを取得する\n *\n * @return レンダリングするモデル\n */\n public getModel(): CubismModel {\n return this._model;\n }\n\n /**\n * マスク描画の方式を変更する。\n * falseの場合、マスクを1枚のテクスチャに分割してレンダリングする(デフォルト)\n * 高速だが、マスク個数の上限が36に限定され、質も荒くなる\n * trueの場合、パーツ描画の前にその都度必要なマスクを描き直す\n * レンダリング品質は高いが描画処理負荷は増す\n *\n * @param high 高精細マスクに切り替えるか?\n */\n public useHighPrecisionMask(high: boolean): void {\n this._useHighPrecisionMask = high;\n }\n\n /**\n * マスクの描画方式を取得する\n *\n * @return true 高精細方式\n * false デフォルト\n */\n public isUsingHighPrecisionMask(): boolean {\n return this._useHighPrecisionMask;\n }\n\n /**\n * モデルを描画したバッファのサイズを設定\n *\n * @param[in] width -> モデルを描画したバッファの幅\n * @param[in] height -> モデルを描画したバッファの高さ\n */\n public setRenderTargetSize(width: number, height: number): void {\n this._modelRenderTargetWidth = width;\n this._modelRenderTargetHeight = height;\n }\n\n /**\n * コンストラクタ\n */\n protected constructor(width: number, height: number) {\n this._modelRenderTargetWidth = width;\n this._modelRenderTargetHeight = height;\n this._isCulling = false;\n this._isPremultipliedAlpha = false;\n this._anisotropy = 0.0;\n this._model = null;\n this._modelColor = new CubismTextureColor();\n this._useHighPrecisionMask = false;\n\n // 単位行列に初期化\n this._mvpMatrix4x4 = new CubismMatrix44();\n this._mvpMatrix4x4.loadIdentity();\n }\n\n /**\n * モデル描画直前のオフスクリーン設定を行う\n */\n public abstract beforeDrawModelRenderTarget(): void;\n\n /**\n * モデル描画直後のオフスクリーン設定を行う\n */\n public abstract afterDrawModelRenderTarget(): void;\n\n /**\n * モデル描画の実装\n * @param shaderPath ブレンドモード用シェーダのパス\n */\n public abstract doDrawModel(shaderPath: string): void;\n\n /**\n * モデル描画直前のレンダラのステートを保持する\n */\n protected abstract saveProfile(): void;\n\n /**\n * モデル描画直前のレンダラのステートを復帰する\n */\n protected abstract restoreProfile(): void;\n\n /**\n * レンダラが保持する静的なリソースを開放する\n */\n public static staticRelease: any;\n\n protected _mvpMatrix4x4: CubismMatrix44; // Model-View-Projection 行列\n protected _modelColor: CubismTextureColor; // モデル自体のカラー(RGBA)\n protected _isCulling: boolean; // カリングが有効ならtrue\n protected _isPremultipliedAlpha: boolean; // 乗算済みαならtrue\n protected _anisotropy: any; // テクスチャの異方性フィルタリングのパラメータ\n protected _model: CubismModel; // レンダリング対象のモデル\n protected _useHighPrecisionMask: boolean; // falseの場合、マスクを纏めて描画する trueの場合、マスクはパーツ描画ごとに書き直す\n\n protected _modelRenderTargetWidth: number;\n protected _modelRenderTargetHeight: number;\n}\n\nexport enum CubismBlendMode {\n CubismBlendMode_Normal = 0, // 通常\n CubismBlendMode_Additive = 1, // 加算\n CubismBlendMode_Multiplicative = 2 // 乗算\n}\n\n/**\n * オブジェクトのタイプ\n */\nexport enum DrawableObjectType {\n DrawableObjectType_Drawable = 0,\n DrawableObjectType_Offscreen = 1\n}\n\n/**\n * テクスチャの色をRGBAで扱うためのクラス\n */\nexport class CubismTextureColor {\n /**\n * コンストラクタ\n */\n constructor(r = 1.0, g = 1.0, b = 1.0, a = 1.0) {\n this.r = r;\n this.g = g;\n this.b = b;\n this.a = a;\n }\n\n r: number; // 赤チャンネル\n g: number; // 緑チャンネル\n b: number; // 青チャンネル\n a: number; // αチャンネル\n}\n\n/**\n * クリッピングマスクのコンテキスト\n */\nexport abstract class CubismClippingContext {\n /**\n * 引数付きコンストラクタ\n */\n public constructor(clippingDrawableIndices: Int32Array, clipCount: number) {\n // クリップしている(=マスク用の)Drawableのインデックスリスト\n this._clippingIdList = clippingDrawableIndices;\n\n // マスクの数\n this._clippingIdCount = clipCount;\n\n this._allClippedDrawRect = new csmRect();\n this._layoutBounds = new csmRect();\n\n this._clippedDrawableIndexList = [];\n this._clippedOffscreenIndexList = [];\n\n this._matrixForMask = new CubismMatrix44();\n this._matrixForDraw = new CubismMatrix44();\n\n this._bufferIndex = 0;\n this._layoutChannelIndex = 0;\n }\n\n /**\n * このマスクを管理するマネージャのインスタンスを取得する\n * @return クリッピングマネージャのインスタンス\n */\n public abstract getClippingManager(): ICubismClippingManager;\n\n /**\n * デストラクタ相当の処理\n */\n public release(): void {\n if (this._layoutBounds != null) {\n this._layoutBounds = null;\n }\n\n if (this._allClippedDrawRect != null) {\n this._allClippedDrawRect = null;\n }\n\n if (this._clippedDrawableIndexList != null) {\n this._clippedDrawableIndexList = null;\n }\n if (this._clippedOffscreenIndexList != null) {\n this._clippedOffscreenIndexList = null;\n }\n }\n\n /**\n * このマスクにクリップされる描画オブジェクトを追加する\n *\n * @param drawableIndex クリッピング対象に追加する描画オブジェクトのインデックス\n */\n public addClippedDrawable(drawableIndex: number) {\n this._clippedDrawableIndexList.push(drawableIndex);\n }\n\n /**\n * このマスクにクリップされるオフスクリーンオブジェクトを追加する\n *\n * @param offscreenIndex クリッピング対象に追加するオフスクリーンオブジェクトのインデックス\n */\n public addClippedOffscreen(offscreenIndex: number) {\n this._clippedOffscreenIndexList.push(offscreenIndex);\n }\n\n public _isUsing: boolean; // 現在の描画状態でマスクの準備が必要ならtrue\n public readonly _clippingIdList: Int32Array; // クリッピングマスクのIDリスト\n public _clippingIdCount: number; // クリッピングマスクの数\n public _layoutChannelIndex: number; // RGBAのいずれのチャンネルにこのクリップを配置するか(0:R, 1:G, 2:B, 3:A)\n public _layoutBounds: csmRect; // マスク用チャンネルのどの領域にマスクを入れるか(View座標-1~1, UVは0~1に直す)\n public _allClippedDrawRect: csmRect; // このクリッピングで、クリッピングされるすべての描画オブジェクトの囲み矩形(毎回更新)\n public _matrixForMask: CubismMatrix44; // マスクの位置計算結果を保持する行列\n public _matrixForDraw: CubismMatrix44; // 描画オブジェクトの位置計算結果を保持する行列\n public _clippedDrawableIndexList: number[]; // このマスクにクリップされる描画オブジェクトのリスト\n public _clippedOffscreenIndexList: number[]; // このマスクにクリップされるオフスクリーンオブジェクトのリスト\n public _bufferIndex: number; // このマスクが割り当てられるレンダーテクスチャ(フレームバッファ)やカラーバッファのインデックス\n}\n\n// Namespace definition for compatibility.\nimport * as $ from './cubismrenderer';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const CubismBlendMode = $.CubismBlendMode;\n export type CubismBlendMode = $.CubismBlendMode;\n export const CubismRenderer = $.CubismRenderer;\n export type CubismRenderer = $.CubismRenderer;\n export const CubismTextureColor = $.CubismTextureColor;\n export type CubismTextureColor = $.CubismTextureColor;\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport {\n JsonArray,\n JsonBoolean,\n JsonFloat,\n JsonMap,\n JsonNullvalue,\n JsonString,\n Value\n} from './cubismjson';\n\n/**\n * CubismJsonで実装されているJsonパーサを使用せず、\n * TypeScript標準のJsonパーサなどを使用し出力された結果を\n * Cubism SDKで定義されているJSONエレメントの要素に\n * 置き換える処理をするクラス。\n */\nexport class CubismJsonExtension {\n static parseJsonObject(obj: Value, map: JsonMap) {\n Object.keys(obj).forEach(key => {\n if (typeof obj[key] == 'boolean') {\n const convValue = Boolean(obj[key]);\n map.put(key, new JsonBoolean(convValue));\n } else if (typeof obj[key] == 'string') {\n const convValue = String(obj[key]);\n map.put(key, new JsonString(convValue));\n } else if (typeof obj[key] == 'number') {\n const convValue = Number(obj[key]);\n map.put(key, new JsonFloat(convValue));\n } else if (obj[key] instanceof Array) {\n // HACK: Array 単体で変換できないので unknown に変更してから Value にしている\n map.put(\n key,\n CubismJsonExtension.parseJsonArray(obj[key] as unknown as Value)\n );\n } else if (obj[key] instanceof Object) {\n map.put(\n key,\n CubismJsonExtension.parseJsonObject(obj[key], new JsonMap())\n );\n } else if (obj[key] == null) {\n map.put(key, new JsonNullvalue());\n } else {\n // どれにも当てはまらない場合でも処理する\n map.put(key, obj[key]);\n }\n });\n return map;\n }\n\n protected static parseJsonArray(obj: Value) {\n const arr = new JsonArray();\n Object.keys(obj).forEach(key => {\n const convKey = Number(key);\n if (typeof convKey == 'number') {\n if (typeof obj[key] == 'boolean') {\n const convValue = Boolean(obj[key]);\n arr.add(new JsonBoolean(convValue));\n } else if (typeof obj[key] == 'string') {\n const convValue = String(obj[key]);\n arr.add(new JsonString(convValue));\n } else if (typeof obj[key] == 'number') {\n const convValue = Number(obj[key]);\n arr.add(new JsonFloat(convValue));\n } else if (obj[key] instanceof Array) {\n // HACK: Array 単体で変換できないので unknown に変更してから Value にしている\n arr.add(this.parseJsonArray(obj[key] as unknown as Value));\n } else if (obj[key] instanceof Object) {\n arr.add(this.parseJsonObject(obj[key], new JsonMap()));\n } else if (obj[key] == null) {\n arr.add(new JsonNullvalue());\n } else {\n // どれにも当てはまらない場合でも処理する\n arr.add(obj[key]);\n }\n } else if (obj[key] instanceof Array) {\n // HACK: Array 単体で変換できないので unknown に変更してから Value にしている\n arr.add(this.parseJsonArray(obj[key] as unknown as Value));\n } else if (obj[key] instanceof Object) {\n arr.add(this.parseJsonObject(obj[key], new JsonMap()));\n } else if (obj[key] == null) {\n arr.add(new JsonNullvalue());\n } else {\n const convValue = Array(obj[key]);\n // 配列ともObjectとも判定できなかった場合でも処理する\n for (let i = 0; i < convValue.length; i++) {\n arr.add(convValue[i]);\n }\n }\n });\n return arr;\n }\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport { strtod } from '../live2dcubismframework';\nimport { CubismLogInfo } from './cubismdebug';\n\n// StaticInitializeNotForClientCall()で初期化する\nconst CSM_JSON_ERROR_TYPE_MISMATCH = 'Error: type mismatch';\nconst CSM_JSON_ERROR_INDEX_OF_BOUNDS = 'Error: index out of bounds';\n\n/**\n * パースしたJSONエレメントの要素の基底クラス。\n */\nexport abstract class Value {\n /**\n * コンストラクタ\n */\n public constructor() {}\n\n /**\n * 要素を文字列型で返す(string型)\n */\n public abstract getString(defaultValue?: string, indent?: string): string;\n\n /**\n * 要素を文字列型で返す(string)\n */\n public getRawString(defaultValue?: string, indent?: string): string {\n return this.getString(defaultValue, indent);\n }\n\n /**\n * 要素を数値型で返す(number)\n */\n public toInt(defaultValue = 0): number {\n return defaultValue;\n }\n\n /**\n * 要素を数値型で返す(number)\n */\n public toFloat(defaultValue = 0): number {\n return defaultValue;\n }\n\n /**\n * 要素を真偽値で返す(boolean)\n */\n public toBoolean(defaultValue = false): boolean {\n return defaultValue;\n }\n\n /**\n * サイズを返す\n */\n public getSize(): number {\n return 0;\n }\n\n /**\n * 要素を配列で返す(Value[])\n */\n public getArray(defaultValue: Value[] = null): Value[] {\n return defaultValue;\n }\n\n /**\n * 要素をコンテナで返す(array)\n */\n public getVector(defaultValue = new Array<Value>()): Array<Value> {\n return defaultValue;\n }\n\n /**\n * 要素をマップで返す(Map<String, Value>)\n */\n public getMap(defaultValue?: Map<string, Value>): Map<string, Value> {\n return defaultValue;\n }\n\n /**\n * 添字演算子[index]\n */\n public getValueByIndex(index: number): Value {\n return Value.errorValue.setErrorNotForClientCall(\n CSM_JSON_ERROR_TYPE_MISMATCH\n );\n }\n\n /**\n * 添字演算子[string]\n */\n public getValueByString(s: string): Value {\n return Value.nullValue.setErrorNotForClientCall(\n CSM_JSON_ERROR_TYPE_MISMATCH\n );\n }\n\n /**\n * マップのキー一覧をコンテナで返す\n *\n * @return マップのキーの一覧\n */\n public getKeys(): Array<string> {\n return Value.dummyKeys;\n }\n\n /**\n * Valueの種類がエラー値ならtrue\n */\n public isError(): boolean {\n return false;\n }\n\n /**\n * Valueの種類がnullならtrue\n */\n public isNull(): boolean {\n return false;\n }\n\n /**\n * Valueの種類が真偽値ならtrue\n */\n public isBool(): boolean {\n return false;\n }\n\n /**\n * Valueの種類が数値型ならtrue\n */\n public isFloat(): boolean {\n return false;\n }\n\n /**\n * Valueの種類が文字列ならtrue\n */\n public isString(): boolean {\n return false;\n }\n\n /**\n * Valueの種類が配列ならtrue\n */\n public isArray(): boolean {\n return false;\n }\n\n /**\n * Valueの種類がマップ型ならtrue\n */\n public isMap(): boolean {\n return false;\n }\n\n /**\n * 引数の値と等しければtrue\n */\n public equals(value: string): boolean;\n public equals(value: string): boolean;\n public equals(value: number): boolean;\n public equals(value: boolean): boolean;\n public equals(value: any): boolean {\n return false;\n }\n\n /**\n * Valueの値が静的ならtrue、静的なら解放しない\n */\n public isStatic(): boolean {\n return false;\n }\n\n /**\n * Valueにエラー値をセットする\n */\n public setErrorNotForClientCall(errorStr: string): Value {\n return JsonError.errorValue;\n }\n\n /**\n * 初期化用メソッド\n */\n public static staticInitializeNotForClientCall(): void {\n JsonBoolean.trueValue = new JsonBoolean(true);\n JsonBoolean.falseValue = new JsonBoolean(false);\n Value.errorValue = new JsonError('ERROR', true);\n Value.nullValue = new JsonNullvalue();\n Value.dummyKeys = new Array<string>();\n }\n\n /**\n * リリース用メソッド\n */\n public static staticReleaseNotForClientCall(): void {\n JsonBoolean.trueValue = null;\n JsonBoolean.falseValue = null;\n Value.errorValue = null;\n Value.nullValue = null;\n Value.dummyKeys = null;\n }\n\n protected _stringBuffer: string; // 文字列バッファ\n\n private static dummyKeys: Array<string>; // ダミーキー\n\n public static errorValue: Value; // 一時的な返り値として返すエラー。 CubismFramework::Disposeするまではdeleteしない\n public static nullValue: Value; // 一時的な返り値として返すNULL。 CubismFramework::Disposeするまではdeleteしない\n\n [key: string]: any; // 明示的に連想配列をany型で指定\n}\n\n/**\n * Ascii文字のみ対応した最小限の軽量JSONパーサ。\n * 仕様はJSONのサブセットとなる。\n * 設定ファイル(model3.json)などのロード用\n *\n * [未対応項目]\n * ・日本語などの非ASCII文字\n * ・eによる指数表現\n */\nexport class CubismJson {\n /**\n * コンストラクタ\n */\n public constructor(buffer?: ArrayBuffer, length?: number) {\n this._error = null;\n this._lineCount = 0;\n this._root = null;\n\n if (buffer != undefined) {\n this.parseBytes(buffer, length, this._parseCallback);\n }\n }\n\n /**\n * バイトデータから直接ロードしてパースする\n *\n * @param buffer バッファ\n * @param size バッファサイズ\n * @return CubismJsonクラスのインスタンス。失敗したらNULL\n */\n public static create(buffer: ArrayBuffer, size: number) {\n const json = new CubismJson();\n const succeeded: boolean = json.parseBytes(\n buffer,\n size,\n json._parseCallback\n );\n\n if (!succeeded) {\n CubismJson.delete(json);\n return null;\n } else {\n return json;\n }\n }\n\n /**\n * パースしたJSONオブジェクトの解放処理\n *\n * @param instance CubismJsonクラスのインスタンス\n */\n public static delete(instance: CubismJson) {\n instance = null;\n }\n\n /**\n * パースしたJSONのルート要素を返す\n */\n public getRoot(): Value {\n return this._root;\n }\n\n /**\n * UnicodeのバイナリをStringに変換\n *\n * @param buffer 変換するバイナリデータ\n * @return 変換後の文字列\n */\n public static arrayBufferToString(buffer: ArrayBuffer): string {\n const uint8Array: Uint8Array = new Uint8Array(buffer);\n let str = '';\n\n for (let i = 0, len: number = uint8Array.length; i < len; ++i) {\n str += '%' + this.pad(uint8Array[i].toString(16));\n }\n\n str = decodeURIComponent(str);\n return str;\n }\n\n /**\n * エンコード、パディング\n */\n private static pad(n: string): string {\n return n.length < 2 ? '0' + n : n;\n }\n\n /**\n * JSONのパースを実行する\n * @param buffer パース対象のデータバイト\n * @param size データバイトのサイズ\n * return true : 成功\n * return false: 失敗\n */\n public parseBytes(\n buffer: ArrayBuffer,\n size: number,\n parseCallback?: parseJsonObject\n ): boolean {\n const endPos: number[] = new Array<number>(1); // 参照渡しにするため配列\n const decodeBuffer: string = CubismJson.arrayBufferToString(buffer);\n\n if (parseCallback == undefined) {\n this._root = this.parseValue(decodeBuffer, size, 0, endPos);\n } else {\n // TypeScript標準のJSONパーサを使う\n this._root = parseCallback(JSON.parse(decodeBuffer), new JsonMap());\n }\n\n if (this._error) {\n let strbuf = '\\0';\n strbuf = 'Json parse error : @line ' + (this._lineCount + 1) + '\\n';\n this._root = new JsonString(strbuf);\n\n CubismLogInfo('{0}', this._root.getRawString());\n return false;\n } else if (this._root == null) {\n this._root = new JsonError(this._error, false); // rootは解放されるのでエラーオブジェクトを別途作成する\n return false;\n }\n return true;\n }\n\n /**\n * パース時のエラー値を返す\n */\n public getParseError(): string {\n return this._error;\n }\n\n /**\n * ルート要素の次の要素がファイルの終端だったらtrueを返す\n */\n public checkEndOfFile(): boolean {\n return this._root.getArray()[1].equals('EOF');\n }\n\n /**\n * JSONエレメントからValue(float,String,Value*,Array,null,true,false)をパースする\n * エレメントの書式に応じて内部でParseString(), ParseObject(), ParseArray()を呼ぶ\n *\n * @param buffer JSONエレメントのバッファ\n * @param length パースする長さ\n * @param begin パースを開始する位置\n * @param outEndPos パース終了時の位置\n * @return パースから取得したValueオブジェクト\n */\n protected parseValue(\n buffer: string,\n length: number,\n begin: number,\n outEndPos: number[]\n ) {\n if (this._error) return null;\n\n let o: Value = null;\n let i: number = begin;\n let f: number;\n\n for (; i < length; i++) {\n const c: string = buffer[i];\n switch (c) {\n case '-':\n case '.':\n case '0':\n case '1':\n case '2':\n case '3':\n case '4':\n case '5':\n case '6':\n case '7':\n case '8':\n case '9': {\n const afterString: string[] = new Array(1); // 参照渡しにするため\n f = strtod(buffer.slice(i), afterString);\n outEndPos[0] = buffer.indexOf(afterString[0]);\n return new JsonFloat(f);\n }\n case '\"':\n return new JsonString(\n this.parseString(buffer, length, i + 1, outEndPos)\n ); // \\\"の次の文字から\n case '[':\n o = this.parseArray(buffer, length, i + 1, outEndPos);\n return o;\n case '{':\n o = this.parseObject(buffer, length, i + 1, outEndPos);\n return o;\n case 'n': // null以外にない\n if (i + 3 < length) {\n o = new JsonNullvalue(); // 解放できるようにする\n outEndPos[0] = i + 4;\n } else {\n this._error = 'parse null';\n }\n return o;\n case 't': // true以外にない\n if (i + 3 < length) {\n o = JsonBoolean.trueValue;\n outEndPos[0] = i + 4;\n } else {\n this._error = 'parse true';\n }\n return o;\n case 'f': // false以外にない\n if (i + 4 < length) {\n o = JsonBoolean.falseValue;\n outEndPos[0] = i + 5;\n } else {\n this._error = \"illegal ',' position\";\n }\n return o;\n case ',': // Array separator\n this._error = \"illegal ',' position\";\n return null;\n case ']': // 不正な}だがスキップする。配列の最後に不要な , があると思われる\n outEndPos[0] = i; // 同じ文字を再処理\n return null;\n case '\\n':\n this._lineCount++;\n // falls through\n case ' ':\n case '\\t':\n case '\\r':\n default:\n // スキップ\n break;\n }\n }\n\n this._error = 'illegal end of value';\n return null;\n }\n\n /**\n * 次の「\"」までの文字列をパースする。\n *\n * @param string -> パース対象の文字列\n * @param length -> パースする長さ\n * @param begin -> パースを開始する位置\n * @param outEndPos -> パース終了時の位置\n * @return パースした文F字列要素\n */\n protected parseString(\n string: string,\n length: number,\n begin: number,\n outEndPos: number[]\n ): string {\n if (this._error) {\n return null;\n }\n\n if (!string) {\n this._error = 'string is null';\n return null;\n }\n\n let i = begin;\n let c: string, c2: string;\n let ret: string = '';\n let bufStart: number = begin; // sbufに登録されていない文字の開始位置\n\n for (; i < length; i++) {\n c = string[i];\n\n switch (c) {\n case '\"': {\n // 終端の”、エスケープ文字は別に処理されるのでここに来ない\n outEndPos[0] = i + 1; // ”の次の文字\n ret += string.substr(bufStart, i - bufStart); // 前の文字までを登録する\n return ret;\n }\n // falls through\n case '//': {\n // エスケープの場合\n i++; // 2文字をセットで扱う\n\n if (i - 1 > bufStart) {\n ret += string.substr(bufStart, i - bufStart); // 前の文字までを登録する\n }\n bufStart = i + 1; // エスケープ(2文字)の次の文字から\n\n if (i < length) {\n c2 = string[i];\n\n switch (c2) {\n case '\\\\':\n ret += '\\\\';\n break;\n case '\"':\n ret += '\"';\n break;\n case '/':\n ret += '/';\n break;\n case 'b':\n ret += '\\b';\n break;\n case 'f':\n ret += '\\f';\n break;\n case 'n':\n ret += '\\n';\n break;\n case 'r':\n ret += '\\r';\n break;\n case 't':\n ret += '\\t';\n break;\n case 'u':\n this._error = 'parse string/unicord escape not supported';\n break;\n default:\n break;\n }\n } else {\n this._error = 'parse string/escape error';\n }\n }\n // falls through\n default: {\n break;\n }\n }\n }\n\n this._error = 'parse string/illegal end';\n return null;\n }\n\n /**\n * JSONのオブジェクトエレメントをパースしてValueオブジェクトを返す\n *\n * @param buffer JSONエレメントのバッファ\n * @param length パースする長さ\n * @param begin パースを開始する位置\n * @param outEndPos パース終了時の位置\n * @return パースから取得したValueオブジェクト\n */\n protected parseObject(\n buffer: string,\n length: number,\n begin: number,\n outEndPos: number[]\n ): Value {\n if (this._error) {\n return null;\n }\n\n if (!buffer) {\n this._error = 'buffer is null';\n return null;\n }\n\n const ret: JsonMap = new JsonMap();\n\n // Key: Value\n let key = '';\n let i: number = begin;\n let c = '';\n const localRetEndPos2: number[] = Array(1);\n let ok = false;\n\n // , が続く限りループ\n for (; i < length; i++) {\n FOR_LOOP: for (; i < length; i++) {\n c = buffer[i];\n\n switch (c) {\n case '\"':\n key = this.parseString(buffer, length, i + 1, localRetEndPos2);\n if (this._error) {\n return null;\n }\n\n i = localRetEndPos2[0];\n ok = true;\n break FOR_LOOP; //-- loopから出る\n case '}': // 閉じカッコ\n outEndPos[0] = i + 1;\n return ret; // 空\n case ':':\n this._error = \"illegal ':' position\";\n break;\n case '\\n':\n this._lineCount++;\n // falls through\n default:\n break; // スキップする文字\n }\n }\n if (!ok) {\n this._error = 'key not found';\n return null;\n }\n\n ok = false;\n\n // : をチェック\n FOR_LOOP2: for (; i < length; i++) {\n c = buffer[i];\n\n switch (c) {\n case ':':\n ok = true;\n i++;\n break FOR_LOOP2;\n case '}':\n this._error = \"illegal '}' position\";\n break;\n // falls through\n case '\\n':\n this._lineCount++;\n // case ' ': case '\\t' : case '\\r':\n // falls through\n default:\n break; // スキップする文字\n }\n }\n\n if (!ok) {\n this._error = \"':' not found\";\n return null;\n }\n\n // 値をチェック\n const value: Value = this.parseValue(buffer, length, i, localRetEndPos2);\n if (this._error) {\n return null;\n }\n\n i = localRetEndPos2[0];\n\n // ret.put(key, value);\n ret.put(key, value);\n\n FOR_LOOP3: for (; i < length; i++) {\n c = buffer[i];\n\n switch (c) {\n case ',':\n break FOR_LOOP3;\n case '}':\n outEndPos[0] = i + 1;\n return ret; // 正常終了\n case '\\n':\n this._lineCount++;\n // falls through\n default:\n break; // スキップ\n }\n }\n }\n\n this._error = 'illegal end of perseObject';\n return null;\n }\n\n /**\n * 次の「\"」までの文字列をパースする。\n * @param buffer JSONエレメントのバッファ\n * @param length パースする長さ\n * @param begin パースを開始する位置\n * @param outEndPos パース終了時の位置\n * @return パースから取得したValueオブジェクト\n */\n protected parseArray(\n buffer: string,\n length: number,\n begin: number,\n outEndPos: number[]\n ): Value {\n if (this._error) {\n return null;\n }\n\n if (!buffer) {\n this._error = 'buffer is null';\n return null;\n }\n\n let ret: JsonArray = new JsonArray();\n\n // key : value\n let i: number = begin;\n let c: string;\n const localRetEndpos2: number[] = new Array(1);\n\n // , が続く限りループ\n for (; i < length; i++) {\n // : をチェック\n const value: Value = this.parseValue(buffer, length, i, localRetEndpos2);\n\n if (this._error) {\n return null;\n }\n i = localRetEndpos2[0];\n\n if (value) {\n ret.add(value);\n }\n\n // FOR_LOOP3:\n // boolean breakflag = false;\n FOR_LOOP: for (; i < length; i++) {\n c = buffer[i];\n\n switch (c) {\n case ',':\n // breakflag = true;\n // break; // 次のKEY, VAlUEへ\n break FOR_LOOP;\n case ']':\n outEndPos[0] = i + 1;\n return ret; // 終了\n case '\\n':\n ++this._lineCount;\n //case ' ': case '\\t': case '\\r':\n // falls through\n default:\n break; // スキップ\n }\n }\n }\n\n ret = void 0;\n this._error = 'illegal end of parseObject';\n return null;\n }\n\n _parseCallback: parseJsonObject = CubismJsonExtension.parseJsonObject; // パース時に使う処理のコールバック関数\n\n _error: string; // パース時のエラー\n _lineCount: number; // エラー報告に用いる行数カウント\n _root: Value; // パースされたルート要素\n}\n\ninterface parseJsonObject {\n (obj: Value, map: JsonMap): JsonMap;\n}\n\n/**\n * パースしたJSONの要素をfloat値として扱う\n */\nexport class JsonFloat extends Value {\n /**\n * コンストラクタ\n */\n constructor(v: number) {\n super();\n\n this._value = v;\n }\n\n /**\n * Valueの種類が数値型ならtrue\n */\n public isFloat(): boolean {\n return true;\n }\n\n /**\n * 要素を文字列で返す(string型)\n */\n public getString(defaultValue: string, indent: string): string {\n const strbuf = '\\0';\n this._value = parseFloat(strbuf);\n this._stringBuffer = strbuf;\n\n return this._stringBuffer;\n }\n\n /**\n * 要素を数値型で返す(number)\n */\n public toInt(defaultValue = 0): number {\n return parseInt(this._value.toString());\n }\n\n /**\n * 要素を数値型で返す(number)\n */\n public toFloat(defaultValue = 0.0): number {\n return this._value;\n }\n\n /**\n * 引数の値と等しければtrue\n */\n public equals(value: string): boolean;\n public equals(value: string): boolean;\n public equals(value: number): boolean;\n public equals(value: boolean): boolean;\n public equals(value: any): boolean {\n if ('number' === typeof value) {\n // int\n if (Math.round(value)) {\n return false;\n }\n // float\n else {\n return value == this._value;\n }\n }\n return false;\n }\n\n private _value: number; // JSON要素の値\n}\n\n/**\n * パースしたJSONの要素を真偽値として扱う\n */\nexport class JsonBoolean extends Value {\n /**\n * Valueの種類が真偽値ならtrue\n */\n public isBool(): boolean {\n return true;\n }\n\n /**\n * 要素を真偽値で返す(boolean)\n */\n public toBoolean(defaultValue = false): boolean {\n return this._boolValue;\n }\n\n /**\n * 要素を文字列で返す(string型)\n */\n public getString(defaultValue: string, indent: string): string {\n this._stringBuffer = this._boolValue ? 'true' : 'false';\n\n return this._stringBuffer;\n }\n\n /**\n * 引数の値と等しければtrue\n */\n public equals(value: string): boolean;\n public equals(value: string): boolean;\n public equals(value: number): boolean;\n public equals(value: boolean): boolean;\n public equals(value: any): boolean {\n if ('boolean' === typeof value) {\n return value == this._boolValue;\n }\n return false;\n }\n\n /**\n * Valueの値が静的ならtrue, 静的なら解放しない\n */\n public isStatic(): boolean {\n return true;\n }\n\n /**\n * 引数付きコンストラクタ\n */\n public constructor(v: boolean) {\n super();\n\n this._boolValue = v;\n }\n\n static trueValue: JsonBoolean; // true\n static falseValue: JsonBoolean; // false\n\n private _boolValue: boolean; // JSON要素の値\n}\n\n/**\n * パースしたJSONの要素を文字列として扱う\n */\nexport class JsonString extends Value {\n /**\n * 引数付きコンストラクタ\n */\n public constructor(s: string) {\n super();\n this._stringBuffer = s;\n }\n\n /**\n * Valueの種類が文字列ならtrue\n */\n public isString(): boolean {\n return true;\n }\n\n /**\n * 要素を文字列で返す(string型)\n */\n public getString(defaultValue: string, indent: string): string {\n return this._stringBuffer;\n }\n\n /**\n * 引数の値と等しければtrue\n */\n public equals(value: string): boolean;\n public equals(value: string): boolean;\n public equals(value: number): boolean;\n public equals(value: boolean): boolean;\n public equals(value: any): boolean {\n if ('string' === typeof value) {\n return this._stringBuffer == value;\n }\n\n return false;\n }\n}\n\n/**\n * JSONパース時のエラー結果。文字列型のようにふるまう\n */\nexport class JsonError extends JsonString {\n /**\n * Valueの値が静的ならtrue、静的なら解放しない\n */\n public isStatic(): boolean {\n return this._isStatic;\n }\n\n /**\n * エラー情報をセットする\n */\n public setErrorNotForClientCall(s: string): Value {\n this._stringBuffer = s;\n return this;\n }\n\n /**\n * 引数付きコンストラクタ\n */\n public constructor(s: string, isStatic: boolean) {\n if ('string' === typeof s) {\n super(s);\n } else {\n super(s);\n }\n this._isStatic = isStatic;\n }\n\n /**\n * Valueの種類がエラー値ならtrue\n */\n public isError(): boolean {\n return true;\n }\n\n protected _isStatic: boolean; // 静的なValueかどうか\n}\n\n/**\n * パースしたJSONの要素をNULL値として持つ\n */\nexport class JsonNullvalue extends Value {\n /**\n * Valueの種類がNULL値ならtrue\n */\n public isNull(): boolean {\n return true;\n }\n\n /**\n * 要素を文字列で返す(string型)\n */\n public getString(defaultValue: string, indent: string): string {\n return this._stringBuffer;\n }\n\n /**\n * Valueの値が静的ならtrue, 静的なら解放しない\n */\n public isStatic(): boolean {\n return true;\n }\n\n /**\n * Valueにエラー値をセットする\n */\n public setErrorNotForClientCall(s: string): Value {\n this._stringBuffer = s;\n return JsonError.nullValue;\n }\n\n /**\n * コンストラクタ\n */\n public constructor() {\n super();\n\n this._stringBuffer = 'NullValue';\n }\n}\n\n/**\n * パースしたJSONの要素を配列として持つ\n */\nexport class JsonArray extends Value {\n /**\n * コンストラクタ\n */\n public constructor() {\n super();\n this._array = new Array<Value>();\n }\n\n /**\n * デストラクタ相当の処理\n */\n public release(): void {\n for (let i = 0; i < this._array.length; i++) {\n let v: Value = this._array[i];\n if (v && !v.isStatic()) {\n v = void 0;\n v = null;\n }\n }\n }\n\n /**\n * Valueの種類が配列ならtrue\n */\n public isArray(): boolean {\n return true;\n }\n\n /**\n * 添字演算子[index]\n */\n public getValueByIndex(index: number): Value {\n if (index < 0 || this._array.length <= index) {\n return Value.errorValue.setErrorNotForClientCall(\n CSM_JSON_ERROR_INDEX_OF_BOUNDS\n );\n }\n\n const v: Value = this._array[index];\n\n if (v == null) {\n return Value.nullValue;\n }\n\n return v;\n }\n\n /**\n * 添字演算子[string]\n */\n public getValueByString(s: string): Value {\n return Value.errorValue.setErrorNotForClientCall(\n CSM_JSON_ERROR_TYPE_MISMATCH\n );\n }\n\n /**\n * 要素を文字列で返す(string型)\n */\n public getString(defaultValue: string, indent: string): string {\n const stringBuffer: string = indent + '[\\n';\n\n for (let i = 0; i < this._array.length; i++) {\n const v: Value = this._array[i];\n this._stringBuffer += indent + '' + v.getString(indent + ' ') + '\\n';\n }\n\n this._stringBuffer = stringBuffer + indent + ']\\n';\n\n return this._stringBuffer;\n }\n\n /**\n * 配列要素を追加する\n * @param v 追加する要素\n */\n public add(v: Value): void {\n this._array.push(v);\n }\n\n /**\n * 要素をコンテナで返す(Array<Value>)\n */\n public getVector(defaultValue: Array<Value> = null): Array<Value> {\n return this._array;\n }\n\n /**\n * 要素の数を返す\n */\n public getSize(): number {\n return this._array.length;\n }\n\n private _array: Array<Value>; // JSON要素の値\n}\n\n/**\n * パースしたJSONの要素をマップとして持つ\n */\nexport class JsonMap extends Value {\n /**\n * コンストラクタ\n */\n public constructor() {\n super();\n this._map = new Map<string, Value>();\n }\n\n /**\n * デストラクタ相当の処理\n */\n public release(): void {\n this._map.clear();\n }\n\n /**\n * Valueの値がMap型ならtrue\n */\n public isMap(): boolean {\n return true;\n }\n\n /**\n * 添字演算子[string]\n */\n public getValueByString(s: string): Value {\n const ret = this._map.get(s);\n if (ret != undefined) {\n return ret;\n }\n return Value.nullValue;\n }\n\n /**\n * 添字演算子[index]\n */\n public getValueByIndex(index: number): Value {\n return Value.errorValue.setErrorNotForClientCall(\n CSM_JSON_ERROR_TYPE_MISMATCH\n );\n }\n\n /**\n * 要素を文字列で返す(string型)\n */\n public getString(defaultValue: string, indent: string) {\n this._stringBuffer = indent + '{\\n';\n\n for (const element of this._map) {\n const key = element[0];\n const v: Value = element[1];\n\n this._stringBuffer +=\n indent + ' ' + key + ' : ' + v.getString(indent + ' ') + ' \\n';\n }\n\n this._stringBuffer += indent + '}\\n';\n\n return this._stringBuffer;\n }\n\n /**\n * 要素をMap型で返す\n */\n public getMap(defaultValue?: Map<string, Value>): Map<string, Value> {\n return this._map;\n }\n\n /**\n * Mapに要素を追加する\n */\n public put(key: string, v: Value): void {\n this._map.set(key, v);\n }\n\n /**\n * Mapからキーのリストを取得する\n */\n public getKeys(): Array<string> {\n if (!this._keys) {\n this._keys = [...this._map.keys()];\n }\n return this._keys;\n }\n\n /**\n * Mapの要素数を取得する\n */\n public getSize(): number {\n return this._keys.length;\n }\n\n private _map: Map<string, Value>; // JSON要素の値\n private _keys: Array<string>; // JSON要素の値\n}\n\n// Namespace definition for compatibility.\nimport * as $ from './cubismjson';\nimport { CubismJsonExtension } from './cubismjsonextension';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const CubismJson = $.CubismJson;\n export type CubismJson = $.CubismJson;\n export const JsonArray = $.JsonArray;\n export type JsonArray = $.JsonArray;\n export const JsonBoolean = $.JsonBoolean;\n export type JsonBoolean = $.JsonBoolean;\n export const JsonError = $.JsonError;\n export type JsonError = $.JsonError;\n export const JsonFloat = $.JsonFloat;\n export type JsonFloat = $.JsonFloat;\n export const JsonMap = $.JsonMap;\n export type JsonMap = $.JsonMap;\n export const JsonNullvalue = $.JsonNullvalue;\n export type JsonNullvalue = $.JsonNullvalue;\n export const JsonString = $.JsonString;\n export type JsonString = $.JsonString;\n export const Value = $.Value;\n export type Value = $.Value;\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport { CubismIdManager } from './id/cubismidmanager';\nimport { CubismRenderer } from './rendering/cubismrenderer';\nimport {\n CSM_ASSERT,\n CubismLogInfo,\n CubismLogWarning\n} from './utils/cubismdebug';\nimport { Value } from './utils/cubismjson';\n\nexport function strtod(s: string, endPtr: string[]): number {\n let index = 0;\n for (let i = 1; ; i++) {\n const testC: string = s.slice(i - 1, i);\n\n // 指数・マイナスの可能性があるのでスキップする\n if (testC == 'e' || testC == '-' || testC == 'E') {\n continue;\n } // 文字列の範囲を広げていく\n\n const test: string = s.substring(0, i);\n const number = Number(test);\n if (isNaN(number)) {\n // 数値として認識できなくなったので終了\n break;\n } // 最後に数値としてできたindexを格納しておく\n\n index = i;\n }\n let d = parseFloat(s); // パースした数値\n\n if (isNaN(d)) {\n // 数値として認識できなくなったので終了\n d = NaN;\n }\n\n endPtr[0] = s.slice(index); // 後続の文字列\n return d;\n}\n\n// ファイルスコープの変数を初期化\n\nlet s_isStarted = false;\nlet s_isInitialized = false;\nlet s_option: Option = null;\nlet s_cubismIdManager: CubismIdManager = null;\n\n/**\n * Framework内で使う定数の宣言\n */\nexport const Constant = Object.freeze<Record<string, number>>({\n vertexOffset: 0, // メッシュ頂点のオフセット値\n vertexStep: 2 // メッシュ頂点のステップ値\n});\n\nexport function csmDelete<T>(address: T): void {\n if (!address) {\n return;\n }\n\n address = void 0;\n}\n\n/**\n * Live2D Cubism SDK Original Workflow SDKのエントリポイント\n * 利用開始時はCubismFramework.initialize()を呼び、CubismFramework.dispose()で終了する。\n */\nexport class CubismFramework {\n /**\n * Cubism FrameworkのAPIを使用可能にする。\n * APIを実行する前に必ずこの関数を実行すること。\n * 一度準備が完了して以降は、再び実行しても内部処理がスキップされます。\n *\n * @param option Optionクラスのインスタンス\n *\n * @return 準備処理が完了したらtrueが返ります。\n */\n public static startUp(option: Option = null): boolean {\n if (s_isStarted) {\n CubismLogInfo('CubismFramework.startUp() is already done.');\n return s_isStarted;\n }\n\n s_option = option;\n\n if (s_option != null) {\n Live2DCubismCore.Logging.csmSetLogFunction(s_option.logFunction);\n }\n\n s_isStarted = true;\n\n // Live2D Cubism Coreバージョン情報を表示\n if (s_isStarted) {\n const version: number = Live2DCubismCore.Version.csmGetVersion();\n const major: number = (version & 0xff000000) >> 24;\n const minor: number = (version & 0x00ff0000) >> 16;\n const patch: number = version & 0x0000ffff;\n const versionNumber: number = version;\n\n CubismLogInfo(\n `Live2D Cubism Core version: {0}.{1}.{2} ({3})`,\n ('00' + major).slice(-2),\n ('00' + minor).slice(-2),\n ('0000' + patch).slice(-4),\n versionNumber\n );\n }\n\n CubismLogInfo('CubismFramework.startUp() is complete.');\n\n return s_isStarted;\n }\n\n /**\n * StartUp()で初期化したCubismFrameworkの各パラメータをクリアします。\n * Dispose()したCubismFrameworkを再利用する際に利用してください。\n */\n public static cleanUp(): void {\n s_isStarted = false;\n s_isInitialized = false;\n s_option = null;\n s_cubismIdManager = null;\n }\n\n /**\n * Cubism Framework内のリソースを初期化してモデルを表示可能な状態にします。<br>\n * 再度Initialize()するには先にDispose()を実行する必要があります。\n *\n * @param memorySize 初期化時メモリ量 [byte(s)]\n * 複数モデル表示時などにモデルが更新されない際に使用してください。\n * 指定する際は必ず1024*1024*16 byte(16MB)以上の値を指定してください。\n * それ以外はすべて1024*1024*16 byteに丸めます。\n */\n public static initialize(memorySize = 0): void {\n CSM_ASSERT(s_isStarted);\n if (!s_isStarted) {\n CubismLogWarning('CubismFramework is not started.');\n return;\n }\n\n // --- s_isInitializedによる連続初期化ガード ---\n // 連続してリソース確保が行われないようにする。\n // 再度Initialize()するには先にDispose()を実行する必要がある。\n if (s_isInitialized) {\n CubismLogWarning(\n 'CubismFramework.initialize() skipped, already initialized.'\n );\n return;\n }\n\n //---- static 初期化 ----\n Value.staticInitializeNotForClientCall();\n\n s_cubismIdManager = new CubismIdManager();\n\n // --- HACK: 初期化時メモリ量の拡張(単位byte) ---\n // 複数モデル表示時などにモデルが更新されない際に使用してください。\n // 指定する際は必ず1024*1024*16 byte(16MB)以上の値を指定してください。\n // それ以外はすべて1024*1024*16 byteに丸めます。\n Live2DCubismCore.Memory.initializeAmountOfMemory(memorySize);\n\n s_isInitialized = true;\n\n CubismLogInfo('CubismFramework.initialize() is complete.');\n }\n\n /**\n * Cubism Framework内の全てのリソースを解放します。\n * ただし、外部で確保されたリソースについては解放しません。\n * 外部で適切に破棄する必要があります。\n */\n public static dispose(): void {\n CSM_ASSERT(s_isStarted);\n if (!s_isStarted) {\n CubismLogWarning('CubismFramework is not started.');\n return;\n }\n\n // --- s_isInitializedによる未初期化解放ガード ---\n // dispose()するには先にinitialize()を実行する必要がある。\n if (!s_isInitialized) {\n // false...リソース未確保の場合\n CubismLogWarning('CubismFramework.dispose() skipped, not initialized.');\n return;\n }\n\n Value.staticReleaseNotForClientCall();\n\n s_cubismIdManager.release();\n s_cubismIdManager = null;\n\n // レンダラの静的リソース(シェーダプログラム他)を解放する\n CubismRenderer.staticRelease();\n\n s_isInitialized = false;\n\n CubismLogInfo('CubismFramework.dispose() is complete.');\n }\n\n /**\n * Cubism FrameworkのAPIを使用する準備が完了したかどうか\n * @return APIを使用する準備が完了していればtrueが返ります。\n */\n public static isStarted(): boolean {\n return s_isStarted;\n }\n\n /**\n * Cubism Frameworkのリソース初期化がすでに行われているかどうか\n * @return リソース確保が完了していればtrueが返ります\n */\n public static isInitialized(): boolean {\n return s_isInitialized;\n }\n\n /**\n * Core APIにバインドしたログ関数を実行する\n *\n * @praram message ログメッセージ\n */\n public static coreLogFunction(message: string): void {\n // Return if logging not possible.\n if (!Live2DCubismCore.Logging.csmGetLogFunction()) {\n return;\n }\n\n Live2DCubismCore.Logging.csmGetLogFunction()(message);\n }\n\n /**\n * 現在のログ出力レベル設定の値を返す。\n *\n * @return 現在のログ出力レベル設定の値\n */\n public static getLoggingLevel(): LogLevel {\n if (s_option != null) {\n return s_option.loggingLevel;\n }\n return LogLevel.LogLevel_Off;\n }\n\n /**\n * IDマネージャのインスタンスを取得する\n * @return CubismManagerクラスのインスタンス\n */\n public static getIdManager(): CubismIdManager {\n return s_cubismIdManager;\n }\n\n /**\n * 静的クラスとして使用する\n * インスタンス化させない\n */\n private constructor() {}\n}\n\nexport class Option {\n logFunction: Live2DCubismCore.csmLogFunction; // ログ出力の関数オブジェクト\n loggingLevel: LogLevel; // ログ出力レベルの設定\n}\n\n/**\n * ログ出力のレベル\n */\nexport enum LogLevel {\n LogLevel_Verbose = 0, // 詳細ログ\n LogLevel_Debug, // デバッグログ\n LogLevel_Info, // Infoログ\n LogLevel_Warning, // 警告ログ\n LogLevel_Error, // エラーログ\n LogLevel_Off // ログ出力無効\n}\n\n// Namespace definition for compatibility.\nimport * as $ from './live2dcubismframework';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const Constant = $.Constant;\n export const csmDelete = $.csmDelete;\n export const CubismFramework = $.CubismFramework;\n export type CubismFramework = $.CubismFramework;\n}\n","import * as CubismFrameworkConfig from '@cubism/cubismframeworkconfig'\n\nconst LOG_LEVEL_VERBOSE = 0\nconst LOG_LEVEL_WARNING = 1\nconst LOG_LEVEL_ERROR = 2\nconst LOG_LEVEL_NONE = 999\n\n/**\n * Global configs.\n */\nexport const config = {\n LOG_LEVEL_VERBOSE,\n LOG_LEVEL_WARNING,\n LOG_LEVEL_ERROR,\n LOG_LEVEL_NONE,\n\n /**\n * Global log level.\n * @default config.LOG_LEVEL_WARNING\n */\n logLevel: __DEV__ ? LOG_LEVEL_VERBOSE : LOG_LEVEL_WARNING,\n\n /**\n * Enabling sound for motions.\n */\n sound: true,\n\n /**\n * fftSize for sound analyzer for lipsync.\n * Must be a power of 2 between 2^5 and 2^15, so one of: 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, and 32768.\n * @default 512\n */\n fftSize: 512,\n\n /**\n * Deferring motion and corresponding sound until both are loaded.\n */\n motionSync: true,\n\n /**\n * Default fading duration for motions without such value specified.\n */\n motionFadingDuration: 500,\n\n /**\n * Default fading duration for idle motions without such value specified.\n */\n idleMotionFadingDuration: 2000,\n\n /**\n * Default fading duration for expressions without such value specified.\n */\n expressionFadingDuration: 500,\n\n /**\n * If false, expression will be reset to default when playing non-idle motions.\n */\n preserveExpressionOnMotion: true,\n\n cubism: CubismFrameworkConfig,\n}\n","export const LOGICAL_WIDTH = 2\nexport const LOGICAL_HEIGHT = 2\n","/**\n * Remove an element from array.\n */\nexport function remove<T>(array: T[], item: T) {\n const index = array.indexOf(item)\n\n if (index !== -1) {\n array.splice(index, 1)\n }\n}\n","import { config } from '@/config'\n\n/**\n * A simple tagged logger.\n *\n * You can replace the methods with your own ones.\n *\n * ```js\n * import { logger } from 'pixi-live2d-display';\n *\n * logger.log = (tag, ...messages) => {\n * console.log(tag, 'says:', ...messages);\n * };\n * ```\n */\nexport const logger = {\n log(tag: string, ...messages: unknown[]) {\n if (config.logLevel <= config.LOG_LEVEL_VERBOSE) {\n console.log(`[${tag}]`, ...messages)\n }\n },\n\n warn(tag: string, ...messages: unknown[]) {\n if (config.logLevel <= config.LOG_LEVEL_WARNING) {\n console.warn(`[${tag}]`, ...messages)\n }\n },\n\n error(tag: string, ...messages: unknown[]) {\n if (config.logLevel <= config.LOG_LEVEL_ERROR) {\n console.error(`[${tag}]`, ...messages)\n }\n },\n}\n","/**\n * These functions can be slightly faster than the ones in Lodash.\n * @packageDocumentation\n */\n\nexport function clamp(num: number, lower: number, upper: number) {\n return num < lower ? lower : num > upper ? upper : num\n}\n\nexport function rand(min: number, max: number) {\n return Math.random() * (max - min) + min\n}\n\nexport function MBToByte(value: number): number {\n return value * 1024 * 1024\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n// biome-ignore-all lint/suspicious/noExplicitAny: generic mixin/copy plumbing needs any (mirrors the eslint-disable)\n/**\n * Copies a property at only if it matches the `type`.\n * @param type - Type expected to match `typeof` on the property.\n * @param from - Source object.\n * @param to - Destination object.\n * @param fromKey - Key of the property in source object.\n * @param toKey - Key of the property in destination object.\n */\nexport function copyProperty<\n From,\n FromKey extends keyof From,\n ToKey extends keyof any,\n To extends Partial<Record<ToKey, From[FromKey]>>,\n>(type: string, from: From, to: To, fromKey: FromKey, toKey: ToKey) {\n const value = from[fromKey]\n\n if (value !== null && typeof value === type) {\n // a type error will occur here, have no idea\n to[toKey] = value as unknown as To[ToKey]\n }\n}\n\n/**\n * Copies an array at `key`, filtering the items that match the `type`.\n * @param type - Type expected to match `typeof` on the items.\n * @param from - Source object.\n * @param to - Destination object.\n * @param fromKey - Key of the array property in source object.\n * @param toKey - Key of the array property in destination object.\n */\nexport function copyArray<\n FromKey extends keyof any,\n From extends Partial<Record<FromKey, any[]>>,\n ToKey extends keyof any,\n To extends Partial<Record<ToKey, any[]>>,\n>(type: string, from: From, to: To, fromKey: FromKey, toKey: ToKey) {\n const array = from[fromKey]\n\n if (Array.isArray(array)) {\n to[toKey] = array.filter(item => item !== null && typeof item === type) as unknown as To[ToKey]\n }\n}\n\n/**\n * @see {@link https://www.typescriptlang.org/docs/handbook/mixins.html}\n */\nexport function applyMixins(derivedCtor: new (...args: any[]) => any, baseCtors: Array<new (...args: any[]) => any>) {\n baseCtors.forEach(baseCtor => {\n Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => {\n if (name !== 'constructor') {\n Object.defineProperty(derivedCtor.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name)!)\n }\n })\n })\n}\n","/**\n * Gets the name of parent folder in a url.\n * @param url - URL of a file.\n * @return Name of the parent folder, or the file itself if it has no parent folder.\n */\nexport function folderName(url: string) {\n let lastSlashIndex = url.lastIndexOf('/')\n\n if (lastSlashIndex !== -1) {\n url = url.slice(0, lastSlashIndex)\n }\n\n lastSlashIndex = url.lastIndexOf('/')\n\n if (lastSlashIndex !== -1) {\n url = url.slice(lastSlashIndex + 1)\n }\n\n return url\n}\n","const SCHEME_RE = /^[a-zA-Z][a-zA-Z0-9+.-]*:/\n\n/**\n * Resolves a path/URL against a base string without relying on Node's `url` module.\n */\nexport function resolveURL(base: string, path: string): string {\n if (!path) {\n return base\n }\n\n if (SCHEME_RE.test(path)) {\n return path\n }\n\n if (path.startsWith('/')) {\n return SCHEME_RE.test(base) ? new URL(path, base).toString() : path\n }\n\n if (SCHEME_RE.test(base)) {\n return new URL(path, base).toString()\n }\n\n const dummyOrigin = 'http://example.com'\n const baseForURL = base.startsWith('/') ? dummyOrigin + base : `${dummyOrigin}/${base}`\n const resolved = new URL(path, baseForURL)\n let result = resolved.pathname + resolved.search + resolved.hash\n\n if (!base.startsWith('/') && result.startsWith('/')) {\n result = result.slice(1)\n }\n\n return result\n}\n","import { EventEmitter } from 'pixi.js'\n\nimport type { ModelSettings } from '@/cubism-common/ModelSettings'\nimport type { MotionManagerOptions } from '@/cubism-common/MotionManager'\nimport type { ExpressionManagerEvents } from '@/types/events'\nimport type { JSONObject, Mutable } from '@/types/helpers'\n\nimport { logger } from '@/utils'\n\n/**\n * Abstract expression manager. Expressions are independent toggles (VTube Studio-style):\n * any number can be active at once, each fading in/out on its own.\n * @emits {@link ExpressionManagerEvents}\n */\nexport abstract class ExpressionManager<Expression = unknown, ExpressionSpec = unknown> extends EventEmitter<\n keyof ExpressionManagerEvents\n> {\n /**\n * Indicates the content type used when loading expressions.\n * @default \"json\"\n */\n readonly expressionDataType: XMLHttpRequestResponseType = 'json'\n\n /**\n * Tag for logging.\n */\n tag: string\n\n /**\n * Expression definitions copied from ModelSettings.\n */\n abstract readonly definitions: ExpressionSpec[]\n\n /**\n * The ModelSettings reference.\n */\n readonly settings: ModelSettings\n\n /**\n * The Expressions. The structure is the same as {@link definitions}, initially there's only\n * an empty array, which means all expressions will be `undefined`. When an Expression has\n * been loaded, it'll fill the place in which it should be; when it fails to load,\n * the place will be filled with `null`.\n */\n expressions: (Expression | null | undefined)[] = []\n\n /**\n * Indices of active expressions, in request order (last = most recently requested).\n */\n protected activeIndices: number[] = []\n\n /**\n * Indices whose activation load is still in flight. Counts as active intent.\n */\n protected pendingIndices = new Set<number>()\n\n /**\n * Monotonic request stamps for pending and active indices. A late-settling load\n * splices into {@link activeIndices} at its request position instead of the end,\n * without ever waiting on another request's load.\n */\n private requestSeqs = new Map<number, number>()\n\n private nextRequestSeq = 0\n\n /**\n * Active set remembered by {@link resetExpression} for {@link restoreExpression}.\n */\n protected suppressedIndices: number[] | null = null\n\n /**\n * Flags the instance has been destroyed.\n */\n destroyed = false\n\n protected constructor(settings: ModelSettings, _options?: MotionManagerOptions) {\n super()\n this.settings = settings\n this.tag = `ExpressionManager(${settings.name})`\n }\n\n /**\n * Loads an Expression. Errors in this method will not be thrown,\n * but be emitted with an \"expressionLoadError\" event.\n * @param index - Index of the expression in definitions.\n * @return Promise that resolves with the Expression, or with undefined if it can't be loaded.\n * @emits {@link ExpressionManagerEvents.expressionLoaded}\n * @emits {@link ExpressionManagerEvents.expressionLoadError}\n */\n protected async loadExpression(index: number): Promise<Expression | undefined> {\n if (!this.definitions[index]) {\n logger.warn(this.tag, `Undefined expression at [${index}]`)\n return undefined\n }\n\n if (this.expressions[index] === null) {\n logger.warn(this.tag, `Cannot set expression at [${index}] because it's already failed in loading.`)\n return undefined\n }\n\n if (this.expressions[index]) {\n return this.expressions[index]\n }\n\n const expression = await this._loadExpression(index)\n\n if (this.destroyed) {\n return undefined\n }\n\n this.expressions[index] = expression\n\n return expression\n }\n\n /**\n * Loads the Expression. Will be implemented by Live2DFactory in order to avoid circular dependency.\n * @ignore\n */\n private _loadExpression(_index: number): Promise<Expression | undefined> {\n throw new Error('Not implemented.')\n }\n\n /**\n * Activates a random inactive Expression.\n * @return Promise that resolves with true if succeeded, with false otherwise.\n */\n async setRandomExpression(): Promise<boolean> {\n if (this.definitions.length) {\n const availableIndices = []\n\n for (let i = 0; i < this.definitions.length; i++) {\n if (this.expressions[i] !== null && !this.activeIndices.includes(i) && !this.pendingIndices.has(i)) {\n availableIndices.push(i)\n }\n }\n\n if (availableIndices.length) {\n const index = availableIndices[Math.floor(Math.random() * availableIndices.length)]!\n\n return this.setExpression(index)\n }\n }\n\n return false\n }\n\n /**\n * Temporarily suppresses all active expressions, remembering them for\n * {@link ExpressionManager#restoreExpression}. Used while a motion overrides the expression.\n * Repeated calls keep the first snapshot.\n */\n resetExpression(): void {\n const snapshot = this.suppressedIndices ?? [...this.activeIndices, ...this.pendingIndices]\n const changed = this.activeIndices.length > 0 || this.pendingIndices.size > 0\n\n this.pendingIndices.clear()\n this.requestSeqs.clear()\n\n for (const index of this.activeIndices) {\n this.deactivateExpression(index)\n }\n\n this.activeIndices = []\n this.suppressedIndices = snapshot\n\n if (changed) {\n this.emit('expressionsChanged')\n }\n }\n\n /**\n * Re-activates the expressions suppressed by {@link ExpressionManager#resetExpression}.\n */\n async restoreExpression(): Promise<void> {\n const suppressed = this.suppressedIndices\n\n if (!suppressed) {\n return\n }\n\n this.suppressedIndices = null\n\n await Promise.all(suppressed.map(index => this.setExpression(index)))\n }\n\n /**\n * Names of active expressions in request order, followed by pending activations in request order.\n */\n activeExpressionNames(): string[] {\n return [...this.activeIndices, ...this.pendingIndices].map(index =>\n this.getExpressionName(this.definitions[index]!)\n )\n }\n\n /**\n * Deactivates all expressions, fading each out.\n */\n clearExpressions(): void {\n const changed = this.activeIndices.length > 0 || this.pendingIndices.size > 0\n\n this.pendingIndices.clear()\n this.requestSeqs.clear()\n this.suppressedIndices = null\n\n for (const index of this.activeIndices) {\n this.deactivateExpression(index)\n }\n\n this.activeIndices = []\n\n if (changed) {\n this.emit('expressionsChanged')\n }\n }\n\n /**\n * Activates an Expression on top of the ones already active.\n * @param index - Either the index, or the name of the expression.\n * @param options - `fadeSeconds` overrides the expression's own fade-in time; `0` applies it at full weight immediately.\n * @return Promise that resolves with true if newly activated, with false otherwise.\n */\n async setExpression(index: number | string, options?: { fadeSeconds?: number }): Promise<boolean> {\n if (typeof index !== 'number') {\n index = this.getExpressionIndex(index)\n }\n\n if (!(index > -1 && index < this.definitions.length)) {\n return false\n }\n\n if (this.activeIndices.includes(index) || this.pendingIndices.has(index)) {\n return false\n }\n\n this.pendingIndices.add(index)\n const seq = this.nextRequestSeq++\n this.requestSeqs.set(index, seq)\n // Synchronous: a pending activation already counts as active intent.\n this.emit('expressionsChanged')\n\n const expression = await this.loadExpression(index)\n\n // The seq doubles as a request token: a stale invocation whose request was\n // cancelled must not consume a newer request's pending marker for this index.\n if (this.destroyed || this.requestSeqs.get(index) !== seq || !this.pendingIndices.has(index)) {\n return false\n }\n\n if (!expression) {\n this.pendingIndices.delete(index)\n this.requestSeqs.delete(index)\n this.emit('expressionsChanged')\n return false\n }\n\n this.pendingIndices.delete(index)\n\n const at = this.activeIndices.findIndex(active => (this.requestSeqs.get(active) ?? -1) > seq)\n\n if (at < 0) {\n this.activeIndices.push(index)\n } else {\n this.activeIndices.splice(at, 0, index)\n }\n\n this.activateExpression(index, expression, options?.fadeSeconds)\n this.emit('expressionsChanged')\n\n return true\n }\n\n /**\n * Deactivates an active (or pending) Expression, fading it out.\n * @param index - Either the index, or the name of the expression.\n * @return True if the expression was active.\n */\n unsetExpression(index: number | string): boolean {\n if (typeof index !== 'number') {\n index = this.getExpressionIndex(index)\n }\n\n if (this.pendingIndices.delete(index)) {\n this.requestSeqs.delete(index)\n this.emit('expressionsChanged')\n return true\n }\n\n const position = this.activeIndices.indexOf(index)\n\n if (position < 0) {\n return false\n }\n\n this.activeIndices.splice(position, 1)\n this.requestSeqs.delete(index)\n this.deactivateExpression(index)\n this.emit('expressionsChanged')\n\n return true\n }\n\n /**\n * Toggles an Expression.\n * @param index - Either the index, or the name of the expression.\n * @return Promise that resolves with the resulting active state.\n */\n async toggleExpression(index: number | string): Promise<boolean> {\n if (typeof index !== 'number') {\n index = this.getExpressionIndex(index)\n }\n\n if (this.activeIndices.includes(index) || this.pendingIndices.has(index)) {\n this.unsetExpression(index)\n return false\n }\n\n return this.setExpression(index)\n }\n\n /**\n * Updates parameters of the core model.\n * @return True if the parameters are actually updated.\n */\n update(model: object, now: DOMHighResTimeStamp) {\n if (!this.isFinished()) {\n return this.updateParameters(model, now)\n }\n\n return false\n }\n\n /**\n * Destroys the instance.\n * @emits {@link ExpressionManagerEvents.destroy}\n */\n destroy() {\n this.destroyed = true\n this.emit('destroy')\n\n this.pendingIndices.clear()\n this.requestSeqs.clear()\n this.activeIndices = []\n this.suppressedIndices = null\n this.stopAllExpressions()\n\n const self = this as Mutable<Partial<this>>\n self.definitions = undefined\n self.expressions = undefined\n }\n\n /**\n * Checks if the expression playback has finished.\n */\n abstract isFinished(): boolean\n\n /**\n * Retrieves the expression's index by its name.\n * @return The index. `-1` if not found.\n */\n abstract getExpressionIndex(name: string): number\n\n /**\n * Retrieves the expression's file path by its definition.\n * @return The file path extracted from given definition. Not resolved.\n */\n abstract getExpressionFile(definition: ExpressionSpec): string\n\n /**\n * Retrieves the expression's name by its definition.\n */\n abstract getExpressionName(definition: ExpressionSpec): string\n\n /**\n * Creates an Expression from the data.\n * @param data - Content of the expression file.\n * @param definition - The expression definition.\n * @return The created Expression.\n */\n abstract createExpression(data: JSONObject, definition: ExpressionSpec | undefined): Expression\n\n /**\n * Starts fading the Expression in (or revives it when still fading out).\n * `fadeSeconds` overrides the expression's own fade-in time; `0` means full weight immediately.\n */\n protected abstract activateExpression(index: number, expression: Expression, fadeSeconds: number | undefined): void\n\n /**\n * Starts fading the Expression out.\n */\n protected abstract deactivateExpression(index: number): void\n\n /**\n * Cancels expression playback immediately.\n */\n protected abstract stopAllExpressions(): void\n\n /**\n * Updates parameters of the core model.\n * @return True if the parameters are actually updated.\n */\n protected abstract updateParameters(model: object, now: DOMHighResTimeStamp): boolean\n}\n","import { clamp } from '@/utils'\n\n// Minimum distance to respond\nconst EPSILON = 0.01\n\nconst MAX_SPEED = 40 / 7.5\n\n// the time to accelerate to max speed\nconst ACCELERATION_TIME = 1 / (0.15 * 1000)\n\n/**\n * Interpolates the transition of focus position.\n */\nexport class FocusController {\n /** The focus position. */\n targetX = 0\n\n /** The focus position. */\n targetY = 0\n\n /** Current position. */\n x = 0\n\n /** Current position. */\n y = 0\n\n /** Current velocity. */\n vx = 0\n\n /** Current velocity. */\n vy = 0\n\n /**\n * Sets the focus position.\n * @param x - X position in range `[-1, 1]`.\n * @param y - Y position in range `[-1, 1]`.\n * @param instant - Should the focus position be instantly applied.\n */\n focus(x: number, y: number, instant: boolean = false) {\n this.targetX = clamp(x, -1, 1)\n this.targetY = clamp(y, -1, 1)\n\n if (instant) {\n this.x = this.targetX\n this.y = this.targetY\n }\n }\n\n /**\n * Updates the interpolation.\n * @param dt - Delta time in milliseconds.\n */\n update(dt: DOMHighResTimeStamp) {\n const dx = this.targetX - this.x\n const dy = this.targetY - this.y\n\n if (Math.abs(dx) < EPSILON && Math.abs(dy) < EPSILON) return\n\n const d = Math.sqrt(dx ** 2 + dy ** 2)\n const maxSpeed = MAX_SPEED / (1000 / dt)\n\n let ax = maxSpeed * (dx / d) - this.vx\n let ay = maxSpeed * (dy / d) - this.vy\n\n const a = Math.sqrt(ax ** 2 + ay ** 2)\n const maxA = maxSpeed * ACCELERATION_TIME * dt\n\n if (a > maxA) {\n ax *= maxA / a\n ay *= maxA / a\n }\n\n this.vx += ax\n this.vy += ay\n\n const v = Math.sqrt(this.vx ** 2 + this.vy ** 2)\n const maxV = 0.5 * (Math.sqrt(maxA ** 2 + 8 * maxA * d) - maxA)\n\n if (v > maxV) {\n this.vx *= maxV / v\n this.vy *= maxV / v\n }\n\n this.x += this.vx\n this.y += this.vy\n }\n}\n","import type { Matrix } from 'pixi.js'\n\nimport { LOGICAL_HEIGHT, LOGICAL_WIDTH } from '@/cubism-common/constants'\n\nexport interface CommonLayout {\n centerX?: number\n centerY?: number\n x?: number\n y?: number\n width?: number\n height?: number\n top?: number\n bottom?: number\n left?: number\n right?: number\n}\n\nexport interface LayoutBounds {\n width: number\n height: number\n}\n\ntype LayoutKey = keyof CommonLayout\ntype LayoutEntry = [LayoutKey, number]\n\nfunction setScale(matrix: Matrix, scale: number): void {\n matrix.a = scale\n matrix.b = 0\n matrix.c = 0\n matrix.d = scale\n}\n\nfunction getLayoutEntries(rawLayout: CommonLayout): LayoutEntry[] {\n const entries: LayoutEntry[] = []\n\n for (const [key, value] of Object.entries(rawLayout)) {\n if (typeof value !== 'number') {\n continue\n }\n\n entries.push([key as LayoutKey, value])\n }\n\n return entries\n}\n\n/**\n * Applies the historical common layout transform used by this project.\n */\nexport function setupLayoutMatrix(\n matrix: Matrix,\n originalWidth: number,\n originalHeight: number,\n rawLayout: CommonLayout\n): LayoutBounds {\n const layout = {\n width: LOGICAL_WIDTH,\n height: LOGICAL_HEIGHT,\n ...rawLayout,\n }\n const layoutWidth = layout.width ?? LOGICAL_WIDTH\n const layoutHeight = layout.height ?? LOGICAL_HEIGHT\n\n matrix.identity()\n matrix.scale(layoutWidth / LOGICAL_WIDTH, layoutHeight / LOGICAL_HEIGHT)\n\n const width = originalWidth * matrix.a\n const height = originalHeight * matrix.d\n\n const offsetX =\n (layout.x !== undefined && layout.x - layoutWidth / 2) ||\n (layout.centerX !== undefined && layout.centerX) ||\n (layout.left !== undefined && layout.left - layoutWidth / 2) ||\n (layout.right !== undefined && layout.right + layoutWidth / 2) ||\n 0\n\n const offsetY =\n (layout.y !== undefined && layout.y - layoutHeight / 2) ||\n (layout.centerY !== undefined && layout.centerY) ||\n (layout.top !== undefined && layout.top - layoutHeight / 2) ||\n (layout.bottom !== undefined && layout.bottom + layoutHeight / 2) ||\n 0\n\n matrix.translate(width * offsetX, -height * offsetY)\n\n return {\n width,\n height,\n }\n}\n\ninterface CubismLayoutState {\n scale: number\n x: number\n y: number\n}\n\nfunction getCubismLayoutWidth(state: CubismLayoutState, aspect: number): number {\n return LOGICAL_HEIGHT * aspect * state.scale\n}\n\nfunction getCubismLayoutHeight(state: CubismLayoutState): number {\n return LOGICAL_HEIGHT * state.scale\n}\n\nfunction setCubismWidth(state: CubismLayoutState, aspect: number, width: number): void {\n state.scale = width / (LOGICAL_HEIGHT * aspect)\n}\n\nfunction setCubismHeight(state: CubismLayoutState, height: number): void {\n state.scale = height / LOGICAL_HEIGHT\n}\n\nfunction setCubismX(state: CubismLayoutState, x: number): void {\n state.x = x\n}\n\nfunction setCubismY(state: CubismLayoutState, y: number): void {\n state.y = y\n}\n\nfunction centerCubismX(state: CubismLayoutState, aspect: number, x: number): void {\n setCubismX(state, x - getCubismLayoutWidth(state, aspect) / 2)\n}\n\nfunction centerCubismY(state: CubismLayoutState, y: number): void {\n setCubismY(state, y - getCubismLayoutHeight(state) / 2)\n}\n\nfunction rightCubism(state: CubismLayoutState, aspect: number, x: number): void {\n setCubismX(state, x - getCubismLayoutWidth(state, aspect))\n}\n\nfunction bottomCubism(state: CubismLayoutState, y: number): void {\n setCubismY(state, y - getCubismLayoutHeight(state))\n}\n\n/**\n * Applies model3.json layout with the same two-pass semantics as\n * CubismModelMatrix.setupFromLayout(), then converts the SDK logical matrix back\n * to this renderer's top-left pixel local coordinates.\n */\nexport function setupCubismLayoutMatrix(\n matrix: Matrix,\n originalWidth: number,\n originalHeight: number,\n rawLayout: CommonLayout\n): LayoutBounds {\n if (originalWidth <= 0 || originalHeight <= 0) {\n matrix.identity()\n return { width: 0, height: 0 }\n }\n\n const entries = getLayoutEntries(rawLayout)\n const aspect = originalWidth / originalHeight\n const state: CubismLayoutState = { scale: 1, x: 0, y: 0 }\n\n for (const [key, value] of entries) {\n if (key === 'width') {\n setCubismWidth(state, aspect, value)\n } else if (key === 'height') {\n setCubismHeight(state, value)\n }\n }\n\n for (const [key, value] of entries) {\n if (key === 'x') {\n setCubismX(state, value)\n } else if (key === 'y') {\n setCubismY(state, value)\n } else if (key === 'centerX') {\n centerCubismX(state, aspect, value)\n } else if (key === 'centerY') {\n centerCubismY(state, value)\n } else if (key === 'top') {\n setCubismY(state, value)\n } else if (key === 'bottom') {\n bottomCubism(state, value)\n } else if (key === 'left') {\n setCubismX(state, value)\n } else if (key === 'right') {\n rightCubism(state, aspect, value)\n }\n }\n\n const pixelsPerLogicalUnit = originalHeight / LOGICAL_HEIGHT\n const defaultLogicalHalfWidth = (LOGICAL_HEIGHT * aspect) / 2\n const defaultLogicalHalfHeight = LOGICAL_HEIGHT / 2\n\n matrix.identity()\n setScale(matrix, state.scale)\n matrix.tx = pixelsPerLogicalUnit * (state.x + defaultLogicalHalfWidth) - (originalWidth * state.scale) / 2\n matrix.ty = pixelsPerLogicalUnit * (defaultLogicalHalfHeight - state.y) - (originalHeight * state.scale) / 2\n\n return {\n width: originalWidth * state.scale,\n height: originalHeight * state.scale,\n }\n}\n","import type { CubismMotion } from '@cubism/motion/cubismmotion'\nimport { EventEmitter, Matrix } from 'pixi.js'\n\nimport type { CommonLayout } from '@/cubism-common/layout'\nimport type { ModelSettings } from '@/cubism-common/ModelSettings'\nimport type { MotionManager, MotionManagerOptions } from '@/cubism-common/MotionManager'\nimport type { ParallelMotionManager } from '@/cubism-common/ParallelMotionManager'\nimport type { Mutable } from '@/types/helpers'\n\nimport { FocusController } from '@/cubism-common/FocusController'\nimport { setupLayoutMatrix } from '@/cubism-common/layout'\n\nexport type { CommonLayout } from '@/cubism-common/layout'\n\n/**\n * Common hit area definition shared between all Cubism versions.\n */\nexport interface CommonHitArea {\n id: string\n name: string\n index: number\n}\n\nexport function normalizeHitAreaDefs(raw: unknown, resolveIndex: (id: string) => number): CommonHitArea[] {\n if (!Array.isArray(raw)) {\n return []\n }\n\n const defs: CommonHitArea[] = []\n\n for (const hitArea of raw) {\n if (!hitArea || typeof hitArea !== 'object') {\n continue\n }\n\n const record = hitArea as Record<string, unknown>\n const id = typeof record.id === 'string' ? record.id : typeof record.Id === 'string' ? record.Id : undefined\n const name =\n typeof record.name === 'string' ? record.name : typeof record.Name === 'string' ? record.Name : undefined\n\n if (!id || !name) {\n continue\n }\n\n defs.push({\n id,\n name,\n index: resolveIndex(id),\n })\n }\n\n return defs\n}\n\nexport interface Bounds {\n x: number\n y: number\n width: number\n height: number\n}\n\nexport interface InternalModelOptions extends MotionManagerOptions {\n /**\n * Define natural movements depth (0.0-1.0).\n * @default 1.0\n */\n breathDepth?: number\n\n /**\n * Gain multiplier applied to the analyzed mouth-sync input value.\n * @default 1.5\n */\n lipSyncGain?: number\n\n /**\n * Blend weight used when adding lip-sync values to mouth parameters.\n * @default 0.4\n */\n lipSyncWeight?: number\n\n /**\n * Whether to enable automatic eye blinking between motions.\n * @default true\n */\n eyeBlink?: boolean\n\n /**\n * Whether to use Cubism's high precision clipping mask rendering.\n * Only supported by Cubism 3/4/5 models.\n * @default 'auto'\n */\n useHighPrecisionMask?: boolean | 'auto'\n}\n\nconst tempBounds: Bounds = { x: 0, y: 0, width: 0, height: 0 }\n\n/**\n * A wrapper that manages the states of a Live2D core model, and delegates all operations to it.\n * @emits {@link InternalModelEvents}\n */\nexport abstract class InternalModel extends EventEmitter {\n /**\n * The managed Live2D core model.\n */\n abstract readonly coreModel: object\n\n abstract readonly settings: ModelSettings\n\n abstract readonly options: InternalModelOptions\n\n focusController = new FocusController()\n\n abstract motionManager: MotionManager\n abstract parallelMotionManager: ParallelMotionManager<CubismMotion>[]\n\n pose?: unknown\n physics?: unknown\n\n /**\n * Original canvas width of the model. Note this doesn't represent the model's real size,\n * as the model can overflow from its canvas.\n */\n readonly originalWidth: number = 0\n\n /**\n * Original canvas height of the model. Note this doesn't represent the model's real size,\n * as the model can overflow from its canvas.\n */\n readonly originalHeight: number = 0\n\n /**\n * Canvas width of the model, scaled by the `width` of the model's layout.\n */\n readonly width: number = 0\n\n /**\n * Canvas height of the model, scaled by the `height` of the model's layout.\n */\n readonly height: number = 0\n\n /**\n * Local transformation, calculated from the model's layout.\n */\n localTransform = new Matrix()\n\n /**\n * The final matrix to draw the model.\n */\n drawingMatrix = new Matrix()\n\n /**\n * Render opacity applied to the whole model, 0..1. Fed from the Pixi\n * container's alpha each render, so `model.alpha` affects the Cubism draw.\n */\n alpha = 1\n\n // TODO: change structure\n /**\n * The hit area definitions, keyed by their names.\n */\n hitAreas: Record<string, CommonHitArea> = {}\n\n /**\n * Flags whether `gl.UNPACK_FLIP_Y_WEBGL` should be enabled when binding the textures.\n */\n textureFlipY = false\n\n /**\n * WebGL viewport when drawing the model. The format is `[x, y, width, height]`.\n */\n viewport: [number, number, number, number] = [0, 0, 0, 0]\n\n /**\n * Flags this instance has been destroyed.\n */\n destroyed = false\n\n /**\n * Should be called in the constructor of derived class.\n */\n protected init() {\n this.setupLayout()\n this.setupHitAreas()\n }\n\n /**\n * Sets up the model's size and local transform by the model's layout.\n */\n protected setupLayout() {\n // cast `this` to be mutable\n const self = this as Mutable<this>\n\n const size = this.getSize()\n\n self.originalWidth = size[0]\n self.originalHeight = size[1]\n\n const bounds = setupLayoutMatrix(this.localTransform, this.originalWidth, this.originalHeight, this.getLayout())\n\n self.width = bounds.width\n self.height = bounds.height\n }\n\n /**\n * Sets up the hit areas by their definitions in settings.\n */\n protected setupHitAreas() {\n const definitions = this.getHitAreaDefs()\n\n this.hitAreas = {}\n\n for (const def of definitions) {\n if (!def.name) {\n continue\n }\n\n this.hitAreas[def.name] = def\n }\n }\n\n /**\n * Hit-test on the model.\n * @param x - Position in model canvas.\n * @param y - Position in model canvas.\n * @return The names of the *hit* hit areas. Can be empty if none is hit.\n */\n hitTest(x: number, y: number): string[] {\n return Object.keys(this.hitAreas).filter(hitAreaName => this.isHit(hitAreaName, x, y))\n }\n\n /**\n * Hit-test for a single hit area.\n * @param hitAreaName - The hit area's name.\n * @param x - Position in model canvas.\n * @param y - Position in model canvas.\n * @return True if hit.\n */\n isHit(hitAreaName: string, x: number, y: number): boolean {\n const hitArea = this.hitAreas[hitAreaName]\n if (!hitArea) {\n return false\n }\n\n let drawIndex = hitArea.index\n\n if (drawIndex < 0) {\n if (!hitArea.id) {\n return false\n }\n\n drawIndex = this.getDrawableIndex(hitArea.id)\n\n if (drawIndex < 0) {\n return false\n }\n\n hitArea.index = drawIndex\n }\n\n const bounds = this.getDrawableBounds(drawIndex, tempBounds)\n\n return bounds.x <= x && x <= bounds.x + bounds.width && bounds.y <= y && y <= bounds.y + bounds.height\n }\n\n /**\n * Gets a drawable's bounds.\n * @param index - Index of the drawable.\n * @param bounds - Object to store the output values.\n * @return The bounds in model canvas space.\n */\n getDrawableBounds(index: number, bounds?: Bounds): Bounds {\n const vertices = this.getDrawableVertices(index)\n\n let left = vertices[0]!\n let right = vertices[0]!\n let top = vertices[1]!\n let bottom = vertices[1]!\n\n for (let i = 0; i < vertices.length; i += 2) {\n const vx = vertices[i]!\n const vy = vertices[i + 1]!\n\n left = Math.min(vx, left)\n right = Math.max(vx, right)\n top = Math.min(vy, top)\n bottom = Math.max(vy, bottom)\n }\n\n bounds ??= {} as Bounds\n\n bounds.x = left\n bounds.y = top\n bounds.width = right - left\n bounds.height = bottom - top\n\n return bounds\n }\n\n /**\n * Updates the model's transform.\n * @param transform - The world transform.\n */\n updateTransform(transform: Matrix) {\n this.drawingMatrix.copyFrom(transform).append(this.localTransform)\n }\n\n /**\n * Updates the model's parameters.\n * @param dt - Elapsed time in milliseconds from last frame.\n * @param _now - Current time in milliseconds.\n */\n update(dt: DOMHighResTimeStamp, _now: DOMHighResTimeStamp): void {\n this.focusController.update(dt)\n }\n\n /**\n * Destroys the model and all related resources.\n * @emits {@link `InternalModelEvents.destroy` | destroy}\n */\n destroy(): void {\n this.destroyed = true\n this.emit('destroy')\n\n this.motionManager.destroy()\n ;(this as Partial<this>).motionManager = undefined\n this.parallelMotionManager.forEach(m => {\n m.destroy()\n })\n this.parallelMotionManager = []\n }\n\n // noinspection JSValidateJSDoc\n /**\n * Updates all active motions for the model and emits lifecycle events.\n *\n * This method coordinates the update cycle for both primary and parallel motion managers,\n * ensuring all animations are synchronized with the current timestamp. It emits events\n * before and after the update process, allowing external listeners to hook into the motion\n * lifecycle. The return value indicates whether any motion was actively updated during this cycle.\n *\n * @param {object} model - The model instance to apply motion updates to.\n * @param {number} now - The current timestamp (in milliseconds) used to calculate motion progress.\n * @returns {boolean} Returns `true` if any motion (primary or parallel) was updated; `false` otherwise.\n *\n * @emits beforeMotionUpdate - Triggered before any motion updates are processed.\n * @emits afterMotionUpdate - Triggered after all motion updates are completed.\n *\n */\n protected updateMotions(model: object, now: number): boolean {\n this.emit('beforeMotionUpdate')\n\n const motionUpdated0 = this.motionManager.update(model, now)\n const parallelMotionUpdated = this.parallelMotionManager.map(m => m.update(model, now))\n const motionUpdated = motionUpdated0 || parallelMotionUpdated.reduce((prev, curr) => prev || curr, false)\n\n this.emit('afterMotionUpdate')\n\n return motionUpdated\n }\n\n /**\n * Gets all the hit area definitions.\n * @return Normalized definitions.\n */\n protected abstract getHitAreaDefs(): CommonHitArea[]\n\n /**\n * Gets the model's original canvas size.\n * @return `[width, height]`\n */\n protected abstract getSize(): [number, number]\n\n /**\n * Gets the layout definition.\n * @return Normalized definition.\n */\n protected abstract getLayout(): CommonLayout\n\n /**\n * Gets all the drawables' IDs.\n * @return IDs.\n */\n abstract getDrawableIDs(): string[]\n\n /**\n * Finds the index of a drawable by its ID.\n * @return The index.\n */\n abstract getDrawableIndex(id: string): number\n\n /**\n * Gets a drawable's vertices.\n * @param index - Either the index or the ID of the drawable.\n * @throws Error when the drawable cannot be found.\n */\n abstract getDrawableVertices(index: number | string): Float32Array\n\n /**\n * Updates WebGL context bound to this model.\n * @param gl - WebGL context.\n * @param glContextID - Unique ID for given WebGL context.\n */\n abstract updateWebGLContext(gl: WebGLRenderingContext, glContextID: number): void\n\n /**\n * Binds a texture to the model. The index must be the same as that of this texture\n * in the {@link ModelSettings.textures} array.\n */\n abstract bindTexture(index: number, texture: WebGLTexture): void\n\n /**\n * Draws the model.\n */\n abstract draw(gl: WebGLRenderingContext): void\n\n /**\n * Add parallel motion manager.\n * @param managerCount - Count of parallel motion managers.\n */\n abstract extendParallelMotionManager(managerCount: number): void\n}\n","import type { JSONObject } from '@/types/helpers'\n\nimport { folderName, resolveURL } from '@/utils'\n\n/**\n * Parses, and provides access to the settings JSON.\n */\nexport abstract class ModelSettings {\n json: JSONObject\n\n /**\n * The model's name, typically used for displaying or logging. By default it's inferred from\n * the URL by taking the folder name (the second to last component). In Cubism 2 it'll be overwritten\n * by the `name` field of settings JSON.\n */\n name: string\n\n /**\n * URL of the model settings file, used to resolve paths of the resource files defined in settings.\n * This typically ends with `.model.json` in Cubism 2 and `.model3.json` in Cubism 4.\n */\n url: string\n\n /**\n * Relative path of he moc file, typically ends with `.moc` in Cubism 2 and `.moc3` in Cubism 4.\n */\n abstract moc: string\n\n /**\n * Relative paths of the texture images.\n */\n abstract textures: string[]\n\n /**\n * Relative path of the pose file.\n */\n pose?: string\n\n /**\n * Relative path of the physics file.\n */\n physics?: string\n\n /**\n * @param json - The settings JSON object.\n * @param json.url - The `url` field must be defined to specify the settings file's URL.\n */\n protected constructor(json: JSONObject & { url: string }) {\n this.json = json\n\n this.url = json.url\n\n // set default name to folder's name\n this.name = folderName(this.url)\n }\n\n /**\n * Ensures the model name is meaningful; falls back to the folder name when missing or placeholder.\n */\n protected normalizeName(): void {\n if (!this.name || this.name.toLowerCase() === 'name') {\n this.name = folderName(this.url)\n }\n }\n\n /**\n * Picks the first non-empty, non-placeholder name from candidates and applies it.\n * Falls back to {@link normalizeName} when no candidate is usable.\n */\n protected setModelName(...candidates: (string | undefined)[]): void {\n for (const candidate of candidates) {\n const name = typeof candidate === 'string' ? candidate.trim() : ''\n if (name && name.toLowerCase() !== 'name') {\n this.name = name\n return\n }\n }\n\n this.normalizeName()\n }\n\n /**\n * Returns the file name without extension from a path.\n */\n protected getFileStem(path?: string): string | undefined {\n if (!path) return undefined\n\n const fileName = path.split(/[/\\\\]/).filter(Boolean).pop()\n\n return fileName?.replace(/\\.[^.]+$/, '')\n }\n\n /**\n * Resolves a relative path using the {@link url}. This is used to resolve the resource files\n * defined in the settings.\n * @param path - Relative path.\n * @return Resolved path.\n */\n resolveURL(path: string): string {\n return resolveURL(this.url, path)\n }\n\n /**\n * Replaces the resource files by running each file through the `replacer`.\n * @param replacer - Invoked with two arguments: `(file, path)`, where `file` is the file definition,\n * and `path` is its property path in the ModelSettings instance. A string must be returned to be the replacement.\n *\n * ```js\n * modelSettings.replaceFiles((file, path) => {\n * // file = \"foo.moc\", path = \"moc\"\n * // file = \"foo.png\", path = \"textures[0]\"\n * // file = \"foo.mtn\", path = \"motions.idle[0].file\"\n * // file = \"foo.motion3.json\", path = \"motions.idle[0].File\"\n *\n * return \"bar/\" + file;\n * });\n * ```\n */\n replaceFiles(replacer: (file: string, path: string) => string) {\n this.moc = replacer(this.moc, 'moc')\n\n if (this.pose !== undefined) {\n this.pose = replacer(this.pose, 'pose')\n }\n\n if (this.physics !== undefined) {\n this.physics = replacer(this.physics, 'physics')\n }\n\n for (let i = 0; i < this.textures.length; i++) {\n this.textures[i] = replacer(this.textures[i]!, `textures[${i}]`)\n }\n }\n\n /**\n * Retrieves all resource files defined in the settings.\n * @return A flat array of the paths of all resource files.\n *\n * ```js\n * modelSettings.getDefinedFiles();\n * // returns: [\"foo.moc\", \"foo.png\", ...]\n * ```\n */\n getDefinedFiles(): string[] {\n const files: string[] = []\n\n this.replaceFiles((file: string) => {\n files.push(file)\n\n return file\n })\n\n return files\n }\n\n /**\n * Validates that the files defined in the settings exist in given files. Each file will be\n * resolved by {@link resolveURL} before comparison.\n * @param files - A flat array of file paths.\n * @return All the files which are defined in the settings and also exist in given files,\n * *including the optional files*.\n * @throws Error if any *essential* file is defined in settings but not included in given files.\n */\n validateFiles(files: string[]): string[] {\n const assertFileExists = (expectedFile: string, shouldThrow: boolean): boolean => {\n const actualPath = this.resolveURL(expectedFile)\n\n if (!files.includes(actualPath)) {\n if (shouldThrow) {\n throw new Error(`File \"${expectedFile}\" is defined in settings, but doesn't exist in given files`)\n }\n\n return false\n }\n\n return true\n }\n\n const essentialFiles = [this.moc, ...this.textures]\n\n essentialFiles.forEach(texture => {\n assertFileExists(texture, true)\n })\n\n const definedFiles = this.getDefinedFiles()\n\n return definedFiles.filter(file => assertFileExists(file, false))\n }\n}\n","import { config } from '@/config'\nimport { logger } from '@/utils'\n\n/**\n * Indicates the motion priority.\n */\nexport enum MotionPriority {\n /** States that the model is currently not playing any motion. This priority cannot be applied to a motion. */\n NONE,\n\n /** Low priority, used when starting idle motions automatically. */\n IDLE,\n\n /** Medium priority. */\n NORMAL,\n\n /** High priority. Motions as this priority will always be played regardless of the current priority. */\n FORCE,\n}\n\n/**\n * Handles the state of a MotionManager.\n */\nexport class MotionState {\n /**\n * Tag for logging.\n */\n tag!: string\n\n /**\n * When enabled, the states will be dumped to the logger when an exception occurs.\n */\n debug = false\n\n /**\n * Priority of the current motion. Will be `MotionPriority.NONE` if there's no playing motion.\n */\n currentPriority = MotionPriority.NONE\n\n /**\n * Priority of the reserved motion, which is still in loading and will be played once loaded.\n * Will be `MotionPriority.NONE` if there's no reserved motion.\n */\n reservePriority = MotionPriority.NONE\n\n /**\n * Group of current motion.\n */\n currentGroup?: string\n\n /**\n * Index of current motion in its group.\n */\n currentIndex?: number\n\n /**\n * Group of the reserved motion.\n */\n reservedGroup?: string\n\n /**\n * Index of the reserved motion in its group.\n */\n reservedIndex?: number\n\n /**\n * Group of the reserved idle motion.\n */\n reservedIdleGroup?: string\n\n /**\n * Index of the reserved idle motion in its group.\n */\n reservedIdleIndex?: number\n\n /**\n * Reserves the playback for a motion.\n * @param group - The motion group.\n * @param index - Index in the motion group.\n * @param priority - The priority to be applied.\n * @return True if the reserving has succeeded.\n */\n reserve(group: string, index: number, priority: MotionPriority): boolean {\n if (priority <= MotionPriority.NONE) {\n logger.log(this.tag, `Cannot start a motion with MotionPriority.NONE.`)\n return false\n }\n\n if (group === this.currentGroup && index === this.currentIndex) {\n logger.log(this.tag, `Motion is already playing.`, this.dump(group, index))\n return false\n }\n\n if (\n (group === this.reservedGroup && index === this.reservedIndex) ||\n (group === this.reservedIdleGroup && index === this.reservedIdleIndex)\n ) {\n logger.log(this.tag, `Motion is already reserved.`, this.dump(group, index))\n return false\n }\n\n if (priority === MotionPriority.IDLE) {\n if (this.currentPriority !== MotionPriority.NONE) {\n logger.log(this.tag, `Cannot start idle motion because another motion is playing.`, this.dump(group, index))\n return false\n }\n\n if (this.reservedIdleGroup !== undefined) {\n logger.log(\n this.tag,\n `Cannot start idle motion because another idle motion has reserved.`,\n this.dump(group, index)\n )\n return false\n }\n\n this.setReservedIdle(group, index)\n } else {\n if (priority < MotionPriority.FORCE) {\n if (priority <= this.currentPriority) {\n logger.log(\n this.tag,\n 'Cannot start motion because another motion is playing as an equivalent or higher priority.',\n this.dump(group, index)\n )\n return false\n }\n\n if (priority <= this.reservePriority) {\n logger.log(\n this.tag,\n 'Cannot start motion because another motion has reserved as an equivalent or higher priority.',\n this.dump(group, index)\n )\n return false\n }\n }\n\n this.setReserved(group, index, priority)\n }\n\n return true\n }\n\n /**\n * Requests the playback for a motion.\n * @param motion - The Motion, can be undefined.\n * @param group - The motion group.\n * @param index - Index in the motion group.\n * @param priority - The priority to be applied.\n * @return True if the request has been approved, i.e. the motion is allowed to play.\n */\n start(motion: unknown, group: string, index: number, priority: MotionPriority): boolean {\n if (priority === MotionPriority.IDLE) {\n this.setReservedIdle(undefined, undefined)\n\n if (this.currentPriority !== MotionPriority.NONE) {\n logger.log(this.tag, 'Cannot start idle motion because another motion is playing.', this.dump(group, index))\n return false\n }\n } else {\n if (group !== this.reservedGroup || index !== this.reservedIndex) {\n logger.log(this.tag, 'Cannot start motion because another motion has taken the place.', this.dump(group, index))\n return false\n }\n\n this.setReserved(undefined, undefined, MotionPriority.NONE)\n }\n\n if (!motion) {\n return false\n }\n\n this.setCurrent(group, index, priority)\n\n return true\n }\n\n /**\n * Notifies the motion playback has finished.\n */\n complete() {\n this.setCurrent(undefined, undefined, MotionPriority.NONE)\n }\n\n /**\n * Sets the current motion.\n */\n setCurrent(group: string | undefined, index: number | undefined, priority: MotionPriority) {\n this.currentPriority = priority\n this.currentGroup = group\n this.currentIndex = index\n }\n\n /**\n * Sets the reserved motion.\n */\n setReserved(group: string | undefined, index: number | undefined, priority: MotionPriority) {\n this.reservePriority = priority\n this.reservedGroup = group\n this.reservedIndex = index\n }\n\n /**\n * Sets the reserved idle motion.\n */\n setReservedIdle(group: string | undefined, index: number | undefined) {\n this.reservedIdleGroup = group\n this.reservedIdleIndex = index\n }\n\n /**\n * Checks if a Motion is currently playing or has reserved.\n * @return True if active.\n */\n isActive(group: string, index: number): boolean {\n return (\n (group === this.currentGroup && index === this.currentIndex) ||\n (group === this.reservedGroup && index === this.reservedIndex) ||\n (group === this.reservedIdleGroup && index === this.reservedIdleIndex)\n )\n }\n\n /**\n * Resets the state.\n */\n reset() {\n this.setCurrent(undefined, undefined, MotionPriority.NONE)\n\n // make sure the reserved motions (if existing) won't start when they are loaded\n this.setReserved(undefined, undefined, MotionPriority.NONE)\n this.setReservedIdle(undefined, undefined)\n }\n\n /**\n * Checks if an idle motion should be requests to play.\n */\n shouldRequestIdleMotion(): boolean {\n return this.currentGroup === undefined && this.reservedIdleGroup === undefined\n }\n\n /**\n * Checks if the model's expression should be overridden by the motion.\n */\n shouldOverrideExpression(): boolean {\n return !config.preserveExpressionOnMotion && this.currentPriority > MotionPriority.IDLE\n }\n\n /**\n * Dumps the state for debugging.\n */\n dump(requestedGroup?: string, requestedIndex?: number): string {\n if (this.debug) {\n const keys: (keyof this & string)[] = [\n 'currentPriority',\n 'reservePriority',\n 'currentGroup',\n 'currentIndex',\n 'reservedGroup',\n 'reservedIndex',\n 'reservedIdleGroup',\n 'reservedIdleIndex',\n ]\n return (\n `\\n<Requested> group = \"${requestedGroup}\", index = ${requestedIndex}\\n` +\n keys.map(key => `[${key}] ${this[key]}`).join('\\n')\n )\n }\n return ''\n }\n}\n","import type { Sound, SoundLibrary } from '@pixi/sound'\n\nimport { config } from '@/config'\nimport { logger, remove } from '@/utils'\n\nconst TAG = 'SoundManager'\nexport const VOLUME = 0.5\n\nconst SOUND_ALIAS_PREFIX = 'live2d-sound-'\n\nlet soundId = 0\nlet pixiSoundPromise: Promise<SoundLibrary | null> | undefined\nconst configuredLibraries = new WeakSet<SoundLibrary>()\n\nfunction configureSoundLibrary(library: SoundLibrary): SoundLibrary {\n if (!configuredLibraries.has(library)) {\n try {\n library.disableAutoPause = true\n } catch (e) {\n logger.warn(TAG, 'Failed to disable @pixi/sound auto pause.', e)\n }\n\n configuredLibraries.add(library)\n }\n\n return library\n}\n\nfunction getGlobalSoundLibrary(): SoundLibrary | undefined {\n return typeof PIXI !== 'undefined' ? PIXI?.sound : undefined\n}\n\nasync function resolveSoundLibrary(): Promise<SoundLibrary | null> {\n const globalLibrary = getGlobalSoundLibrary()\n\n if (globalLibrary) {\n return configureSoundLibrary(globalLibrary)\n }\n\n pixiSoundPromise ??= import('@pixi/sound')\n .then(({ sound }) => configureSoundLibrary(sound))\n .catch((e: unknown) => {\n logger.warn(\n TAG,\n '@pixi/sound is not available. Load pixi-sound.js before using motion sounds, speak(), or lip sync.',\n e\n )\n\n return null\n })\n\n return pixiSoundPromise\n}\n\nfunction removeSound(library: SoundLibrary, alias: string): void {\n try {\n library.remove(alias)\n } catch (e) {\n logger.warn(TAG, `Failed to remove sound \"${alias}\".`, e)\n }\n}\n\nfunction destroySound(audio: Sound): void {\n try {\n audio.destroy()\n } catch (e) {\n logger.warn(TAG, 'Failed to destroy audio.', e)\n }\n}\n\nfunction getAudioBuffer(audio: Sound): AudioBuffer | undefined {\n const media = audio.media as { buffer?: unknown }\n const buffer = media.buffer\n\n if (!buffer || typeof buffer !== 'object') {\n return undefined\n }\n\n const candidate = buffer as Partial<AudioBuffer>\n\n return typeof candidate.getChannelData === 'function' ? (buffer as AudioBuffer) : undefined\n}\n\n/**\n * Manages all the sounds.\n */\nexport class SoundManager {\n /**\n * Audio elements playing or pending to play. Finished audios will be removed automatically.\n */\n static audios: Sound[] = []\n static analysers: AnalyserNode[] = []\n static contexts: AudioContext[] = []\n protected static aliases = new WeakMap<Sound, { alias: string; library: SoundLibrary }>()\n\n protected static _volume = VOLUME\n\n /**\n * Global volume that applies to all the sounds.\n */\n static get volume(): number {\n return SoundManager._volume\n }\n\n static set volume(value: number) {\n SoundManager._volume = (value > 1 ? 1 : value < 0 ? 0 : value) || 0\n SoundManager.audios.forEach(audio => {\n audio.volume = SoundManager._volume\n })\n }\n\n // TODO: return an ID?\n /**\n * Creates an audio element and adds it to the {@link audios}.\n * @param file - URL of the sound file.\n * @param onError - Callback invoked when error occurs.\n * @return Created audio element.\n */\n static async add(file: string, onError?: (e: Error) => void): Promise<Sound | null> {\n let library: SoundLibrary | null = null\n let alias: string | undefined\n\n try {\n library = await resolveSoundLibrary()\n\n if (!library) {\n throw new Error('@pixi/sound is not available')\n }\n\n alias = `${SOUND_ALIAS_PREFIX}${soundId++}`\n const soundLibrary = library\n const soundAlias = alias\n\n const task = new Promise<Sound>((resolve, reject) => {\n const audio = soundLibrary.add(soundAlias, {\n url: file,\n volume: SoundManager._volume,\n preload: true,\n loaded: (error, loadedAudio) => {\n if (error) {\n reject(error)\n return\n }\n\n const sound = loadedAudio ?? audio\n\n if (!sound) {\n reject(new Error(`Error: ${file} failed to load`))\n return\n }\n\n if (!getAudioBuffer(sound)) {\n reject(new Error(`Error: ${file} is not WebAudioMedia`))\n return\n }\n\n resolve(sound)\n },\n })\n })\n\n const audio = await task\n\n SoundManager.aliases.set(audio, { alias: soundAlias, library: soundLibrary })\n SoundManager.audios.push(audio)\n\n return audio\n } catch (e) {\n if (library && alias) {\n removeSound(library, alias)\n }\n\n logger.warn(TAG, `Error occurred on \"${file}\"`, e)\n onError?.(e as Error)\n return null\n }\n }\n\n /**\n * Plays the sound.\n * @param audio - An audio element.\n * @param onFinish - Callback invoked when the playback has finished.\n */\n static play(audio: Sound, onFinish?: () => void): void {\n void audio.play({\n singleInstance: true,\n complete: () => {\n onFinish?.()\n SoundManager.dispose(audio)\n },\n })\n }\n\n static addAnalyzer(audio: Sound, context: AudioContext): AnalyserNode | undefined {\n const buffer = getAudioBuffer(audio)\n\n if (!buffer) {\n logger.warn(TAG, 'Cannot create audio analyzer because WebAudio media is unavailable.')\n return undefined\n }\n\n /* Create an AnalyserNode */\n const source = context.createBufferSource()\n\n source.buffer = buffer\n\n const analyser = context.createAnalyser()\n\n analyser.fftSize = config.fftSize\n analyser.minDecibels = -90\n analyser.maxDecibels = -10\n analyser.smoothingTimeConstant = 0.85\n\n source.connect(analyser)\n source.start(0)\n\n SoundManager.analysers.push(analyser)\n return analyser\n }\n\n /**\n * Get volume for lip sync\n * @param analyser - An analyzer element.\n * @return Returns value to feed into lip sync\n */\n static analyze(analyser?: AnalyserNode): number {\n if (!analyser) return parseFloat(Math.random().toFixed(1))\n\n const buffer = new Float32Array(analyser.fftSize)\n analyser.getFloatTimeDomainData(buffer)\n\n let sumSquares = 0\n for (let i = 0; i < buffer.length; i++) {\n sumSquares += buffer[i]! ** 2\n }\n const rms = Math.sqrt(sumSquares / buffer.length)\n\n const minDecibel = -100\n const db = 20 * Math.log10(rms || 10 ** (minDecibel / 20))\n\n const scaledDb = Math.min(\n Math.max((db - analyser.minDecibels) / (analyser.maxDecibels - analyser.minDecibels), 0),\n 1\n )\n\n return parseFloat(scaledDb.toFixed(1))\n }\n\n /**\n * Disposes an audio element and removes it from {@link audios}.\n * @param audio - An audio element.\n */\n static dispose(audio: Sound): void {\n try {\n audio.pause()\n } catch (e) {\n logger.warn(TAG, 'Failed to pause audio.', e)\n }\n\n const managedSound = SoundManager.aliases.get(audio)\n\n if (managedSound) {\n removeSound(managedSound.library, managedSound.alias)\n SoundManager.aliases.delete(audio)\n } else {\n destroySound(audio)\n }\n\n remove(SoundManager.audios, audio)\n }\n\n /**\n * Destroys all managed audios.\n */\n static destroy(): void {\n // dispose() removes given audio from the array, so the loop must be backward\n for (let i = SoundManager.contexts.length - 1; i >= 0; i--) {\n const context = SoundManager.contexts[i]\n void context?.close().catch((e: unknown) => {\n logger.warn(TAG, 'Failed to close AudioContext.', e)\n })\n }\n\n for (let i = SoundManager.audios.length - 1; i >= 0; i--) {\n SoundManager.dispose(SoundManager.audios[i]!)\n }\n }\n}\n","import type { Sound } from '@pixi/sound'\nimport { EventEmitter } from 'pixi.js'\n\nimport type { ExpressionManager } from '@/cubism-common/ExpressionManager'\nimport type { InternalModel } from '@/cubism-common/InternalModel'\nimport type { ModelSettings } from '@/cubism-common/ModelSettings'\nimport type { JSONObject, Mutable } from '@/types/helpers'\n\nimport { config } from '@/config'\nimport { MotionPriority, MotionState } from '@/cubism-common/MotionState'\nimport { SoundManager, VOLUME } from '@/cubism-common/SoundManager'\nimport { logger } from '@/utils'\n\nexport interface MotionManagerOptions {\n /**\n * How to preload the motions.\n * @default {@link MotionPreloadStrategy.NONE}\n */\n motionPreload?: MotionPreloadStrategy\n\n /**\n * Specifies the idle motion group.\n * @default \"idle\" in Cubism 2 and \"Idle\" in Cubism 4.\n */\n idleMotionGroup?: string\n\n /**\n * Whether to validate motion3.json consistency when creating motions.\n * @default false\n */\n checkMotionConsistency?: boolean\n}\n\nexport interface MotionStartOptions {\n sound?: string\n volume?: number\n expression?: number | string\n resetExpression?: boolean\n onFinish?: () => void\n onError?: (e: Error) => void\n ignoreParamIds?: string[]\n /**\n * Whether the motion should loop. Overrides Cubism 3/4/5 motion JSON loop metadata when specified.\n */\n loop?: boolean\n}\n\nexport type MotionStartRandomOptions = Omit<MotionStartOptions, 'ignoreParamIds'>\n\n/**\n * Indicates how the motions will be preloaded.\n */\nexport enum MotionPreloadStrategy {\n /** Preload all the motions. */\n ALL = 'ALL',\n\n /** Preload only the idle motions. */\n IDLE = 'IDLE',\n\n /** No preload. */\n NONE = 'NONE',\n}\n\n/**\n * Handles the motion playback for Live2D models.\n * Responsible for loading, playing, and managing motion states and audio.\n * @emits {@link MotionManagerEvents}\n */\nexport abstract class MotionManager<Motion = unknown, MotionSpec = unknown> extends EventEmitter {\n /**\n * Tag for logging.\n * @type {string}\n */\n tag: string\n\n // noinspection JSValidateJSDoc\n /**\n * Motion definitions copied from ModelSettings.\n * @type {Partial<Record<string, MotionSpec[]>>}\n * @abstract\n */\n abstract readonly definitions: Partial<Record<string, MotionSpec[]>>\n\n /**\n * Motion groups with specific internal usages. Includes at least the 'idle' field.\n * @type {{ idle: string }}\n * @abstract\n */\n abstract readonly groups: { idle: string }\n\n /**\n * Indicates the content type of the motion files, varies in different Cubism versions.\n * Used as `xhr.responseType`.\n * @type {'json' | 'arraybuffer'}\n * @abstract\n */\n abstract readonly motionDataType: 'json' | 'arraybuffer'\n\n /**\n * Expression manager for handling model expressions.\n * Can be undefined if the settings define no expression.\n * @type {ExpressionManager | undefined}\n * @abstract\n */\n abstract expressionManager?: ExpressionManager\n\n /**\n * The ModelSettings reference.\n * @type {ModelSettings}\n */\n readonly settings: ModelSettings\n\n /**\n * The Motions. The structure is the same as {@link definitions}, initially each group contains\n * an empty array, which means all motions will be `undefined`. When a Motion has been loaded,\n * it'll fill the place in which it should be; when it fails to load, the place will be filled\n * with `null`.\n * @type {Partial<Record<string, (Motion | undefined | null)[]>>}\n */\n motionGroups: Partial<Record<string, (Motion | undefined | null)[]>> = {}\n\n /**\n * Maintains the state of this MotionManager.\n * @type {MotionState}\n */\n state: MotionState = new MotionState()\n\n /**\n * Audio element of the current motion if a sound file is defined with it.\n * @type {Sound | undefined}\n */\n currentAudio?: Sound\n\n /**\n * Analyzer element for the current sound being played.\n * @type {AnalyserNode | undefined}\n */\n currentAnalyzer?: AnalyserNode\n\n /**\n * Context element for the current sound being played.\n * @type {AudioContext | undefined}\n */\n currentContext?: AudioContext\n\n /**\n * Flags whether there is a motion currently playing.\n * @type {boolean}\n */\n playing: boolean = false\n\n /**\n * Flags whether the instance has been destroyed.\n * @type {boolean}\n */\n destroyed: boolean = false\n\n /**\n * Reference to the parent InternalModel.\n * @type {InternalModel}\n */\n parent: InternalModel\n\n /**\n * Constructor for MotionManager.\n * @param parent - The parent InternalModel.\n */\n protected constructor(parent: InternalModel) {\n super()\n this.settings = parent.settings\n this.tag = `MotionManager(${this.settings.name})`\n this.state.tag = this.tag\n this.parent = parent\n }\n\n /**\n * Should be called in the constructor of derived class to initialize options and setup motions.\n * @param options - Initialization options for the manager.\n */\n protected init(options?: MotionManagerOptions) {\n if (options?.idleMotionGroup) {\n this.groups.idle = options.idleMotionGroup\n }\n\n this.setupMotions(options)\n this.stopAllMotions()\n }\n\n /**\n * Sets up motions from the definitions, and preloads them according to the preload strategy.\n * @param options - Options controlling which motions to preload.\n */\n protected setupMotions(options?: MotionManagerOptions): void {\n if (!this.definitions) {\n logger.warn(this.tag, 'Motion definitions are not initialized.')\n return\n }\n\n for (const group of Object.keys(this.definitions)) {\n // init with the same structure of definitions\n this.motionGroups[group] = []\n }\n\n // preload motions\n\n let groups: string[]\n\n switch (options?.motionPreload) {\n case MotionPreloadStrategy.NONE:\n return\n\n case MotionPreloadStrategy.ALL:\n groups = Object.keys(this.definitions)\n break\n\n default:\n groups = [this.groups.idle]\n break\n }\n\n for (const group of groups) {\n const definitions = this.definitions[group]\n if (definitions) {\n for (let i = 0; i < definitions.length; i++) {\n void this.loadMotion(group, i)\n }\n }\n }\n }\n\n /**\n * Loads a Motion in a motion group. Errors in this method will not be thrown,\n * but be emitted with a \"motionLoadError\" event.\n * @param group - The motion group.\n * @param index - Index in the motion group.\n * @return Promise that resolves with the Motion, or with undefined if it can't be loaded.\n * @emits {@link MotionManagerEvents.motionLoaded}\n * @emits {@link MotionManagerEvents.motionLoadError}\n */\n async loadMotion(group: string, index: number): Promise<Motion | undefined> {\n if (this.destroyed) {\n return undefined\n }\n\n const definition = this.getMotionDefinition(group, index)\n\n if (!definition) {\n return undefined\n }\n\n let groupMotions = this.motionGroups[group]\n if (!groupMotions) {\n groupMotions = []\n this.motionGroups[group] = groupMotions\n }\n\n if (groupMotions[index] === null) {\n logger.warn(this.tag, `Cannot start motion at \"${group}\"[${index}] because it's already failed in loading.`)\n return undefined\n }\n\n if (groupMotions[index]) {\n return groupMotions[index]\n }\n\n const motion = await this._loadMotion(group, index)\n\n if (this.destroyed) {\n return\n }\n\n groupMotions[index] = motion ?? null\n\n return motion\n }\n\n /**\n * Loads the Motion. Will be implemented by Live2DFactory in order to avoid circular dependency.\n * @ignore\n */\n private _loadMotion(_group: string, _index: number): Promise<Motion | undefined> {\n throw new Error('Not implemented.')\n }\n\n /**\n * Initializes audio playback and sets up audio analysis for lipsync.\n * @param audio - The Sound to initialize.\n * @param volume - The playback volume (0-1).\n */\n protected initializeAudio(audio: Sound, volume: number) {\n this.currentAudio = audio!\n SoundManager.volume = volume\n\n this.currentContext = audio.context.audioContext\n\n this.currentAnalyzer = SoundManager.addAnalyzer(this.currentAudio, this.currentContext)\n }\n\n /**\n * Only play sound with lip sync.\n * @param sound - The audio url or base64 content.\n * @param volume - Volume of the sound (0-1).\n * @param expression - Expression to apply while playing sound.\n * @param resetExpression - Whether to reset the expression before and after playing sound (default: true).\n * @param crossOrigin - Cross origin setting.\n * @param onFinish - Callback when playback finishes.\n * @param onError - Callback when playback errors.\n * @returns Promise that resolves with true if the sound is playing, false otherwise.\n */\n async speak(\n sound: string,\n {\n volume = VOLUME,\n expression,\n resetExpression = true,\n onFinish,\n onError,\n }: {\n volume?: number\n expression?: number | string\n resetExpression?: boolean\n onFinish?: () => void\n onError?: (e: Error) => void\n } = {}\n ): Promise<boolean> {\n if (!config.sound) {\n return false\n }\n\n let audio: Sound | null | undefined\n\n if (this.currentAudio) {\n if (this.currentAudio.isPlaying) {\n return false\n }\n }\n\n let soundURL: string | undefined\n const isBase64Content = sound?.startsWith('data:')\n\n if (sound && !isBase64Content) {\n const A = document.createElement('a')\n A.href = sound\n sound = A.href // This should be the absolute url\n soundURL = sound\n } else {\n soundURL = 'data:audio/' // Dummy url for base64\n }\n const file: string | undefined = sound\n if (file) {\n try {\n audio = await SoundManager.add(file, (e, that = this) => {\n logger.error(this.tag, 'Error during audio playback:', e)\n onError?.(e)\n if (resetExpression && expression && that.expressionManager) {\n that.expressionManager.resetExpression()\n }\n that.currentAudio = undefined\n })\n\n if (!audio) {\n return false\n }\n\n this.initializeAudio(audio, volume)\n } catch (e) {\n logger.warn(this.tag, 'Failed to create audio', soundURL, e)\n return false\n }\n }\n\n if (audio) {\n let playSuccess = true\n try {\n if (config.motionSync) {\n SoundManager.play(audio, () => {\n onFinish?.()\n if (resetExpression && expression && this.expressionManager) {\n this.expressionManager.resetExpression()\n }\n this.currentAudio = undefined\n })\n }\n } catch (e) {\n logger.warn(this.tag, 'Failed to play audio', audio.url, e)\n playSuccess = false\n }\n\n if (!playSuccess) {\n return false\n }\n }\n\n if (this.state.shouldOverrideExpression()) {\n if (this.expressionManager) this.expressionManager.resetExpression()\n }\n if (expression && this.expressionManager) {\n await this.expressionManager.setExpression(expression)\n }\n\n this.playing = true\n\n return true\n }\n\n /**\n * Starts a motion with the given priority.\n * @param group - The motion group.\n * @param index - Index in the motion group.\n * @param priority - The priority to be applied. Default: NORMAL (2).\n * @param sound - The audio url or base64 content.\n * @param volume - Volume of the sound (0-1).\n * @param expression - Expression to apply while playing sound.\n * @param resetExpression - Whether to reset the expression before and after playing sound (default: true).\n * @param crossOrigin - Cross origin setting.\n * @param onFinish - Callback when playback finishes.\n * @param onError - Callback when playback errors.\n * @param ignoreParamIds - The ids to be ignored.\n * @param loop - Whether the motion should loop. Overrides Cubism 3/4/5 motion JSON loop metadata when specified.\n * @return Promise that resolves with true if the motion is successfully started, false otherwise.\n */\n async startMotion(\n group: string,\n index: number,\n priority = MotionPriority.NORMAL,\n {\n sound = undefined,\n volume = VOLUME,\n expression = undefined,\n resetExpression = true,\n onFinish,\n onError,\n ignoreParamIds = [],\n loop = undefined,\n }: MotionStartOptions = {}\n ): Promise<boolean> {\n if (this.destroyed) {\n return false\n }\n\n if (!this.state.reserve(group, index, priority)) {\n return false\n }\n // Does not start a new motion if audio is still playing\n if (this.currentAudio) {\n if (this.currentAudio.isPlaying && priority !== MotionPriority.FORCE) {\n return false\n }\n }\n\n const definition = this.getMotionDefinition(group, index)\n\n if (!definition) {\n return false\n }\n\n if (this.currentAudio) {\n // TODO: reuse the audio?\n SoundManager.dispose(this.currentAudio)\n }\n\n let audio: Sound | null | undefined\n\n let soundURL: string | undefined\n const isBase64Content = sound?.startsWith('data:')\n\n if (sound && !isBase64Content) {\n const A = document.createElement('a')\n A.href = sound\n sound = A.href // This should be the absolute url\n soundURL = sound\n } else {\n soundURL = this.getSoundFile(definition)\n if (soundURL) {\n soundURL = this.settings.resolveURL(soundURL)\n }\n }\n const file: string | undefined = soundURL\n\n if (file) {\n try {\n audio = await SoundManager.add(file, (e, that = this) => {\n logger.error(this.tag, 'Error during audio playback:', e)\n onError?.(e)\n if (resetExpression && expression && that.expressionManager) {\n that.expressionManager.resetExpression()\n }\n that.currentAudio = undefined\n })\n\n if (audio) {\n this.initializeAudio(audio, volume)\n }\n } catch (e) {\n logger.warn(this.tag, 'Failed to create audio', soundURL, e)\n }\n }\n\n const motion = await this.loadMotion(group, index)\n\n if (audio) {\n if (config.motionSync) {\n try {\n SoundManager.play(audio, (that = this) => {\n onFinish?.()\n if (resetExpression && expression && that.expressionManager) {\n that.expressionManager.resetExpression()\n }\n that.currentAudio = undefined\n })\n } catch (e) {\n logger.warn(this.tag, 'Failed to play audio', audio.url, e)\n }\n }\n }\n\n if (!this.state.start(motion, group, index, priority)) {\n if (audio) {\n SoundManager.dispose(audio)\n this.currentAudio = undefined\n }\n\n return false\n }\n\n if (this.state.shouldOverrideExpression()) {\n if (this.expressionManager) this.expressionManager.resetExpression()\n }\n\n logger.log(this.tag, 'Start motion:', this.getMotionName(definition))\n\n this.emit('motionStart', group, index, audio)\n\n if (expression && this.expressionManager && this.state.shouldOverrideExpression()) {\n await this.expressionManager.setExpression(expression)\n }\n\n this.playing = true\n\n if (motion) {\n this._startMotion(motion, undefined, ignoreParamIds, loop)\n }\n\n return true\n }\n\n /**\n * Starts a random Motion as given priority.\n * @param group - The motion group.\n * @param priority - The priority to be applied. Default: IDLE (1).\n * @param sound - The audio url or base64 content.\n * @param volume - Volume of the sound (0-1).\n * @param expression - Expression to apply while playing sound.\n * @param resetExpression - Whether to reset the expression before and after playing sound (default: true).\n * @param crossOrigin - Cross origin setting.\n * @param onFinish - Callback when playback finishes.\n * @param onError - Callback when playback errors.\n * @param loop - Whether the motion should loop. Overrides Cubism 3/4/5 motion JSON loop metadata when specified.\n * @return Promise that resolves with true if the motion is successfully started, false otherwise.\n */\n async startRandomMotion(\n group: string,\n priority?: MotionPriority,\n {\n sound,\n volume = VOLUME,\n expression,\n resetExpression = true,\n onFinish,\n onError,\n loop = undefined,\n }: MotionStartRandomOptions = {}\n ): Promise<boolean> {\n if (this.destroyed) {\n return false\n }\n\n const groupDefs = this.definitions?.[group]\n\n if (groupDefs?.length) {\n const availableIndices: number[] = []\n const groupMotions = this.motionGroups[group] ?? []\n\n for (let i = 0; i < groupDefs.length; i++) {\n if (groupMotions[i] !== null && !this.state.isActive(group, i)) {\n availableIndices.push(i)\n }\n }\n\n if (availableIndices.length) {\n const index = availableIndices[Math.floor(Math.random() * availableIndices.length)]!\n\n return this.startMotion(group, index, priority, {\n sound: sound,\n volume: volume,\n expression: expression,\n resetExpression: resetExpression,\n onFinish: onFinish,\n onError: onError,\n loop: loop,\n })\n }\n }\n\n return false\n }\n\n /**\n * Stops current audio playback and lipsync.\n */\n stopSpeaking(): void {\n if (this.currentAudio) {\n SoundManager.dispose(this.currentAudio)\n this.currentAudio = undefined\n }\n }\n\n /**\n * Stops all playing motions as well as the sound.\n */\n stopAllMotions(): void {\n this._stopAllMotions()\n\n this.state.reset()\n\n this.stopSpeaking()\n }\n\n /**\n * Updates parameters of the core model.\n * @param model - The core model.\n * @param now - Current time in milliseconds.\n * @return True if the parameters have been actually updated.\n */\n update(model: object, now: DOMHighResTimeStamp): boolean {\n if (this.isFinished()) {\n if (this.playing) {\n this.playing = false\n this.emit('motionFinish')\n }\n\n if (this.state.shouldOverrideExpression()) {\n this.expressionManager?.restoreExpression()\n }\n\n this.state.complete()\n\n if (this.state.shouldRequestIdleMotion()) {\n void this.startRandomMotion(this.groups.idle, MotionPriority.IDLE)\n }\n }\n\n return this.updateParameters(model, now)\n }\n\n /**\n * Move the mouth for lipsync.\n * @returns The current lipsync value.\n */\n mouthSync(): number {\n if (this.currentAnalyzer) {\n return SoundManager.analyze(this.currentAnalyzer)\n } else {\n return 0\n }\n }\n\n /**\n * Destroys the instance and releases all resources.\n * @emits {@link MotionManagerEvents.destroy}\n */\n destroy() {\n this.destroyed = true\n this.emit('destroy')\n\n this.stopAllMotions()\n this.expressionManager?.destroy()\n\n const self = this as Mutable<Partial<this>>\n self.definitions = undefined\n self.motionGroups = undefined\n }\n\n /**\n * Checks if the motion playback has finished.\n * @abstract\n */\n abstract isFinished(): boolean\n\n /**\n * Creates a Motion from the data.\n * @param data - Content of the motion file. The format must be consistent with {@link MotionManager#motionDataType}.\n * @param group - The motion group.\n * @param definition - The motion definition.\n * @returns The created Motion.\n * @abstract\n */\n abstract createMotion(data: ArrayBuffer | JSONObject, group: string, definition: MotionSpec): Motion\n\n /**\n * Retrieves the motion's file path by its definition.\n * @param definition - Motion definition.\n * @returns The file path extracted from the given definition. Not resolved.\n * @abstract\n */\n abstract getMotionFile(definition: MotionSpec): string\n\n /**\n * Retrieves the motion's name by its definition.\n * @param definition - Motion definition.\n * @returns The motion's name.\n * @protected\n * @abstract\n */\n protected abstract getMotionName(definition: MotionSpec): string\n\n /**\n * Retrieves the motion's sound file by its definition.\n * @param definition - Motion definition.\n * @returns The motion's sound file, or undefined.\n * @protected\n * @abstract\n */\n protected abstract getSoundFile(definition: MotionSpec): string | undefined\n\n /**\n * Starts the Motion.\n * @param motion - The Motion to start.\n * @param onFinish - Optional callback when finished.\n * @param ignoreParamIds - The ids to be ignored.\n * @param loop - Whether the motion should loop.\n * @returns An ID or token for the motion.\n * @protected\n * @abstract\n */\n protected abstract _startMotion(\n motion: Motion,\n onFinish?: (motion: Motion) => void,\n ignoreParamIds?: string[],\n loop?: boolean\n ): number\n\n /**\n * Stops all playing motions.\n * @protected\n * @abstract\n */\n protected abstract _stopAllMotions(): void\n\n /**\n * Updates parameters of the core model.\n * @param model - The core model.\n * @param now - Current time in milliseconds.\n * @return True if the parameters have been actually updated.\n * @protected\n * @abstract\n */\n protected abstract updateParameters(model: object, now: DOMHighResTimeStamp): boolean\n\n /**\n * Loads a motion and applies the given expression with FORCE priority.\n * @param group - The motion group.\n * @param index - The motion index.\n * @param expression - Expression to apply (optional).\n * @returns The loaded motion, or null if not started.\n * @protected\n */\n protected async getMotionAndApplyExpression(\n group: string,\n index: number,\n expression?: number | string\n ): Promise<unknown> {\n if (this.destroyed) {\n return null\n }\n\n if (!this.state.reserve(group, index, MotionPriority.FORCE)) {\n return null\n }\n\n const definition = this.getMotionDefinition(group, index)\n\n if (!definition) {\n return null\n }\n\n if (this.currentAudio) {\n SoundManager.dispose(this.currentAudio)\n }\n\n const motion = await this.loadMotion(group, index)\n\n if (!this.state.start(motion, group, index, MotionPriority.FORCE)) {\n return null\n }\n\n if (this.state.shouldOverrideExpression()) {\n if (this.expressionManager) this.expressionManager.resetExpression()\n }\n\n logger.log(this.tag, 'Start motion:', this.getMotionName(definition))\n\n this.emit('motionStart', group, index, undefined)\n\n if (expression && this.expressionManager && this.state.shouldOverrideExpression()) {\n await this.expressionManager.setExpression(expression)\n }\n\n return motion\n }\n\n /**\n * Play the last frame of the given motion, optionally applying an expression.\n * @param group - Motion group.\n * @param index - Motion index.\n * @param expression - Expression to apply (optional).\n * @returns Promise resolving to true if successful.\n * @abstract\n */\n abstract motionLastFrame(\n group: string,\n index: number,\n {\n expression,\n }: {\n expression?: number | string\n }\n ): Promise<boolean>\n\n private getMotionDefinition(group: string, index: number): MotionSpec | undefined {\n const definition = this.definitions?.[group]?.[index]\n\n if (!definition) {\n logger.warn(this.tag, `Undefined motion at \"${group}\"[${index}]`)\n }\n\n return definition\n }\n}\n","import type { InternalModel, ModelSettings } from '@/cubism-common'\nimport type { Live2DFactoryContext } from '@/factory'\nimport type { JSONObject } from '@/types/helpers'\nimport type { Middleware } from '@/utils/middleware'\n\nimport { Live2DFactory } from '@/factory'\nimport { resolveURL } from '@/utils'\n\ndeclare global {\n interface File {\n readonly webkitRelativePath: string\n }\n}\n\ndeclare module '@/cubism-common/ModelSettings' {\n interface ModelSettings {\n /** @ignore */\n _objectURL?: string\n }\n}\n\nexport type ExtendedFileList = File[] & { settings?: ModelSettings }\n\n/**\n * Experimental loader to load resources from uploaded files.\n *\n * This loader relies on\n * [webkitRelativePath](https://developer.mozilla.org/en-US/docs/Web/API/File/webkitRelativePath)\n * to recognize the file path.\n *\n * Though named as a \"Loader\", this class has nothing to do with Live2DLoader,\n * it only contains a middleware for the Live2DFactory.\n */\nexport class FileLoader {\n // will be set by Live2DFactory\n static live2dFactory?: typeof Live2DFactory\n\n /**\n * Stores all the object URLs of uploaded files.\n */\n static filesMap: {\n [settingsFileURL: string]: {\n [resourceFileURL: string]: string\n }\n } = {}\n\n /**\n * Resolves the path of a resource file to the object URL.\n * @param settingsURL - Object URL of the settings file.\n * @param filePath - Resource file path.\n * @return Resolved object URL.\n */\n static resolveURL(settingsURL: string, filePath: string): string {\n const resolved = FileLoader.filesMap[settingsURL]?.[filePath]\n\n if (resolved === undefined) {\n throw new Error(`Cannot find this file from uploaded files: ${filePath}`)\n }\n\n return resolved\n }\n\n /**\n * Middleware for Live2DFactory.\n */\n static factory: Middleware<Live2DFactoryContext> = async (context, next) => {\n if (Array.isArray(context.source) && context.source[0] instanceof File) {\n const files = context.source as File[]\n\n let settings = (files as ExtendedFileList).settings\n\n if (!settings) {\n settings = await FileLoader.createSettings(files)\n } else if (!settings._objectURL) {\n throw new Error('\"_objectURL\" must be specified in ModelSettings')\n }\n\n settings.validateFiles(files.map(file => encodeURI(file.webkitRelativePath)))\n\n FileLoader.upload(files, settings)\n\n // override the default method to resolve URL from uploaded files\n settings.resolveURL = function (url) {\n return FileLoader.resolveURL(this._objectURL!, url)\n }\n\n context.source = settings\n\n // clean up when destroying the model\n context.live2dModel.once('modelLoaded', (internalModel: InternalModel) => {\n internalModel.once('destroy', function (this: InternalModel) {\n const objectURL = this.settings._objectURL!\n\n URL.revokeObjectURL(objectURL)\n\n if (FileLoader.filesMap[objectURL]) {\n for (const resourceObjectURL of Object.values(FileLoader.filesMap[objectURL])) {\n URL.revokeObjectURL(resourceObjectURL)\n }\n }\n\n delete FileLoader.filesMap[objectURL]\n })\n })\n }\n\n return next()\n }\n\n /**\n * Consumes the files by storing their object URLs. Files not defined in the settings will be ignored.\n */\n static upload(files: File[], settings: ModelSettings): void {\n const fileMap: Record<string, string> = {}\n\n // only consume the files defined in settings\n for (const definedFile of settings.getDefinedFiles()) {\n const actualPath = decodeURI(resolveURL(settings.url, definedFile))\n\n const actualFile = files.find(file => file.webkitRelativePath === actualPath)\n\n if (actualFile) {\n fileMap[definedFile] = URL.createObjectURL(actualFile)\n }\n }\n\n FileLoader.filesMap[settings._objectURL!] = fileMap\n }\n\n /**\n * Creates a ModelSettings by given files.\n * @return Promise that resolves with the created ModelSettings.\n */\n static async createSettings(files: File[]): Promise<ModelSettings> {\n const settingsFile = files.find(file => file.name.endsWith('model.json') || file.name.endsWith('model3.json'))\n\n if (!settingsFile) {\n throw new TypeError('Settings file not found')\n }\n\n const settingsText = await FileLoader.readText(settingsFile)\n const settingsJSON = JSON.parse(settingsText) as JSONObject & { url?: string }\n\n settingsJSON.url = settingsFile.webkitRelativePath\n\n const runtime = Live2DFactory.findRuntime(settingsJSON)\n\n if (!runtime) {\n throw new Error('Unknown settings JSON')\n }\n\n const settings = runtime.createModelSettings(settingsJSON)\n\n settings._objectURL = URL.createObjectURL(settingsFile)\n\n return settings\n }\n\n /**\n * Reads a file as text in UTF-8.\n */\n static async readText(file: File): Promise<string> {\n return new Promise<string>((resolve, reject) => {\n const reader = new FileReader()\n\n reader.onload = () => resolve(reader.result as string)\n reader.onerror = reject\n reader.readAsText(file, 'utf8')\n })\n }\n}\n","export type Middleware<T> = (context: T, next: (err?: Error | null) => Promise<void>) => Promise<void>\n\n/**\n * Run middlewares with given context.\n * @see https://github.com/koajs/compose/blob/master/index.js\n *\n * @param middleware\n * @param context\n */\nexport function runMiddlewares<T>(middleware: Middleware<T>[], context: T): Promise<void> {\n // last called middleware #\n let index = -1\n return dispatch(0)\n\n function dispatch(i: number, err?: Error | null): Promise<void> {\n if (err) return Promise.reject(err)\n if (i <= index) return Promise.reject(new Error('next() called multiple times'))\n index = i\n const fn = middleware[i]\n if (!fn) return Promise.resolve()\n try {\n return Promise.resolve(fn(context, dispatch.bind(null, i + 1)))\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err))\n return Promise.reject(error)\n }\n }\n}\n","import type { Live2DLoaderContext, Live2DLoaderTarget } from '@/factory/Live2DLoader'\nimport type { Middleware } from '@/utils/middleware'\n\nimport { logger } from '@/utils'\n\nconst TAG = 'XHRLoader'\n\nclass NetworkError extends Error {\n constructor(\n message: string,\n public url: string,\n public status: number,\n public aborted = false\n ) {\n super(message)\n }\n}\n\n/**\n * The basic XHR loader.\n *\n * A network error will be thrown with the following properties:\n * - `url` - The request URL.\n * - `status` - The HTTP status.\n * - `aborted` - True if the error is caused by aborting the XHR.\n */\nexport class XHRLoader {\n /**\n * All the created XHRs, keyed by their owners respectively.\n */\n static xhrMap = new WeakMap<Live2DLoaderTarget, Set<XMLHttpRequest>>()\n\n /**\n * All the created XHRs as a flat array.\n */\n static allXhrSet = new Set<XMLHttpRequest>()\n\n /**\n * Middleware for Live2DLoader.\n */\n static loader: Middleware<Live2DLoaderContext> = context => {\n return new Promise<void>((resolve, reject) => {\n const targetWithEvents = context.target as unknown as {\n listeners?: (event: string) => unknown[]\n once?: (event: string, cb: () => void) => void\n }\n const cancelListener =\n context.target && typeof XHRLoader.cancelXHRs === 'function'\n ? XHRLoader.cancelXHRs.bind(context.target)\n : undefined\n const xhr = XHRLoader.createXHR(\n context.target,\n context.settings ? context.settings.resolveURL(context.url) : context.url,\n context.type,\n data => {\n context.result = data\n resolve()\n },\n reject\n )\n\n if (context.target && cancelListener) {\n if (typeof targetWithEvents.listeners === 'function' && typeof targetWithEvents.once === 'function') {\n const listeners = targetWithEvents.listeners('destroy')\n if (!Array.isArray(listeners) || !listeners.includes(cancelListener)) {\n targetWithEvents.once('destroy', cancelListener)\n }\n }\n }\n xhr.send()\n })\n }\n\n /**\n * Creates a managed XHR.\n * @param target - If provided, the XHR will be canceled when receiving an \"destroy\" event from the target.\n * @param url - The URL.\n * @param type - The XHR response type.\n * @param onload - Load listener.\n * @param onerror - Error handler.\n */\n static createXHR<T = unknown>(\n target: Live2DLoaderTarget | undefined,\n url: string,\n type: XMLHttpRequestResponseType,\n onload: (data: T) => void,\n onerror: (e: Error) => void\n ): XMLHttpRequest {\n const xhr = new XMLHttpRequest()\n\n XHRLoader.allXhrSet.add(xhr)\n\n if (target) {\n let xhrSet = XHRLoader.xhrMap.get(target)\n\n if (!xhrSet) {\n xhrSet = new Set([xhr])\n XHRLoader.xhrMap.set(target, xhrSet)\n } else {\n xhrSet.add(xhr)\n }\n }\n\n xhr.open('GET', url)\n xhr.responseType = type\n xhr.onload = () => {\n if ((xhr.status === 200 || xhr.status === 0) && xhr.response) {\n onload(xhr.response as T)\n } else {\n xhr.onerror?.(new ProgressEvent('error'))\n }\n }\n xhr.onerror = () => {\n logger.warn(TAG, `Failed to load resource as ${xhr.responseType} (Status ${xhr.status}): ${url}`)\n onerror(new NetworkError('Network error.', url, xhr.status))\n }\n xhr.onabort = () => onerror(new NetworkError('Aborted.', url, xhr.status, true))\n xhr.onloadend = () => {\n XHRLoader.allXhrSet.delete(xhr)\n\n if (target) {\n XHRLoader.xhrMap.get(target)?.delete(xhr)\n }\n }\n\n return xhr\n }\n\n /**\n * Cancels all XHRs related to this target.\n */\n static cancelXHRs(this: Live2DLoaderTarget) {\n // biome-ignore lint/complexity/noThisInStatic: bound-this static — call()'d with the loader target as `this`\n XHRLoader.xhrMap.get(this)?.forEach(xhr => {\n xhr.abort()\n XHRLoader.allXhrSet.delete(xhr)\n })\n // biome-ignore lint/complexity/noThisInStatic: same bound-this contract\n XHRLoader.xhrMap.delete(this)\n }\n\n /**\n * Release all XHRs.\n */\n static release() {\n XHRLoader.allXhrSet.forEach(xhr => {\n xhr.abort()\n })\n XHRLoader.allXhrSet.clear()\n XHRLoader.xhrMap = new WeakMap()\n }\n}\n","import type { ExpressionManager, InternalModel, ModelSettings, MotionManager } from '@/cubism-common'\nimport type { Live2DModel } from '@/Live2DModel'\nimport type { Middleware } from '@/utils/middleware'\n\nimport { runMiddlewares } from '@/utils/middleware'\n\nimport { XHRLoader } from '@/factory/XHRLoader'\n\nexport type Live2DLoaderTarget = Live2DModel | InternalModel | MotionManager | ExpressionManager\n\n/**\n * The context transferred through Live2DLoader middlewares.\n */\nexport interface Live2DLoaderContext {\n /** The XHR's response type. */\n type: XMLHttpRequestResponseType\n\n /** Will be resolved by {@link ModelSettings.resolveURL} if a ModelSettings is provided. */\n url: string\n\n /** If provided, the given URL will be resolved by {@link ModelSettings.resolveURL}. */\n settings?: ModelSettings\n\n /**\n * Owner of this resource. The load task will be automatically canceled\n * when receiving an \"destroy\" event from the target.\n */\n target?: Live2DLoaderTarget\n\n /** Loaded data. */\n result?: unknown\n}\n\nexport class Live2DLoader {\n static middlewares: Middleware<Live2DLoaderContext>[] = [XHRLoader.loader]\n\n /**\n * Loads a resource.\n * @return Promise that resolves with the loaded data in a format that's consistent with the specified `type`.\n */\n static async load<T = unknown>(context: Live2DLoaderContext): Promise<T> {\n await runMiddlewares(Live2DLoader.middlewares, context)\n return context.result as T\n }\n}\n","/**\n * Atlas texture LOD strategy used when loading and rendering Live2D model textures.\n *\n * - `full`: ask Pixi to generate a full mipmap chain for the original atlas.\n * - `single-auto`: keep the original atlas, and render with one generated downsampled\n * atlas when the model is small enough on screen.\n * - `false`: use the original atlas only.\n */\nexport type Live2DTextureLODMode = false | 'full' | 'single-auto'\n\n/**\n * Sampling filter used while generating a `single-auto` downsampled atlas.\n */\nexport type Live2DTextureLODFilter = 'linear' | 'nearest'\n\nexport interface Live2DTextureLODOptions {\n /**\n * Selects the atlas LOD strategy for model textures.\n *\n * `full` is the default and uses Pixi's mipmap generation for the original atlas.\n * `single-auto` creates one downsampled atlas on demand and switches to it while\n * rendering small models. `false` disables both paths.\n *\n * @default 'full'\n */\n lod?: Live2DTextureLODMode\n\n /**\n * Effective screen scale below which `single-auto` can switch to a generated\n * downsampled atlas. The effective scale is computed from model world scale and\n * renderer resolution.\n *\n * Ignored unless `lod` is `'single-auto'`.\n *\n * @default 0.5\n */\n lodScaleThreshold?: number\n\n /**\n * Minimum original atlas side length required before `single-auto` considers\n * generating a downsampled atlas.\n *\n * Ignored unless `lod` is `'single-auto'`.\n *\n * @default 4096\n */\n lodTextureSizeThreshold?: number\n\n /**\n * Maximum generated `single-auto` LOD level. Each level halves the atlas width and\n * height once, so level 1 is 1/2 size and level 2 is 1/4 size.\n *\n * Ignored unless `lod` is `'single-auto'`.\n *\n * @default undefined\n */\n lodMaxLevel?: number\n\n /**\n * Sampling filter used while drawing the generated `single-auto` atlas.\n *\n * Ignored unless `lod` is `'single-auto'`.\n *\n * @default 'linear'\n */\n lodFilter?: Live2DTextureLODFilter\n}\n\nexport interface TextureLODPlanInput extends Live2DTextureLODOptions {\n effectiveScale: number\n textureWidth: number\n textureHeight: number\n}\n\nexport interface TextureLODPlan {\n level: number\n width: number\n height: number\n}\n\nconst DEFAULT_LOD_SCALE_THRESHOLD = 0.5\nconst DEFAULT_LOD_TEXTURE_SIZE_THRESHOLD = 4096\n\nexport function getTextureLODPlan({\n lod,\n effectiveScale,\n textureWidth,\n textureHeight,\n lodScaleThreshold,\n lodTextureSizeThreshold,\n lodMaxLevel,\n}: TextureLODPlanInput): TextureLODPlan | undefined {\n if (getTextureLODMode(lod) !== 'single-auto') {\n return undefined\n }\n\n if (!Number.isFinite(effectiveScale) || effectiveScale <= 0) {\n return undefined\n }\n\n const width = Math.floor(textureWidth)\n const height = Math.floor(textureHeight)\n\n if (width <= 1 || height <= 1) {\n return undefined\n }\n\n const scaleThreshold = validPositive(lodScaleThreshold, DEFAULT_LOD_SCALE_THRESHOLD)\n\n if (effectiveScale >= scaleThreshold) {\n return undefined\n }\n\n const textureSizeThreshold = validPositive(lodTextureSizeThreshold, DEFAULT_LOD_TEXTURE_SIZE_THRESHOLD)\n\n if (Math.max(width, height) < textureSizeThreshold) {\n return undefined\n }\n\n const rawLevel = Math.round(Math.log2(1 / effectiveScale))\n const maxDimensionLevel = Math.max(1, Math.floor(Math.log2(Math.max(width, height))))\n const maxLevel = Math.min(maxDimensionLevel, validMaxLevel(lodMaxLevel, maxDimensionLevel))\n const level = clamp(Math.max(1, rawLevel), 1, maxLevel)\n const factor = 2 ** level\n\n return {\n level,\n width: Math.max(1, Math.round(width / factor)),\n height: Math.max(1, Math.round(height / factor)),\n }\n}\n\nexport function getTextureLODMode(lod?: Live2DTextureLODMode): Live2DTextureLODMode {\n if (lod === false || lod === 'single-auto') {\n return lod\n }\n\n return 'full'\n}\n\nexport function getTextureLODFilter(filter?: Live2DTextureLODFilter): Live2DTextureLODFilter {\n return filter === 'nearest' ? 'nearest' : 'linear'\n}\n\nfunction validPositive(value: number | undefined, fallback: number): number {\n return value !== undefined && Number.isFinite(value) && value > 0 ? value : fallback\n}\n\nfunction validMaxLevel(value: number | undefined, fallback: number): number {\n return value !== undefined && Number.isFinite(value) && value >= 1 ? Math.floor(value) : fallback\n}\n\nfunction clamp(value: number, min: number, max: number): number {\n return Math.min(max, Math.max(min, value))\n}\n","import type { Texture } from 'pixi.js'\nimport { Assets, loadTextures } from 'pixi.js'\n\nimport type { Live2DTextureLODOptions } from './texture-lod'\n\nimport { getTextureLODMode } from './texture-lod'\n\n/**\n * Texture loading options accepted by Live2D model atlas loading.\n */\nexport interface Live2DTextureSourceOptions extends Live2DTextureLODOptions {\n /**\n * Forces Pixi to load texture resources without createImageBitmap.\n * Cubism 2 textures use this because their WebGL upload path depends on HTML image sources.\n * @default undefined\n */\n preferCreateImageBitmap?: boolean\n}\n\nexport interface CreateTextureOptions extends Live2DTextureSourceOptions {\n crossOrigin?: string\n}\n\n// Assets caches textures by URL and hands the same Texture instance to every loader, so\n// teardown must be reference-counted or destroying one model kills its URL-sharing peers.\nconst cachedTextureRefs = new Map<string, number>()\n\n/** Records one model's hold on an Assets-cached texture URL. */\nexport function acquireCachedTexture(url: string): void {\n cachedTextureRefs.set(url, (cachedTextureRefs.get(url) ?? 0) + 1)\n}\n\n/**\n * Drops one hold on an Assets-cached texture URL. An unmatched release (no recorded holds)\n * is a no-op — it carries no license to tear down an entry other users may rely on.\n * @returns true when this release removed the last hold, so the entry may be torn down.\n */\nexport function releaseCachedTexture(url: string): boolean {\n const count = cachedTextureRefs.get(url) ?? 0\n\n if (count === 0) {\n return false\n }\n\n if (count === 1) {\n cachedTextureRefs.delete(url)\n return true\n }\n\n cachedTextureRefs.set(url, count - 1)\n return false\n}\n\nexport function createTexture(url: string, options: CreateTextureOptions = {}): Promise<Texture> {\n const config = loadTextures.config\n const previousCrossOrigin = config?.crossOrigin\n const previousPreferCreateImageBitmap = config?.preferCreateImageBitmap\n const previousPreferWorkers = config?.preferWorkers\n\n if (options.crossOrigin !== undefined && config) {\n config.crossOrigin = options.crossOrigin\n }\n if (options.preferCreateImageBitmap === false && config) {\n config.preferCreateImageBitmap = false\n config.preferWorkers = false\n }\n\n return Assets.load<Texture>({\n src: url,\n data: {\n autoGenerateMipmaps: getTextureLODMode(options.lod) === 'full',\n },\n })\n .catch((error: unknown) => {\n if (error instanceof Error) {\n throw error\n }\n\n throw new Error('Texture loading error', { cause: error })\n })\n .finally(() => {\n if (config) {\n config.crossOrigin = previousCrossOrigin ?? config.crossOrigin\n if (options.preferCreateImageBitmap === false) {\n config.preferCreateImageBitmap = previousPreferCreateImageBitmap ?? config.preferCreateImageBitmap\n config.preferWorkers = previousPreferWorkers ?? config.preferWorkers\n }\n }\n })\n}\n","import type { Live2DFactoryContext } from '@/factory/Live2DFactory'\nimport type { JSONObject } from '@/types/helpers'\nimport type { Middleware } from '@/utils/middleware'\n\nimport { ModelSettings } from '@/cubism-common'\nimport { Live2DFactory } from '@/factory/Live2DFactory'\nimport { Live2DLoader } from '@/factory/Live2DLoader'\nimport { acquireCachedTexture, type CreateTextureOptions, createTexture } from '@/factory/texture'\nimport { logger } from '@/utils'\n\nconst TAG = 'Live2DFactory'\n\n/**\n * A middleware that converts the source from a URL to a settings JSON object.\n */\nexport const urlToJSON: Middleware<Live2DFactoryContext> = async (context, next) => {\n if (typeof context.source === 'string') {\n const data = (await Live2DLoader.load<JSONObject>({\n url: context.source,\n type: 'json',\n target: context.live2dModel,\n })) as JSONObject & { url?: string }\n\n data.url = typeof data.url === 'string' ? data.url : context.source\n\n context.source = data\n\n context.live2dModel.emit('settingsJSONLoaded', data)\n }\n\n return next()\n}\n\n/**\n * A middleware that converts the source from a settings JSON object to a ModelSettings instance.\n */\nexport const jsonToSettings: Middleware<Live2DFactoryContext> = async (context, next) => {\n if (context.source instanceof ModelSettings) {\n context.settings = context.source\n\n return next()\n } else if (typeof context.source === 'object') {\n const runtime = Live2DFactory.findRuntime(context.source)\n\n if (runtime) {\n const settings = runtime.createModelSettings(context.source as JSONObject & { url: string })\n\n context.settings = settings\n context.live2dModel.emit('settingsLoaded', settings)\n\n return next()\n }\n }\n\n const url =\n context.source && typeof (context.source as { url?: unknown }).url === 'string'\n ? (context.source as { url: string }).url\n : undefined\n\n const runtimeVersions = Live2DFactory.runtimes.map(r => r.version).join(', ')\n\n if (Live2DFactory.runtimes.length === 0) {\n throw new TypeError(\n [\n 'Unknown settings format: no Live2D runtimes registered.',\n 'Import a published runtime entry before loading models (e.g. \"<package>/cubism\" for Cubism 3/4/5).',\n url ? `Settings URL: ${url}` : undefined,\n ]\n .filter(Boolean)\n .join('\\n')\n )\n }\n\n const topLevelKeys = (() => {\n try {\n if (!context.source || typeof context.source !== 'object' || Array.isArray(context.source)) {\n return undefined\n }\n return Object.keys(context.source as Record<string, unknown>)\n .slice(0, 30)\n .join(', ')\n } catch {\n return undefined\n }\n })()\n\n throw new TypeError(\n [\n 'Unknown settings format: no matching runtime found for the loaded settings JSON.',\n runtimeVersions ? `Registered runtimes (versions): ${runtimeVersions}` : undefined,\n topLevelKeys ? `Settings JSON keys: ${topLevelKeys}` : undefined,\n url ? `Settings URL: ${url}` : undefined,\n ]\n .filter(Boolean)\n .join('\\n')\n )\n}\n\nexport const waitUntilReady: Middleware<Live2DFactoryContext> = (context, next) => {\n if (context.settings) {\n const runtime = Live2DFactory.findRuntime(context.settings)\n\n if (runtime) {\n return runtime.ready().then(() => next())\n }\n }\n\n return next()\n}\n\n/**\n * A middleware that populates the Live2DModel with optional resources.\n * Requires InternalModel in context when all the subsequent middlewares have finished.\n */\nexport const setupOptionals: Middleware<Live2DFactoryContext> = async (context, next) => {\n // wait until all has finished\n await next()\n\n const internalModel = context.internalModel\n\n if (internalModel) {\n const settings = context.settings!\n const runtime = Live2DFactory.findRuntime(settings)\n\n if (runtime) {\n const tasks: Promise<void>[] = []\n const optionalDataType: XMLHttpRequestResponseType = 'arraybuffer'\n\n if (settings.pose) {\n tasks.push(\n Live2DLoader.load<unknown>({\n settings,\n url: settings.pose,\n type: optionalDataType,\n target: internalModel,\n })\n .then((data: unknown) => {\n internalModel.pose = runtime.createPose(internalModel.coreModel, data)\n context.live2dModel.emit('poseLoaded', internalModel.pose)\n })\n .catch((e: Error) => {\n context.live2dModel.emit('poseLoadError', e)\n logger.warn(TAG, 'Failed to load pose.', e)\n })\n )\n }\n\n if (settings.physics) {\n tasks.push(\n Live2DLoader.load<unknown>({\n settings,\n url: settings.physics,\n type: optionalDataType,\n target: internalModel,\n })\n .then((data: unknown) => {\n internalModel.physics = runtime.createPhysics(internalModel.coreModel, data)\n context.live2dModel.emit('physicsLoaded', internalModel.physics)\n })\n .catch((e: Error) => {\n context.live2dModel.emit('physicsLoadError', e)\n logger.warn(TAG, 'Failed to load physics.', e)\n })\n )\n }\n\n if (tasks.length) {\n await Promise.all(tasks)\n }\n }\n }\n}\n\n/**\n * A middleware that populates the Live2DModel with essential resources.\n * Requires ModelSettings in context immediately, and InternalModel in context\n * when all the subsequent middlewares have finished.\n */\nexport const setupEssentials: Middleware<Live2DFactoryContext> = async (context, next) => {\n if (context.settings) {\n const live2DModel = context.live2dModel\n const textureOptions: CreateTextureOptions = {\n crossOrigin: context.options.crossOrigin,\n ...context.options.textureOptions,\n }\n\n const loadingTextures = Promise.all(\n context.settings.textures.map(tex => {\n const url = context.settings!.resolveURL(tex)\n return createTexture(url, textureOptions)\n })\n )\n\n // we'll handle the error later (using await), this catch() is to suppress the unhandled rejection warning\n loadingTextures.catch(() => {})\n\n // wait for the internal model to be created\n await next()\n\n if (context.internalModel) {\n live2DModel.internalModel = context.internalModel\n live2DModel.emit('modelLoaded', context.internalModel)\n } else {\n throw new TypeError('Missing internal model.')\n }\n\n live2DModel.textures = await loadingTextures\n\n // A model destroyed mid-load never releases its holds, so don't record any for it.\n if (!live2DModel.destroyed) {\n for (const tex of context.settings.textures) {\n acquireCachedTexture(context.settings.resolveURL(tex))\n }\n }\n\n live2DModel.emit('textureLoaded', live2DModel.textures)\n } else {\n throw new TypeError('Missing settings.')\n }\n}\n\n/**\n * A middleware that creates the InternalModel. Requires ModelSettings in context.\n */\nexport const createInternalModel: Middleware<Live2DFactoryContext> = async (context, next) => {\n const settings = context.settings\n\n if (settings instanceof ModelSettings) {\n const runtime = Live2DFactory.findRuntime(settings)\n\n if (!runtime) {\n throw new TypeError('Unknown model settings.')\n }\n\n const modelData = await Live2DLoader.load<ArrayBuffer>({\n settings,\n url: settings.moc,\n type: 'arraybuffer',\n target: context.live2dModel,\n })\n\n if (!runtime.isValidMoc(modelData)) {\n throw new Error('Invalid moc data')\n }\n\n const coreModel: unknown = runtime.createCoreModel(modelData, context.options)\n\n context.internalModel = runtime.createInternalModel(coreModel, settings, context.options)\n\n return next()\n }\n\n throw new TypeError('Missing settings.')\n}\n","// biome-ignore-all lint/complexity/useLiteralKeys: prototype hook wiring assigns non-public members\n// biome-ignore-all lint/suspicious/noExplicitAny: generic runtime/middleware plumbing needs any (mirrors the eslint-disable)\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { InternalModel, ModelSettings } from '@/cubism-common'\nimport type { Live2DModel, Live2DModelOptions } from '@/Live2DModel'\nimport type { JSONObject } from '@/types/helpers'\nimport type { Middleware } from '@/utils/middleware'\nimport type { Live2DTextureSourceOptions } from './texture'\n\nimport { runMiddlewares } from '@/utils/middleware'\n\nimport { ExpressionManager, MotionManager } from '@/cubism-common'\nimport { Live2DLoader } from '@/factory/Live2DLoader'\nimport {\n createInternalModel,\n jsonToSettings,\n setupEssentials,\n setupOptionals,\n urlToJSON,\n waitUntilReady,\n} from '@/factory/model-middlewares'\nimport { logger } from '@/utils'\nimport { FileLoader } from './FileLoader'\n\nexport interface Live2DFactoryOptions extends Live2DModelOptions {\n /**\n * Whether to check the consistency of the moc file. It's an internal\n * function of Cubism core and only available since Cubism 4 R7.\n * @default false\n */\n checkMocConsistency?: boolean\n\n /**\n * String to use for crossOrigin properties on `<img>` elements when loading textures.\n * @default undefined\n */\n crossOrigin?: string\n\n /**\n * Callback invoked when the model has been loaded.\n * @default undefined\n */\n onLoad?(): void\n\n /**\n * Callback invoked when error occurs while loading the model.\n * @default undefined\n */\n onError?(e: Error): void\n\n /**\n * Whether to validate motion3.json consistency when loading motions.\n * @default false\n */\n checkMotionConsistency?: boolean\n\n /**\n * Texture loading and atlas LOD options.\n *\n * See {@link Live2DTextureLODOptions} for the available `lod` strategies.\n *\n * @default { lod: 'full' }\n */\n textureOptions?: Live2DTextureSourceOptions\n}\n\n/**\n * The context transferred through the model creation middlewares.\n */\nexport interface Live2DFactoryContext {\n source: any\n options: Live2DFactoryOptions\n live2dModel: Live2DModel\n internalModel?: InternalModel\n settings?: ModelSettings\n}\n\n/**\n * Represents a Cubism version.\n */\nexport interface Live2DRuntime {\n /**\n * The version number. Higher version takes priority when matching the runtime.\n */\n version: number\n\n /**\n * Checks if the source belongs to this runtime.\n * @param source - Either a settings JSON object or a ModelSettings instance.\n * @return True if the source belongs to this runtime.\n */\n test(source: any): boolean\n\n // TODO: remove\n ready(): Promise<void>\n\n /**\n * Checks if the data is a valid moc to create the core model.\n * @param modelData - The moc content.\n * @return True if the data is valid.\n */\n isValidMoc(modelData: ArrayBuffer): boolean\n\n /**\n * Creates a ModelSettings.\n * @param json - The settings JSON object.\n * @return Created ModelSettings.\n */\n createModelSettings(json: JSONObject): ModelSettings\n\n /**\n * Creates a core model.\n * @param data - Content of the moc file.\n * @param options\n * @return Created core model.\n */\n createCoreModel(data: ArrayBuffer, options?: Live2DFactoryOptions): any\n\n /**\n * Creates an InternalModel.\n * @param coreModel - Core model that *must* belong to this runtime.\n * @param settings - ModelSettings of this model.\n * @param options - Options that will be passed to the InternalModel's constructor.\n * @return Created InternalModel.\n */\n createInternalModel(coreModel: any, settings: ModelSettings, options?: Live2DFactoryOptions): InternalModel\n\n /**\n * Creates a pose.\n * @param coreModel - Core model that *must* belong to this runtime.\n * @param data - Content of the pose file.\n * @return Created pose.\n */\n createPose(coreModel: any, data: any): any\n\n /**\n * Creates a physics.\n * @param coreModel - Core model that *must* belong to this runtime.\n * @param data - Content of the physics file.\n * @return Created physics.\n */\n createPhysics(coreModel: any, data: any): any\n}\n\n/**\n * Handles all the network load tasks.\n *\n * - Model creation: requested by {@link Live2DModel.from}.\n * - Motion loading: implements the load method of MotionManager.\n * - Expression loading: implements the load method of ExpressionManager.\n */\nexport class Live2DFactory {\n /**\n * All registered runtimes, sorted by versions in descending order.\n */\n static runtimes: Live2DRuntime[] = []\n\n static urlToJSON = urlToJSON\n static jsonToSettings = jsonToSettings\n static waitUntilReady = waitUntilReady\n static setupOptionals = setupOptionals\n static setupEssentials = setupEssentials\n static createInternalModel = createInternalModel\n\n /**\n * Middlewares to run through when setting up a Live2DModel.\n */\n static live2DModelMiddlewares: Middleware<Live2DFactoryContext>[] = [\n FileLoader.factory,\n urlToJSON,\n jsonToSettings,\n waitUntilReady,\n setupOptionals,\n setupEssentials,\n createInternalModel,\n ]\n\n /**\n * load tasks of each motion. The structure of each value in this map\n * is the same as respective {@link MotionManager.definitions}.\n */\n static motionTasksMap = new WeakMap<MotionManager, Record<string, (Promise<any> | undefined)[]>>()\n\n /**\n * Load tasks of each expression.\n */\n static expressionTasksMap = new WeakMap<ExpressionManager, (Promise<any> | undefined)[]>()\n\n /**\n * Registers a Live2DRuntime.\n */\n static registerRuntime(runtime: Live2DRuntime) {\n Live2DFactory.runtimes.push(runtime)\n\n // higher version as higher priority\n Live2DFactory.runtimes.sort((a, b) => b.version - a.version)\n }\n\n /**\n * Finds a runtime that matches given source.\n * @param source - Either a settings JSON object or a ModelSettings instance.\n * @return The Live2DRuntime, or undefined if not found.\n */\n static findRuntime(source: any): Live2DRuntime | undefined {\n for (const runtime of Live2DFactory.runtimes) {\n if (runtime.test(source)) {\n return runtime\n }\n }\n }\n\n /**\n * Sets up a Live2DModel, populating it with all defined resources.\n * @param live2dModel - The Live2DModel instance.\n * @param source - Can be one of: settings file URL, settings JSON object, ModelSettings instance.\n * @param options - Options for the process.\n * @return Promise that resolves when all resources have been loaded, rejects when error occurs.\n */\n static async setupLive2DModel<IM extends InternalModel>(\n live2dModel: Live2DModel<IM>,\n source: string | object | IM['settings'],\n options?: Live2DFactoryOptions\n ): Promise<void> {\n const textureLoaded = new Promise(resolve => live2dModel.once('textureLoaded', resolve))\n const modelLoaded = new Promise(resolve => live2dModel.once('modelLoaded', resolve))\n\n // because the \"ready\" event is supposed to be emitted after\n // both the internal model and textures have been loaded,\n // we should here wrap the emit() in a then() so it'll\n // be executed after all the handlers of \"modelLoaded\" and \"textureLoaded\"\n const readyEventEmitted = Promise.all([textureLoaded, modelLoaded]).then(() => live2dModel.emit('ready'))\n\n await runMiddlewares(Live2DFactory.live2DModelMiddlewares, {\n live2dModel: live2dModel,\n source,\n options: options || {},\n })\n\n // the \"load\" event should never be emitted before \"ready\"\n await readyEventEmitted\n\n live2dModel.emit('load')\n }\n\n /**\n * Loads a Motion and registers the task to {@link motionTasksMap}. The task will be automatically\n * canceled when its owner - the MotionManager instance - has been destroyed.\n * @param motionManager - MotionManager that owns this Motion.\n * @param group - The motion group.\n * @param index - Index in the motion group.\n * @return Promise that resolves with the Motion, or with undefined if it can't be loaded.\n */\n static loadMotion<Motion, MotionSpec>(\n motionManager: MotionManager<Motion, MotionSpec>,\n group: string,\n index: number\n ): Promise<Motion | undefined> {\n // errors in this method are always handled\n const handleError = (e: any) => motionManager.emit('motionLoadError', group, index, e)\n\n try {\n const definition = motionManager.definitions[group]?.[index]\n\n if (!definition) {\n return Promise.resolve(undefined)\n }\n\n motionManager.once('destroy', () => Live2DFactory.releaseMotionTasks(motionManager))\n\n let tasks = Live2DFactory.motionTasksMap.get(motionManager)\n\n if (!tasks) {\n tasks = {}\n Live2DFactory.motionTasksMap.set(motionManager, tasks)\n }\n\n let taskGroup = tasks[group]\n\n if (!taskGroup) {\n taskGroup = []\n tasks[group] = taskGroup\n }\n\n const path = motionManager.getMotionFile(definition)\n\n taskGroup[index] ??= Live2DLoader.load({\n url: path,\n settings: motionManager.settings,\n type: motionManager.motionDataType,\n target: motionManager,\n })\n .then(data => {\n const taskGroup = Live2DFactory.motionTasksMap.get(motionManager)?.[group]\n\n if (taskGroup) {\n taskGroup[index] = undefined\n }\n\n const motionData = data as Parameters<typeof motionManager.createMotion>[0]\n const motion = motionManager.createMotion(motionData, group, definition)\n\n motionManager.emit('motionLoaded', group, index, motion)\n\n return motion\n })\n .catch(e => {\n logger.warn(motionManager.tag, `Failed to load motion: ${path}\\n`, e)\n handleError(e)\n })\n\n return taskGroup[index]\n } catch (e) {\n logger.warn(motionManager.tag, `Failed to load motion at \"${group}\"[${index}]\\n`, e)\n handleError(e)\n }\n\n return Promise.resolve(undefined)\n }\n\n /**\n * Loads an Expression and registers the task to {@link expressionTasksMap}. The task will be automatically\n * canceled when its owner - the ExpressionManager instance - has been destroyed.\n * @param expressionManager - ExpressionManager that owns this Expression.\n * @param index - Index of the Expression.\n * @return Promise that resolves with the Expression, or with undefined if it can't be loaded.\n */\n static loadExpression<Expression, ExpressionSpec>(\n expressionManager: ExpressionManager<Expression, ExpressionSpec>,\n index: number\n ): Promise<Expression | undefined> {\n // errors in this method are always handled\n const handleError = (e: any) => expressionManager.emit('expressionLoadError', index, e)\n\n try {\n const definition = expressionManager.definitions[index]\n\n if (!definition) {\n return Promise.resolve(undefined)\n }\n\n expressionManager.once('destroy', () => Live2DFactory.releaseExpressionTasks(expressionManager))\n\n let tasks = Live2DFactory.expressionTasksMap.get(expressionManager)\n\n if (!tasks) {\n tasks = []\n Live2DFactory.expressionTasksMap.set(expressionManager, tasks)\n }\n\n const path = expressionManager.getExpressionFile(definition)\n const responseType = expressionManager.expressionDataType ?? 'json'\n\n tasks[index] ??= Live2DLoader.load({\n url: path,\n settings: expressionManager.settings,\n type: responseType,\n target: expressionManager,\n })\n .then(data => {\n const tasks = Live2DFactory.expressionTasksMap.get(expressionManager)\n\n if (tasks) {\n tasks[index] = undefined\n }\n\n const expressionData = data as Parameters<typeof expressionManager.createExpression>[0]\n const expression = expressionManager.createExpression(expressionData, definition)\n\n expressionManager.emit('expressionLoaded', index, expression)\n\n return expression\n })\n .catch(e => {\n logger.warn(expressionManager.tag, `Failed to load expression: ${path}\\n`, e)\n handleError(e)\n })\n\n return tasks[index]\n } catch (e) {\n logger.warn(expressionManager.tag, `Failed to load expression at [${index}]\\n`, e)\n handleError(e)\n }\n\n return Promise.resolve(undefined)\n }\n\n static releaseMotionTasks(motionManager: MotionManager) {\n Live2DFactory.motionTasksMap.delete(motionManager)\n }\n\n static releaseExpressionTasks(expressionManager: ExpressionManager) {\n Live2DFactory.expressionTasksMap.delete(expressionManager)\n }\n}\n\nMotionManager.prototype['_loadMotion'] = function (group, index) {\n return Live2DFactory.loadMotion(this, group, index)\n}\n\nExpressionManager.prototype['_loadExpression'] = function (index) {\n return Live2DFactory.loadExpression(this, index)\n}\n\nFileLoader['live2dFactory'] = Live2DFactory\n","import type { FederatedPointerEvent } from 'pixi.js'\nimport { Ticker } from 'pixi.js'\n\nimport type { Live2DModel } from './Live2DModel'\n\nimport { logger } from './utils'\n\nexport interface AutomatorOptions {\n /**\n * Should the internal model be automatically updated by `PIXI.Ticker.shared`.\n * @default ture\n */\n autoUpdate?: boolean\n\n /**\n * Should the internal model automatically reacts to interactions by listening for pointer events.\n * @default true\n * @deprecated since v0.5.0, reading/writing this property is equivalent to reading/writing `autoHitTest && autoFocus`.\n */\n autoInteract?: boolean\n\n /**\n * Automatically hit-test the model when `pointertap` event is triggered.\n * @default true\n */\n autoHitTest?: boolean\n\n /**\n * Automatically update the focus position when `globalpointermove` event is triggered.\n * @default true\n */\n autoFocus?: boolean\n\n /**\n * The ticker to be used for automatic updates.\n * @default `PIXI.Ticker.shared` from the global PIXI namespace.\n */\n ticker?: Ticker\n}\n\nexport class Automator {\n private static defaultTicker?: Ticker\n\n model: Live2DModel\n private destroyed = false\n\n private _ticker?: Ticker\n\n get ticker(): Ticker | undefined {\n return this._ticker\n }\n\n set ticker(ticker: Ticker | undefined) {\n if (this._ticker) {\n this._ticker.remove(onTickerUpdate, this)\n }\n\n this._ticker = ticker\n\n if (this._autoUpdate) {\n this._ticker?.add(onTickerUpdate, this)\n this._ticker?.start()\n }\n }\n\n private _autoUpdate = false\n\n /**\n * @see {@link AutomatorOptions.autoUpdate}\n */\n get autoUpdate() {\n return this._autoUpdate\n }\n\n set autoUpdate(autoUpdate: boolean) {\n if (this.destroyed) {\n return\n }\n\n if (autoUpdate) {\n if (this._ticker) {\n this._ticker.add(onTickerUpdate, this)\n this._autoUpdate = true\n } else {\n logger.warn(\n this.model.tag,\n 'No Ticker to be used for automatic updates. Either set option.ticker when creating Live2DModel, or expose PIXI to global scope (window.PIXI = PIXI).'\n )\n }\n } else {\n this._ticker?.remove(onTickerUpdate, this)\n this._autoUpdate = false\n }\n }\n\n private _autoHitTest = false\n\n /**\n * @see {@link AutomatorOptions.autoHitTest}\n */\n get autoHitTest(): boolean {\n return this._autoHitTest\n }\n\n set autoHitTest(autoHitTest: boolean) {\n if (autoHitTest !== this.autoHitTest) {\n if (autoHitTest) {\n this.model.on('pointertap', onTap, this)\n } else {\n this.model.off('pointertap', onTap, this)\n }\n\n this._autoHitTest = autoHitTest\n }\n }\n\n private _autoFocus = false\n\n /**\n * @see {@link AutomatorOptions.autoFocus}\n */\n get autoFocus(): boolean {\n return this._autoFocus\n }\n\n set autoFocus(autoFocus: boolean) {\n if (autoFocus !== this.autoFocus) {\n if (autoFocus) {\n this.model.on('globalpointermove', onPointerMove, this)\n this.model.on('pointermove', onPointerMove, this)\n } else {\n this.model.off('globalpointermove', onPointerMove, this)\n this.model.off('pointermove', onPointerMove, this)\n }\n\n this._autoFocus = autoFocus\n }\n }\n\n /**\n * @see {@link AutomatorOptions.autoInteract}\n */\n get autoInteract(): boolean {\n return this._autoHitTest && this._autoFocus\n }\n\n set autoInteract(autoInteract: boolean) {\n this.autoHitTest = autoInteract\n this.autoFocus = autoInteract\n }\n\n constructor(\n model: Live2DModel,\n { autoUpdate = true, autoHitTest = true, autoFocus = true, autoInteract, ticker }: AutomatorOptions = {}\n ) {\n ticker ??= Automator.defaultTicker ?? (typeof PIXI !== 'undefined' ? PIXI.Ticker.shared : Ticker.shared)\n\n if (autoInteract !== undefined) {\n autoHitTest = autoInteract\n autoFocus = autoInteract\n logger.warn(model.tag, 'options.autoInteract is deprecated since v0.5.0, use autoHitTest and autoFocus instead.')\n }\n\n this.model = model\n this.ticker = ticker\n this.autoUpdate = autoUpdate\n this.autoHitTest = autoHitTest\n this.autoFocus = autoFocus\n\n if (autoHitTest || autoFocus) {\n this.model.eventMode = 'static'\n }\n }\n\n onTickerUpdate() {\n // the delta time can only be obtained from the ticker instead from the listener's argument\n // because the argument is not the delta time, but the delta frame count\n const deltaMS = this.ticker!.deltaMS\n\n this.model.update(deltaMS)\n }\n\n onTap(event: FederatedPointerEvent) {\n this.model.tap(event.global.x, event.global.y)\n }\n\n onPointerMove(event: FederatedPointerEvent) {\n this.model.focus(event.global.x, event.global.y)\n }\n\n destroy() {\n // call setters to clean up\n this.autoFocus = false\n this.autoHitTest = false\n this.autoUpdate = false\n this.ticker = undefined\n\n this.destroyed = true\n }\n}\n\n// static event delegates\nfunction onTickerUpdate(this: Automator) {\n this.onTickerUpdate()\n}\nfunction onTap(this: Automator, event: FederatedPointerEvent) {\n this.onTap(event)\n}\nfunction onPointerMove(this: Automator, event: FederatedPointerEvent) {\n this.onPointerMove(event)\n}\n","import { Transform } from 'pixi.js'\n\n/**\n * Useless class. May be useful in the future.\n */\nexport class Live2DTransform extends Transform {}\n","import type { GlRenderingContext, InstructionSet, Renderer, RenderLayer, Ticker } from 'pixi.js'\nimport {\n Assets,\n Bounds,\n CanvasSource,\n Container,\n DOMAdapter,\n ExtensionType,\n Matrix,\n ObservablePoint,\n Point,\n Texture,\n WebGLRenderer,\n} from 'pixi.js'\n\nimport type { InternalModel, InternalModelOptions, ModelSettings, MotionPriority } from '@/cubism-common'\nimport type { Live2DFactoryOptions } from '@/factory/Live2DFactory'\nimport type { JSONObject } from './types/helpers'\n\nimport { VOLUME } from '@/cubism-common/SoundManager'\nimport { Live2DFactory } from '@/factory/Live2DFactory'\nimport { type Live2DTextureSourceOptions, releaseCachedTexture } from '@/factory/texture'\nimport { getTextureLODFilter, getTextureLODPlan } from '@/factory/texture-lod'\nimport { Automator, type AutomatorOptions } from './Automator'\nimport { Live2DTransform } from './Live2DTransform'\n\nexport interface Live2DModelOptions extends InternalModelOptions, AutomatorOptions {\n /**\n * Defines which bounds are used to resolve the normalized {@link Live2DModel.anchor}.\n * `'canvas'` preserves the historical model-canvas behavior, while `'drawable'`\n * resolves the anchor against the visible drawable bounds.\n * @default 'canvas'\n */\n anchorMode?: 'canvas' | 'drawable'\n\n /**\n * Texture loading and atlas LOD options for this model.\n *\n * See {@link Live2DTextureLODOptions} for the available `lod` strategies.\n *\n * @default { lod: 'full' }\n */\n textureOptions?: Live2DTextureSourceOptions\n}\n\nconst tempPoint = new Point()\nconst tempMatrix = new Matrix()\nconst tempWorldMatrix = new Matrix()\nconst tempDrawableBounds = { x: 0, y: 0, width: 0, height: 0 }\nconst tempModelBounds = new Bounds()\n\ntype Live2DTextureLODState = {\n source: Texture\n level: number\n texture: Texture\n}\n\ntype Live2DTextureLODFailures = {\n source: Texture\n levels: Set<number>\n}\n\nexport type Live2DConstructor = { new (options?: Live2DModelOptions): Live2DModel }\n\ntype RenderPipeRegistry = Record<\n string,\n {\n push?: (...args: unknown[]) => void\n pop?: (...args: unknown[]) => void\n break?: (instructionSet: InstructionSet) => void\n }\n>\n\ntype Live2DPipeRenderer = Renderer & {\n renderPipes: RenderPipeRegistry & {\n live2d?: Live2DPipe\n batch?: { break?: (instructionSet: InstructionSet) => void }\n }\n}\n\ntype Live2DPrepareInstruction = {\n renderPipeId: 'live2d'\n action: 'prepare'\n canBundle: false\n prepare: () => void\n}\n\ntype Live2DInstruction = Live2DModel | Live2DPrepareInstruction\n\nlet live2DPluginFallbackWarned = false\n\n/**\n * Internal PixiJS render pipe for Live2D models.\n * @internal\n */\nclass Live2DPipe {\n static extension = {\n type: [ExtensionType.WebGLPipes],\n name: 'live2d',\n } as const\n\n constructor(private renderer: Renderer) {}\n\n addPrepare(prepare: () => void, instructionSet: InstructionSet): void {\n const renderPipes = (this.renderer as Live2DPipeRenderer).renderPipes\n\n renderPipes.batch?.break?.(instructionSet)\n instructionSet.add({\n renderPipeId: 'live2d',\n action: 'prepare',\n canBundle: false,\n prepare,\n } as Live2DPrepareInstruction)\n }\n\n addRenderable(model: Live2DModel, instructionSet: InstructionSet): void {\n const renderPipes = (this.renderer as Live2DPipeRenderer).renderPipes\n\n renderPipes.batch?.break?.(instructionSet)\n instructionSet.add(model)\n }\n\n execute(instruction: Live2DInstruction): void {\n if (!(instruction instanceof Live2DModel)) {\n instruction.prepare()\n return\n }\n\n const model = instruction\n\n if (!model.visible || model.alpha <= 0) {\n return\n }\n\n model.renderLive2D(this.renderer)\n }\n\n updateRenderable(): void {}\n\n destroyRenderable(): void {}\n\n validateRenderable(): boolean {\n return false\n }\n\n destroy(): void {}\n}\n\n/**\n * PixiJS extension entry for registering the Live2D WebGL render pipe.\n *\n * Register it before creating a renderer:\n *\n * ```ts\n * import { extensions } from 'pixi.js'\n * import { Live2DPlugin } from 'untitled-pixi-live2d-engine'\n *\n * extensions.add(Live2DPlugin)\n * ```\n */\nexport const Live2DPlugin = Live2DPipe\n\n/**\n * @deprecated Register {@link Live2DPlugin} with `extensions.add(Live2DPlugin)` before\n * creating the Pixi renderer. This lazy fallback is kept only for backward compatibility.\n */\nfunction ensureLive2DPipe(renderer: Renderer): void {\n const r = renderer as Live2DPipeRenderer\n\n if (!r.renderPipes.live2d) {\n if (!live2DPluginFallbackWarned) {\n live2DPluginFallbackWarned = true\n console.warn(\n '[@laplace.live/pixijs-live2d] Lazy Live2D render pipe registration is deprecated. ' +\n 'Register Live2DPlugin explicitly with `extensions.add(Live2DPlugin)` before creating the Pixi renderer.'\n )\n }\n\n r.renderPipes.live2d = new Live2DPipe(renderer)\n }\n}\n\nfunction getMatrixMaxScale(matrix: Matrix): number {\n return Math.max(Math.hypot(matrix.a, matrix.b), Math.hypot(matrix.c, matrix.d))\n}\n\nfunction isDrawableTextureResource(resource: unknown): resource is CanvasImageSource {\n if (!resource || typeof resource !== 'object') {\n return false\n }\n\n const { width, height } = resource as { width?: unknown; height?: unknown }\n\n return typeof width === 'number' && width > 0 && typeof height === 'number' && height > 0\n}\n\nfunction createTextureLODTexture(\n sourceTexture: Texture,\n level: number,\n width: number,\n height: number,\n filter: Live2DTextureSourceOptions['lodFilter']\n): Texture | undefined {\n const resource: unknown = sourceTexture.source.resource\n\n if (!isDrawableTextureResource(resource)) {\n return undefined\n }\n\n const canvas = DOMAdapter.get().createCanvas(width, height)\n const context = canvas.getContext('2d') as CanvasRenderingContext2D | null\n\n if (!context) {\n return undefined\n }\n\n try {\n context.clearRect(0, 0, width, height)\n context.imageSmoothingEnabled = filter !== 'nearest'\n\n if ('imageSmoothingQuality' in context && filter !== 'nearest') {\n context.imageSmoothingQuality = 'high'\n }\n\n context.drawImage(\n resource,\n 0,\n 0,\n sourceTexture.source.pixelWidth,\n sourceTexture.source.pixelHeight,\n 0,\n 0,\n width,\n height\n )\n } catch {\n return undefined\n }\n\n const label = `${sourceTexture.label ?? sourceTexture.source.label ?? 'Live2DTexture'} LOD ${level}`\n\n return new Texture({\n label,\n source: new CanvasSource({\n resource: canvas,\n width,\n height,\n resolution: 1,\n scaleMode: getTextureLODFilter(filter),\n autoGenerateMipmaps: false,\n label,\n }),\n })\n}\n\n// noinspection JSUnusedGlobalSymbols\n/**\n * A wrapper that allows the Live2D model to be used as a DisplayObject in PixiJS.\n *\n * ```js\n * const model = await Live2DModel.from('shizuku.model.json');\n * container.add(model);\n * ```\n * @emits {@link Live2DModelEvents}\n */\nexport class Live2DModel<IM extends InternalModel = InternalModel> extends Container {\n /** @internal */\n renderPipeId = 'live2d'\n /** @internal */\n get isRenderable(): true {\n return true\n }\n /** @internal */\n get canBundle(): false {\n return false\n }\n\n /**\n * Creates a Live2DModel from given source.\n * @param source - Can be one of: settings file URL, settings JSON object, ModelSettings instance.\n * @param options - Options for the creation.\n * @return Promise that resolves with the Live2DModel.\n */\n static async from<M extends Live2DConstructor = typeof Live2DModel>(\n this: M,\n source: string | JSONObject | ModelSettings,\n options?: Live2DFactoryOptions\n ): Promise<InstanceType<M>> {\n const model = new this(options) as InstanceType<M>\n\n await Live2DFactory.setupLive2DModel(model, source, options)\n return model\n }\n\n /**\n * Synchronous version of `Live2DModel.from()`. This method immediately returns a Live2DModel instance,\n * whose resources have not been loaded. Therefore, this model can't be manipulated or rendered\n * until the \"load\" event has been emitted.\n *\n * ```js\n * // no `await` here as it's not a Promise\n * const model = Live2DModel.fromSync('shizuku.model.json');\n *\n * // these will cause errors!\n * // app.stage.addChild(model);\n * // model.motion('tap_body');\n *\n * model.once('load', () => {\n * // now it's safe\n * app.stage.addChild(model);\n * model.motion('tap_body');\n * });\n * ```\n * @param source - Model source, can be a file path, JSON object, or ModelSettings instance.\n * @param options - Options for the model creation.\n * @returns The created Live2DModel instance.\n */\n static fromSync<M extends Live2DConstructor = typeof Live2DModel>(\n this: M,\n source: string | JSONObject | ModelSettings,\n options?: Live2DFactoryOptions\n ): InstanceType<M> {\n const model = new this(options) as InstanceType<M>\n\n void Live2DFactory.setupLive2DModel(model, source, options)\n .then(() => options?.onLoad?.())\n .catch(err => options?.onError?.(err as Error))\n\n return model\n }\n\n /**\n * Registers the class of `PIXI.Ticker` for auto updating.\n * @deprecated Use {@link Live2DModelOptions.ticker} instead.\n * @param tickerClass - The Ticker class to be registered.\n */\n static registerTicker(tickerClass: typeof Ticker): void {\n // biome-ignore lint/complexity/useLiteralKeys: bracket access reaches Automator's non-public static\n Automator['defaultTicker'] = tickerClass.shared\n }\n\n /**\n * Tag for logging.\n * @type {string}\n */\n tag: string = 'Live2DModel(uninitialized)'\n\n /**\n * The internal model. Though typed as non-nullable, it'll be undefined until the \"ready\" event is emitted.\n */\n internalModel!: IM\n\n /**\n * Pixi textures.\n * @type {Texture[]}\n */\n textures: Texture[] = []\n\n private readonly textureOptions?: Live2DTextureSourceOptions\n readonly anchorMode: NonNullable<Live2DModelOptions['anchorMode']>\n private readonly textureLODStates: (Live2DTextureLODState | undefined)[] = []\n private readonly textureLODFailures: (Live2DTextureLODFailures | undefined)[] = []\n\n /** @override\n * The Live2DTransform instance for this model.\n */\n transform = new Live2DTransform()\n\n /**\n * The anchor behaves like the one in `PIXI.Sprite`, where `(0, 0)` means the top left\n * and `(1, 1)` means the bottom right.\n * @type {ObservablePoint}\n */\n anchor!: ObservablePoint\n /** @internal */\n private readonly _bounds = new Bounds()\n /** @internal */\n private _boundsDirty = true\n /** @internal */\n private _boundsRetryAfterDraw = false\n\n /** @internal */\n get bounds(): Bounds {\n if (!this.internalModel) {\n this._bounds.set(0, 0, 0, 0)\n return this._bounds\n }\n\n if (this._boundsDirty) {\n this.updateDrawableBounds()\n }\n\n return this._bounds\n }\n\n private updateDrawableBounds(applyAnchor = false): void {\n if (!this.internalModel) {\n this._bounds.set(0, 0, 0, 0)\n this._boundsDirty = false\n return\n }\n\n const drawableIds = this.internalModel.getDrawableIDs()\n tempModelBounds.clear()\n\n for (let i = 0; i < drawableIds.length; i++) {\n const drawableId = drawableIds[i]!\n const drawableIndex = this.internalModel.getDrawableIndex(drawableId)\n\n if (drawableIndex < 0) {\n continue\n }\n\n const drawableBounds = this.internalModel.getDrawableBounds(drawableIndex, tempDrawableBounds)\n\n if (\n !Number.isFinite(drawableBounds.x) ||\n !Number.isFinite(drawableBounds.y) ||\n !Number.isFinite(drawableBounds.width) ||\n !Number.isFinite(drawableBounds.height)\n ) {\n continue\n }\n\n tempModelBounds.addFrame(\n drawableBounds.x,\n drawableBounds.y,\n drawableBounds.x + drawableBounds.width,\n drawableBounds.y + drawableBounds.height,\n Matrix.IDENTITY\n )\n }\n\n this._bounds.clear()\n\n if (tempModelBounds.isValid && tempModelBounds.isPositive) {\n this._bounds.addFrame(\n tempModelBounds.minX,\n tempModelBounds.minY,\n tempModelBounds.maxX,\n tempModelBounds.maxY,\n this.internalModel.localTransform\n )\n this._boundsRetryAfterDraw = false\n } else {\n const width = this.internalModel.originalWidth || this.internalModel.width\n const height = this.internalModel.originalHeight || this.internalModel.height\n\n this._bounds.addFrame(0, 0, width, height, this.internalModel.localTransform)\n this._boundsRetryAfterDraw = true\n }\n\n this._boundsDirty = false\n this._didViewChangeTick++\n\n if (applyAnchor && this.anchorMode === 'drawable') {\n this.onAnchorChange()\n }\n }\n\n /**\n * Updates the model and its drawable bounds before Pixi calculates filter areas.\n * Filter pipes collect their framebuffer bounds before the Live2D render pipe runs,\n * so waiting until `renderLive2D()` is too late for animated vertices.\n */\n private prepareForRender(): void {\n if (!this.internalModel) {\n return\n }\n\n const frameDelta = this.deltaTime\n this.deltaTime = 0\n\n if (frameDelta) {\n this.internalModel.update(frameDelta, this.elapsedTime)\n }\n\n this.updateDrawableBounds()\n }\n\n /**\n * An ID of Gl context that syncs with `renderer.CONTEXT_UID`. Used to check if the GL context has changed.\n * @protected\n * @type {number}\n */\n\n protected gl: GlRenderingContext | null = null\n\n /**\n * Elapsed time in milliseconds since created.\n * @type {DOMHighResTimeStamp}\n */\n elapsedTime: DOMHighResTimeStamp = 0\n\n /**\n * Elapsed time in milliseconds from last frame to this frame.\n * @type {DOMHighResTimeStamp}\n */\n deltaTime: DOMHighResTimeStamp = 0\n\n /**\n * The Automator instance that controls model automation.\n * @type {Automator}\n */\n automator: Automator\n\n currentGlId: number = 0\n private generateUID(): number {\n return ++this.currentGlId\n }\n\n /**\n * Creates a new Live2DModel instance.\n * @param options - Options for Live2DModel and Automator.\n */\n constructor(options?: Live2DModelOptions) {\n super()\n\n this.textureOptions = options?.textureOptions\n this.anchorMode = options?.anchorMode ?? 'canvas'\n\n this.anchor = new ObservablePoint(\n {\n _onUpdate: () => this.onAnchorChange(),\n },\n 0,\n 0\n )\n\n this.automator = new Automator(this, options)\n this.once('modelLoaded', () => this.initializeOnModelLoad(options))\n }\n\n /**\n * Insert this model into Pixi's instruction set so zIndex ordering works with other objects.\n */\n collectRenderables(instructionSet: InstructionSet, renderer: Renderer, currentLayer: RenderLayer): void {\n if (this.parentRenderLayer && this.parentRenderLayer !== currentLayer) {\n return\n }\n\n if (this.globalDisplayStatus < 0b111) {\n return\n }\n\n if (!this.includeInBuild) {\n return\n }\n\n if (this.sortableChildren) {\n this.sortChildren()\n }\n\n ensureLive2DPipe(renderer)\n\n const renderPipes = (renderer as Live2DPipeRenderer).renderPipes\n\n const addRenderable = () => {\n renderPipes.live2d!.addRenderable(this, instructionSet)\n }\n\n const collectChildren = () => {\n const children = this.children\n const length = children.length\n\n for (let i = 0; i < length; i++) {\n children[i]!.collectRenderables(instructionSet, renderer, currentLayer)\n }\n }\n\n const effects = this.effects\n\n if (effects) {\n if (effects.length) {\n renderPipes.live2d!.addPrepare(() => this.prepareForRender(), instructionSet)\n }\n\n for (let i = 0; i < effects.length; i++) {\n const effect = effects[i]!\n\n // Inherit renderer resolution so filtered Live2D stays crisp.\n const filters = (effect as { filters?: { resolution?: unknown }[] | undefined }).filters\n\n if (filters) {\n for (const f of filters) {\n if (f && typeof f.resolution === 'number' && f.resolution === 1) {\n f.resolution = 'inherit' as const\n }\n }\n }\n\n renderPipes[effect.pipe]?.push?.(effect, this, instructionSet)\n }\n\n addRenderable()\n collectChildren()\n\n for (let i = effects.length - 1; i >= 0; i--) {\n const effect = effects[i]!\n renderPipes[effect.pipe]?.pop?.(effect, this, instructionSet)\n }\n } else {\n addRenderable()\n collectChildren()\n }\n }\n\n /**\n * A handler of the \"modelLoaded\" event, invoked when the internal model has been loaded.\n * @protected\n * @param _options - The options used for initialization.\n */\n protected initializeOnModelLoad(_options?: Live2DModelOptions) {\n this.tag = `Live2DModel(${this.internalModel.settings.name})`\n\n this.updateDrawableBounds(true)\n if (this.anchorMode === 'canvas') {\n this.onAnchorChange()\n }\n }\n\n /**\n * A callback that observes {@link anchor}, invoked when the anchor's values have been changed.\n * @protected\n */\n protected onAnchorChange(): void {\n if (!this.internalModel || !this.pivot) {\n return\n }\n\n if (this.anchorMode === 'drawable') {\n const bounds = this.bounds\n\n this.pivot.set(bounds.minX + this.anchor.x * bounds.width, bounds.minY + this.anchor.y * bounds.height)\n } else {\n this.pivot.set(this.anchor.x * this.internalModel.width, this.anchor.y * this.internalModel.height)\n }\n }\n\n /**\n * Shorthand to start a motion.\n * @param group - The motion group.\n * @param [index] - Index in the motion group.\n * @param [priority=2] - The priority to be applied. (0: No priority, 1: IDLE, 2:NORMAL, 3:FORCE)\n * @param {Object} options - Additional options for motion.\n * @param [options.sound] - The audio url to file or base64 content.\n * @param [options.volume=0.5] - Volume of the sound (0-1).\n * @param [options.expression] - In case you want to mix up an expression while playing sound (bind with Model.expression()).\n * @param [options.resetExpression=true] - Reset the expression to default after the motion is finished.\n * @param [options.onFinish] - Callback function when speaking completes.\n * @param [options.onError] - Callback function when an error occurs.\n * @param [options.loop] - Whether the motion should loop. Overrides Cubism 3/4/5 motion JSON loop metadata when specified.\n * @return Promise that resolves with true if the motion is successfully started, with false otherwise.\n */\n async motion(\n group: string,\n index?: number,\n priority?: MotionPriority,\n {\n sound = undefined,\n volume = VOLUME,\n expression = undefined,\n resetExpression = true,\n onFinish,\n onError,\n loop = undefined,\n }: {\n sound?: string\n volume?: number\n expression?: number | string\n resetExpression?: boolean\n onFinish?: () => void\n onError?: (e: Error) => void\n loop?: boolean\n } = {}\n ): Promise<boolean> {\n if (index === undefined) {\n return this.internalModel.motionManager.startRandomMotion(group, priority, {\n sound: sound,\n volume: volume,\n expression: expression,\n resetExpression: resetExpression,\n onFinish: onFinish,\n onError: onError,\n loop: loop,\n })\n } else {\n return this.internalModel.motionManager.startMotion(group, index, priority, {\n sound: sound,\n volume: volume,\n expression: expression,\n resetExpression: resetExpression,\n onFinish: onFinish,\n onError: onError,\n loop: loop,\n })\n }\n }\n\n async motionLastFrame(\n group: string,\n id: number,\n {\n expression = undefined,\n }: {\n expression?: number | string\n } = {}\n ): Promise<boolean> {\n return this.internalModel.motionManager.motionLastFrame(group, id, { expression: expression })\n }\n\n /**\n * Shorthand to start multiple motions in parallel.\n * @param motionList - The motion list, each item includes:\n * group: The motion group,\n * index: Index in the motion group,\n * priority: The priority to be applied. (0: No priority, 1: IDLE, 2:NORMAL, 3:FORCE) (default: 2)\n * ignoreParamIds: The ids to be ignored,\n * loop: Whether the motion should loop.\n * @return Promise that resolves with a list, indicates the motion is successfully started, with false otherwise.\n */\n async parallelMotion(\n motionList: {\n group: string\n index: number\n priority?: MotionPriority\n ignoreParamIds?: string[]\n loop?: boolean\n }[]\n ): Promise<boolean[]> {\n this.internalModel.extendParallelMotionManager(motionList.length)\n const result = motionList.map((m, idx) =>\n this.internalModel.parallelMotionManager[idx]!.startMotion(m.group, m.index, m.priority, {\n ignoreParamIds: m.ignoreParamIds,\n loop: m.loop,\n })\n )\n const flags: boolean[] = []\n for (const r of result) {\n flags.push(await r)\n }\n return flags\n }\n\n /**\n * Shorthand to play the last frame of multiple motions in parallel and await their completion.\n *\n * This method initiates the final frame of each specified motion concurrently,\n * leveraging the internal parallel motion manager. Each motion's completion is awaited\n * sequentially, and the results are returned as an array of success flags.\n *\n * @async\n * @param {{group: string, index: number, priority?: MotionPriority}[]} motionList - Array of motions to execute.\n * @param {string} motionList.group - Motion group identifier (e.g., \"idle\", \"walk\").\n * @param {number} motionList.index - Index within the motion group.\n * @param {MotionPriority} [motionList.priority=2] - Motion priority (0: None, 1: IDLE, 2: NORMAL, 3: FORCE).\n * @returns {Promise<boolean[]>} Resolves with an array where each boolean indicates\n * whether the corresponding motion completed successfully.\n */\n async parallelLastFrame(\n motionList: {\n group: string\n index: number\n }[]\n ): Promise<boolean[]> {\n this.internalModel.extendParallelMotionManager(motionList.length)\n const result = motionList.map((m, idx) =>\n this.internalModel.parallelMotionManager[idx]!.playMotionLastFrame(m.group, m.index)\n )\n const flags: boolean[] = []\n for (const r of result) {\n flags.push(await r)\n }\n return flags\n }\n\n /**\n * Stops all playing motions as well as the sound.\n */\n stopMotions(): void {\n this.internalModel.motionManager.stopAllMotions()\n }\n\n /**\n * Shorthand to start speaking a sound with an expression.\n * @param sound - The audio url to file or base64 content.\n * @param {Object} options - Additional options for speaking.\n * @param [options.volume] - Volume of the sound (0-1).\n * @param [options.expression] - In case you want to mix up an expression while playing sound (bind with Model.expression()).\n * @param [options.resetExpression=true] - Reset the expression to default after the motion is finished.\n * @param [options.onFinish] - Callback function when speaking completes.\n * @param [options.onError] - Callback function when an error occurs.\n * @returns Promise that resolves with true if the sound is playing, false if it's not.\n */\n speak(\n sound: string,\n {\n volume = VOLUME,\n expression,\n resetExpression = true,\n onFinish,\n onError,\n }: {\n volume?: number\n expression?: number | string\n resetExpression?: boolean\n onFinish?: () => void\n onError?: (e: Error) => void\n } = {}\n ): Promise<boolean> {\n return this.internalModel.motionManager.speak(sound, {\n volume: volume,\n expression: expression,\n resetExpression: resetExpression,\n onFinish: onFinish,\n onError: onError,\n })\n }\n\n /**\n * Stop current audio playback and lipsync.\n */\n stopSpeaking(): void {\n this.internalModel.motionManager.stopSpeaking()\n }\n\n /**\n * Shorthand to activate an expression on top of the ones already active.\n * @param id - Either the index, or the name of the expression. If not presented, a random inactive expression will be activated.\n * @return Promise that resolves with true if succeeded, with false otherwise.\n */\n expression(id?: number | string): Promise<boolean> {\n if (this.internalModel.motionManager.expressionManager) {\n return id === undefined\n ? this.internalModel.motionManager.expressionManager.setRandomExpression()\n : this.internalModel.motionManager.expressionManager.setExpression(id)\n }\n return Promise.resolve(false)\n }\n\n /**\n * Updates the focus position. This will not cause the model to immediately look at the position,\n * instead the movement will be interpolated.\n * @param x - Position in world space.\n * @param y - Position in world space.\n * @param instant - Should the focus position be instantly applied.\n */\n focus(x: number, y: number, instant: boolean = false): void {\n tempPoint.x = x\n tempPoint.y = y\n\n // we can pass `true` as the third argument to skip the update transform\n // because focus won't take effect until the model is rendered,\n // and a model being rendered will always get transform updated\n this.toModelPosition(tempPoint, tempPoint, true)\n\n const tx = (tempPoint.x / this.internalModel.originalWidth) * 2 - 1\n const ty = (tempPoint.y / this.internalModel.originalHeight) * 2 - 1\n const radian = Math.atan2(ty, tx)\n this.internalModel.focusController.focus(Math.cos(radian), -Math.sin(radian), instant)\n }\n\n /**\n * Tap on the model. This will perform a hit-testing, and emit a \"hit\" event\n * if at least one of the hit areas is hit.\n * @param x - Position in world space.\n * @param y - Position in world space.\n * @emits {@link Live2DModelEvents.hit}\n */\n tap(x: number, y: number): void {\n const hitAreaNames = this.hitTest(x, y)\n\n if (hitAreaNames.length) {\n this.emit('hit', hitAreaNames)\n }\n }\n\n /**\n * Hit-test on the model.\n * @param x - Position in world space.\n * @param y - Position in world space.\n * @return The names of the *hit* hit areas. Can be empty if none is hit.\n */\n hitTest(x: number, y: number): string[] {\n tempPoint.x = x\n tempPoint.y = y\n this.toModelPosition(tempPoint, tempPoint)\n\n return this.internalModel.hitTest(tempPoint.x, tempPoint.y)\n }\n\n /**\n * Calculates the position in the canvas of original, unscaled Live2D model.\n * @param position - A Point in world space.\n * @param result - A Point to store the new value. Defaults to a new Point.\n * @param skipUpdate - True to skip the update transform.\n * @return The Point in model canvas space.\n */\n toModelPosition(position: Point, result: Point = position.clone(), skipUpdate?: boolean): Point {\n if (!skipUpdate) {\n this.updateLocalTransform()\n }\n\n this.toLocal(position, undefined, result, skipUpdate)\n this.internalModel.localTransform.applyInverse(result, result)\n return result\n }\n\n /**\n * A method required by `PIXI.InteractionManager` to perform hit-testing.\n * @param point - A Point in local space.\n * @return True if the point is inside this model.\n */\n containsPoint(point: Point): boolean {\n return this.bounds.containsPoint(point.x, point.y)\n }\n\n /** @override\n * Calculates the bounds of the Live2DModel for rendering and interaction purposes.\n */\n protected _calculateBounds(): void {\n if (!this.internalModel) {\n this.getBounds().set(0, 0, 0, 0)\n return\n }\n\n const bounds = this.bounds\n\n this.getBounds().addFrame(bounds.minX, bounds.minY, bounds.maxX, bounds.maxY, this.transform.matrix)\n }\n\n /**\n * Updates the model. Note this method just updates the timer,\n * and the actual update will be done right before rendering the model.\n * @param dt - The elapsed time in milliseconds since last frame.\n */\n update(dt: DOMHighResTimeStamp): void {\n this.deltaTime += dt\n this.elapsedTime += dt\n\n // don't call `this.internalModel.update()` here, because it requires WebGL context\n }\n\n private resolveTextureForRender(index: number, texture: Texture, effectiveScale: number): Texture {\n const plan = getTextureLODPlan({\n ...this.textureOptions,\n effectiveScale,\n textureWidth: texture.source.pixelWidth,\n textureHeight: texture.source.pixelHeight,\n })\n\n if (!plan) {\n return texture\n }\n\n const failure = this.textureLODFailures[index]\n\n if (failure?.source === texture && failure.levels.has(plan.level)) {\n return texture\n }\n\n const existing = this.textureLODStates[index]\n\n if (existing?.source === texture && existing.level === plan.level && !existing.texture.destroyed) {\n return existing.texture\n }\n\n this.destroyTextureLODState(index)\n\n const lodTexture = createTextureLODTexture(\n texture,\n plan.level,\n plan.width,\n plan.height,\n this.textureOptions?.lodFilter\n )\n\n if (!lodTexture) {\n this.markTextureLODFailure(index, texture, plan.level)\n return texture\n }\n\n this.textureLODStates[index] = {\n source: texture,\n level: plan.level,\n texture: lodTexture,\n }\n\n return lodTexture\n }\n\n private markTextureLODFailure(index: number, texture: Texture, level: number): void {\n let failure = this.textureLODFailures[index]\n\n if (failure?.source !== texture) {\n failure = { source: texture, levels: new Set<number>() }\n this.textureLODFailures[index] = failure\n }\n\n failure.levels.add(level)\n }\n\n private destroyTextureLODState(index: number): void {\n const state = this.textureLODStates[index]\n\n if (!state) {\n return\n }\n\n state.texture.destroy(true)\n this.textureLODStates[index] = undefined\n }\n\n private destroyTextureLODStates(): void {\n for (let i = 0; i < this.textureLODStates.length; i++) {\n this.destroyTextureLODState(i)\n }\n\n this.textureLODFailures.length = 0\n }\n\n private uploadTextureForRender(renderer: WebGLRenderer, texture: Texture, shouldUpdateTexture: boolean): void {\n // getGlSource() cannot be used here, as it will trigger PixiJS's material upload\n // before Cubism's expected UNPACK_FLIP_Y state is applied.\n const hasGlSource = Boolean(texture.source._gpuData[renderer.uid])\n\n if (shouldUpdateTexture || !hasGlSource) {\n renderer.gl.pixelStorei(WebGLRenderingContext.UNPACK_FLIP_Y_WEBGL, this.internalModel.textureFlipY)\n\n renderer.texture.bind(texture, 0)\n }\n }\n\n /**\n * Renders the Live2DModel to the renderer.\n * @param renderer - The PixiJS Renderer instance.\n */\n renderLive2D = (renderer: Renderer) => {\n if (!(renderer instanceof WebGLRenderer)) {\n throw new Error(`Renderer is not supported`)\n }\n renderer.geometry.resetState()\n renderer.shader.resetState()\n renderer.texture.resetState()\n\n let shouldUpdateTexture = false\n\n if (this.gl !== renderer.gl) {\n this.gl = renderer.gl\n\n this.internalModel.updateWebGLContext(renderer.gl, this.generateUID())\n\n shouldUpdateTexture = true\n }\n\n const { projectionMatrix, offset, worldTransformMatrix } = renderer.globalUniforms.globalUniformData\n const adjustedWorld = tempWorldMatrix.copyFrom(worldTransformMatrix).append(this.groupTransform)\n const effectiveScale = getMatrixMaxScale(adjustedWorld) * renderer.resolution\n\n for (let i = 0; i < this.textures.length; i++) {\n const originalTexture = this.textures[i]!\n let texture = this.resolveTextureForRender(i, originalTexture, effectiveScale)\n\n try {\n this.uploadTextureForRender(renderer, texture, shouldUpdateTexture)\n } catch {\n if (texture === originalTexture) {\n throw new Error('Failed to upload Live2D texture.')\n }\n\n const state = this.textureLODStates[i]\n\n if (state?.texture === texture) {\n this.markTextureLODFailure(i, originalTexture, state.level)\n this.destroyTextureLODState(i)\n }\n\n texture = originalTexture\n this.uploadTextureForRender(renderer, texture, shouldUpdateTexture)\n }\n\n this.internalModel.bindTexture(i, renderer.texture.getGlSource(texture.source).texture)\n }\n\n const viewport = renderer.renderTarget.viewport\n const renderTarget = renderer.renderTarget.renderTarget\n let viewportY = viewport.y\n\n if (renderTarget?.isRoot) {\n const pixelHeight = renderTarget.colorTexture.source.pixelHeight\n viewportY = pixelHeight - viewport.height - viewport.y\n }\n\n this.internalModel.viewport = [viewport.x, viewportY, viewport.width, viewport.height]\n\n const frameDelta = this.deltaTime\n this.deltaTime = 0\n\n if (frameDelta) {\n this.internalModel.update(frameDelta, this.elapsedTime)\n }\n\n adjustedWorld.tx -= offset?.x ?? 0\n adjustedWorld.ty -= offset?.y ?? 0\n\n const internalTransform = tempMatrix.copyFrom(projectionMatrix).append(adjustedWorld)\n\n this.internalModel.updateTransform(internalTransform)\n // groupAlpha is the container's alpha combined within its render group, so\n // `model.alpha` (and ancestors') applies to the Cubism draw.\n this.internalModel.alpha = this.groupAlpha\n this.internalModel.draw(renderer.gl)\n\n if (this._boundsRetryAfterDraw) {\n this.updateDrawableBounds(true)\n }\n\n renderer.state.resetState()\n renderer.texture.resetState()\n\n // Restore Pixi's cached clear color so subsequent clears use the expected background.\n const clearColor = renderer.renderTarget?.defaultClearColor\n const clearColorCache = (renderer.renderTarget as unknown as { adaptor?: { _clearColorCache?: number[] } })?.adaptor\n ?._clearColorCache\n if (clearColor) {\n renderer.gl.clearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3])\n if (clearColorCache) {\n clearColorCache[0] = clearColor[0]\n clearColorCache[1] = clearColor[1]\n clearColorCache[2] = clearColor[2]\n clearColorCache[3] = clearColor[3]\n }\n }\n }\n\n /**\n * Tears down the atlas textures per the destroy options. A destroy without `texture: true`\n * keeps this model's cached holds — the textures are presumed retained by the caller, so the\n * shared cache entries stay pinned and peers' full teardowns can't destroy them. An\n * Assets-cached texture is unloaded only when its last holder releases it AND source\n * destruction was requested (`baseTexture: true`); otherwise it stays alive in the cache —\n * destroying or unloading it would break URL-sharing models and poison re-loads.\n */\n private releaseTextures(options?: { texture?: boolean; baseTexture?: boolean }): void {\n if (!options?.texture) {\n return\n }\n\n const settings = this.internalModel.settings\n\n this.textures.forEach((texture, index) => {\n const path = settings.textures[index]\n const url = path === undefined ? undefined : settings.resolveURL(path)\n const lastRef = url === undefined ? true : releaseCachedTexture(url)\n\n if (url !== undefined && Assets.cache.has(url)) {\n if (lastRef && options.baseTexture) {\n void Assets.unload(url)\n }\n return\n }\n\n texture.destroy(options.baseTexture)\n })\n }\n\n /**\n * Destroys the model and all related resources. This takes the same options and also\n * behaves the same as `PIXI.Container#destroy`.\n * @param options - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. `options` will be passed on to those calls.\n * @param [options.texture=false] - Only used for child Sprites if `options.children` is set to true\n * Should it destroy the texture of the child sprite\n * @param [options.baseTexture=false] - Only used for child Sprites if `options.children` is set to true\n * Should it destroy the base texture of the child sprite\n */\n destroy(options?: { children?: boolean; texture?: boolean; baseTexture?: boolean }): void {\n // Re-entry would double-release the cached-texture holds.\n if (this.destroyed) {\n return\n }\n\n this.emit('destroy')\n\n this.destroyTextureLODStates()\n this.releaseTextures(options)\n\n this.automator.destroy()\n this.internalModel.destroy()\n\n super.destroy(options)\n }\n}\n","if (typeof window === 'undefined' || typeof window.Live2DCubismCore === 'undefined') {\n throw new Error('Could not find Cubism runtime. This plugin requires live2dcubismcore.js to be loaded.')\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport { CubismIdHandle } from '../id/cubismid';\nimport { CubismFramework } from '../live2dcubismframework';\nimport { CubismModel } from '../model/cubismmodel';\nimport { CubismJson, Value } from '../utils/cubismjson';\n\nconst Epsilon = 0.001;\nconst DefaultFadeInSeconds = 0.5;\n\n// Pose.jsonのタグ\nconst FadeIn = 'FadeInTime';\nconst Link = 'Link';\nconst Groups = 'Groups';\nconst Id = 'Id';\n\n/**\n * パーツの不透明度の設定\n *\n * パーツの不透明度の管理と設定を行う。\n */\nexport class CubismPose {\n /**\n * インスタンスの作成\n * @param pose3json pose3.jsonのデータ\n * @param size pose3.jsonのデータのサイズ[byte]\n * @return 作成されたインスタンス\n */\n public static create(pose3json: ArrayBuffer, size: number): CubismPose {\n const json: CubismJson = CubismJson.create(pose3json, size);\n if (!json) {\n return null;\n }\n\n const ret: CubismPose = new CubismPose();\n const root: Value = json.getRoot();\n\n // フェード時間の指定\n if (!root.getValueByString(FadeIn).isNull()) {\n ret._fadeTimeSeconds = root\n .getValueByString(FadeIn)\n .toFloat(DefaultFadeInSeconds);\n\n if (ret._fadeTimeSeconds < 0.0) {\n ret._fadeTimeSeconds = DefaultFadeInSeconds;\n }\n }\n\n // パーツグループ\n const poseListInfo: Value = root.getValueByString(Groups);\n const poseCount: number = poseListInfo.getSize();\n\n ret._partGroupCounts.length = poseCount;\n for (let poseIndex = 0; poseIndex < poseCount; ++poseIndex) {\n const idListInfo: Value = poseListInfo.getValueByIndex(poseIndex);\n const idCount: number = idListInfo.getSize();\n let groupCount = 0;\n\n for (let groupIndex = 0; groupIndex < idCount; ++groupIndex) {\n const partInfo: Value = idListInfo.getValueByIndex(groupIndex);\n const partData: PartData = new PartData();\n const parameterId: CubismIdHandle =\n CubismFramework.getIdManager().getId(\n partInfo.getValueByString(Id).getRawString()\n );\n\n partData.partId = parameterId;\n\n // リンクするパーツの設定\n if (!partInfo.getValueByString(Link).isNull()) {\n const linkListInfo: Value = partInfo.getValueByString(Link);\n const linkCount: number = linkListInfo.getSize();\n\n for (let linkIndex = 0; linkIndex < linkCount; ++linkIndex) {\n const linkPart: PartData = new PartData();\n const linkId: CubismIdHandle = CubismFramework.getIdManager().getId(\n linkListInfo.getValueByIndex(linkIndex).getString()\n );\n\n linkPart.partId = linkId;\n\n partData.link.push(linkPart);\n }\n }\n\n ret._partGroups.push(partData.clone());\n\n ++groupCount;\n }\n\n ret._partGroupCounts[poseIndex] = groupCount;\n }\n\n CubismJson.delete(json);\n\n return ret;\n }\n\n /**\n * インスタンスを破棄する\n * @param pose 対象のCubismPose\n */\n public static delete(pose: CubismPose): void {\n if (pose != null) {\n pose = null;\n }\n }\n\n /**\n * モデルのパラメータの更新\n * @param model 対象のモデル\n * @param deltaTimeSeconds デルタ時間[秒]\n */\n public updateParameters(model: CubismModel, deltaTimeSeconds: number): void {\n // 前回のモデルと同じでない場合は初期化が必要\n if (model != this._lastModel) {\n // パラメータインデックスの初期化\n this.reset(model);\n }\n\n this._lastModel = model;\n\n // 設定から時間を変更すると、経過時間がマイナスになる事があるので、経過時間0として対応\n if (deltaTimeSeconds < 0.0) {\n deltaTimeSeconds = 0.0;\n }\n\n let beginIndex = 0;\n\n for (let i = 0; i < this._partGroupCounts.length; i++) {\n const partGroupCount: number = this._partGroupCounts[i];\n\n this.doFade(model, deltaTimeSeconds, beginIndex, partGroupCount);\n\n beginIndex += partGroupCount;\n }\n\n this.copyPartOpacities(model);\n }\n\n /**\n * 表示を初期化\n * @param model 対象のモデル\n * @note 不透明度の初期値が0でないパラメータは、不透明度を1に設定する\n */\n public reset(model: CubismModel): void {\n let beginIndex = 0;\n\n for (let i = 0; i < this._partGroupCounts.length; ++i) {\n const groupCount: number = this._partGroupCounts[i];\n\n for (let j: number = beginIndex; j < beginIndex + groupCount; ++j) {\n this._partGroups[j].initialize(model);\n\n const partsIndex: number = this._partGroups[j].partIndex;\n const paramIndex: number = this._partGroups[j].parameterIndex;\n\n if (partsIndex < 0) {\n continue;\n }\n\n model.setPartOpacityByIndex(partsIndex, j == beginIndex ? 1.0 : 0.0);\n model.setParameterValueByIndex(paramIndex, j == beginIndex ? 1.0 : 0.0);\n\n for (let k = 0; k < this._partGroups[j].link.length; ++k) {\n this._partGroups[j].link[k].initialize(model);\n }\n }\n\n beginIndex += groupCount;\n }\n }\n\n /**\n * パーツの不透明度をコピー\n *\n * @param model 対象のモデル\n */\n public copyPartOpacities(model: CubismModel): void {\n for (\n let groupIndex = 0;\n groupIndex < this._partGroups.length;\n ++groupIndex\n ) {\n const partData: PartData = this._partGroups[groupIndex];\n\n if (partData.link.length == 0) {\n continue; // 連動するパラメータはない\n }\n\n const partIndex: number = this._partGroups[groupIndex].partIndex;\n const opacity: number = model.getPartOpacityByIndex(partIndex);\n\n for (let linkIndex = 0; linkIndex < partData.link.length; ++linkIndex) {\n const linkPart: PartData = partData.link[linkIndex];\n const linkPartIndex: number = linkPart.partIndex;\n\n if (linkPartIndex < 0) {\n continue;\n }\n\n model.setPartOpacityByIndex(linkPartIndex, opacity);\n }\n }\n }\n\n /**\n * パーツのフェード操作を行う。\n * @param model 対象のモデル\n * @param deltaTimeSeconds デルタ時間[秒]\n * @param beginIndex フェード操作を行うパーツグループの先頭インデックス\n * @param partGroupCount フェード操作を行うパーツグループの個数\n */\n public doFade(\n model: CubismModel,\n deltaTimeSeconds: number,\n beginIndex: number,\n partGroupCount: number\n ): void {\n let visiblePartIndex = -1;\n let newOpacity = 1.0;\n\n const phi = 0.5;\n const backOpacityThreshold = 0.15;\n\n // 現在、表示状態になっているパーツを取得\n for (let i: number = beginIndex; i < beginIndex + partGroupCount; ++i) {\n const partIndex: number = this._partGroups[i].partIndex;\n const paramIndex: number = this._partGroups[i].parameterIndex;\n\n if (model.getParameterValueByIndex(paramIndex) > Epsilon) {\n if (visiblePartIndex >= 0) {\n break;\n }\n\n visiblePartIndex = i;\n // ゼロ除算の回避\n if (this._fadeTimeSeconds == 0) {\n newOpacity = 1.0;\n continue;\n }\n\n newOpacity = model.getPartOpacityByIndex(partIndex);\n\n // 新しい不透明度を計算\n newOpacity += deltaTimeSeconds / this._fadeTimeSeconds;\n\n if (newOpacity > 1.0) {\n newOpacity = 1.0;\n }\n }\n }\n\n if (visiblePartIndex < 0) {\n visiblePartIndex = 0;\n newOpacity = 1.0;\n }\n\n // 表示パーツ、非表示パーツの不透明度を設定する\n for (let i: number = beginIndex; i < beginIndex + partGroupCount; ++i) {\n const partsIndex: number = this._partGroups[i].partIndex;\n\n // 表示パーツの設定\n if (visiblePartIndex == i) {\n model.setPartOpacityByIndex(partsIndex, newOpacity); // 先に設定\n }\n // 非表示パーツの設定\n else {\n let opacity: number = model.getPartOpacityByIndex(partsIndex);\n let a1: number; // 計算によって求められる不透明度\n\n if (newOpacity < phi) {\n a1 = (newOpacity * (phi - 1)) / phi + 1.0; // (0,1),(phi,phi)を通る直線式\n } else {\n a1 = ((1 - newOpacity) * phi) / (1.0 - phi); // (1,0),(phi,phi)を通る直線式\n }\n\n // 背景の見える割合を制限する場合\n const backOpacity: number = (1.0 - a1) * (1.0 - newOpacity);\n\n if (backOpacity > backOpacityThreshold) {\n a1 = 1.0 - backOpacityThreshold / (1.0 - newOpacity);\n }\n\n if (opacity > a1) {\n opacity = a1; // 計算の不透明度よりも大きければ(濃ければ)不透明度を上げる\n }\n\n model.setPartOpacityByIndex(partsIndex, opacity);\n }\n }\n }\n\n /**\n * コンストラクタ\n */\n public constructor() {\n this._fadeTimeSeconds = DefaultFadeInSeconds;\n this._lastModel = null;\n this._partGroups = new Array<PartData>();\n this._partGroupCounts = new Array<number>();\n }\n\n _partGroups: Array<PartData>; // パーツグループ\n _partGroupCounts: Array<number>; // それぞれのパーツグループの個数\n _fadeTimeSeconds: number; // フェード時間[秒]\n _lastModel: CubismModel; // 前回操作したモデル\n}\n\n/**\n * パーツにまつわるデータを管理\n */\nexport class PartData {\n /**\n * コンストラクタ\n */\n constructor(v?: PartData) {\n this.parameterIndex = 0;\n this.partIndex = 0;\n this.link = new Array<PartData>();\n\n if (v != undefined) {\n this.partId = v.partId;\n\n this.link.length = v.link.length;\n for (let i = 0; i < v.link.length; i++) {\n this.link[i] = v.link[i].clone();\n }\n }\n }\n\n /**\n * =演算子のオーバーロード\n */\n public assignment(v: PartData): PartData {\n this.partId = v.partId;\n\n let dstIndex: number = this.link.length;\n this.link.length += v.link.length;\n for (const partData of v.link) {\n this.link[dstIndex++] = partData.clone();\n }\n\n return this;\n }\n\n /**\n * 初期化\n * @param model 初期化に使用するモデル\n */\n public initialize(model: CubismModel): void {\n this.parameterIndex = model.getParameterIndex(this.partId);\n this.partIndex = model.getPartIndex(this.partId);\n\n model.setParameterValueByIndex(this.parameterIndex, 1);\n }\n\n /**\n * オブジェクトのコピーを生成する\n */\n public clone(): PartData {\n const clonePartData: PartData = new PartData();\n\n clonePartData.partId = this.partId;\n clonePartData.parameterIndex = this.parameterIndex;\n clonePartData.partIndex = this.partIndex;\n clonePartData.link = new Array<PartData>();\n\n clonePartData.link.length = this.link.length;\n for (let i = 0; i < this.link.length; i++) {\n clonePartData.link[i] = this.link[i].clone();\n }\n\n return clonePartData;\n }\n\n partId: CubismIdHandle; // パーツID\n parameterIndex: number; // パラメータのインデックス\n partIndex: number; // パーツのインデックス\n link: Array<PartData>; // 連動するパラメータ\n}\n\n// Namespace definition for compatibility.\nimport * as $ from './cubismpose';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const CubismPose = $.CubismPose;\n export type CubismPose = $.CubismPose;\n export const PartData = $.PartData;\n export type PartData = $.PartData;\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport { CubismTextureColor } from '../rendering/cubismrenderer';\nimport { CubismModelObjectType, NoOffscreenIndex } from './cubismmodel';\nimport { CubismLogWarning } from '../utils/cubismdebug';\n\n/**\n * SDK側から与えられた描画オブジェクトの乗算色・スクリーン色上書きフラグと\n * その色を保持する構造体\n */\nexport class ColorData {\n constructor(\n isOverridden = false,\n color: CubismTextureColor = new CubismTextureColor()\n ) {\n this.isOverridden = isOverridden;\n this.color = color;\n }\n\n public isOverridden: boolean;\n public color: CubismTextureColor;\n}\n\n/**\n * Handling multiply and screen colors of the model.\n */\nexport class CubismModelMultiplyAndScreenColor {\n private _model: any; // CubismModel\n private _isOverriddenModelMultiplyColors: boolean;\n private _isOverriddenModelScreenColors: boolean;\n private _userPartScreenColors: Array<ColorData>;\n private _userPartMultiplyColors: Array<ColorData>;\n private _userDrawableScreenColors: Array<ColorData>;\n private _userDrawableMultiplyColors: Array<ColorData>;\n private _userOffscreenScreenColors: Array<ColorData>;\n private _userOffscreenMultiplyColors: Array<ColorData>;\n\n /**\n * Constructor.\n *\n * @param model cubism model.\n */\n public constructor(model: any) {\n this._model = model;\n this._isOverriddenModelMultiplyColors = false;\n this._isOverriddenModelScreenColors = false;\n this._userPartScreenColors = [];\n this._userPartMultiplyColors = [];\n this._userDrawableScreenColors = [];\n this._userDrawableMultiplyColors = [];\n this._userOffscreenScreenColors = [];\n this._userOffscreenMultiplyColors = [];\n }\n\n /**\n * Initialization for using multiply and screen colors.\n *\n * @param partCount number of parts.\n * @param drawableCount number of drawables.\n * @param offscreenCount number of offscreen.\n */\n public initialize(\n partCount: number,\n drawableCount: number,\n offscreenCount: number\n ): void {\n // 乗算色の初期値\n const userMultiplyColor = new ColorData(\n false,\n new CubismTextureColor(1.0, 1.0, 1.0, 1.0)\n );\n\n // スクリーン色の初期値\n const userScreenColor = new ColorData(\n false,\n new CubismTextureColor(0.0, 0.0, 0.0, 1.0)\n );\n\n // Part\n this._userPartMultiplyColors = new Array(partCount);\n this._userPartScreenColors = new Array(partCount);\n for (let i = 0; i < partCount; i++) {\n this._userPartMultiplyColors[i] = new ColorData(\n userMultiplyColor.isOverridden,\n new CubismTextureColor(\n userMultiplyColor.color.r,\n userMultiplyColor.color.g,\n userMultiplyColor.color.b,\n userMultiplyColor.color.a\n )\n );\n this._userPartScreenColors[i] = new ColorData(\n userScreenColor.isOverridden,\n new CubismTextureColor(\n userScreenColor.color.r,\n userScreenColor.color.g,\n userScreenColor.color.b,\n userScreenColor.color.a\n )\n );\n }\n\n // Drawable\n this._userDrawableMultiplyColors = new Array(drawableCount);\n this._userDrawableScreenColors = new Array(drawableCount);\n for (let i = 0; i < drawableCount; i++) {\n this._userDrawableMultiplyColors[i] = new ColorData(\n userMultiplyColor.isOverridden,\n new CubismTextureColor(\n userMultiplyColor.color.r,\n userMultiplyColor.color.g,\n userMultiplyColor.color.b,\n userMultiplyColor.color.a\n )\n );\n this._userDrawableScreenColors[i] = new ColorData(\n userScreenColor.isOverridden,\n new CubismTextureColor(\n userScreenColor.color.r,\n userScreenColor.color.g,\n userScreenColor.color.b,\n userScreenColor.color.a\n )\n );\n }\n\n // Offscreen\n this._userOffscreenMultiplyColors = new Array(offscreenCount);\n this._userOffscreenScreenColors = new Array(offscreenCount);\n for (let i = 0; i < offscreenCount; i++) {\n this._userOffscreenMultiplyColors[i] = new ColorData(\n userMultiplyColor.isOverridden,\n new CubismTextureColor(\n userMultiplyColor.color.r,\n userMultiplyColor.color.g,\n userMultiplyColor.color.b,\n userMultiplyColor.color.a\n )\n );\n this._userOffscreenScreenColors[i] = new ColorData(\n userScreenColor.isOverridden,\n new CubismTextureColor(\n userScreenColor.color.r,\n userScreenColor.color.g,\n userScreenColor.color.b,\n userScreenColor.color.a\n )\n );\n }\n }\n\n /**\n * Outputs a warning message for index out of range errors.\n *\n * @param functionName Name of the calling function\n * @param index The invalid index value\n * @param maxIndex The maximum valid index (length - 1)\n */\n private warnIndexOutOfRange(\n functionName: string,\n index: number,\n maxIndex: number\n ): void {\n CubismLogWarning(\n `${functionName}: index is out of range. index=${index}, valid range=[0, ${maxIndex}].`\n );\n }\n\n /**\n * Validates if the given part index is within valid range.\n *\n * @param index Part index to validate\n * @param functionName Name of the calling function for error reporting\n * @return true if the index is valid; otherwise false\n */\n private isValidPartIndex(index: number, functionName: string): boolean {\n if (index < 0 || index >= this._model.getPartCount()) {\n this.warnIndexOutOfRange(\n functionName,\n index,\n this._model.getPartCount() - 1\n );\n return false;\n }\n return true;\n }\n\n /**\n * Validates if the given drawable index is within valid range.\n *\n * @param index Drawable index to validate\n * @param functionName Name of the calling function for error reporting\n * @return true if the index is valid; otherwise false\n */\n private isValidDrawableIndex(index: number, functionName: string): boolean {\n if (index < 0 || index >= this._model.getDrawableCount()) {\n this.warnIndexOutOfRange(\n functionName,\n index,\n this._model.getDrawableCount() - 1\n );\n return false;\n }\n return true;\n }\n\n /**\n * Validates if the given offscreen index is within valid range.\n *\n * @param index Offscreen index to validate\n * @param functionName Name of the calling function for error reporting\n * @return true if the index is valid; otherwise false\n */\n private isValidOffscreenIndex(index: number, functionName: string): boolean {\n if (index < 0 || index >= this._model.getOffscreenCount()) {\n this.warnIndexOutOfRange(\n functionName,\n index,\n this._model.getOffscreenCount() - 1\n );\n return false;\n }\n return true;\n }\n\n /**\n * Sets the flag indicating whether the color set at runtime is used as the multiply color for the entire model during rendering.\n *\n * @param value true if the color set at runtime is to be used; otherwise false.\n */\n public setMultiplyColorEnabled(value: boolean): void {\n this._isOverriddenModelMultiplyColors = value;\n }\n\n /**\n * Returns the flag indicating whether the color set at runtime is used as the multiply color for the entire model during rendering.\n *\n * @return true if the color set at runtime is used; otherwise false.\n */\n public getMultiplyColorEnabled(): boolean {\n return this._isOverriddenModelMultiplyColors;\n }\n\n /**\n * Sets the flag indicating whether the color set at runtime is used as the screen color for the entire model during rendering.\n *\n * @param value true if the color set at runtime is to be used; otherwise false.\n */\n public setScreenColorEnabled(value: boolean): void {\n this._isOverriddenModelScreenColors = value;\n }\n\n /**\n * Returns the flag indicating whether the color set at runtime is used as the screen color for the entire model during rendering.\n *\n * @return true if the color set at runtime is used; otherwise false.\n */\n public getScreenColorEnabled(): boolean {\n return this._isOverriddenModelScreenColors;\n }\n\n /**\n * Sets whether the part multiply color is overridden by the SDK.\n * Use true to use the color information from the SDK, or false to use the color information from the model.\n *\n * @param partIndex Part index\n * @param value true enable override, false to disable\n */\n public setPartMultiplyColorEnabled(partIndex: number, value: boolean): void {\n if (!this.isValidPartIndex(partIndex, 'setPartMultiplyColorEnabled')) {\n return;\n }\n this.setPartColorEnabled(\n partIndex,\n value,\n this._userPartMultiplyColors,\n this._userDrawableMultiplyColors,\n this._userOffscreenMultiplyColors\n );\n }\n\n /**\n * Checks whether the part multiply color is overridden by the SDK.\n *\n * @param partIndex Part index\n *\n * @return true if the color information from the SDK is used; otherwise false.\n */\n public getPartMultiplyColorEnabled(partIndex: number): boolean {\n if (!this.isValidPartIndex(partIndex, 'getPartMultiplyColorEnabled')) {\n return false;\n }\n return this._userPartMultiplyColors[partIndex].isOverridden;\n }\n\n /**\n * Sets whether the part screen color is overridden by the SDK.\n * Use true to use the color information from the SDK, or false to use the color information from the model.\n *\n * @param partIndex Part index\n * @param value true enable override, false to disable\n */\n public setPartScreenColorEnabled(partIndex: number, value: boolean): void {\n if (!this.isValidPartIndex(partIndex, 'setPartScreenColorEnabled')) {\n return;\n }\n this.setPartColorEnabled(\n partIndex,\n value,\n this._userPartScreenColors,\n this._userDrawableScreenColors,\n this._userOffscreenScreenColors\n );\n }\n\n /**\n * Checks whether the part screen color is overridden by the SDK.\n *\n * @param partIndex Part index\n *\n * @return true if the color information from the SDK is used; otherwise false.\n */\n public getPartScreenColorEnabled(partIndex: number): boolean {\n if (!this.isValidPartIndex(partIndex, 'getPartScreenColorEnabled')) {\n return false;\n }\n return this._userPartScreenColors[partIndex].isOverridden;\n }\n\n /**\n * Sets the multiply color of the part.\n *\n * @param partIndex Part index\n * @param color Multiply color to be set (CubismTextureColor)\n */\n public setPartMultiplyColorByTextureColor(\n partIndex: number,\n color: CubismTextureColor\n ): void {\n if (\n !this.isValidPartIndex(partIndex, 'setPartMultiplyColorByTextureColor')\n ) {\n return;\n }\n this.setPartMultiplyColorByRGBA(\n partIndex,\n color.r,\n color.g,\n color.b,\n color.a\n );\n }\n\n /**\n * Sets the multiply color of the part.\n *\n * @param partIndex Part index\n * @param r Red value of the multiply color to be set\n * @param g Green value of the multiply color to be set\n * @param b Blue value of the multiply color to be set\n * @param a Alpha value of the multiply color to be set\n */\n public setPartMultiplyColorByRGBA(\n partIndex: number,\n r: number,\n g: number,\n b: number,\n a: number = 1.0\n ): void {\n if (!this.isValidPartIndex(partIndex, 'setPartMultiplyColorByRGBA')) {\n return;\n }\n this.setPartColor(\n partIndex,\n r,\n g,\n b,\n a,\n this._userPartMultiplyColors,\n this._userDrawableMultiplyColors,\n this._userOffscreenMultiplyColors\n );\n }\n\n /**\n * Returns the multiply color of the part.\n *\n * @param partIndex Part index\n *\n * @return Multiply color (CubismTextureColor)\n */\n public getPartMultiplyColor(partIndex: number): CubismTextureColor {\n if (!this.isValidPartIndex(partIndex, 'getPartMultiplyColor')) {\n return new CubismTextureColor(1.0, 1.0, 1.0, 1.0);\n }\n return this._userPartMultiplyColors[partIndex].color;\n }\n\n /**\n * Sets the screen color of the part.\n *\n * @param partIndex Part index\n * @param color Screen color to be set (CubismTextureColor)\n */\n public setPartScreenColorByTextureColor(\n partIndex: number,\n color: CubismTextureColor\n ): void {\n if (!this.isValidPartIndex(partIndex, 'setPartScreenColorByTextureColor')) {\n return;\n }\n this.setPartScreenColorByRGBA(\n partIndex,\n color.r,\n color.g,\n color.b,\n color.a\n );\n }\n\n /**\n * Sets the screen color of the part.\n *\n * @param partIndex Part index\n * @param r Red value of the screen color to be set\n * @param g Green value of the screen color to be set\n * @param b Blue value of the screen color to be set\n * @param a Alpha value of the screen color to be set\n */\n public setPartScreenColorByRGBA(\n partIndex: number,\n r: number,\n g: number,\n b: number,\n a: number = 1.0\n ): void {\n if (!this.isValidPartIndex(partIndex, 'setPartScreenColorByRGBA')) {\n return;\n }\n this.setPartColor(\n partIndex,\n r,\n g,\n b,\n a,\n this._userPartScreenColors,\n this._userDrawableScreenColors,\n this._userOffscreenScreenColors\n );\n }\n\n /**\n * Returns the screen color of the part.\n *\n * @param partIndex Part index\n *\n * @return Screen color (CubismTextureColor)\n */\n public getPartScreenColor(partIndex: number): CubismTextureColor {\n if (!this.isValidPartIndex(partIndex, 'getPartScreenColor')) {\n return new CubismTextureColor(0.0, 0.0, 0.0, 1.0);\n }\n return this._userPartScreenColors[partIndex].color;\n }\n\n /**\n * Sets the flag indicating whether the color set at runtime is used as the multiply color for the drawable during rendering.\n *\n * @param drawableIndex Drawable index\n * @param value true if the color set at runtime is to be used; otherwise false.\n */\n public setDrawableMultiplyColorEnabled(\n drawableIndex: number,\n value: boolean\n ): void {\n if (\n !this.isValidDrawableIndex(\n drawableIndex,\n 'setDrawableMultiplyColorEnabled'\n )\n ) {\n return;\n }\n this._userDrawableMultiplyColors[drawableIndex].isOverridden = value;\n }\n\n /**\n * Returns the flag indicating whether the color set at runtime is used as the multiply color for the drawable during rendering.\n *\n * @param drawableIndex Drawable index\n *\n * @return true if the color set at runtime is used; otherwise false.\n */\n public getDrawableMultiplyColorEnabled(drawableIndex: number): boolean {\n if (\n !this.isValidDrawableIndex(\n drawableIndex,\n 'getDrawableMultiplyColorEnabled'\n )\n ) {\n return false;\n }\n return this._userDrawableMultiplyColors[drawableIndex].isOverridden;\n }\n\n /**\n * Sets the flag indicating whether the color set at runtime is used as the screen color for the drawable during rendering.\n *\n * @param drawableIndex Drawable index\n * @param value true if the color set at runtime is to be used; otherwise false.\n */\n public setDrawableScreenColorEnabled(\n drawableIndex: number,\n value: boolean\n ): void {\n if (\n !this.isValidDrawableIndex(drawableIndex, 'setDrawableScreenColorEnabled')\n ) {\n return;\n }\n this._userDrawableScreenColors[drawableIndex].isOverridden = value;\n }\n\n /**\n * Returns the flag indicating whether the color set at runtime is used as the screen color for the drawable during rendering.\n *\n * @param drawableIndex Drawable index\n *\n * @return true if the color set at runtime is used; otherwise false.\n */\n public getDrawableScreenColorEnabled(drawableIndex: number): boolean {\n if (\n !this.isValidDrawableIndex(drawableIndex, 'getDrawableScreenColorEnabled')\n ) {\n return false;\n }\n return this._userDrawableScreenColors[drawableIndex].isOverridden;\n }\n\n /**\n * Sets the multiply color of the drawable.\n *\n * @param drawableIndex Drawable index\n * @param color Multiply color to be set (CubismTextureColor)\n */\n public setDrawableMultiplyColorByTextureColor(\n drawableIndex: number,\n color: CubismTextureColor\n ): void {\n if (\n !this.isValidDrawableIndex(\n drawableIndex,\n 'setDrawableMultiplyColorByTextureColor'\n )\n ) {\n return;\n }\n this.setDrawableMultiplyColorByRGBA(\n drawableIndex,\n color.r,\n color.g,\n color.b,\n color.a\n );\n }\n\n /**\n * Sets the multiply color of the drawable.\n *\n * @param drawableIndex Drawable index\n * @param r Red value of the multiply color to be set\n * @param g Green value of the multiply color to be set\n * @param b Blue value of the multiply color to be set\n * @param a Alpha value of the multiply color to be set\n */\n public setDrawableMultiplyColorByRGBA(\n drawableIndex: number,\n r: number,\n g: number,\n b: number,\n a: number = 1.0\n ): void {\n if (\n !this.isValidDrawableIndex(\n drawableIndex,\n 'setDrawableMultiplyColorByRGBA'\n )\n ) {\n return;\n }\n this._userDrawableMultiplyColors[drawableIndex].color.r = r;\n this._userDrawableMultiplyColors[drawableIndex].color.g = g;\n this._userDrawableMultiplyColors[drawableIndex].color.b = b;\n this._userDrawableMultiplyColors[drawableIndex].color.a = a;\n }\n\n /**\n * Returns the multiply color from the list of drawables.\n *\n * @param drawableIndex Drawable index\n *\n * @return Multiply color (CubismTextureColor)\n */\n public getDrawableMultiplyColor(drawableIndex: number): CubismTextureColor {\n if (!this.isValidDrawableIndex(drawableIndex, 'getDrawableMultiplyColor')) {\n return new CubismTextureColor(1.0, 1.0, 1.0, 1.0);\n }\n if (\n this.getMultiplyColorEnabled() ||\n this.getDrawableMultiplyColorEnabled(drawableIndex)\n ) {\n return this._userDrawableMultiplyColors[drawableIndex].color;\n }\n return this._model.getDrawableMultiplyColor(drawableIndex);\n }\n\n /**\n * Sets the screen color of the drawable.\n *\n * @param drawableIndex Drawable index\n * @param color Screen color to be set (CubismTextureColor)\n */\n public setDrawableScreenColorByTextureColor(\n drawableIndex: number,\n color: CubismTextureColor\n ): void {\n if (\n !this.isValidDrawableIndex(\n drawableIndex,\n 'setDrawableScreenColorByTextureColor'\n )\n ) {\n return;\n }\n this.setDrawableScreenColorByRGBA(\n drawableIndex,\n color.r,\n color.g,\n color.b,\n color.a\n );\n }\n\n /**\n * Sets the screen color of the drawable.\n *\n * @param drawableIndex Drawable index\n * @param r Red value of the screen color to be set\n * @param g Green value of the screen color to be set\n * @param b Blue value of the screen color to be set\n * @param a Alpha value of the screen color to be set\n */\n public setDrawableScreenColorByRGBA(\n drawableIndex: number,\n r: number,\n g: number,\n b: number,\n a: number = 1.0\n ): void {\n if (\n !this.isValidDrawableIndex(drawableIndex, 'setDrawableScreenColorByRGBA')\n ) {\n return;\n }\n this._userDrawableScreenColors[drawableIndex].color.r = r;\n this._userDrawableScreenColors[drawableIndex].color.g = g;\n this._userDrawableScreenColors[drawableIndex].color.b = b;\n this._userDrawableScreenColors[drawableIndex].color.a = a;\n }\n\n /**\n * Returns the screen color from the list of drawables.\n *\n * @param drawableIndex Drawable index\n *\n * @return Screen color (CubismTextureColor)\n */\n public getDrawableScreenColor(drawableIndex: number): CubismTextureColor {\n if (!this.isValidDrawableIndex(drawableIndex, 'getDrawableScreenColor')) {\n return new CubismTextureColor(0.0, 0.0, 0.0, 1.0);\n }\n if (\n this.getScreenColorEnabled() ||\n this.getDrawableScreenColorEnabled(drawableIndex)\n ) {\n return this._userDrawableScreenColors[drawableIndex].color;\n }\n return this._model.getDrawableScreenColor(drawableIndex);\n }\n\n /**\n * Sets whether the offscreen multiply color is overridden by the SDK.\n * Use true to use the color information from the SDK, or false to use the color information from the model.\n *\n * @param offscreenIndex Offscreen index\n * @param value true enable override, false to disable\n */\n public setOffscreenMultiplyColorEnabled(\n offscreenIndex: number,\n value: boolean\n ): void {\n if (\n !this.isValidOffscreenIndex(\n offscreenIndex,\n 'setOffscreenMultiplyColorEnabled'\n )\n ) {\n return;\n }\n this._userOffscreenMultiplyColors[offscreenIndex].isOverridden = value;\n }\n\n /**\n * Checks whether the offscreen multiply color is overridden by the SDK.\n *\n * @param offscreenIndex Offscreen index\n *\n * @return true if the color information from the SDK is used; otherwise false.\n */\n public getOffscreenMultiplyColorEnabled(offscreenIndex: number): boolean {\n if (\n !this.isValidOffscreenIndex(\n offscreenIndex,\n 'getOffscreenMultiplyColorEnabled'\n )\n ) {\n return false;\n }\n return this._userOffscreenMultiplyColors[offscreenIndex].isOverridden;\n }\n\n /**\n * Sets whether the offscreen screen color is overridden by the SDK.\n * Use true to use the color information from the SDK, or false to use the color information from the model.\n *\n * @param offscreenIndex Offscreen index\n * @param value true enable override, false to disable\n */\n public setOffscreenScreenColorEnabled(\n offscreenIndex: number,\n value: boolean\n ): void {\n if (\n !this.isValidOffscreenIndex(\n offscreenIndex,\n 'setOffscreenScreenColorEnabled'\n )\n ) {\n return;\n }\n this._userOffscreenScreenColors[offscreenIndex].isOverridden = value;\n }\n\n /**\n * Checks whether the offscreen screen color is overridden by the SDK.\n *\n * @param offscreenIndex Offscreen index\n *\n * @return true if the color information from the SDK is used; otherwise false.\n */\n public getOffscreenScreenColorEnabled(offscreenIndex: number): boolean {\n if (\n !this.isValidOffscreenIndex(\n offscreenIndex,\n 'getOffscreenScreenColorEnabled'\n )\n ) {\n return false;\n }\n return this._userOffscreenScreenColors[offscreenIndex].isOverridden;\n }\n\n /**\n * Sets the multiply color of the offscreen.\n *\n * @param offscreenIndex Offsscreen index\n * @param color Multiply color to be set (CubismTextureColor)\n */\n public setOffscreenMultiplyColorByTextureColor(\n offscreenIndex: number,\n color: CubismTextureColor\n ): void {\n if (\n !this.isValidOffscreenIndex(\n offscreenIndex,\n 'setOffscreenMultiplyColorByTextureColor'\n )\n ) {\n return;\n }\n this.setOffscreenMultiplyColorByRGBA(\n offscreenIndex,\n color.r,\n color.g,\n color.b,\n color.a\n );\n }\n\n /**\n * Sets the multiply color of the offscreen.\n *\n * @param offscreenIndex Offsscreen index\n * @param r Red value of the multiply color to be set\n * @param g Green value of the multiply color to be set\n * @param b Blue value of the multiply color to be set\n * @param a Alpha value of the multiply color to be set\n */\n public setOffscreenMultiplyColorByRGBA(\n offscreenIndex: number,\n r: number,\n g: number,\n b: number,\n a: number = 1.0\n ): void {\n if (\n !this.isValidOffscreenIndex(\n offscreenIndex,\n 'setOffscreenMultiplyColorByRGBA'\n )\n ) {\n return;\n }\n this._userOffscreenMultiplyColors[offscreenIndex].color.r = r;\n this._userOffscreenMultiplyColors[offscreenIndex].color.g = g;\n this._userOffscreenMultiplyColors[offscreenIndex].color.b = b;\n this._userOffscreenMultiplyColors[offscreenIndex].color.a = a;\n }\n\n /**\n * Returns the multiply color from the list of offscreen.\n *\n * @param offscreenIndex Offsscreen index\n *\n * @return Multiply color (CubismTextureColor)\n */\n public getOffscreenMultiplyColor(offscreenIndex: number): CubismTextureColor {\n if (\n !this.isValidOffscreenIndex(offscreenIndex, 'getOffscreenMultiplyColor')\n ) {\n return new CubismTextureColor(1.0, 1.0, 1.0, 1.0); // Default offscreen multiply color\n }\n if (\n this.getMultiplyColorEnabled() ||\n this.getOffscreenMultiplyColorEnabled(offscreenIndex)\n ) {\n return this._userOffscreenMultiplyColors[offscreenIndex].color;\n }\n return this._model.getOffscreenMultiplyColor(offscreenIndex);\n }\n\n /**\n * Sets the screen color of the offscreen.\n *\n * @param offscreenIndex Offsscreen index\n * @param color Screen color to be set (CubismTextureColor)\n */\n public setOffscreenScreenColorByTextureColor(\n offscreenIndex: number,\n color: CubismTextureColor\n ): void {\n if (\n !this.isValidOffscreenIndex(\n offscreenIndex,\n 'setOffscreenScreenColorByTextureColor'\n )\n ) {\n return;\n }\n this.setOffscreenScreenColorByRGBA(\n offscreenIndex,\n color.r,\n color.g,\n color.b,\n color.a\n );\n }\n\n /**\n * Sets the screen color of the offscreen.\n *\n * @param offscreenIndex Offsscreen index\n * @param r Red value of the screen color to be set\n * @param g Green value of the screen color to be set\n * @param b Blue value of the screen color to be set\n * @param a Alpha value of the screen color to be set\n */\n public setOffscreenScreenColorByRGBA(\n offscreenIndex: number,\n r: number,\n g: number,\n b: number,\n a: number = 1.0\n ): void {\n if (\n !this.isValidOffscreenIndex(\n offscreenIndex,\n 'setOffscreenScreenColorByRGBA'\n )\n ) {\n return;\n }\n this._userOffscreenScreenColors[offscreenIndex].color.r = r;\n this._userOffscreenScreenColors[offscreenIndex].color.g = g;\n this._userOffscreenScreenColors[offscreenIndex].color.b = b;\n this._userOffscreenScreenColors[offscreenIndex].color.a = a;\n }\n\n /**\n * Returns the screen color from the list of offscreen.\n *\n * @param offscreenIndex Offsscreen index\n *\n * @return Screen color (CubismTextureColor)\n */\n public getOffscreenScreenColor(offscreenIndex: number): CubismTextureColor {\n if (\n !this.isValidOffscreenIndex(offscreenIndex, 'getOffscreenScreenColor')\n ) {\n return new CubismTextureColor(0.0, 0.0, 0.0, 1.0); // Default offscreen screen color\n }\n if (\n this.getScreenColorEnabled() ||\n this.getOffscreenScreenColorEnabled(offscreenIndex)\n ) {\n return this._userOffscreenScreenColors[offscreenIndex].color;\n }\n return this._model.getOffscreenScreenColor(offscreenIndex);\n }\n\n /**\n * Sets the part color with hierarchical propagation (internal method)\n */\n private setPartColor(\n partIndex: number,\n r: number,\n g: number,\n b: number,\n a: number,\n partColors: Array<ColorData>,\n drawableColors: Array<ColorData>,\n offscreenColors: Array<ColorData>\n ): void {\n partColors[partIndex].color.r = r;\n partColors[partIndex].color.g = g;\n partColors[partIndex].color.b = b;\n partColors[partIndex].color.a = a;\n\n if (partColors[partIndex].isOverridden) {\n const offscreenIndices = this._model.getPartOffscreenIndices();\n const offscreenIndex = offscreenIndices[partIndex];\n if (offscreenIndex == NoOffscreenIndex) {\n // If no offscreen buffer is attached, the effect is applied to the children.\n const partsHierarchy = this._model.getPartsHierarchy();\n if (partsHierarchy && partsHierarchy[partIndex]) {\n for (let i = 0; i < partsHierarchy[partIndex].objects.length; ++i) {\n const objectInfo = partsHierarchy[partIndex].objects[i];\n if (\n objectInfo.objectType ===\n CubismModelObjectType.CubismModelObjectType_Drawable\n ) {\n const drawableIndex = objectInfo.objectIndex;\n drawableColors[drawableIndex].color.r = r;\n drawableColors[drawableIndex].color.g = g;\n drawableColors[drawableIndex].color.b = b;\n drawableColors[drawableIndex].color.a = a;\n } else {\n const childPartIndex = objectInfo.objectIndex;\n this.setPartColor(\n childPartIndex,\n r,\n g,\n b,\n a,\n partColors,\n drawableColors,\n offscreenColors\n );\n }\n }\n }\n } else {\n // If an offscreen buffer is attached, only that offscreen buffer is affected.\n offscreenColors[offscreenIndex].color.r = r;\n offscreenColors[offscreenIndex].color.g = g;\n offscreenColors[offscreenIndex].color.b = b;\n offscreenColors[offscreenIndex].color.a = a;\n }\n }\n }\n\n /**\n * Sets the part color enabled flag with hierarchical propagation (internal method)\n */\n private setPartColorEnabled(\n partIndex: number,\n value: boolean,\n partColors: Array<ColorData>,\n drawableColors: Array<ColorData>,\n offscreenColors: Array<ColorData>\n ): void {\n partColors[partIndex].isOverridden = value;\n\n const offscreenIndices = this._model.getPartOffscreenIndices();\n const offscreenIndex = offscreenIndices[partIndex];\n if (offscreenIndex == NoOffscreenIndex) {\n // If no offscreen buffer is attached, the effect is applied to the children.\n const partsHierarchy = this._model.getPartsHierarchy();\n if (partsHierarchy && partsHierarchy[partIndex]) {\n for (let i = 0; i < partsHierarchy[partIndex].objects.length; ++i) {\n const objectInfo = partsHierarchy[partIndex].objects[i];\n if (\n objectInfo.objectType ===\n CubismModelObjectType.CubismModelObjectType_Drawable\n ) {\n const drawableIndex = objectInfo.objectIndex;\n drawableColors[drawableIndex].isOverridden = value;\n if (value) {\n drawableColors[drawableIndex].color.r =\n partColors[partIndex].color.r;\n drawableColors[drawableIndex].color.g =\n partColors[partIndex].color.g;\n drawableColors[drawableIndex].color.b =\n partColors[partIndex].color.b;\n drawableColors[drawableIndex].color.a =\n partColors[partIndex].color.a;\n }\n } else {\n const childPartIndex = objectInfo.objectIndex;\n if (value) {\n partColors[childPartIndex].color.r =\n partColors[partIndex].color.r;\n partColors[childPartIndex].color.g =\n partColors[partIndex].color.g;\n partColors[childPartIndex].color.b =\n partColors[partIndex].color.b;\n partColors[childPartIndex].color.a =\n partColors[partIndex].color.a;\n }\n this.setPartColorEnabled(\n childPartIndex,\n value,\n partColors,\n drawableColors,\n offscreenColors\n );\n }\n }\n }\n } else {\n // If an offscreen buffer is attached, only that offscreen buffer is affected.\n offscreenColors[offscreenIndex].isOverridden = value;\n if (value) {\n offscreenColors[offscreenIndex].color.r = partColors[partIndex].color.r;\n offscreenColors[offscreenIndex].color.g = partColors[partIndex].color.g;\n offscreenColors[offscreenIndex].color.b = partColors[partIndex].color.b;\n offscreenColors[offscreenIndex].color.a = partColors[partIndex].color.a;\n }\n }\n }\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport { CubismIdHandle } from '../id/cubismid';\nimport { CubismFramework } from '../live2dcubismframework';\nimport { CubismMath } from '../math/cubismmath';\nimport {\n CubismBlendMode,\n CubismTextureColor\n} from '../rendering/cubismrenderer';\nimport { CSM_ASSERT } from '../utils/cubismdebug';\nimport { CubismModelMultiplyAndScreenColor } from './cubismmodelmultiplyandscreencolor';\n\nexport const NoParentIndex = -1; // 親が取得できない場合の値を表す定数\nexport const NoOffscreenIndex = -1; // オフスクリーンが取得できない場合の値を表す定数\n/**\n * カラーブレンドのタイプ\n */\nexport enum CubismColorBlend {\n ColorBlend_None = -1,\n ColorBlend_Normal = Live2DCubismCore.ColorBlendType_Normal,\n ColorBlend_AddGlow = Live2DCubismCore.ColorBlendType_AddGlow,\n ColorBlend_Add = Live2DCubismCore.ColorBlendType_Add,\n ColorBlend_Darken = Live2DCubismCore.ColorBlendType_Darken,\n ColorBlend_Multiply = Live2DCubismCore.ColorBlendType_Multiply,\n ColorBlend_ColorBurn = Live2DCubismCore.ColorBlendType_ColorBurn,\n ColorBlend_LinearBurn = Live2DCubismCore.ColorBlendType_LinearBurn,\n ColorBlend_Lighten = Live2DCubismCore.ColorBlendType_Lighten,\n ColorBlend_Screen = Live2DCubismCore.ColorBlendType_Screen,\n ColorBlend_ColorDodge = Live2DCubismCore.ColorBlendType_ColorDodge,\n ColorBlend_Overlay = Live2DCubismCore.ColorBlendType_Overlay,\n ColorBlend_SoftLight = Live2DCubismCore.ColorBlendType_SoftLight,\n ColorBlend_HardLight = Live2DCubismCore.ColorBlendType_HardLight,\n ColorBlend_LinearLight = Live2DCubismCore.ColorBlendType_LinearLight,\n ColorBlend_Hue = Live2DCubismCore.ColorBlendType_Hue,\n ColorBlend_Color = Live2DCubismCore.ColorBlendType_Color,\n // Cubism 5.2以前\n ColorBlend_AddCompatible = Live2DCubismCore.ColorBlendType_AddCompatible,\n ColorBlend_MultiplyCompatible = Live2DCubismCore.ColorBlendType_MultiplyCompatible\n}\n\n/**\n * アルファブレンドのタイプ\n */\nexport enum CubismAlphaBlend {\n AlphaBlend_None = -1,\n AlphaBlend_Over,\n AlphaBlend_Atop,\n AlphaBlend_Out,\n AlphaBlend_ConjointOver,\n AlphaBlend_DisjointOver\n}\n\n/**\n * オブジェクトのタイプ\n */\nexport enum CubismModelObjectType {\n CubismModelObjectType_Drawable = 0,\n CubismModelObjectType_Parts = 1\n}\n\n/**\n * Structure for managing the override of parameter repetition settings\n */\nexport class ParameterRepeatData {\n /**\n * Constructor\n *\n * @param isOverridden whether to be overriden\n * @param isParameterRepeated override flag for settings\n */\n public constructor(\n isOverridden: boolean = false,\n isParameterRepeated: boolean = false\n ) {\n this.isOverridden = isOverridden;\n this.isParameterRepeated = isParameterRepeated;\n }\n\n /**\n * Whether to be overridden\n */\n public isOverridden: boolean;\n\n /**\n * Override flag for settings\n */\n public isParameterRepeated: boolean;\n}\n\n/**\n * (deprecated) テクスチャのカリング設定を管理するための構造体\n */\nexport class DrawableCullingData {\n /**\n * コンストラクタ\n *\n * @param isOverridden\n * @param isCulling\n */\n public constructor(isOverridden = false, isCulling = false) {\n this.isOverridden = isOverridden;\n this.isCulling = isCulling;\n }\n\n public isOverridden: boolean;\n public isCulling: boolean;\n\n get isOverwritten(): boolean {\n return this.isOverridden;\n }\n}\n\n/**\n * テクスチャのカリング設定を管理するための構造体\n */\nexport class CullingData {\n /**\n * コンストラクタ\n *\n * @param isOverridden\n * @param isCulling\n */\n public constructor(isOverridden = false, isCulling = false) {\n this.isOverridden = isOverridden;\n this.isCulling = isCulling;\n }\n\n public isOverridden: boolean;\n public isCulling: boolean;\n}\n\n/**\n * パーツ子描画オブジェクト情報構造体\n */\nexport class PartChildDrawObjects {\n public drawableIndices: Array<number>;\n public offscreenIndices: Array<number>;\n\n constructor(\n drawableIndices: Array<number> = new Array<number>(),\n offscreenIndices: Array<number> = new Array<number>()\n ) {\n this.drawableIndices = drawableIndices;\n this.offscreenIndices = offscreenIndices;\n }\n}\n\n/**\n * オブジェクト情報構造体\n */\nexport class CubismModelObjectInfo {\n public objectType: CubismModelObjectType; // オブジェクトのタイプ (Drawable / Parts)\n public objectIndex: number; // オブジェクトインデックス\n\n constructor(objectIndex: number, objectType: CubismModelObjectType) {\n this.objectIndex = objectIndex;\n this.objectType = objectType;\n }\n}\n\n/**\n * パーツ情報管理構造体\n */\nexport class CubismModelPartInfo {\n public objects: Array<CubismModelObjectInfo>;\n public childDrawObjects: PartChildDrawObjects;\n\n constructor(\n objects: Array<CubismModelObjectInfo> = new Array<CubismModelObjectInfo>(),\n childDrawObjects: PartChildDrawObjects = new PartChildDrawObjects()\n ) {\n this.objects = objects;\n this.childDrawObjects = childDrawObjects;\n }\n\n // 子オブジェクト数を返す関数\n public getChildObjectCount(): number {\n return this.objects.length;\n }\n}\n\n/**\n * モデル\n *\n * Mocデータから生成されるモデルのクラス。\n */\nexport class CubismModel {\n /**\n * モデルのパラメータの更新\n */\n public update(): void {\n // Update model\n this._model.update();\n\n this._model.drawables.resetDynamicFlags();\n }\n\n /**\n * PixelsPerUnitを取得する\n * @return PixelsPerUnit\n */\n public getPixelsPerUnit(): number {\n if (this._model == null) {\n return 0.0;\n }\n\n return this._model.canvasinfo.PixelsPerUnit;\n }\n\n /**\n * キャンバスの幅を取得する\n */\n public getCanvasWidth(): number {\n if (this._model == null) {\n return 0.0;\n }\n\n return (\n this._model.canvasinfo.CanvasWidth / this._model.canvasinfo.PixelsPerUnit\n );\n }\n\n /**\n * キャンバスの高さを取得する\n */\n public getCanvasHeight(): number {\n if (this._model == null) {\n return 0.0;\n }\n\n return (\n this._model.canvasinfo.CanvasHeight / this._model.canvasinfo.PixelsPerUnit\n );\n }\n\n /**\n * パラメータを保存する\n */\n public saveParameters(): void {\n const parameterCount: number = this._model.parameters.count;\n const savedParameterCount: number = this._savedParameters.length;\n\n for (let i = 0; i < parameterCount; ++i) {\n if (i < savedParameterCount) {\n this._savedParameters[i] = this._parameterValues[i];\n } else {\n this._savedParameters.push(this._parameterValues[i]);\n }\n }\n }\n\n /**\n * 乗算色・スクリーン色管理クラスを取得する\n *\n * @return CubismModelMultiplyAndScreenColorのインスタンス\n */\n public getOverrideMultiplyAndScreenColor(): CubismModelMultiplyAndScreenColor {\n return this._overrideMultiplyAndScreenColor;\n }\n\n /**\n * Checks whether parameter repetition is performed for the entire model.\n *\n * @return true if parameter repetition is performed for the entire model; otherwise returns false.\n */\n public getOverrideFlagForModelParameterRepeat(): boolean {\n return this._isOverriddenParameterRepeat;\n }\n\n /**\n * Sets whether parameter repetition is performed for the entire model.\n * Use true to perform parameter repetition for the entire model, or false to not perform it.\n */\n public setOverrideFlagForModelParameterRepeat(isRepeat: boolean): void {\n this._isOverriddenParameterRepeat = isRepeat;\n }\n\n /**\n * Returns the flag indicating whether to override the parameter repeat.\n *\n * @param parameterIndex Parameter index\n *\n * @return true if the parameter repeat is overridden, false otherwise.\n */\n public getOverrideFlagForParameterRepeat(parameterIndex: number): boolean {\n return this._userParameterRepeatDataList[parameterIndex].isOverridden;\n }\n\n /**\n * Sets the flag indicating whether to override the parameter repeat.\n *\n * @param parameterIndex Parameter index\n * @param value true if it is to be overridden; otherwise, false.\n */\n public setOverrideFlagForParameterRepeat(\n parameterIndex: number,\n value: boolean\n ): void {\n this._userParameterRepeatDataList[parameterIndex].isOverridden = value;\n }\n\n /**\n * Returns the repeat flag.\n *\n * @param parameterIndex Parameter index\n *\n * @return true if repeating, false otherwise.\n */\n public getRepeatFlagForParameterRepeat(parameterIndex: number): boolean {\n return this._userParameterRepeatDataList[parameterIndex]\n .isParameterRepeated;\n }\n\n /**\n * Sets the repeat flag.\n *\n * @param parameterIndex Parameter index\n * @param value true to enable repeating, false otherwise.\n */\n public setRepeatFlagForParameterRepeat(\n parameterIndex: number,\n value: boolean\n ): void {\n this._userParameterRepeatDataList[parameterIndex].isParameterRepeated =\n value;\n }\n\n /**\n * Drawableのカリング情報を取得する。\n *\n * @param drawableIndex Drawableのインデックス\n *\n * @return Drawableのカリング情報\n */\n public getDrawableCulling(drawableIndex: number): boolean {\n if (\n this.getOverrideFlagForModelCullings() ||\n this.getOverrideFlagForDrawableCullings(drawableIndex)\n ) {\n return this._userDrawableCullings[drawableIndex].isCulling;\n }\n\n const constantFlags = this._model.drawables.constantFlags;\n return !Live2DCubismCore.Utils.hasIsDoubleSidedBit(\n constantFlags[drawableIndex]\n );\n }\n\n /**\n * Drawableのカリング情報を設定する。\n *\n * @param drawableIndex Drawableのインデックス\n * @param isCulling カリング情報\n */\n public setDrawableCulling(drawableIndex: number, isCulling: boolean): void {\n this._userDrawableCullings[drawableIndex].isCulling = isCulling;\n }\n\n /**\n * Offscreenのカリング情報を取得する。\n *\n * @param offscreenIndex Offscreenのインデックス\n *\n * @return Offscreenのカリング情報\n */\n public getOffscreenCulling(offscreenIndex: number): boolean {\n if (\n this.getOverrideFlagForModelCullings() ||\n this.getOverrideFlagForOffscreenCullings(offscreenIndex)\n ) {\n return this._userOffscreenCullings[offscreenIndex].isCulling;\n }\n\n const constantFlags = this._model.offscreens.constantFlags;\n return !Live2DCubismCore.Utils.hasIsDoubleSidedBit(\n constantFlags[offscreenIndex]\n );\n }\n\n /**\n * Offscreenのカリング設定を設定する。\n *\n * @param offscreenIndex Offscreenのインデックス\n * @param isCulling カリング情報\n */\n public setOffscreenCulling(offscreenIndex: number, isCulling: boolean): void {\n this._userOffscreenCullings[offscreenIndex].isCulling = isCulling;\n }\n\n /**\n * SDKからモデル全体のカリング設定を上書きするか。\n *\n * @return true -> SDK上のカリング設定を使用\n * false -> モデルのカリング設定を使用\n */\n public getOverrideFlagForModelCullings(): boolean {\n return this._isOverriddenCullings;\n }\n\n /**\n * SDKからモデル全体のカリング設定を上書きするかを設定する。\n *\n * @param isOverriddenCullings SDK上のカリング設定を使うならtrue、モデルのカリング設定を使うならfalse\n */\n public setOverrideFlagForModelCullings(isOverriddenCullings: boolean): void {\n this._isOverriddenCullings = isOverriddenCullings;\n }\n\n /**\n *\n * @param drawableIndex Drawableのインデックス\n * @return true -> SDK上のカリング設定を使用\n * false -> モデルのカリング設定を使用\n */\n public getOverrideFlagForDrawableCullings(drawableIndex: number): boolean {\n return this._userDrawableCullings[drawableIndex].isOverridden;\n }\n\n /**\n * @param offscreenIndex Offscreenのインデックス\n * @return true -> SDK上のカリング設定を使用\n * false -> モデルのカリング設定を使用\n */\n public getOverrideFlagForOffscreenCullings(offscreenIndex: number): boolean {\n return this._userOffscreenCullings[offscreenIndex].isOverridden;\n }\n\n /**\n *\n * @param drawableIndex Drawableのインデックス\n * @param isOverriddenCullings SDK上のカリング設定を使うならtrue、モデルのカリング設定を使うならfalse\n */\n public setOverrideFlagForDrawableCullings(\n drawableIndex: number,\n isOverriddenCullings: boolean\n ): void {\n this._userDrawableCullings[drawableIndex].isOverridden =\n isOverriddenCullings;\n }\n\n /**\n * モデルの不透明度を取得する\n *\n * @return 不透明度の値\n */\n public getModelOapcity(): number {\n return this._modelOpacity;\n }\n\n /**\n * モデルの不透明度を設定する\n *\n * @param value 不透明度の値\n */\n public setModelOapcity(value: number) {\n this._modelOpacity = value;\n }\n\n /**\n * モデルを取得\n */\n public getModel(): Live2DCubismCore.Model {\n return this._model;\n }\n\n /**\n * パーツのインデックスを取得\n * @param partId パーツのID\n * @return パーツのインデックス\n */\n public getPartIndex(partId: CubismIdHandle): number {\n let partIndex: number;\n const partCount: number = this._model.parts.count;\n\n for (partIndex = 0; partIndex < partCount; ++partIndex) {\n if (partId == this._partIds[partIndex]) {\n return partIndex;\n }\n }\n\n // モデルに存在していない場合、非存在パーツIDリスト内にあるかを検索し、そのインデックスを返す\n if (this._notExistPartId.has(partId)) {\n return this._notExistPartId.get(partId);\n }\n\n // 非存在パーツIDリストにない場合、新しく要素を追加する\n partIndex = partCount + this._notExistPartId.size;\n this._notExistPartId.set(partId, partIndex);\n this._notExistPartOpacities.set(partIndex, null);\n\n return partIndex;\n }\n\n /**\n * パーツのIDを取得する。\n *\n * @param partIndex 取得するパーツのインデックス\n * @return パーツのID\n */\n public getPartId(partIndex: number): CubismIdHandle {\n const partId = this._model.parts.ids[partIndex];\n return CubismFramework.getIdManager().getId(partId);\n }\n\n /**\n * パーツの個数の取得\n * @return パーツの個数\n */\n public getPartCount(): number {\n const partCount: number = this._model.parts.count;\n return partCount;\n }\n\n /**\n * パーツのオフスクリーンインデックスの取得\n * @param partIndex パーツのインデックス\n * @return オフスクリーンインデックスのリスト\n */\n public getPartOffscreenIndices(): Int32Array {\n const offscreenIndices = this._model.parts.offscreenIndices;\n return offscreenIndices;\n }\n\n /**\n * パーツの親パーツインデックスのリストを取得\n *\n * @return パーツの親パーツインデックスのリスト\n */\n public getPartParentPartIndices(): Int32Array {\n const parentIndices = this._model.parts.parentIndices;\n return parentIndices;\n }\n\n /**\n * パーツの不透明度の設定(Index)\n * @param partIndex パーツのインデックス\n * @param opacity 不透明度\n */\n public setPartOpacityByIndex(partIndex: number, opacity: number): void {\n if (this._notExistPartOpacities.has(partIndex)) {\n this._notExistPartOpacities.set(partIndex, opacity);\n return;\n }\n\n // インデックスの範囲内検知\n CSM_ASSERT(0 <= partIndex && partIndex < this.getPartCount());\n\n this._partOpacities[partIndex] = opacity;\n }\n\n /**\n * パーツの不透明度の設定(Id)\n * @param partId パーツのID\n * @param opacity パーツの不透明度\n */\n public setPartOpacityById(partId: CubismIdHandle, opacity: number): void {\n // 高速化のためにPartIndexを取得できる機構になっているが、外部からの設定の時は呼び出し頻度が低いため不要\n const index: number = this.getPartIndex(partId);\n\n if (index < 0) {\n return; // パーツがないのでスキップ\n }\n\n this.setPartOpacityByIndex(index, opacity);\n }\n\n /**\n * パーツの不透明度の取得(index)\n * @param partIndex パーツのインデックス\n * @return パーツの不透明度\n */\n public getPartOpacityByIndex(partIndex: number): number {\n if (this._notExistPartOpacities.has(partIndex)) {\n // モデルに存在しないパーツIDの場合、非存在パーツリストから不透明度を返す。\n return this._notExistPartOpacities.get(partIndex);\n }\n\n // インデックスの範囲内検知\n CSM_ASSERT(0 <= partIndex && partIndex < this.getPartCount());\n\n return this._partOpacities[partIndex];\n }\n\n /**\n * パーツの不透明度の取得(id)\n * @param partId パーツのId\n * @return パーツの不透明度\n */\n public getPartOpacityById(partId: CubismIdHandle): number {\n // 高速化のためにPartIndexを取得できる機構になっているが、外部からの設定の時は呼び出し頻度が低いため不要\n const index: number = this.getPartIndex(partId);\n\n if (index < 0) {\n return 0; // パーツが無いのでスキップ\n }\n\n return this.getPartOpacityByIndex(index);\n }\n\n /**\n * パラメータのインデックスの取得\n * @param パラメータID\n * @return パラメータのインデックス\n */\n public getParameterIndex(parameterId: CubismIdHandle): number {\n let parameterIndex: number;\n const idCount: number = this._model.parameters.count;\n\n for (parameterIndex = 0; parameterIndex < idCount; ++parameterIndex) {\n if (parameterId != this._parameterIds[parameterIndex]) {\n continue;\n }\n\n return parameterIndex;\n }\n\n // モデルに存在していない場合、非存在パラメータIDリスト内を検索し、そのインデックスを返す\n if (this._notExistParameterId.has(parameterId)) {\n return this._notExistParameterId.get(parameterId);\n }\n\n // 非存在パラメータIDリストにない場合新しく要素を追加する\n parameterIndex =\n this._model.parameters.count + this._notExistParameterId.size;\n\n this._notExistParameterId.set(parameterId, parameterIndex);\n this._notExistParameterValues.set(parameterIndex, null);\n\n return parameterIndex;\n }\n\n /**\n * パラメータの個数の取得\n * @return パラメータの個数\n */\n public getParameterCount(): number {\n return this._model.parameters.count;\n }\n\n /**\n * パラメータの種類の取得\n * @param parameterIndex パラメータのインデックス\n * @return csmParameterType_Normal -> 通常のパラメータ\n * csmParameterType_BlendShape -> ブレンドシェイプパラメータ\n */\n public getParameterType(\n parameterIndex: number\n ): Live2DCubismCore.csmParameterType {\n return this._model.parameters.types[parameterIndex];\n }\n\n /**\n * パラメータの最大値の取得\n * @param parameterIndex パラメータのインデックス\n * @return パラメータの最大値\n */\n public getParameterMaximumValue(parameterIndex: number): number {\n return this._model.parameters.maximumValues[parameterIndex];\n }\n\n /**\n * パラメータの最小値の取得\n * @param parameterIndex パラメータのインデックス\n * @return パラメータの最小値\n */\n public getParameterMinimumValue(parameterIndex: number): number {\n return this._model.parameters.minimumValues[parameterIndex];\n }\n\n /**\n * パラメータのデフォルト値の取得\n * @param parameterIndex パラメータのインデックス\n * @return パラメータのデフォルト値\n */\n public getParameterDefaultValue(parameterIndex: number): number {\n return this._model.parameters.defaultValues[parameterIndex];\n }\n\n /**\n * 指定したパラメータindexのIDを取得\n *\n * @param parameterIndex パラメータのインデックス\n * @return パラメータID\n */\n public getParameterId(parameterIndex: number): CubismIdHandle {\n return CubismFramework.getIdManager().getId(\n this._model.parameters.ids[parameterIndex]\n );\n }\n\n /**\n * パラメータの値の取得\n * @param parameterIndex パラメータのインデックス\n * @return パラメータの値\n */\n public getParameterValueByIndex(parameterIndex: number): number {\n if (this._notExistParameterValues.has(parameterIndex)) {\n return this._notExistParameterValues.get(parameterIndex);\n }\n\n // インデックスの範囲内検知\n CSM_ASSERT(\n 0 <= parameterIndex && parameterIndex < this.getParameterCount()\n );\n\n return this._parameterValues[parameterIndex];\n }\n\n /**\n * パラメータの値の取得\n * @param parameterId パラメータのID\n * @return パラメータの値\n */\n public getParameterValueById(parameterId: CubismIdHandle): number {\n // 高速化のためにparameterIndexを取得できる機構になっているが、外部からの設定の時は呼び出し頻度が低いため不要\n const parameterIndex: number = this.getParameterIndex(parameterId);\n return this.getParameterValueByIndex(parameterIndex);\n }\n\n /**\n * パラメータの値の設定\n * @param parameterIndex パラメータのインデックス\n * @param value パラメータの値\n * @param weight 重み\n */\n public setParameterValueByIndex(\n parameterIndex: number,\n value: number,\n weight = 1.0\n ): void {\n if (this._notExistParameterValues.has(parameterIndex)) {\n this._notExistParameterValues.set(\n parameterIndex,\n weight == 1\n ? value\n : this._notExistParameterValues.get(parameterIndex) * (1 - weight) +\n value * weight\n );\n\n return;\n }\n\n // インデックスの範囲内検知\n CSM_ASSERT(\n 0 <= parameterIndex && parameterIndex < this.getParameterCount()\n );\n\n if (this.isRepeat(parameterIndex)) {\n value = this.getParameterRepeatValue(parameterIndex, value);\n } else {\n value = this.getParameterClampValue(parameterIndex, value);\n }\n\n this._parameterValues[parameterIndex] =\n weight == 1\n ? value\n : (this._parameterValues[parameterIndex] =\n this._parameterValues[parameterIndex] * (1 - weight) +\n value * weight);\n }\n\n /**\n * パラメータの値の設定\n * @param parameterId パラメータのID\n * @param value パラメータの値\n * @param weight 重み\n */\n public setParameterValueById(\n parameterId: CubismIdHandle,\n value: number,\n weight = 1.0\n ): void {\n const index: number = this.getParameterIndex(parameterId);\n this.setParameterValueByIndex(index, value, weight);\n }\n\n /**\n * パラメータの値の加算(index)\n * @param parameterIndex パラメータインデックス\n * @param value 加算する値\n * @param weight 重み\n */\n public addParameterValueByIndex(\n parameterIndex: number,\n value: number,\n weight = 1.0\n ): void {\n this.setParameterValueByIndex(\n parameterIndex,\n this.getParameterValueByIndex(parameterIndex) + value * weight\n );\n }\n\n /**\n * パラメータの値の加算(id)\n * @param parameterId パラメータID\n * @param value 加算する値\n * @param weight 重み\n */\n public addParameterValueById(\n parameterId: any,\n value: number,\n weight = 1.0\n ): void {\n const index: number = this.getParameterIndex(parameterId);\n this.addParameterValueByIndex(index, value, weight);\n }\n\n /**\n * Gets whether the parameter has the repeat setting.\n *\n * @param parameterIndex Parameter index\n *\n * @return true if it is set, otherwise returns false.\n */\n public isRepeat(parameterIndex: number): boolean {\n if (this._notExistParameterValues.has(parameterIndex)) {\n return false;\n }\n\n // In-index range detection\n CSM_ASSERT(\n 0 <= parameterIndex && parameterIndex < this.getParameterCount()\n );\n\n let isRepeat: boolean;\n\n // Determines whether to perform parameter repeat processing\n if (\n this._isOverriddenParameterRepeat ||\n this._userParameterRepeatDataList[parameterIndex].isOverridden\n ) {\n // Use repeat information set on the SDK side\n isRepeat =\n this._userParameterRepeatDataList[parameterIndex].isParameterRepeated;\n } else {\n // Use repeat information set in Editor\n isRepeat = this._model.parameters.repeats[parameterIndex] != 0;\n }\n\n return isRepeat;\n }\n\n /**\n * Returns the calculated result ensuring the value falls within the parameter's range.\n *\n * @param parameterIndex Parameter index\n * @param value Parameter value\n *\n * @return a value that falls within the parameter’s range. If the parameter does not exist, returns it as is.\n */\n public getParameterRepeatValue(\n parameterIndex: number,\n value: number\n ): number {\n if (this._notExistParameterValues.has(parameterIndex)) {\n return value;\n }\n\n // In-index range detection\n CSM_ASSERT(\n 0 <= parameterIndex && parameterIndex < this.getParameterCount()\n );\n\n const maxValue: number =\n this._model.parameters.maximumValues[parameterIndex];\n const minValue: number =\n this._model.parameters.minimumValues[parameterIndex];\n const valueSize: number = maxValue - minValue;\n\n if (maxValue < value) {\n const overValue: number = CubismMath.mod(value - maxValue, valueSize);\n if (!Number.isNaN(overValue)) {\n value = minValue + overValue;\n } else {\n value = maxValue;\n }\n }\n if (value < minValue) {\n const overValue: number = CubismMath.mod(minValue - value, valueSize);\n if (!Number.isNaN(overValue)) {\n value = maxValue - overValue;\n } else {\n value = minValue;\n }\n }\n\n return value;\n }\n\n /**\n * Returns the result of clamping the value to ensure it falls within the parameter's range.\n *\n * @param parameterIndex Parameter index\n * @param value Parameter value\n *\n * @return the clamped value. If the parameter does not exist, returns it as is.\n */\n public getParameterClampValue(parameterIndex: number, value: number): number {\n if (this._notExistParameterValues.has(parameterIndex)) {\n return value;\n }\n\n // In-index range detection\n CSM_ASSERT(\n 0 <= parameterIndex && parameterIndex < this.getParameterCount()\n );\n\n const maxValue: number =\n this._model.parameters.maximumValues[parameterIndex];\n const minValue: number =\n this._model.parameters.minimumValues[parameterIndex];\n\n return CubismMath.clamp(value, minValue, maxValue);\n }\n\n /**\n * Returns the repeat of the parameter.\n *\n * @param parameterIndex Parameter index\n *\n * @return the raw data parameter repeat from the Cubism Core.\n */\n public getParameterRepeats(parameterIndex: number): boolean {\n return this._model.parameters.repeats[parameterIndex] != 0;\n }\n\n /**\n * パラメータの値の乗算\n * @param parameterId パラメータのID\n * @param value 乗算する値\n * @param weight 重み\n */\n public multiplyParameterValueById(\n parameterId: CubismIdHandle,\n value: number,\n weight = 1.0\n ): void {\n const index: number = this.getParameterIndex(parameterId);\n this.multiplyParameterValueByIndex(index, value, weight);\n }\n\n /**\n * パラメータの値の乗算\n * @param parameterIndex パラメータのインデックス\n * @param value 乗算する値\n * @param weight 重み\n */\n public multiplyParameterValueByIndex(\n parameterIndex: number,\n value: number,\n weight = 1.0\n ): void {\n this.setParameterValueByIndex(\n parameterIndex,\n this.getParameterValueByIndex(parameterIndex) *\n (1.0 + (value - 1.0) * weight)\n );\n }\n\n /**\n * Drawableのインデックスの取得\n * @param drawableId DrawableのID\n * @return Drawableのインデックス\n */\n public getDrawableIndex(drawableId: CubismIdHandle): number {\n const drawableCount = this._model.drawables.count;\n\n for (\n let drawableIndex = 0;\n drawableIndex < drawableCount;\n ++drawableIndex\n ) {\n if (this._drawableIds[drawableIndex] == drawableId) {\n return drawableIndex;\n }\n }\n\n return -1;\n }\n\n /**\n * Drawableの個数の取得\n * @return drawableの個数\n */\n public getDrawableCount(): number {\n const drawableCount = this._model.drawables.count;\n return drawableCount;\n }\n\n /**\n * DrawableのIDを取得する\n * @param drawableIndex Drawableのインデックス\n * @return drawableのID\n */\n public getDrawableId(drawableIndex: number): CubismIdHandle {\n const parameterIds: string[] = this._model.drawables.ids;\n return CubismFramework.getIdManager().getId(parameterIds[drawableIndex]);\n }\n\n /**\n * Drawableの描画順リストの取得\n * @return Drawableの描画順リスト\n */\n public getRenderOrders(): Int32Array {\n const renderOrders: Int32Array = this._model.getRenderOrders();\n return renderOrders;\n }\n\n /**\n * Drawableのテクスチャインデックスの取得\n * @param drawableIndex Drawableのインデックス\n * @return drawableのテクスチャインデックス\n */\n public getDrawableTextureIndex(drawableIndex: number): number {\n const textureIndices: Int32Array = this._model.drawables.textureIndices;\n return textureIndices[drawableIndex];\n }\n\n /**\n * DrawableのVertexPositionsの変化情報の取得\n *\n * 直近のCubismModel.update関数でDrawableの頂点情報が変化したかを取得する。\n *\n * @param drawableIndex Drawableのインデックス\n * @return true Drawableの頂点情報が直近のCubismModel.update関数で変化した\n * false Drawableの頂点情報が直近のCubismModel.update関数で変化していない\n */\n public getDrawableDynamicFlagVertexPositionsDidChange(\n drawableIndex: number\n ): boolean {\n const dynamicFlags: Uint8Array = this._model.drawables.dynamicFlags;\n return Live2DCubismCore.Utils.hasVertexPositionsDidChangeBit(\n dynamicFlags[drawableIndex]\n );\n }\n\n /**\n * Drawableの頂点インデックスの個数の取得\n * @param drawableIndex Drawableのインデックス\n * @return drawableの頂点インデックスの個数\n */\n public getDrawableVertexIndexCount(drawableIndex: number): number {\n const indexCounts: Int32Array = this._model.drawables.indexCounts;\n return indexCounts[drawableIndex];\n }\n\n /**\n * Drawableの頂点の個数の取得\n * @param drawableIndex Drawableのインデックス\n * @return drawableの頂点の個数\n */\n public getDrawableVertexCount(drawableIndex: number): number {\n const vertexCounts = this._model.drawables.vertexCounts;\n return vertexCounts[drawableIndex];\n }\n\n /**\n * Drawableの頂点リストの取得\n * @param drawableIndex drawableのインデックス\n * @return drawableの頂点リスト\n */\n public getDrawableVertices(drawableIndex: number): Float32Array {\n return this.getDrawableVertexPositions(drawableIndex);\n }\n\n /**\n * Drawableの頂点インデックスリストの取得\n * @param drawableIndex Drawableのインデックス\n * @return drawableの頂点インデックスリスト\n */\n public getDrawableVertexIndices(drawableIndex: number): Uint16Array {\n const indicesArray: Uint16Array[] = this._model.drawables.indices;\n return indicesArray[drawableIndex];\n }\n\n /**\n * Drawableの頂点リストの取得\n * @param drawableIndex Drawableのインデックス\n * @return drawableの頂点リスト\n */\n public getDrawableVertexPositions(drawableIndex: number): Float32Array {\n const verticesArray: Float32Array[] = this._model.drawables.vertexPositions;\n return verticesArray[drawableIndex];\n }\n\n /**\n * Drawableの頂点のUVリストの取得\n * @param drawableIndex Drawableのインデックス\n * @return drawableの頂点UVリスト\n */\n public getDrawableVertexUvs(drawableIndex: number): Float32Array {\n const uvsArray: Float32Array[] = this._model.drawables.vertexUvs;\n return uvsArray[drawableIndex];\n }\n\n /**\n * Drawableの不透明度の取得\n * @param drawableIndex Drawableのインデックス\n * @return drawableの不透明度\n */\n public getDrawableOpacity(drawableIndex: number): number {\n const opacities: Float32Array = this._model.drawables.opacities;\n return opacities[drawableIndex];\n }\n\n /**\n * Drawableの乗算色の取得\n * @param drawableIndex Drawableのインデックス\n * @return drawableの乗算色(RGBA)\n * スクリーン色はRGBAで取得されるが、Aは必ず0\n */\n public getDrawableMultiplyColor(drawableIndex: number): CubismTextureColor {\n if (this._drawableMultiplyColors == null) {\n this._drawableMultiplyColors = new Array<CubismTextureColor>(\n this._model.drawables.count\n );\n this._drawableMultiplyColors.fill(new CubismTextureColor());\n }\n const multiplyColors: Float32Array = this._model.drawables.multiplyColors;\n\n const index = drawableIndex * 4;\n this._drawableMultiplyColors[drawableIndex].r = multiplyColors[index];\n this._drawableMultiplyColors[drawableIndex].g = multiplyColors[index + 1];\n this._drawableMultiplyColors[drawableIndex].b = multiplyColors[index + 2];\n this._drawableMultiplyColors[drawableIndex].a = multiplyColors[index + 3];\n return this._drawableMultiplyColors[drawableIndex];\n }\n\n /**\n * Drawableのスクリーン色の取得\n * @param drawableIndex Drawableのインデックス\n * @return drawableのスクリーン色(RGBA)\n * スクリーン色はRGBAで取得されるが、Aは必ず0\n */\n public getDrawableScreenColor(drawableIndex: number): CubismTextureColor {\n if (this._drawableScreenColors == null) {\n this._drawableScreenColors = new Array<CubismTextureColor>(\n this._model.drawables.count\n );\n this._drawableScreenColors.fill(new CubismTextureColor());\n }\n const screenColors: Float32Array = this._model.drawables.screenColors;\n\n const index = drawableIndex * 4;\n this._drawableScreenColors[drawableIndex].r = screenColors[index];\n this._drawableScreenColors[drawableIndex].g = screenColors[index + 1];\n this._drawableScreenColors[drawableIndex].b = screenColors[index + 2];\n this._drawableScreenColors[drawableIndex].a = screenColors[index + 3];\n return this._drawableScreenColors[drawableIndex];\n }\n\n /**\n * Offscreenの乗算色の取得\n * @param offscreenIndex Offscreenのインデックス\n * @return Offscreenの乗算色(RGBA)\n * スクリーン色はRGBAで取得されるが、Aは必ず0\n */\n public getOffscreenMultiplyColor(offscreenIndex: number): CubismTextureColor {\n if (this._offscreenMultiplyColors == null) {\n this._offscreenMultiplyColors = new Array<CubismTextureColor>(\n this._model.offscreens.count\n );\n this._offscreenMultiplyColors.fill(new CubismTextureColor());\n }\n const multiplyColors: Float32Array = this._model.offscreens.multiplyColors;\n\n const index = offscreenIndex * 4;\n this._offscreenMultiplyColors[offscreenIndex].r = multiplyColors[index];\n this._offscreenMultiplyColors[offscreenIndex].g = multiplyColors[index + 1];\n this._offscreenMultiplyColors[offscreenIndex].b = multiplyColors[index + 2];\n this._offscreenMultiplyColors[offscreenIndex].a = multiplyColors[index + 3];\n return this._offscreenMultiplyColors[offscreenIndex];\n }\n\n /**\n * Offscreenのスクリーン色の取得\n * @param offscreenIndex Offscreenのインデックス\n * @return Offscreenのスクリーン色(RGBA)\n * スクリーン色はRGBAで取得されるが、Aは必ず0\n */\n public getOffscreenScreenColor(offscreenIndex: number): CubismTextureColor {\n if (this._offscreenScreenColors == null) {\n this._offscreenScreenColors = new Array<CubismTextureColor>(\n this._model.offscreens.count\n );\n this._offscreenScreenColors.fill(new CubismTextureColor());\n }\n const screenColors: Float32Array = this._model.offscreens.screenColors;\n\n const index = offscreenIndex * 4;\n this._offscreenScreenColors[offscreenIndex].r = screenColors[index];\n this._offscreenScreenColors[offscreenIndex].g = screenColors[index + 1];\n this._offscreenScreenColors[offscreenIndex].b = screenColors[index + 2];\n this._offscreenScreenColors[offscreenIndex].a = screenColors[index + 3];\n return this._offscreenScreenColors[offscreenIndex];\n }\n\n /**\n * Drawableの親パーツのインデックスの取得\n * @param drawableIndex Drawableのインデックス\n * @return drawableの親パーツのインデックス\n */\n public getDrawableParentPartIndex(drawableIndex: number): number {\n return this._model.drawables.parentPartIndices[drawableIndex];\n }\n\n /**\n * Drawableのブレンドモードを取得\n * @param drawableIndex Drawableのインデックス\n * @return drawableのブレンドモード\n */\n public getDrawableBlendMode(drawableIndex: number): CubismBlendMode {\n const constantFlags = this._model.drawables.constantFlags;\n\n return Live2DCubismCore.Utils.hasBlendAdditiveBit(\n constantFlags[drawableIndex]\n )\n ? CubismBlendMode.CubismBlendMode_Additive\n : Live2DCubismCore.Utils.hasBlendMultiplicativeBit(\n constantFlags[drawableIndex]\n )\n ? CubismBlendMode.CubismBlendMode_Multiplicative\n : CubismBlendMode.CubismBlendMode_Normal;\n }\n\n /**\n * Drawableのカラーブレンドの取得(Cubism 5.3 以降)\n *\n * @param drawableIndex Drawableのインデックス\n * @return Drawableのカラーブレンド\n */\n public getDrawableColorBlend(drawableIndex: number): CubismColorBlend {\n // キャッシュ\n if (\n this._drawableColorBlends[drawableIndex] ==\n CubismColorBlend.ColorBlend_None\n ) {\n this._drawableColorBlends[drawableIndex] =\n this._model.drawables.blendModes[drawableIndex] & 0xff;\n }\n return this._drawableColorBlends[drawableIndex];\n }\n\n /**\n * Drawableのアルファブレンドの取得(Cubism 5.3 以降)\n *\n * @param drawableIndex Drawableのインデックス\n * @return Drawableのアルファブレンド\n */\n public getDrawableAlphaBlend(drawableIndex: number): CubismAlphaBlend {\n // キャッシュ\n if (\n this._drawableAlphaBlends[drawableIndex] ==\n CubismAlphaBlend.AlphaBlend_None\n ) {\n this._drawableAlphaBlends[drawableIndex] =\n (this._model.drawables.blendModes[drawableIndex] >> 8) & 0xff;\n }\n return this._drawableAlphaBlends[drawableIndex];\n }\n\n /**\n * Drawableのマスクの反転使用の取得\n *\n * Drawableのマスク使用時の反転設定を取得する。\n * マスクを使用しない場合は無視される。\n *\n * @param drawableIndex Drawableのインデックス\n * @return Drawableの反転設定\n */\n public getDrawableInvertedMaskBit(drawableIndex: number): boolean {\n const constantFlags: Uint8Array = this._model.drawables.constantFlags;\n\n return Live2DCubismCore.Utils.hasIsInvertedMaskBit(\n constantFlags[drawableIndex]\n );\n }\n\n /**\n * Drawableのクリッピングマスクリストの取得\n * @return Drawableのクリッピングマスクリスト\n */\n public getDrawableMasks(): Int32Array[] {\n const masks: Int32Array[] = this._model.drawables.masks;\n return masks;\n }\n\n /**\n * Drawableのクリッピングマスクの個数リストの取得\n * @return Drawableのクリッピングマスクの個数リスト\n */\n public getDrawableMaskCounts(): Int32Array {\n const maskCounts: Int32Array = this._model.drawables.maskCounts;\n return maskCounts;\n }\n\n /**\n * クリッピングマスクの使用状態\n *\n * @return true クリッピングマスクを使用している\n * @return false クリッピングマスクを使用していない\n */\n public isUsingMasking(): boolean {\n for (let d = 0; d < this._model.drawables.count; ++d) {\n if (this._model.drawables.maskCounts[d] <= 0) {\n continue;\n }\n return true;\n }\n return false;\n }\n\n /**\n * Offscreenでクリッピングマスクを使用しているかどうかを取得\n *\n * @return true クリッピングマスクをオフスクリーンで使用している\n */\n public isUsingMaskingForOffscreen(): boolean {\n for (let d = 0; d < this.getOffscreenCount(); ++d) {\n if (this._model.offscreens.maskCounts[d] <= 0) {\n continue;\n }\n return true;\n }\n return false;\n }\n\n /**\n * Drawableの表示情報を取得する\n *\n * @param drawableIndex Drawableのインデックス\n * @return true Drawableが表示\n * @return false Drawableが非表示\n */\n public getDrawableDynamicFlagIsVisible(drawableIndex: number): boolean {\n const dynamicFlags: Uint8Array = this._model.drawables.dynamicFlags;\n return Live2DCubismCore.Utils.hasIsVisibleBit(dynamicFlags[drawableIndex]);\n }\n\n /**\n * DrawableのDrawOrderの変化情報の取得\n *\n * 直近のCubismModel.update関数でdrawableのdrawOrderが変化したかを取得する。\n * drawOrderはartMesh上で指定する0から1000の情報\n * @param drawableIndex drawableのインデックス\n * @return true drawableの不透明度が直近のCubismModel.update関数で変化した\n * @return false drawableの不透明度が直近のCubismModel.update関数で変化している\n */\n public getDrawableDynamicFlagVisibilityDidChange(\n drawableIndex: number\n ): boolean {\n const dynamicFlags: Uint8Array = this._model.drawables.dynamicFlags;\n return Live2DCubismCore.Utils.hasVisibilityDidChangeBit(\n dynamicFlags[drawableIndex]\n );\n }\n\n /**\n * Drawableの不透明度の変化情報の取得\n *\n * 直近のCubismModel.update関数でdrawableの不透明度が変化したかを取得する。\n *\n * @param drawableIndex drawableのインデックス\n * @return true Drawableの不透明度が直近のCubismModel.update関数で変化した\n * @return false Drawableの不透明度が直近のCubismModel.update関数で変化してない\n */\n public getDrawableDynamicFlagOpacityDidChange(\n drawableIndex: number\n ): boolean {\n const dynamicFlags: Uint8Array = this._model.drawables.dynamicFlags;\n return Live2DCubismCore.Utils.hasOpacityDidChangeBit(\n dynamicFlags[drawableIndex]\n );\n }\n\n /**\n * Drawableの描画順序の変化情報の取得\n *\n * 直近のCubismModel.update関数でDrawableの描画の順序が変化したかを取得する。\n *\n * @param drawableIndex Drawableのインデックス\n * @return true Drawableの描画の順序が直近のCubismModel.update関数で変化した\n * @return false Drawableの描画の順序が直近のCubismModel.update関数で変化してない\n */\n public getDrawableDynamicFlagRenderOrderDidChange(\n drawableIndex: number\n ): boolean {\n const dynamicFlags: Uint8Array = this._model.drawables.dynamicFlags;\n return Live2DCubismCore.Utils.hasRenderOrderDidChangeBit(\n dynamicFlags[drawableIndex]\n );\n }\n\n /**\n * Drawableの乗算色・スクリーン色の変化情報の取得\n *\n * 直近のCubismModel.update関数でDrawableの乗算色・スクリーン色が変化したかを取得する。\n *\n * @param drawableIndex Drawableのインデックス\n * @return true Drawableの乗算色・スクリーン色が直近のCubismModel.update関数で変化した\n * @return false Drawableの乗算色・スクリーン色が直近のCubismModel.update関数で変化してない\n */\n public getDrawableDynamicFlagBlendColorDidChange(\n drawableIndex: number\n ): boolean {\n const dynamicFlags: Uint8Array = this._model.drawables.dynamicFlags;\n return Live2DCubismCore.Utils.hasBlendColorDidChangeBit(\n dynamicFlags[drawableIndex]\n );\n }\n\n /**\n * オフスクリーンの個数を取得する\n * @return オフスクリーンの個数\n */\n public getOffscreenCount(): number {\n return this._model.offscreens.count;\n }\n\n /**\n * Offscreenのカラーブレンドの取得(Cubism 5.3 以降)\n *\n * @param offscreenIndex Offscreenのインデックス\n * @return Offscreenのカラーブレンド\n */\n public getOffscreenColorBlend(offscreenIndex: number): CubismColorBlend {\n // キャッシュ\n if (\n this._offscreenColorBlends[offscreenIndex] ==\n CubismColorBlend.ColorBlend_None\n ) {\n this._offscreenColorBlends[offscreenIndex] =\n this._model.offscreens.blendModes[offscreenIndex] & 0xff;\n }\n return this._offscreenColorBlends[offscreenIndex];\n }\n\n /**\n * Offscreenのアルファブレンドの取得(Cubism 5.3 以降)\n *\n * @param offscreenIndex Offscreenのインデックス\n * @return Offscreenのアルファブレンド\n */\n public getOffscreenAlphaBlend(offscreenIndex: number): CubismAlphaBlend {\n // キャッシュ\n if (\n this._offscreenAlphaBlends[offscreenIndex] ==\n CubismAlphaBlend.AlphaBlend_None\n ) {\n this._offscreenAlphaBlends[offscreenIndex] =\n (this._model.offscreens.blendModes[offscreenIndex] >> 8) & 0xff;\n }\n return this._offscreenAlphaBlends[offscreenIndex];\n }\n\n /**\n * オフスクリーンのオーナーインデックス配列を取得する\n * @return オフスクリーンのオーナーインデックス配列\n */\n public getOffscreenOwnerIndices(): Int32Array {\n return this._model.offscreens.ownerIndices;\n }\n\n /**\n * オフスクリーンの不透明度を取得\n * @param offscreenIndex オフスクリーンのインデックス\n * @return 不透明度\n */\n public getOffscreenOpacity(offscreenIndex: number): number {\n if (offscreenIndex < 0 || offscreenIndex >= this._model.offscreens.count) {\n return 1.0; // オフスクリーンが無いのでスキップ\n }\n\n return this._model.offscreens.opacities[offscreenIndex];\n }\n\n /**\n * オフスクリーンのクリッピングマスクリストの取得\n * @return オフスクリーンのクリッピングマスクリスト\n */\n public getOffscreenMasks(): Int32Array[] {\n return this._model.offscreens.masks;\n }\n\n /**\n * オフスクリーンのクリッピングマスクの個数リストの取得\n * @return オフスクリーンのクリッピングマスクの個数リスト\n */\n public getOffscreenMaskCounts(): Int32Array {\n return this._model.offscreens.maskCounts;\n }\n\n /**\n * オフスクリーンのマスク反転設定を取得する\n * @param offscreenIndex オフスクリーンのインデックス\n * @return オフスクリーンのマスク反転設定\n */\n public getOffscreenInvertedMask(offscreenIndex: number): boolean {\n const constantFlags: Uint8Array = this._model.offscreens.constantFlags;\n // Live2DCubismCore.Utils.hasIsInvertedMaskBit を利用\n return Live2DCubismCore.Utils.hasIsInvertedMaskBit(\n constantFlags[offscreenIndex]\n );\n }\n\n /**\n * ブレンドモード使用判定\n * @return ブレンドモードを使用しているか\n */\n public isBlendModeEnabled(): boolean {\n return this._isBlendModeEnabled;\n }\n\n /**\n * 保存されたパラメータの読み込み\n */\n public loadParameters(): void {\n let parameterCount: number = this._model.parameters.count;\n const savedParameterCount: number = this._savedParameters.length;\n\n if (parameterCount > savedParameterCount) {\n parameterCount = savedParameterCount;\n }\n\n for (let i = 0; i < parameterCount; ++i) {\n this._parameterValues[i] = this._savedParameters[i];\n }\n }\n\n /**\n * 初期化する\n */\n public initialize(): void {\n CSM_ASSERT(this._model);\n\n this._parameterValues = this._model.parameters.values;\n this._partOpacities = this._model.parts.opacities;\n this._offscreenOpacities = this._model.offscreens.opacities;\n\n this._parameterMaximumValues = this._model.parameters.maximumValues;\n this._parameterMinimumValues = this._model.parameters.minimumValues;\n\n {\n const parameterIds: string[] = this._model.parameters.ids;\n const parameterCount: number = this._model.parameters.count;\n\n this._parameterIds.length = parameterCount;\n this._userParameterRepeatDataList.length = parameterCount;\n for (let i = 0; i < parameterCount; ++i) {\n this._parameterIds[i] = CubismFramework.getIdManager().getId(\n parameterIds[i]\n );\n this._userParameterRepeatDataList[i] = new ParameterRepeatData(\n false,\n false\n );\n }\n }\n\n const partCount: number = this._model.parts.count;\n {\n const partIds: string[] = this._model.parts.ids;\n\n this._partIds.length = partCount;\n for (let i = 0; i < partCount; ++i) {\n this._partIds[i] = CubismFramework.getIdManager().getId(partIds[i]);\n }\n }\n\n {\n const drawableIds: string[] = this._model.drawables.ids;\n const drawableCount: number = this._model.drawables.count;\n\n // Drawableカリング設定\n this._userDrawableCullings.length = drawableCount;\n const userCulling: CullingData = new CullingData(false, false);\n\n // Offscreenカリング設定\n this._userOffscreenCullings.length = this._model.offscreens.count;\n const userOffscreenCulling: CullingData = new CullingData(false, false);\n\n // Drawables\n {\n for (let i = 0; i < drawableCount; ++i) {\n this._drawableIds.push(\n CubismFramework.getIdManager().getId(drawableIds[i])\n );\n\n this._userDrawableCullings[i] = userCulling;\n }\n }\n\n // Offscreens\n {\n for (let i = 0; i < this._model.offscreens.count; ++i) {\n this._userOffscreenCullings[i] = userOffscreenCulling;\n }\n }\n\n // blendMode\n // オフスクリーンが存在するか、DrawableのブレンドモードでColorBlend、AlphaBlendを使用するのであればブレンドモードを有効にする。\n if (this.getOffscreenCount() > 0) {\n this._isBlendModeEnabled = true;\n } else {\n const blendModes = this._model.drawables.blendModes;\n for (let i = 0; i < drawableCount; ++i) {\n const colorBlendType = this.getDrawableColorBlend(i);\n const alphaBlendType = this.getDrawableAlphaBlend(i);\n\n // NormalOver、AddCompatible、MultiplyCompatible以外であればブレンドモードを有効にする。\n if (\n !(\n colorBlendType == CubismColorBlend.ColorBlend_Normal &&\n alphaBlendType == CubismAlphaBlend.AlphaBlend_Over\n ) &&\n colorBlendType != CubismColorBlend.ColorBlend_AddCompatible &&\n colorBlendType != CubismColorBlend.ColorBlend_MultiplyCompatible\n ) {\n this._isBlendModeEnabled = true;\n break;\n }\n }\n }\n\n this.setupPartsHierarchy();\n\n // CubismModelMultiplyAndScreenColorの初期化\n const offscreenCount = this.getOffscreenCount();\n this._overrideMultiplyAndScreenColor.initialize(\n partCount,\n drawableCount,\n offscreenCount\n );\n }\n }\n\n /**\n * パーツ階層構造を取得する\n * @return パーツ階層構造の配列\n */\n public getPartsHierarchy(): Array<CubismModelPartInfo> {\n return this._partsHierarchy;\n }\n\n /**\n * パーツ階層構造をセットアップする\n */\n public setupPartsHierarchy(): void {\n this._partsHierarchy.length = 0;\n\n // すべてのパーツのパーツ情報管理構造体を作成\n const partCount = this.getPartCount();\n this._partsHierarchy.length = partCount;\n for (let i = 0; i < partCount; ++i) {\n const partInfo = new CubismModelPartInfo();\n this._partsHierarchy[i] = partInfo;\n }\n\n // Partごとに親パーツを取得し、親パーツの子objectリストに追加する\n for (let i = 0; i < partCount; ++i) {\n const parentPartIndex = this.getPartParentPartIndices()[i];\n\n if (parentPartIndex === NoParentIndex) {\n continue;\n }\n\n for (\n let partIndex = 0;\n partIndex < this._partsHierarchy.length;\n ++partIndex\n ) {\n if (partIndex === parentPartIndex) {\n const objectInfo = new CubismModelObjectInfo(\n i,\n CubismModelObjectType.CubismModelObjectType_Parts\n );\n this._partsHierarchy[partIndex].objects.push(objectInfo);\n break;\n }\n }\n }\n\n // Drawableごとに親パーツを取得し、親パーツの子objectリストに追加する\n const drawableCount = this.getDrawableCount();\n for (let i = 0; i < drawableCount; ++i) {\n const parentPartIndex = this.getDrawableParentPartIndex(i);\n\n if (parentPartIndex === NoParentIndex) {\n continue;\n }\n\n for (\n let partIndex = 0;\n partIndex < this._partsHierarchy.length;\n ++partIndex\n ) {\n if (partIndex === parentPartIndex) {\n const objectInfo = new CubismModelObjectInfo(\n i,\n CubismModelObjectType.CubismModelObjectType_Drawable\n );\n this._partsHierarchy[partIndex].objects.push(objectInfo);\n break;\n }\n }\n }\n\n // パーツ子描画オブジェクト情報構造体を作成していく\n for (let i = 0; i < this._partsHierarchy.length; ++i) {\n // パーツ管理構造体を取得\n this.getPartChildDrawObjects(i);\n }\n }\n\n /**\n * 指定したパーツの子描画オブジェクト情報を取得・構築する\n * @param partInfoIndex パーツ情報のインデックス\n * @return PartChildDrawObjects\n */\n public getPartChildDrawObjects(partInfoIndex: number): PartChildDrawObjects {\n if (this._partsHierarchy[partInfoIndex].getChildObjectCount() < 1) {\n // 子オブジェクトがない場合\n return this._partsHierarchy[partInfoIndex].childDrawObjects;\n }\n\n const childDrawObjects =\n this._partsHierarchy[partInfoIndex].childDrawObjects;\n\n // 既にchildDrawObjectsが処理されている場合はスキップ\n if (\n childDrawObjects.drawableIndices.length !== 0 ||\n childDrawObjects.offscreenIndices.length !== 0\n ) {\n return childDrawObjects;\n }\n\n const objects = this._partsHierarchy[partInfoIndex].objects;\n\n for (let i = 0; i < objects.length; ++i) {\n const obj = objects[i];\n\n if (\n obj.objectType === CubismModelObjectType.CubismModelObjectType_Parts\n ) {\n // 子のパーツの場合、再帰的に子objectsを取得\n this.getPartChildDrawObjects(obj.objectIndex);\n\n // 子パーツの子Drawable、Offscreenを取得\n const childToChildDrawObjects =\n this._partsHierarchy[obj.objectIndex].childDrawObjects;\n\n childDrawObjects.drawableIndices.push(\n ...childToChildDrawObjects.drawableIndices\n );\n childDrawObjects.offscreenIndices.push(\n ...childToChildDrawObjects.offscreenIndices\n );\n\n // Offscreenの確認\n const offscreenIndices = this.getOffscreenIndices();\n const offscreenIndex = offscreenIndices\n ? offscreenIndices[obj.objectIndex]\n : NoOffscreenIndex;\n if (offscreenIndex !== NoOffscreenIndex) {\n childDrawObjects.offscreenIndices.push(offscreenIndex);\n }\n } else if (\n obj.objectType === CubismModelObjectType.CubismModelObjectType_Drawable\n ) {\n // Drawableの場合、パーツの子Drawableに追加\n childDrawObjects.drawableIndices.push(obj.objectIndex);\n }\n }\n\n return childDrawObjects;\n }\n\n /**\n * パーツのオフスクリーンインデックス配列を取得\n * @return Int32Array offscreenIndices\n */\n private getOffscreenIndices(): Int32Array {\n // _model.parts.offscreenIndices が存在する場合のみ返す\n return this._model.parts.offscreenIndices;\n }\n\n /**\n * コンストラクタ\n * @param model モデル\n */\n public constructor(model: Live2DCubismCore.Model) {\n this._model = model;\n this._parameterValues = null;\n this._parameterMaximumValues = null;\n this._parameterMinimumValues = null;\n this._partOpacities = null;\n this._offscreenOpacities = null;\n this._savedParameters = new Array<number>();\n this._parameterIds = new Array<CubismIdHandle>();\n this._drawableIds = new Array<CubismIdHandle>();\n this._partIds = new Array<CubismIdHandle>();\n this._isOverriddenParameterRepeat = true;\n this._isOverriddenCullings = false;\n this._modelOpacity = 1.0;\n\n // CubismModelMultiplyAndScreenColorのインスタンスを作成\n this._overrideMultiplyAndScreenColor =\n new CubismModelMultiplyAndScreenColor(this);\n\n this._isBlendModeEnabled = false;\n this._drawableColorBlends = null;\n this._drawableAlphaBlends = null;\n this._offscreenColorBlends = null;\n this._offscreenAlphaBlends = null;\n this._drawableMultiplyColors = null;\n this._drawableScreenColors = null;\n this._offscreenMultiplyColors = null;\n this._offscreenScreenColors = null;\n\n this._userParameterRepeatDataList = new Array<ParameterRepeatData>();\n this._userDrawableCullings = new Array<CullingData>();\n this._userOffscreenCullings = new Array<CullingData>();\n this._partsHierarchy = new Array<CubismModelPartInfo>();\n\n this._notExistPartId = new Map<CubismIdHandle, number>();\n this._notExistParameterId = new Map<CubismIdHandle, number>();\n this._notExistParameterValues = new Map<number, number>();\n this._notExistPartOpacities = new Map<number, number>();\n\n // Drawableのカラーブレンドとアルファブレンドの初期化\n this._drawableColorBlends = new Array<CubismColorBlend>(\n model.drawables.count\n ).fill(CubismColorBlend.ColorBlend_None);\n this._drawableAlphaBlends = new Array<CubismAlphaBlend>(\n model.drawables.count\n ).fill(CubismAlphaBlend.AlphaBlend_None);\n\n // Offscreenのカラーブレンドとアルファブレンドの初期化\n this._offscreenColorBlends = new Array<CubismColorBlend>(\n model.offscreens.count\n ).fill(CubismColorBlend.ColorBlend_None);\n this._offscreenAlphaBlends = new Array<CubismAlphaBlend>(\n model.offscreens.count\n ).fill(CubismAlphaBlend.AlphaBlend_None);\n }\n\n /**\n * デストラクタ相当の処理\n */\n public release(): void {\n this._model.release();\n this._model = null;\n\n this._drawableColorBlends = null;\n this._drawableAlphaBlends = null;\n this._offscreenColorBlends = null;\n this._offscreenAlphaBlends = null;\n\n this._drawableMultiplyColors = null;\n this._drawableScreenColors = null;\n this._offscreenMultiplyColors = null;\n this._offscreenScreenColors = null;\n }\n\n private _notExistPartOpacities: Map<number, number>; // 存在していないパーツの不透明度のリスト\n private _notExistPartId: Map<CubismIdHandle, number>; // 存在していないパーツIDのリスト\n\n private _notExistParameterValues: Map<number, number>; // 存在していないパラメータの値のリスト\n private _notExistParameterId: Map<CubismIdHandle, number>; // 存在していないパラメータIDのリスト\n\n private _savedParameters: Array<number>; // 保存されたパラメータ\n\n /**\n * Flag to determine whether to override model-wide parameter repeats on the SDK\n */\n private _isOverriddenParameterRepeat: boolean;\n\n private _overrideMultiplyAndScreenColor: CubismModelMultiplyAndScreenColor; // 乗算色・スクリーン色の管理クラス\n\n /**\n * List to manage ParameterRepeat and Override flag to be set for each Parameter\n */\n private _userParameterRepeatDataList: Array<ParameterRepeatData>;\n private _partsHierarchy: Array<CubismModelPartInfo>; // Partの親子構造\n\n private _model: Live2DCubismCore.Model; // モデル\n\n private _parameterValues: Float32Array; // パラメータの値のリスト\n private _parameterMaximumValues: Float32Array; // パラメータの最大値のリスト\n private _parameterMinimumValues: Float32Array; // パラメータの最小値のリスト\n\n private _partOpacities: Float32Array; // パーツの不透明度のリスト\n private _offscreenOpacities: Float32Array; // オフスクリーンの不透明度のリスト\n\n private _modelOpacity: number; // モデルの不透明度\n\n private _parameterIds: Array<CubismIdHandle>;\n private _partIds: Array<CubismIdHandle>;\n private _drawableIds: Array<CubismIdHandle>;\n\n private _isOverriddenCullings: boolean; // モデルのカリング設定をすべて上書きするか?\n private _userDrawableCullings: Array<CullingData>; // カリング設定の配列\n private _userOffscreenCullings: Array<CullingData>; // オフスクリーンのカリング設定を使用するか?\n\n private _isBlendModeEnabled: boolean; // ブレンドモードを使用しているか\n\n private _drawableColorBlends: CubismColorBlend[]; // Drawableのカラーブレンドの配列\n private _drawableAlphaBlends: CubismAlphaBlend[]; // Drawableのアルファブレンドの配列\n private _offscreenColorBlends: CubismColorBlend[]; // Offscreen のカラーブレンドの配列\n private _offscreenAlphaBlends: CubismAlphaBlend[]; // Offscreen のアルファブレンドの配列\n\n private _drawableMultiplyColors: CubismTextureColor[]; // Drawableの乗算色の配列\n private _drawableScreenColors: CubismTextureColor[]; // Drawableのスクリーン色の配列\n private _offscreenMultiplyColors: CubismTextureColor[]; // Offscreenの乗算色の配列\n private _offscreenScreenColors: CubismTextureColor[]; // Offscreenのスクリーン色の配列\n}\n\n// Namespace definition for compatibility.\nimport * as $ from './cubismmodel';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const CubismModel = $.CubismModel;\n export type CubismModel = $.CubismModel;\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport { CSM_ASSERT, CubismLogError } from '../utils/cubismdebug';\nimport { CubismModel } from './cubismmodel';\n\n/**\n * Mocデータの管理\n *\n * Mocデータの管理を行うクラス。\n */\nexport class CubismMoc {\n /**\n * Mocデータの作成\n */\n public static create(\n mocBytes: ArrayBuffer,\n shouldCheckMocConsistency: boolean\n ): CubismMoc {\n let cubismMoc: CubismMoc = null;\n\n if (shouldCheckMocConsistency) {\n // .moc3の整合性を確認\n const consistency = this.hasMocConsistency(mocBytes);\n\n if (!consistency) {\n // 整合性が確認できなければ処理しない\n CubismLogError(`Inconsistent MOC3.`);\n return cubismMoc;\n }\n }\n\n const moc: Live2DCubismCore.Moc =\n Live2DCubismCore.Moc.fromArrayBuffer(mocBytes);\n\n if (moc) {\n cubismMoc = new CubismMoc(moc);\n cubismMoc._mocVersion =\n Live2DCubismCore.Version.csmGetMocVersion(mocBytes);\n }\n\n return cubismMoc;\n }\n\n /**\n * Mocデータを削除\n *\n * Mocデータを削除する\n */\n public static delete(moc: CubismMoc): void {\n moc._moc._release();\n moc._moc = null;\n moc = null;\n }\n\n /**\n * モデルを作成する\n *\n * @return Mocデータから作成されたモデル\n */\n createModel(): CubismModel {\n let cubismModel: CubismModel = null;\n\n const model: Live2DCubismCore.Model = Live2DCubismCore.Model.fromMoc(\n this._moc\n );\n\n if (model) {\n cubismModel = new CubismModel(model);\n cubismModel.initialize();\n\n ++this._modelCount;\n }\n\n return cubismModel;\n }\n\n /**\n * モデルを削除する\n */\n deleteModel(model: CubismModel): void {\n if (model != null) {\n model.release();\n model = null;\n --this._modelCount;\n }\n }\n\n /**\n * コンストラクタ\n */\n private constructor(moc: Live2DCubismCore.Moc) {\n this._moc = moc;\n this._modelCount = 0;\n this._mocVersion = 0;\n }\n\n /**\n * デストラクタ相当の処理\n */\n public release(): void {\n CSM_ASSERT(this._modelCount == 0);\n\n this._moc._release();\n this._moc = null;\n }\n\n /**\n * 最新の.moc3 Versionを取得\n */\n public getLatestMocVersion(): number {\n return Live2DCubismCore.Version.csmGetLatestMocVersion();\n }\n\n /**\n * 読み込んだモデルの.moc3 Versionを取得\n */\n public getMocVersion(): number {\n return this._mocVersion;\n }\n\n /**\n * Mocファイルのbufferから.moc3 Versionを取得\n * @param mocBytes Mocファイルのバイト配列\n * @returns .moc3 Version番号\n */\n public static getMocVersionFromBuffer(mocBytes: ArrayBuffer): number {\n return Live2DCubismCore.Version.csmGetMocVersion(mocBytes);\n }\n\n /**\n * .moc3 の整合性を検証する\n */\n public static hasMocConsistency(mocBytes: ArrayBuffer): boolean {\n const isConsistent =\n Live2DCubismCore.Moc.prototype.hasMocConsistency(mocBytes);\n return isConsistent === 1 ? true : false;\n }\n\n _moc: Live2DCubismCore.Moc; // Mocデータ\n _modelCount: number; // Mocデータから作られたモデルの個数\n _mocVersion: number; // 読み込んだモデルの.moc3 Version\n}\n\n// Namespace definition for compatibility.\nimport * as $ from './cubismmoc';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const CubismMoc = $.CubismMoc;\n export type CubismMoc = $.CubismMoc;\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\n/**\n * Arrayのサイズを変更する。\n * @param curArray\n * @param newSize\n * @param value\n * @param callPlacementNew\n */\nexport function updateSize<T>(\n curArray: Array<T>,\n newSize: number,\n value: any = null,\n callPlacementNew: boolean = null\n): void {\n const curSize: number = curArray.length;\n\n if (curSize < newSize) {\n if (callPlacementNew) {\n for (let i: number = curArray.length; i < newSize; i++) {\n if (typeof value == 'function') {\n // new\n curArray[i] = JSON.parse(JSON.stringify(new value()));\n } // プリミティブ型なので値渡し\n else {\n curArray[i] = value;\n }\n }\n } else {\n for (let i: number = curArray.length; i < newSize; i++) {\n curArray[i] = value;\n }\n }\n } else {\n curArray.length = newSize;\n }\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport { CubismIdHandle } from '../id/cubismid';\nimport { CubismVector2 } from '../math/cubismvector2';\n\n/**\n * 物理演算の適用先の種類\n */\nexport enum CubismPhysicsTargetType {\n CubismPhysicsTargetType_Parameter // パラメータに対して適用\n}\n\n/**\n * 物理演算の入力の種類\n */\nexport enum CubismPhysicsSource {\n CubismPhysicsSource_X, // X軸の位置から\n CubismPhysicsSource_Y, // Y軸の位置から\n CubismPhysicsSource_Angle // 角度から\n}\n\n/**\n * @brief 物理演算で使用する外部の力\n *\n * 物理演算で使用する外部の力。\n */\nexport class PhysicsJsonEffectiveForces {\n constructor() {\n this.gravity = new CubismVector2(0, 0);\n this.wind = new CubismVector2(0, 0);\n }\n gravity: CubismVector2; // 重力\n wind: CubismVector2; // 風\n}\n\n/**\n * 物理演算のパラメータ情報\n */\nexport class CubismPhysicsParameter {\n id: CubismIdHandle; // パラメータ\n targetType: CubismPhysicsTargetType; // 適用先の種類\n}\n\n/**\n * 物理演算の正規化情報\n */\nexport class CubismPhysicsNormalization {\n minimum: number; // 最大値\n maximum: number; // 最小値\n defalut: number; // デフォルト値\n}\n\n/**\n * 物理演算の演算委使用する物理点の情報\n */\nexport class CubismPhysicsParticle {\n constructor() {\n this.initialPosition = new CubismVector2(0, 0);\n this.position = new CubismVector2(0, 0);\n this.lastPosition = new CubismVector2(0, 0);\n this.lastGravity = new CubismVector2(0, 0);\n this.force = new CubismVector2(0, 0);\n this.velocity = new CubismVector2(0, 0);\n }\n\n initialPosition: CubismVector2; // 初期位置\n mobility: number; // 動きやすさ\n delay: number; // 遅れ\n acceleration: number; // 加速度\n radius: number; // 距離\n position: CubismVector2; // 現在の位置\n lastPosition: CubismVector2; // 最後の位置\n lastGravity: CubismVector2; // 最後の重力\n force: CubismVector2; // 現在かかっている力\n velocity: CubismVector2; // 現在の速度\n}\n\n/**\n * 物理演算の物理点の管理\n */\nexport class CubismPhysicsSubRig {\n constructor() {\n this.normalizationPosition = new CubismPhysicsNormalization();\n this.normalizationAngle = new CubismPhysicsNormalization();\n }\n inputCount: number; // 入力の個数\n outputCount: number; // 出力の個数\n particleCount: number; // 物理点の個数\n baseInputIndex: number; // 入力の最初のインデックス\n baseOutputIndex: number; // 出力の最初のインデックス\n baseParticleIndex: number; // 物理点の最初のインデックス\n normalizationPosition: CubismPhysicsNormalization; // 正規化された位置\n normalizationAngle: CubismPhysicsNormalization; // 正規化された角度\n}\n\n/**\n * 正規化されたパラメータの取得関数の宣言\n * @param targetTranslation // 演算結果の移動値\n * @param targetAngle // 演算結果の角度\n * @param value // パラメータの値\n * @param parameterMinimunValue // パラメータの最小値\n * @param parameterMaximumValue // パラメータの最大値\n * @param parameterDefaultValue // パラメータのデフォルト値\n * @param normalizationPosition // 正規化された位置\n * @param normalizationAngle // 正規化された角度\n * @param isInverted // 値が反転されているか?\n * @param weight // 重み\n */\nexport interface normalizedPhysicsParameterValueGetter {\n (\n targetTranslation: CubismVector2,\n targetAngle: { angle: number },\n value: number,\n parameterMinimunValue: number,\n parameterMaximumValue: number,\n parameterDefaultValue: number,\n normalizationPosition: CubismPhysicsNormalization,\n normalizationAngle: CubismPhysicsNormalization,\n isInverted: boolean,\n weight: number\n ): void;\n}\n\n/**\n * 物理演算の値の取得関数の宣言\n * @param translation 移動値\n * @param particles 物理点のリスト\n * @param isInverted 値が反映されているか\n * @param parentGravity 重力\n * @return 値\n */\nexport interface physicsValueGetter {\n (\n translation: CubismVector2,\n particles: CubismPhysicsParticle[],\n particleIndex: number,\n isInverted: boolean,\n parentGravity: CubismVector2\n ): number;\n}\n\n/**\n * 物理演算のスケールの取得関数の宣言\n * @param translationScale 移動値のスケール\n * @param angleScale 角度のスケール\n * @return スケール値\n */\nexport interface physicsScaleGetter {\n (translationScale: CubismVector2, angleScale: number): number;\n}\n\n/**\n * 物理演算の入力情報\n */\nexport class CubismPhysicsInput {\n constructor() {\n this.source = new CubismPhysicsParameter();\n }\n source: CubismPhysicsParameter; // 入力元のパラメータ\n sourceParameterIndex: number; // 入力元のパラメータのインデックス\n weight: number; // 重み\n type: number; // 入力の種類\n reflect: boolean; // 値が反転されているかどうか\n getNormalizedParameterValue: normalizedPhysicsParameterValueGetter; // 正規化されたパラメータ値の取得関数\n}\n\n/**\n * @brief 物理演算の出力情報\n *\n * 物理演算の出力情報。\n */\nexport class CubismPhysicsOutput {\n constructor() {\n this.destination = new CubismPhysicsParameter();\n this.translationScale = new CubismVector2(0, 0);\n }\n\n destination: CubismPhysicsParameter; // 出力先のパラメータ\n destinationParameterIndex: number; // 出力先のパラメータのインデックス\n vertexIndex: number; // 振り子のインデックス\n translationScale: CubismVector2; // 移動値のスケール\n angleScale: number; // 角度のスケール\n weight: number; // 重み\n type: CubismPhysicsSource; // 出力の種類\n reflect: boolean; // 値が反転されているかどうか\n valueBelowMinimum: number; // 最小値を下回った時の値\n valueExceededMaximum: number; // 最大値をこえた時の値\n getValue: physicsValueGetter; // 物理演算の値の取得関数\n getScale: physicsScaleGetter; // 物理演算のスケール値の取得関数\n}\n\n/**\n * @brief 物理演算のデータ\n *\n * 物理演算のデータ。\n */\nexport class CubismPhysicsRig {\n constructor() {\n this.settings = new Array<CubismPhysicsSubRig>();\n this.inputs = new Array<CubismPhysicsInput>();\n this.outputs = new Array<CubismPhysicsOutput>();\n this.particles = new Array<CubismPhysicsParticle>();\n this.gravity = new CubismVector2(0, 0);\n this.wind = new CubismVector2(0, 0);\n this.fps = 0.0;\n }\n\n subRigCount: number; // 物理演算の物理点の個数\n settings: Array<CubismPhysicsSubRig>; // 物理演算の物理点の管理のリスト\n inputs: Array<CubismPhysicsInput>; // 物理演算の入力のリスト\n outputs: Array<CubismPhysicsOutput>; // 物理演算の出力のリスト\n particles: Array<CubismPhysicsParticle>; // 物理演算の物理点のリスト\n gravity: CubismVector2; // 重力\n wind: CubismVector2; // 風\n fps: number; //物理演算動作FPS\n}\n\n// Namespace definition for compatibility.\nimport * as $ from './cubismphysicsinternal';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const CubismPhysicsInput = $.CubismPhysicsInput;\n export type CubismPhysicsInput = $.CubismPhysicsInput;\n export const CubismPhysicsNormalization = $.CubismPhysicsNormalization;\n export type CubismPhysicsNormalization = $.CubismPhysicsNormalization;\n export const CubismPhysicsOutput = $.CubismPhysicsOutput;\n export type CubismPhysicsOutput = $.CubismPhysicsOutput;\n export const CubismPhysicsParameter = $.CubismPhysicsParameter;\n export type CubismPhysicsParameter = $.CubismPhysicsParameter;\n export const CubismPhysicsParticle = $.CubismPhysicsParticle;\n export type CubismPhysicsParticle = $.CubismPhysicsParticle;\n export const CubismPhysicsRig = $.CubismPhysicsRig;\n export type CubismPhysicsRig = $.CubismPhysicsRig;\n export const CubismPhysicsSource = $.CubismPhysicsSource;\n export type CubismPhysicsSource = $.CubismPhysicsSource;\n export const CubismPhysicsSubRig = $.CubismPhysicsSubRig;\n export type CubismPhysicsSubRig = $.CubismPhysicsSubRig;\n export const CubismPhysicsTargetType = $.CubismPhysicsTargetType;\n export type CubismPhysicsTargetType = $.CubismPhysicsTargetType;\n export const PhysicsJsonEffectiveForces = $.PhysicsJsonEffectiveForces;\n export type PhysicsJsonEffectiveForces = $.PhysicsJsonEffectiveForces;\n export type normalizedPhysicsParameterValueGetter =\n $.normalizedPhysicsParameterValueGetter;\n export type physicsScaleGetter = $.physicsScaleGetter;\n export type physicsValueGetter = $.physicsValueGetter;\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport { CubismIdHandle } from '../id/cubismid';\nimport { CubismFramework } from '../live2dcubismframework';\nimport { CubismVector2 } from '../math/cubismvector2';\nimport { CubismJson } from '../utils/cubismjson';\n\n// JSON keys\nconst Position = 'Position';\nconst X = 'X';\nconst Y = 'Y';\nconst Angle = 'Angle';\nconst Type = 'Type';\nconst Id = 'Id';\n\n// Meta\nconst Meta = 'Meta';\nconst EffectiveForces = 'EffectiveForces';\nconst TotalInputCount = 'TotalInputCount';\nconst TotalOutputCount = 'TotalOutputCount';\nconst PhysicsSettingCount = 'PhysicsSettingCount';\nconst Gravity = 'Gravity';\nconst Wind = 'Wind';\nconst VertexCount = 'VertexCount';\nconst Fps = 'Fps';\n\n// PhysicsSettings\nconst PhysicsSettings = 'PhysicsSettings';\nconst Normalization = 'Normalization';\nconst Minimum = 'Minimum';\nconst Maximum = 'Maximum';\nconst Default = 'Default';\nconst Reflect = 'Reflect';\nconst Weight = 'Weight';\n\n// Input\nconst Input = 'Input';\nconst Source = 'Source';\n\n// Output\nconst Output = 'Output';\nconst Scale = 'Scale';\nconst VertexIndex = 'VertexIndex';\nconst Destination = 'Destination';\n\n// Particle\nconst Vertices = 'Vertices';\nconst Mobility = 'Mobility';\nconst Delay = 'Delay';\nconst Radius = 'Radius';\nconst Acceleration = 'Acceleration';\n\n/**\n * physics3.jsonのコンテナ。\n */\nexport class CubismPhysicsJson {\n /**\n * コンストラクタ\n * @param buffer physics3.jsonが読み込まれているバッファ\n * @param size バッファのサイズ\n */\n public constructor(buffer: ArrayBuffer, size: number) {\n this._json = CubismJson.create(buffer, size);\n }\n\n /**\n * デストラクタ相当の処理\n */\n public release(): void {\n CubismJson.delete(this._json);\n }\n\n /**\n * 重力の取得\n * @return 重力\n */\n public getGravity(): CubismVector2 {\n const ret: CubismVector2 = new CubismVector2(0, 0);\n ret.x = this._json\n .getRoot()\n .getValueByString(Meta)\n .getValueByString(EffectiveForces)\n .getValueByString(Gravity)\n .getValueByString(X)\n .toFloat();\n ret.y = this._json\n .getRoot()\n .getValueByString(Meta)\n .getValueByString(EffectiveForces)\n .getValueByString(Gravity)\n .getValueByString(Y)\n .toFloat();\n return ret;\n }\n\n /**\n * 風の取得\n * @return 風\n */\n public getWind(): CubismVector2 {\n const ret: CubismVector2 = new CubismVector2(0, 0);\n ret.x = this._json\n .getRoot()\n .getValueByString(Meta)\n .getValueByString(EffectiveForces)\n .getValueByString(Wind)\n .getValueByString(X)\n .toFloat();\n ret.y = this._json\n .getRoot()\n .getValueByString(Meta)\n .getValueByString(EffectiveForces)\n .getValueByString(Wind)\n .getValueByString(Y)\n .toFloat();\n return ret;\n }\n\n /**\n * 物理演算設定FPSの取得\n * @return 物理演算設定FPS\n */\n public getFps(): number {\n return this._json\n .getRoot()\n .getValueByString(Meta)\n .getValueByString(Fps)\n .toFloat(0.0);\n }\n\n /**\n * 物理店の管理の個数の取得\n * @return 物理店の管理の個数\n */\n public getSubRigCount(): number {\n return this._json\n .getRoot()\n .getValueByString(Meta)\n .getValueByString(PhysicsSettingCount)\n .toInt();\n }\n\n /**\n * 入力の総合計の取得\n * @return 入力の総合計\n */\n public getTotalInputCount(): number {\n return this._json\n .getRoot()\n .getValueByString(Meta)\n .getValueByString(TotalInputCount)\n .toInt();\n }\n\n /**\n * 出力の総合計の取得\n * @return 出力の総合計\n */\n public getTotalOutputCount(): number {\n return this._json\n .getRoot()\n .getValueByString(Meta)\n .getValueByString(TotalOutputCount)\n .toInt();\n }\n\n /**\n * 物理点の個数の取得\n * @return 物理点の個数\n */\n public getVertexCount(): number {\n return this._json\n .getRoot()\n .getValueByString(Meta)\n .getValueByString(VertexCount)\n .toInt();\n }\n\n /**\n * 正規化された位置の最小値の取得\n * @param physicsSettingIndex 物理演算の設定のインデックス\n * @return 正規化された位置の最小値\n */\n public getNormalizationPositionMinimumValue(\n physicsSettingIndex: number\n ): number {\n return this._json\n .getRoot()\n .getValueByString(PhysicsSettings)\n .getValueByIndex(physicsSettingIndex)\n .getValueByString(Normalization)\n .getValueByString(Position)\n .getValueByString(Minimum)\n .toFloat();\n }\n\n /**\n * 正規化された位置の最大値の取得\n * @param physicsSettingIndex 物理演算の設定のインデックス\n * @return 正規化された位置の最大値\n */\n public getNormalizationPositionMaximumValue(\n physicsSettingIndex: number\n ): number {\n return this._json\n .getRoot()\n .getValueByString(PhysicsSettings)\n .getValueByIndex(physicsSettingIndex)\n .getValueByString(Normalization)\n .getValueByString(Position)\n .getValueByString(Maximum)\n .toFloat();\n }\n\n /**\n * 正規化された位置のデフォルト値の取得\n * @param physicsSettingIndex 物理演算の設定のインデックス\n * @return 正規化された位置のデフォルト値\n */\n public getNormalizationPositionDefaultValue(\n physicsSettingIndex: number\n ): number {\n return this._json\n .getRoot()\n .getValueByString(PhysicsSettings)\n .getValueByIndex(physicsSettingIndex)\n .getValueByString(Normalization)\n .getValueByString(Position)\n .getValueByString(Default)\n .toFloat();\n }\n\n /**\n * 正規化された角度の最小値の取得\n * @param physicsSettingIndex 物理演算の設定のインデックス\n * @return 正規化された角度の最小値\n */\n public getNormalizationAngleMinimumValue(\n physicsSettingIndex: number\n ): number {\n return this._json\n .getRoot()\n .getValueByString(PhysicsSettings)\n .getValueByIndex(physicsSettingIndex)\n .getValueByString(Normalization)\n .getValueByString(Angle)\n .getValueByString(Minimum)\n .toFloat();\n }\n\n /**\n * 正規化された角度の最大値の取得\n * @param physicsSettingIndex\n * @return 正規化された角度の最大値\n */\n public getNormalizationAngleMaximumValue(\n physicsSettingIndex: number\n ): number {\n return this._json\n .getRoot()\n .getValueByString(PhysicsSettings)\n .getValueByIndex(physicsSettingIndex)\n .getValueByString(Normalization)\n .getValueByString(Angle)\n .getValueByString(Maximum)\n .toFloat();\n }\n\n /**\n * 正規化された角度のデフォルト値の取得\n * @param physicsSettingIndex 物理演算の設定のインデックス\n * @return 正規化された角度のデフォルト値\n */\n public getNormalizationAngleDefaultValue(\n physicsSettingIndex: number\n ): number {\n return this._json\n .getRoot()\n .getValueByString(PhysicsSettings)\n .getValueByIndex(physicsSettingIndex)\n .getValueByString(Normalization)\n .getValueByString(Angle)\n .getValueByString(Default)\n .toFloat();\n }\n\n /**\n * 入力の個数の取得\n * @param physicsSettingIndex 物理演算の設定のインデックス\n * @return 入力の個数\n */\n public getInputCount(physicsSettingIndex: number): number {\n return this._json\n .getRoot()\n .getValueByString(PhysicsSettings)\n .getValueByIndex(physicsSettingIndex)\n .getValueByString(Input)\n .getVector().length;\n }\n\n /**\n * 入力の重みの取得\n * @param physicsSettingIndex 物理演算の設定のインデックス\n * @param inputIndex 入力のインデックス\n * @return 入力の重み\n */\n public getInputWeight(\n physicsSettingIndex: number,\n inputIndex: number\n ): number {\n return this._json\n .getRoot()\n .getValueByString(PhysicsSettings)\n .getValueByIndex(physicsSettingIndex)\n .getValueByString(Input)\n .getValueByIndex(inputIndex)\n .getValueByString(Weight)\n .toFloat();\n }\n\n /**\n * 入力の反転の取得\n * @param physicsSettingIndex 物理演算の設定のインデックス\n * @param inputIndex 入力のインデックス\n * @return 入力の反転\n */\n public getInputReflect(\n physicsSettingIndex: number,\n inputIndex: number\n ): boolean {\n return this._json\n .getRoot()\n .getValueByString(PhysicsSettings)\n .getValueByIndex(physicsSettingIndex)\n .getValueByString(Input)\n .getValueByIndex(inputIndex)\n .getValueByString(Reflect)\n .toBoolean();\n }\n\n /**\n * 入力の種類の取得\n * @param physicsSettingIndex 物理演算の設定のインデックス\n * @param inputIndex 入力のインデックス\n * @return 入力の種類\n */\n public getInputType(physicsSettingIndex: number, inputIndex: number): string {\n return this._json\n .getRoot()\n .getValueByString(PhysicsSettings)\n .getValueByIndex(physicsSettingIndex)\n .getValueByString(Input)\n .getValueByIndex(inputIndex)\n .getValueByString(Type)\n .getRawString();\n }\n\n /**\n * 入力元のIDの取得\n * @param physicsSettingIndex 物理演算の設定のインデックス\n * @param inputIndex 入力のインデックス\n * @return 入力元のID\n */\n public getInputSourceId(\n physicsSettingIndex: number,\n inputIndex: number\n ): CubismIdHandle {\n return CubismFramework.getIdManager().getId(\n this._json\n .getRoot()\n .getValueByString(PhysicsSettings)\n .getValueByIndex(physicsSettingIndex)\n .getValueByString(Input)\n .getValueByIndex(inputIndex)\n .getValueByString(Source)\n .getValueByString(Id)\n .getRawString()\n );\n }\n\n /**\n * 出力の個数の取得\n * @param physicsSettingIndex 物理演算の設定のインデックス\n * @return 出力の個数\n */\n public getOutputCount(physicsSettingIndex: number): number {\n return this._json\n .getRoot()\n .getValueByString(PhysicsSettings)\n .getValueByIndex(physicsSettingIndex)\n .getValueByString(Output)\n .getVector().length;\n }\n\n /**\n * 出力の物理点のインデックスの取得\n * @param physicsSettingIndex 物理演算の設定のインデックス\n * @param outputIndex 出力のインデックス\n * @return 出力の物理点のインデックス\n */\n public getOutputVertexIndex(\n physicsSettingIndex: number,\n outputIndex: number\n ): number {\n return this._json\n .getRoot()\n .getValueByString(PhysicsSettings)\n .getValueByIndex(physicsSettingIndex)\n .getValueByString(Output)\n .getValueByIndex(outputIndex)\n .getValueByString(VertexIndex)\n .toInt();\n }\n\n /**\n * 出力の角度のスケールを取得する\n * @param physicsSettingIndex 物理演算の設定のインデックス\n * @param outputIndex 出力のインデックス\n * @return 出力の角度のスケール\n */\n public getOutputAngleScale(\n physicsSettingIndex: number,\n outputIndex: number\n ): number {\n return this._json\n .getRoot()\n .getValueByString(PhysicsSettings)\n .getValueByIndex(physicsSettingIndex)\n .getValueByString(Output)\n .getValueByIndex(outputIndex)\n .getValueByString(Scale)\n .toFloat();\n }\n\n /**\n * 出力の重みの取得\n * @param physicsSettingIndex 物理演算の設定のインデックス\n * @param outputIndex 出力のインデックス\n * @return 出力の重み\n */\n public getOutputWeight(\n physicsSettingIndex: number,\n outputIndex: number\n ): number {\n return this._json\n .getRoot()\n .getValueByString(PhysicsSettings)\n .getValueByIndex(physicsSettingIndex)\n .getValueByString(Output)\n .getValueByIndex(outputIndex)\n .getValueByString(Weight)\n .toFloat();\n }\n\n /**\n * 出力先のIDの取得\n * @param physicsSettingIndex 物理演算の設定のインデックス\n * @param outputIndex 出力のインデックス\n * @return 出力先のID\n */\n public getOutputDestinationId(\n physicsSettingIndex: number,\n outputIndex: number\n ): CubismIdHandle {\n return CubismFramework.getIdManager().getId(\n this._json\n .getRoot()\n .getValueByString(PhysicsSettings)\n .getValueByIndex(physicsSettingIndex)\n .getValueByString(Output)\n .getValueByIndex(outputIndex)\n .getValueByString(Destination)\n .getValueByString(Id)\n .getRawString()\n );\n }\n\n /**\n * 出力の種類の取得\n * @param physicsSettingIndex 物理演算の設定のインデックス\n * @param outputIndex 出力のインデックス\n * @return 出力の種類\n */\n public getOutputType(\n physicsSettingIndex: number,\n outputIndex: number\n ): string {\n return this._json\n .getRoot()\n .getValueByString(PhysicsSettings)\n .getValueByIndex(physicsSettingIndex)\n .getValueByString(Output)\n .getValueByIndex(outputIndex)\n .getValueByString(Type)\n .getRawString();\n }\n\n /**\n * 出力の反転の取得\n * @param physicsSettingIndex 物理演算のインデックス\n * @param outputIndex 出力のインデックス\n * @return 出力の反転\n */\n public getOutputReflect(\n physicsSettingIndex: number,\n outputIndex: number\n ): boolean {\n return this._json\n .getRoot()\n .getValueByString(PhysicsSettings)\n .getValueByIndex(physicsSettingIndex)\n .getValueByString(Output)\n .getValueByIndex(outputIndex)\n .getValueByString(Reflect)\n .toBoolean();\n }\n\n /**\n * 物理点の個数の取得\n * @param physicsSettingIndex 物理演算男設定のインデックス\n * @return 物理点の個数\n */\n public getParticleCount(physicsSettingIndex: number): number {\n return this._json\n .getRoot()\n .getValueByString(PhysicsSettings)\n .getValueByIndex(physicsSettingIndex)\n .getValueByString(Vertices)\n .getVector().length;\n }\n\n /**\n * 物理点の動きやすさの取得\n * @param physicsSettingIndex 物理演算の設定のインデックス\n * @param vertexIndex 物理点のインデックス\n * @return 物理点の動きやすさ\n */\n public getParticleMobility(\n physicsSettingIndex: number,\n vertexIndex: number\n ): number {\n return this._json\n .getRoot()\n .getValueByString(PhysicsSettings)\n .getValueByIndex(physicsSettingIndex)\n .getValueByString(Vertices)\n .getValueByIndex(vertexIndex)\n .getValueByString(Mobility)\n .toFloat();\n }\n\n /**\n * 物理点の遅れの取得\n * @param physicsSettingIndex 物理演算の設定のインデックス\n * @param vertexIndex 物理点のインデックス\n * @return 物理点の遅れ\n */\n public getParticleDelay(\n physicsSettingIndex: number,\n vertexIndex: number\n ): number {\n return this._json\n .getRoot()\n .getValueByString(PhysicsSettings)\n .getValueByIndex(physicsSettingIndex)\n .getValueByString(Vertices)\n .getValueByIndex(vertexIndex)\n .getValueByString(Delay)\n .toFloat();\n }\n\n /**\n * 物理点の加速度の取得\n * @param physicsSettingIndex 物理演算の設定\n * @param vertexIndex 物理点のインデックス\n * @return 物理点の加速度\n */\n public getParticleAcceleration(\n physicsSettingIndex: number,\n vertexIndex: number\n ): number {\n return this._json\n .getRoot()\n .getValueByString(PhysicsSettings)\n .getValueByIndex(physicsSettingIndex)\n .getValueByString(Vertices)\n .getValueByIndex(vertexIndex)\n .getValueByString(Acceleration)\n .toFloat();\n }\n\n /**\n * 物理点の距離の取得\n * @param physicsSettingIndex 物理演算の設定のインデックス\n * @param vertexIndex 物理点のインデックス\n * @return 物理点の距離\n */\n public getParticleRadius(\n physicsSettingIndex: number,\n vertexIndex: number\n ): number {\n return this._json\n .getRoot()\n .getValueByString(PhysicsSettings)\n .getValueByIndex(physicsSettingIndex)\n .getValueByString(Vertices)\n .getValueByIndex(vertexIndex)\n .getValueByString(Radius)\n .toFloat();\n }\n\n /**\n * 物理点の位置の取得\n * @param physicsSettingIndex 物理演算の設定のインデックス\n * @param vertexInde 物理点のインデックス\n * @return 物理点の位置\n */\n public getParticlePosition(\n physicsSettingIndex: number,\n vertexIndex: number\n ): CubismVector2 {\n const ret: CubismVector2 = new CubismVector2(0, 0);\n ret.x = this._json\n .getRoot()\n .getValueByString(PhysicsSettings)\n .getValueByIndex(physicsSettingIndex)\n .getValueByString(Vertices)\n .getValueByIndex(vertexIndex)\n .getValueByString(Position)\n .getValueByString(X)\n .toFloat();\n ret.y = this._json\n .getRoot()\n .getValueByString(PhysicsSettings)\n .getValueByIndex(physicsSettingIndex)\n .getValueByString(Vertices)\n .getValueByIndex(vertexIndex)\n .getValueByString(Position)\n .getValueByString(Y)\n .toFloat();\n return ret;\n }\n\n _json: CubismJson; // physics3.jsonデータ\n}\n\n// Namespace definition for compatibility.\nimport * as $ from './cubismphysicsjson';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const CubismPhysicsJson = $.CubismPhysicsJson;\n export type CubismPhysicsJson = $.CubismPhysicsJson;\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport { CubismMath } from '../math/cubismmath';\nimport { CubismVector2 } from '../math/cubismvector2';\nimport { CubismModel } from '../model/cubismmodel';\nimport { updateSize } from '../utils/cubismarrayutils';\nimport {\n CubismPhysicsInput,\n CubismPhysicsNormalization,\n CubismPhysicsOutput,\n CubismPhysicsParticle,\n CubismPhysicsRig,\n CubismPhysicsSource,\n CubismPhysicsSubRig,\n CubismPhysicsTargetType\n} from './cubismphysicsinternal';\nimport { CubismPhysicsJson } from './cubismphysicsjson';\n\n// physics types tags.\nconst PhysicsTypeTagX = 'X';\nconst PhysicsTypeTagY = 'Y';\nconst PhysicsTypeTagAngle = 'Angle';\n\n// Constant of air resistance.\nconst AirResistance = 5.0;\n\n// Constant of maximum weight of input and output ratio.\nconst MaximumWeight = 100.0;\n\n// Constant of threshold of movement.\nconst MovementThreshold = 0.001;\n\n// Constant of maximum allowed delta time\nconst MaxDeltaTime = 5.0;\n\n/**\n * 物理演算クラス\n */\nexport class CubismPhysics {\n /**\n * インスタンスの作成\n * @param buffer physics3.jsonが読み込まれているバッファ\n * @param size バッファのサイズ\n * @return 作成されたインスタンス\n */\n public static create(buffer: ArrayBuffer, size: number): CubismPhysics {\n const ret: CubismPhysics = new CubismPhysics();\n\n ret.parse(buffer, size);\n ret._physicsRig.gravity.y = 0;\n\n return ret;\n }\n\n /**\n * インスタンスを破棄する\n * @param physics 破棄するインスタンス\n */\n public static delete(physics: CubismPhysics): void {\n if (physics != null) {\n physics.release();\n physics = null;\n }\n }\n\n /**\n * physics3.jsonをパースする。\n * @param physicsJson physics3.jsonが読み込まれているバッファ\n * @param size バッファのサイズ\n */\n public parse(physicsJson: ArrayBuffer, size: number): void {\n this._physicsRig = new CubismPhysicsRig();\n\n let json: CubismPhysicsJson = new CubismPhysicsJson(physicsJson, size);\n\n this._physicsRig.gravity = json.getGravity();\n this._physicsRig.wind = json.getWind();\n this._physicsRig.subRigCount = json.getSubRigCount();\n\n this._physicsRig.fps = json.getFps();\n\n updateSize(\n this._physicsRig.settings,\n this._physicsRig.subRigCount,\n CubismPhysicsSubRig,\n true\n );\n updateSize(\n this._physicsRig.inputs,\n json.getTotalInputCount(),\n CubismPhysicsInput,\n true\n );\n updateSize(\n this._physicsRig.outputs,\n json.getTotalOutputCount(),\n CubismPhysicsOutput,\n true\n );\n updateSize(\n this._physicsRig.particles,\n json.getVertexCount(),\n CubismPhysicsParticle,\n true\n );\n\n this._currentRigOutputs.length = 0;\n this._previousRigOutputs.length = 0;\n\n let inputIndex = 0,\n outputIndex = 0,\n particleIndex = 0;\n\n let dstIndexCurrentRigOutputs: number = this._currentRigOutputs.length;\n let dstIndexPreviousRigOutputs: number = this._previousRigOutputs.length;\n this._currentRigOutputs.length += this._physicsRig.settings.length;\n this._previousRigOutputs.length += this._physicsRig.settings.length;\n for (let i = 0; i < this._physicsRig.settings.length; ++i) {\n this._physicsRig.settings[i].normalizationPosition.minimum =\n json.getNormalizationPositionMinimumValue(i);\n this._physicsRig.settings[i].normalizationPosition.maximum =\n json.getNormalizationPositionMaximumValue(i);\n this._physicsRig.settings[i].normalizationPosition.defalut =\n json.getNormalizationPositionDefaultValue(i);\n\n this._physicsRig.settings[i].normalizationAngle.minimum =\n json.getNormalizationAngleMinimumValue(i);\n this._physicsRig.settings[i].normalizationAngle.maximum =\n json.getNormalizationAngleMaximumValue(i);\n this._physicsRig.settings[i].normalizationAngle.defalut =\n json.getNormalizationAngleDefaultValue(i);\n\n // Input\n this._physicsRig.settings[i].inputCount = json.getInputCount(i);\n this._physicsRig.settings[i].baseInputIndex = inputIndex;\n\n for (let j = 0; j < this._physicsRig.settings[i].inputCount; ++j) {\n this._physicsRig.inputs[inputIndex + j].sourceParameterIndex = -1;\n this._physicsRig.inputs[inputIndex + j].weight = json.getInputWeight(\n i,\n j\n );\n this._physicsRig.inputs[inputIndex + j].reflect = json.getInputReflect(\n i,\n j\n );\n\n if (json.getInputType(i, j) == PhysicsTypeTagX) {\n this._physicsRig.inputs[inputIndex + j].type =\n CubismPhysicsSource.CubismPhysicsSource_X;\n this._physicsRig.inputs[inputIndex + j].getNormalizedParameterValue =\n getInputTranslationXFromNormalizedParameterValue;\n } else if (json.getInputType(i, j) == PhysicsTypeTagY) {\n this._physicsRig.inputs[inputIndex + j].type =\n CubismPhysicsSource.CubismPhysicsSource_Y;\n this._physicsRig.inputs[inputIndex + j].getNormalizedParameterValue =\n getInputTranslationYFromNormalizedParamterValue;\n } else if (json.getInputType(i, j) == PhysicsTypeTagAngle) {\n this._physicsRig.inputs[inputIndex + j].type =\n CubismPhysicsSource.CubismPhysicsSource_Angle;\n this._physicsRig.inputs[inputIndex + j].getNormalizedParameterValue =\n getInputAngleFromNormalizedParameterValue;\n }\n\n this._physicsRig.inputs[inputIndex + j].source.targetType =\n CubismPhysicsTargetType.CubismPhysicsTargetType_Parameter;\n this._physicsRig.inputs[inputIndex + j].source.id =\n json.getInputSourceId(i, j);\n }\n inputIndex += this._physicsRig.settings[i].inputCount;\n\n // Output\n this._physicsRig.settings[i].outputCount = json.getOutputCount(i);\n this._physicsRig.settings[i].baseOutputIndex = outputIndex;\n\n const currentRigOutput = new PhysicsOutput();\n updateSize(\n currentRigOutput.outputs,\n this._physicsRig.settings[i].outputCount,\n null,\n true\n );\n\n const previousRigOutput = new PhysicsOutput();\n updateSize(\n previousRigOutput.outputs,\n this._physicsRig.settings[i].outputCount,\n null,\n true\n );\n\n for (let j = 0; j < this._physicsRig.settings[i].outputCount; ++j) {\n // initialize\n currentRigOutput.outputs[j] = 0.0;\n previousRigOutput.outputs[j] = 0.0;\n\n this._physicsRig.outputs[outputIndex + j].destinationParameterIndex =\n -1;\n this._physicsRig.outputs[outputIndex + j].vertexIndex =\n json.getOutputVertexIndex(i, j);\n this._physicsRig.outputs[outputIndex + j].angleScale =\n json.getOutputAngleScale(i, j);\n this._physicsRig.outputs[outputIndex + j].weight = json.getOutputWeight(\n i,\n j\n );\n this._physicsRig.outputs[outputIndex + j].destination.targetType =\n CubismPhysicsTargetType.CubismPhysicsTargetType_Parameter;\n\n this._physicsRig.outputs[outputIndex + j].destination.id =\n json.getOutputDestinationId(i, j);\n\n if (json.getOutputType(i, j) == PhysicsTypeTagX) {\n this._physicsRig.outputs[outputIndex + j].type =\n CubismPhysicsSource.CubismPhysicsSource_X;\n this._physicsRig.outputs[outputIndex + j].getValue =\n getOutputTranslationX;\n this._physicsRig.outputs[outputIndex + j].getScale =\n getOutputScaleTranslationX;\n } else if (json.getOutputType(i, j) == PhysicsTypeTagY) {\n this._physicsRig.outputs[outputIndex + j].type =\n CubismPhysicsSource.CubismPhysicsSource_Y;\n this._physicsRig.outputs[outputIndex + j].getValue =\n getOutputTranslationY;\n this._physicsRig.outputs[outputIndex + j].getScale =\n getOutputScaleTranslationY;\n } else if (json.getOutputType(i, j) == PhysicsTypeTagAngle) {\n this._physicsRig.outputs[outputIndex + j].type =\n CubismPhysicsSource.CubismPhysicsSource_Angle;\n this._physicsRig.outputs[outputIndex + j].getValue = getOutputAngle;\n this._physicsRig.outputs[outputIndex + j].getScale =\n getOutputScaleAngle;\n }\n\n this._physicsRig.outputs[outputIndex + j].reflect =\n json.getOutputReflect(i, j);\n }\n\n this._currentRigOutputs[dstIndexCurrentRigOutputs++] = currentRigOutput;\n this._previousRigOutputs[dstIndexPreviousRigOutputs++] =\n previousRigOutput;\n\n outputIndex += this._physicsRig.settings[i].outputCount;\n\n // Particle\n this._physicsRig.settings[i].particleCount = json.getParticleCount(i);\n this._physicsRig.settings[i].baseParticleIndex = particleIndex;\n\n for (let j = 0; j < this._physicsRig.settings[i].particleCount; ++j) {\n this._physicsRig.particles[particleIndex + j].mobility =\n json.getParticleMobility(i, j);\n this._physicsRig.particles[particleIndex + j].delay =\n json.getParticleDelay(i, j);\n this._physicsRig.particles[particleIndex + j].acceleration =\n json.getParticleAcceleration(i, j);\n this._physicsRig.particles[particleIndex + j].radius =\n json.getParticleRadius(i, j);\n this._physicsRig.particles[particleIndex + j].position =\n json.getParticlePosition(i, j);\n }\n\n particleIndex += this._physicsRig.settings[i].particleCount;\n }\n\n this.initialize();\n\n json.release();\n json = void 0;\n json = null;\n }\n\n /**\n * 現在のパラメータ値で物理演算が安定化する状態を演算する。\n * @param model 物理演算の結果を適用するモデル\n */\n public stabilization(model: CubismModel): void {\n let totalAngle: { angle: number };\n let weight: number;\n let radAngle: number;\n let outputValue: number;\n const totalTranslation: CubismVector2 = new CubismVector2();\n let currentSetting: CubismPhysicsSubRig;\n let currentInputs: CubismPhysicsInput[];\n let currentOutputs: CubismPhysicsOutput[];\n let currentParticles: CubismPhysicsParticle[];\n\n const parameterValues: Float32Array = model.getModel().parameters.values;\n const parameterMaximumValues: Float32Array =\n model.getModel().parameters.maximumValues;\n const parameterMinimumValues: Float32Array =\n model.getModel().parameters.minimumValues;\n const parameterDefaultValues: Float32Array =\n model.getModel().parameters.defaultValues;\n\n if ((this._parameterCaches?.length ?? 0) < model.getParameterCount()) {\n this._parameterCaches = new Float32Array(model.getParameterCount());\n }\n\n if ((this._parameterInputCaches?.length ?? 0) < model.getParameterCount()) {\n this._parameterInputCaches = new Float32Array(model.getParameterCount());\n }\n\n for (let j = 0; j < model.getParameterCount(); ++j) {\n this._parameterCaches[j] = parameterValues[j];\n this._parameterInputCaches[j] = parameterValues[j];\n }\n\n for (\n let settingIndex = 0;\n settingIndex < this._physicsRig.subRigCount;\n ++settingIndex\n ) {\n totalAngle = { angle: 0.0 };\n totalTranslation.x = 0.0;\n totalTranslation.y = 0.0;\n currentSetting = this._physicsRig.settings[settingIndex];\n currentInputs = this._physicsRig.inputs.slice(\n currentSetting.baseInputIndex\n );\n currentOutputs = this._physicsRig.outputs.slice(\n currentSetting.baseOutputIndex\n );\n currentParticles = this._physicsRig.particles.slice(\n currentSetting.baseParticleIndex\n );\n\n // Load input parameters\n for (let i = 0; i < currentSetting.inputCount; ++i) {\n weight = currentInputs[i].weight / MaximumWeight;\n\n if (currentInputs[i].sourceParameterIndex == -1) {\n currentInputs[i].sourceParameterIndex = model.getParameterIndex(\n currentInputs[i].source.id\n );\n }\n\n currentInputs[i].getNormalizedParameterValue(\n totalTranslation,\n totalAngle,\n parameterValues[currentInputs[i].sourceParameterIndex],\n parameterMinimumValues[currentInputs[i].sourceParameterIndex],\n parameterMaximumValues[currentInputs[i].sourceParameterIndex],\n parameterDefaultValues[currentInputs[i].sourceParameterIndex],\n currentSetting.normalizationPosition,\n currentSetting.normalizationAngle,\n currentInputs[i].reflect,\n weight\n );\n\n this._parameterCaches[currentInputs[i].sourceParameterIndex] =\n parameterValues[currentInputs[i].sourceParameterIndex];\n }\n\n radAngle = CubismMath.degreesToRadian(-totalAngle.angle);\n\n totalTranslation.x =\n totalTranslation.x * CubismMath.cos(radAngle) -\n totalTranslation.y * CubismMath.sin(radAngle);\n totalTranslation.y =\n totalTranslation.x * CubismMath.sin(radAngle) +\n totalTranslation.y * CubismMath.cos(radAngle);\n\n // Calculate particles position.\n updateParticlesForStabilization(\n currentParticles,\n currentSetting.particleCount,\n totalTranslation,\n totalAngle.angle,\n this._options.wind,\n MovementThreshold * currentSetting.normalizationPosition.maximum\n );\n\n // Update output parameters.\n for (let i = 0; i < currentSetting.outputCount; ++i) {\n const particleIndex = currentOutputs[i].vertexIndex;\n\n if (currentOutputs[i].destinationParameterIndex == -1) {\n currentOutputs[i].destinationParameterIndex = model.getParameterIndex(\n currentOutputs[i].destination.id\n );\n }\n\n if (\n particleIndex < 1 ||\n particleIndex >= currentSetting.particleCount\n ) {\n continue;\n }\n\n let translation: CubismVector2 = new CubismVector2();\n translation = currentParticles[particleIndex].position.substract(\n currentParticles[particleIndex - 1].position\n );\n\n outputValue = currentOutputs[i].getValue(\n translation,\n currentParticles,\n particleIndex,\n currentOutputs[i].reflect,\n this._options.gravity\n );\n\n this._currentRigOutputs[settingIndex].outputs[i] = outputValue;\n this._previousRigOutputs[settingIndex].outputs[i] = outputValue;\n\n const destinationParameterIndex: number =\n currentOutputs[i].destinationParameterIndex;\n\n const outParameterCaches: Float32Array =\n !Float32Array.prototype.slice && 'subarray' in Float32Array.prototype\n ? JSON.parse(\n JSON.stringify(\n parameterValues.subarray(destinationParameterIndex)\n )\n ) // 値渡しするため、JSON.parse, JSON.stringify\n : parameterValues.slice(destinationParameterIndex);\n\n updateOutputParameterValue(\n outParameterCaches,\n parameterMinimumValues[destinationParameterIndex],\n parameterMaximumValues[destinationParameterIndex],\n outputValue,\n currentOutputs[i]\n );\n\n // 値を反映\n for (\n let offset: number = destinationParameterIndex, outParamIndex = 0;\n offset < this._parameterCaches.length;\n offset++, outParamIndex++\n ) {\n parameterValues[offset] = this._parameterCaches[offset] =\n outParameterCaches[outParamIndex];\n }\n }\n }\n }\n\n /**\n * 物理演算の評価\n *\n * Pendulum interpolation weights\n *\n * 振り子の計算結果は保存され、パラメータへの出力は保存された前回の結果で補間されます。\n * The result of the pendulum calculation is saved and\n * the output to the parameters is interpolated with the saved previous result of the pendulum calculation.\n *\n * 図で示すと[1]と[2]で補間されます。\n * The figure shows the interpolation between [1] and [2].\n *\n * 補間の重みは最新の振り子計算タイミングと次回のタイミングの間で見た現在時間で決定する。\n * The weight of the interpolation are determined by the current time seen between\n * the latest pendulum calculation timing and the next timing.\n *\n * 図で示すと[2]と[4]の間でみた(3)の位置の重みになる。\n * Figure shows the weight of position (3) as seen between [2] and [4].\n *\n * 解釈として振り子計算のタイミングと重み計算のタイミングがズレる。\n * As an interpretation, the pendulum calculation and weights are misaligned.\n *\n * physics3.jsonにFPS情報が存在しない場合は常に前の振り子状態で設定される。\n * If there is no FPS information in physics3.json, it is always set in the previous pendulum state.\n *\n * この仕様は補間範囲を逸脱したことが原因の震えたような見た目を回避を目的にしている。\n * The purpose of this specification is to avoid the quivering appearance caused by deviations from the interpolation range.\n *\n * ------------ time -------------->\n *\n * |+++++|------| <- weight\n * ==[1]====#=====[2]---(3)----(4)\n * ^ output contents\n *\n * 1:_previousRigOutputs\n * 2:_currentRigOutputs\n * 3:_currentRemainTime (now rendering)\n * 4:next particles timing\n * @param model 物理演算の結果を適用するモデル\n * @param deltaTimeSeconds デルタ時間[秒]\n */\n public evaluate(model: CubismModel, deltaTimeSeconds: number): void {\n let totalAngle: { angle: number };\n let weight: number;\n let radAngle: number;\n let outputValue: number;\n const totalTranslation: CubismVector2 = new CubismVector2();\n let currentSetting: CubismPhysicsSubRig;\n let currentInputs: CubismPhysicsInput[];\n let currentOutputs: CubismPhysicsOutput[];\n let currentParticles: CubismPhysicsParticle[];\n\n if (0.0 >= deltaTimeSeconds) {\n return;\n }\n\n const parameterValues: Float32Array = model.getModel().parameters.values;\n const parameterMaximumValues: Float32Array =\n model.getModel().parameters.maximumValues;\n const parameterMinimumValues: Float32Array =\n model.getModel().parameters.minimumValues;\n const parameterDefaultValues: Float32Array =\n model.getModel().parameters.defaultValues;\n\n let physicsDeltaTime: number;\n this._currentRemainTime += deltaTimeSeconds;\n if (this._currentRemainTime > MaxDeltaTime) {\n this._currentRemainTime = 0.0;\n }\n\n if ((this._parameterCaches?.length ?? 0) < model.getParameterCount()) {\n this._parameterCaches = new Float32Array(model.getParameterCount());\n }\n\n if ((this._parameterInputCaches?.length ?? 0) < model.getParameterCount()) {\n this._parameterInputCaches = new Float32Array(model.getParameterCount());\n for (let j = 0; j < model.getParameterCount(); ++j) {\n this._parameterInputCaches[j] = parameterValues[j];\n }\n }\n\n if (this._physicsRig.fps > 0.0) {\n physicsDeltaTime = 1.0 / this._physicsRig.fps;\n } else {\n physicsDeltaTime = deltaTimeSeconds;\n }\n\n while (this._currentRemainTime >= physicsDeltaTime) {\n // copyRigOutputs _currentRigOutputs to _previousRigOutputs\n for (\n let settingIndex = 0;\n settingIndex < this._physicsRig.subRigCount;\n ++settingIndex\n ) {\n currentSetting = this._physicsRig.settings[settingIndex];\n currentOutputs = this._physicsRig.outputs.slice(\n currentSetting.baseOutputIndex\n );\n for (let i = 0; i < currentSetting.outputCount; ++i) {\n this._previousRigOutputs[settingIndex].outputs[i] =\n this._currentRigOutputs[settingIndex].outputs[i];\n }\n }\n\n // 入力キャッシュとパラメータで線形補間してUpdateParticlesするタイミングでの入力を計算する。\n // Calculate the input at the timing to UpdateParticles by linear interpolation with the _parameterInputCache and parameterValue.\n // _parameterCacheはグループ間での値の伝搬の役割があるので_parameterInputCacheとの分離が必要。\n // _parameterCache needs to be separated from _parameterInputCache because of its role in propagating values between groups.\n const inputWeight = physicsDeltaTime / this._currentRemainTime;\n for (let j = 0; j < model.getParameterCount(); ++j) {\n this._parameterCaches[j] =\n this._parameterInputCaches[j] * (1.0 - inputWeight) +\n parameterValues[j] * inputWeight;\n this._parameterInputCaches[j] = this._parameterCaches[j];\n }\n\n for (\n let settingIndex = 0;\n settingIndex < this._physicsRig.subRigCount;\n ++settingIndex\n ) {\n totalAngle = { angle: 0.0 };\n totalTranslation.x = 0.0;\n totalTranslation.y = 0.0;\n currentSetting = this._physicsRig.settings[settingIndex];\n currentInputs = this._physicsRig.inputs.slice(\n currentSetting.baseInputIndex\n );\n currentOutputs = this._physicsRig.outputs.slice(\n currentSetting.baseOutputIndex\n );\n currentParticles = this._physicsRig.particles.slice(\n currentSetting.baseParticleIndex\n );\n\n // Load input parameters\n for (let i = 0; i < currentSetting.inputCount; ++i) {\n weight = currentInputs[i].weight / MaximumWeight;\n\n if (currentInputs[i].sourceParameterIndex == -1) {\n currentInputs[i].sourceParameterIndex = model.getParameterIndex(\n currentInputs[i].source.id\n );\n }\n\n currentInputs[i].getNormalizedParameterValue(\n totalTranslation,\n totalAngle,\n this._parameterCaches[currentInputs[i].sourceParameterIndex],\n parameterMinimumValues[currentInputs[i].sourceParameterIndex],\n parameterMaximumValues[currentInputs[i].sourceParameterIndex],\n parameterDefaultValues[currentInputs[i].sourceParameterIndex],\n currentSetting.normalizationPosition,\n currentSetting.normalizationAngle,\n currentInputs[i].reflect,\n weight\n );\n }\n\n radAngle = CubismMath.degreesToRadian(-totalAngle.angle);\n\n totalTranslation.x =\n totalTranslation.x * CubismMath.cos(radAngle) -\n totalTranslation.y * CubismMath.sin(radAngle);\n totalTranslation.y =\n totalTranslation.x * CubismMath.sin(radAngle) +\n totalTranslation.y * CubismMath.cos(radAngle);\n\n // Calculate particles position.\n updateParticles(\n currentParticles,\n currentSetting.particleCount,\n totalTranslation,\n totalAngle.angle,\n this._options.wind,\n MovementThreshold * currentSetting.normalizationPosition.maximum,\n physicsDeltaTime,\n AirResistance\n );\n\n // Update output parameters.\n for (let i = 0; i < currentSetting.outputCount; ++i) {\n const particleIndex = currentOutputs[i].vertexIndex;\n\n if (currentOutputs[i].destinationParameterIndex == -1) {\n currentOutputs[i].destinationParameterIndex =\n model.getParameterIndex(currentOutputs[i].destination.id);\n }\n\n if (\n particleIndex < 1 ||\n particleIndex >= currentSetting.particleCount\n ) {\n continue;\n }\n\n const translation: CubismVector2 = new CubismVector2();\n translation.x =\n currentParticles[particleIndex].position.x -\n currentParticles[particleIndex - 1].position.x;\n translation.y =\n currentParticles[particleIndex].position.y -\n currentParticles[particleIndex - 1].position.y;\n\n outputValue = currentOutputs[i].getValue(\n translation,\n currentParticles,\n particleIndex,\n currentOutputs[i].reflect,\n this._options.gravity\n );\n\n this._currentRigOutputs[settingIndex].outputs[i] = outputValue;\n\n const destinationParameterIndex: number =\n currentOutputs[i].destinationParameterIndex;\n const outParameterCaches: Float32Array =\n !Float32Array.prototype.slice &&\n 'subarray' in Float32Array.prototype\n ? JSON.parse(\n JSON.stringify(\n this._parameterCaches.subarray(destinationParameterIndex)\n )\n ) // 値渡しするため、JSON.parse, JSON.stringify\n : this._parameterCaches.slice(destinationParameterIndex);\n\n updateOutputParameterValue(\n outParameterCaches,\n parameterMinimumValues[destinationParameterIndex],\n parameterMaximumValues[destinationParameterIndex],\n outputValue,\n currentOutputs[i]\n );\n\n // 値を反映\n for (\n let offset: number = destinationParameterIndex, outParamIndex = 0;\n offset < this._parameterCaches.length;\n offset++, outParamIndex++\n ) {\n this._parameterCaches[offset] = outParameterCaches[outParamIndex];\n }\n }\n }\n this._currentRemainTime -= physicsDeltaTime;\n }\n\n const alpha: number = this._currentRemainTime / physicsDeltaTime;\n this.interpolate(model, alpha);\n }\n\n /**\n * 物理演算結果の適用\n * 振り子演算の最新の結果と一つ前の結果から指定した重みで適用する。\n * @param model 物理演算の結果を適用するモデル\n * @param weight 最新結果の重み\n */\n public interpolate(model: CubismModel, weight: number): void {\n let currentOutputs: CubismPhysicsOutput[];\n let currentSetting: CubismPhysicsSubRig;\n const parameterValues: Float32Array = model.getModel().parameters.values;\n const parameterMaximumValues: Float32Array =\n model.getModel().parameters.maximumValues;\n const parameterMinimumValues: Float32Array =\n model.getModel().parameters.minimumValues;\n\n for (\n let settingIndex = 0;\n settingIndex < this._physicsRig.subRigCount;\n ++settingIndex\n ) {\n currentSetting = this._physicsRig.settings[settingIndex];\n currentOutputs = this._physicsRig.outputs.slice(\n currentSetting.baseOutputIndex\n );\n\n // Load input parameters.\n for (let i = 0; i < currentSetting.outputCount; ++i) {\n if (currentOutputs[i].destinationParameterIndex == -1) {\n continue;\n }\n\n const destinationParameterIndex: number =\n currentOutputs[i].destinationParameterIndex;\n const outParameterValues: Float32Array =\n !Float32Array.prototype.slice && 'subarray' in Float32Array.prototype\n ? JSON.parse(\n JSON.stringify(\n parameterValues.subarray(destinationParameterIndex)\n )\n ) // 値渡しするため、JSON.parse, JSON.stringify\n : parameterValues.slice(destinationParameterIndex);\n\n updateOutputParameterValue(\n outParameterValues,\n parameterMinimumValues[destinationParameterIndex],\n parameterMaximumValues[destinationParameterIndex],\n this._previousRigOutputs[settingIndex].outputs[i] * (1 - weight) +\n this._currentRigOutputs[settingIndex].outputs[i] * weight,\n currentOutputs[i]\n );\n\n // 値を反映\n for (\n let offset: number = destinationParameterIndex, outParamIndex = 0;\n offset < parameterValues.length;\n offset++, outParamIndex++\n ) {\n parameterValues[offset] = outParameterValues[outParamIndex];\n }\n }\n }\n }\n\n /**\n * オプションの設定\n * @param options オプション\n */\n public setOptions(options: Options): void {\n this._options = options;\n }\n\n /**\n * オプションの取得\n * @return オプション\n */\n public getOption(): Options {\n return this._options;\n }\n\n /**\n * コンストラクタ\n */\n public constructor() {\n this._physicsRig = null;\n\n // set default options\n this._options = new Options();\n this._options.gravity.y = -1.0;\n this._options.gravity.x = 0.0;\n this._options.wind.x = 0.0;\n this._options.wind.y = 0.0;\n this._currentRigOutputs = new Array<PhysicsOutput>();\n this._previousRigOutputs = new Array<PhysicsOutput>();\n this._currentRemainTime = 0.0;\n this._parameterCaches = null;\n this._parameterInputCaches = null;\n }\n\n /**\n * デストラクタ相当の処理\n */\n public release(): void {\n this._physicsRig = void 0;\n this._physicsRig = null;\n }\n\n /**\n * 初期化する\n */\n public initialize(): void {\n let strand: CubismPhysicsParticle[];\n let currentSetting: CubismPhysicsSubRig;\n let radius: CubismVector2;\n\n for (\n let settingIndex = 0;\n settingIndex < this._physicsRig.subRigCount;\n ++settingIndex\n ) {\n currentSetting = this._physicsRig.settings[settingIndex];\n strand = this._physicsRig.particles.slice(\n currentSetting.baseParticleIndex\n );\n\n // Initialize the top of particle.\n strand[0].initialPosition = new CubismVector2(0.0, 0.0);\n strand[0].lastPosition = new CubismVector2(\n strand[0].initialPosition.x,\n strand[0].initialPosition.y\n );\n strand[0].lastGravity = new CubismVector2(0.0, -1.0);\n strand[0].lastGravity.y *= -1.0;\n strand[0].velocity = new CubismVector2(0.0, 0.0);\n strand[0].force = new CubismVector2(0.0, 0.0);\n\n // Initialize particles.\n for (let i = 1; i < currentSetting.particleCount; ++i) {\n radius = new CubismVector2(0.0, 0.0);\n radius.y = strand[i].radius;\n strand[i].initialPosition = new CubismVector2(\n strand[i - 1].initialPosition.x + radius.x,\n strand[i - 1].initialPosition.y + radius.y\n );\n strand[i].position = new CubismVector2(\n strand[i].initialPosition.x,\n strand[i].initialPosition.y\n );\n strand[i].lastPosition = new CubismVector2(\n strand[i].initialPosition.x,\n strand[i].initialPosition.y\n );\n strand[i].lastGravity = new CubismVector2(0.0, -1.0);\n strand[i].lastGravity.y *= -1.0;\n strand[i].velocity = new CubismVector2(0.0, 0.0);\n strand[i].force = new CubismVector2(0.0, 0.0);\n }\n }\n }\n\n _physicsRig: CubismPhysicsRig; // 物理演算のデータ\n _options: Options; // オプション\n\n _currentRigOutputs: Array<PhysicsOutput>; ///< 最新の振り子計算の結果\n _previousRigOutputs: Array<PhysicsOutput>; ///< 一つ前の振り子計算の結果\n\n _currentRemainTime: number; ///< 物理演算が処理していない時間\n\n _parameterCaches: Float32Array; ///< Evaluateで利用するパラメータのキャッシュ\n _parameterInputCaches: Float32Array; ///< UpdateParticlesが動くときの入力をキャッシュ\n}\n\n/**\n * 物理演算のオプション\n */\nexport class Options {\n constructor() {\n this.gravity = new CubismVector2(0, 0);\n this.wind = new CubismVector2(0, 0);\n }\n\n gravity: CubismVector2; // 重力方向\n wind: CubismVector2; // 風の方向\n}\n\n/**\n * パラメータに適用する前の物理演算の出力結果\n */\nexport class PhysicsOutput {\n constructor() {\n this.outputs = new Array<number>(0);\n }\n\n outputs: Array<number>; // 物理演算出力結果\n}\n\n/**\n * Gets sign.\n *\n * @param value Evaluation target value.\n *\n * @return Sign of value.\n */\nfunction sign(value: number): number {\n let ret = 0;\n\n if (value > 0.0) {\n ret = 1;\n } else if (value < 0.0) {\n ret = -1;\n }\n\n return ret;\n}\n\nfunction getInputTranslationXFromNormalizedParameterValue(\n targetTranslation: CubismVector2,\n targetAngle: { angle: number },\n value: number,\n parameterMinimumValue: number,\n parameterMaximumValue: number,\n parameterDefaultValue: number,\n normalizationPosition: CubismPhysicsNormalization,\n normalizationAngle: CubismPhysicsNormalization,\n isInverted: boolean,\n weight: number\n): void {\n targetTranslation.x +=\n normalizeParameterValue(\n value,\n parameterMinimumValue,\n parameterMaximumValue,\n parameterDefaultValue,\n normalizationPosition.minimum,\n normalizationPosition.maximum,\n normalizationPosition.defalut,\n isInverted\n ) * weight;\n}\n\nfunction getInputTranslationYFromNormalizedParamterValue(\n targetTranslation: CubismVector2,\n targetAngle: { angle: number },\n value: number,\n parameterMinimumValue: number,\n parameterMaximumValue: number,\n parameterDefaultValue: number,\n normalizationPosition: CubismPhysicsNormalization,\n normalizationAngle: CubismPhysicsNormalization,\n isInverted: boolean,\n weight: number\n): void {\n targetTranslation.y +=\n normalizeParameterValue(\n value,\n parameterMinimumValue,\n parameterMaximumValue,\n parameterDefaultValue,\n normalizationPosition.minimum,\n normalizationPosition.maximum,\n normalizationPosition.defalut,\n isInverted\n ) * weight;\n}\n\nfunction getInputAngleFromNormalizedParameterValue(\n targetTranslation: CubismVector2,\n targetAngle: { angle: number },\n value: number,\n parameterMinimumValue: number,\n parameterMaximumValue: number,\n parameterDefaultValue: number,\n normalizaitionPosition: CubismPhysicsNormalization,\n normalizationAngle: CubismPhysicsNormalization,\n isInverted: boolean,\n weight: number\n): void {\n targetAngle.angle +=\n normalizeParameterValue(\n value,\n parameterMinimumValue,\n parameterMaximumValue,\n parameterDefaultValue,\n normalizationAngle.minimum,\n normalizationAngle.maximum,\n normalizationAngle.defalut,\n isInverted\n ) * weight;\n}\n\nfunction getOutputTranslationX(\n translation: CubismVector2,\n particles: CubismPhysicsParticle[],\n particleIndex: number,\n isInverted: boolean,\n parentGravity: CubismVector2\n): number {\n let outputValue: number = translation.x;\n\n if (isInverted) {\n outputValue *= -1.0;\n }\n\n return outputValue;\n}\n\nfunction getOutputTranslationY(\n translation: CubismVector2,\n particles: CubismPhysicsParticle[],\n particleIndex: number,\n isInverted: boolean,\n parentGravity: CubismVector2\n): number {\n let outputValue: number = translation.y;\n\n if (isInverted) {\n outputValue *= -1.0;\n }\n return outputValue;\n}\n\nfunction getOutputAngle(\n translation: CubismVector2,\n particles: CubismPhysicsParticle[],\n particleIndex: number,\n isInverted: boolean,\n parentGravity: CubismVector2\n): number {\n let outputValue: number;\n\n if (particleIndex >= 2) {\n parentGravity = particles[particleIndex - 1].position.substract(\n particles[particleIndex - 2].position\n );\n } else {\n parentGravity = parentGravity.multiplyByScaler(-1.0);\n }\n\n outputValue = CubismMath.directionToRadian(parentGravity, translation);\n\n if (isInverted) {\n outputValue *= -1.0;\n }\n\n return outputValue;\n}\n\nfunction getRangeValue(min: number, max: number): number {\n const maxValue: number = CubismMath.max(min, max);\n const minValue: number = CubismMath.min(min, max);\n\n return CubismMath.abs(maxValue - minValue);\n}\n\nfunction getDefaultValue(min: number, max: number): number {\n const minValue: number = CubismMath.min(min, max);\n return minValue + getRangeValue(min, max) / 2.0;\n}\n\nfunction getOutputScaleTranslationX(\n translationScale: CubismVector2,\n angleScale: number\n): number {\n return JSON.parse(JSON.stringify(translationScale.x));\n}\n\nfunction getOutputScaleTranslationY(\n translationScale: CubismVector2,\n angleScale: number\n): number {\n return JSON.parse(JSON.stringify(translationScale.y));\n}\n\nfunction getOutputScaleAngle(\n translationScale: CubismVector2,\n angleScale: number\n): number {\n return JSON.parse(JSON.stringify(angleScale));\n}\n\n/**\n * Updates particles.\n *\n * @param strand Target array of particle.\n * @param strandCount Count of particle.\n * @param totalTranslation Total translation value.\n * @param totalAngle Total angle.\n * @param windDirection Direction of Wind.\n * @param thresholdValue Threshold of movement.\n * @param deltaTimeSeconds Delta time.\n * @param airResistance Air resistance.\n */\nfunction updateParticles(\n strand: CubismPhysicsParticle[],\n strandCount: number,\n totalTranslation: CubismVector2,\n totalAngle: number,\n windDirection: CubismVector2,\n thresholdValue: number,\n deltaTimeSeconds: number,\n airResistance: number\n) {\n let delay: number;\n let radian: number;\n let direction: CubismVector2 = new CubismVector2(0.0, 0.0);\n let velocity: CubismVector2 = new CubismVector2(0.0, 0.0);\n let force: CubismVector2 = new CubismVector2(0.0, 0.0);\n let newDirection: CubismVector2 = new CubismVector2(0.0, 0.0);\n\n strand[0].position = new CubismVector2(\n totalTranslation.x,\n totalTranslation.y\n );\n\n const totalRadian: number = CubismMath.degreesToRadian(totalAngle);\n const currentGravity: CubismVector2 =\n CubismMath.radianToDirection(totalRadian);\n currentGravity.normalize();\n\n for (let i = 1; i < strandCount; ++i) {\n strand[i].force = currentGravity\n .multiplyByScaler(strand[i].acceleration)\n .add(windDirection);\n\n strand[i].lastPosition = new CubismVector2(\n strand[i].position.x,\n strand[i].position.y\n );\n\n delay = strand[i].delay * deltaTimeSeconds * 30.0;\n\n direction = strand[i].position.substract(strand[i - 1].position);\n\n radian =\n CubismMath.directionToRadian(strand[i].lastGravity, currentGravity) /\n airResistance;\n\n direction.x =\n CubismMath.cos(radian) * direction.x -\n direction.y * CubismMath.sin(radian);\n direction.y =\n CubismMath.sin(radian) * direction.x +\n direction.y * CubismMath.cos(radian);\n\n strand[i].position = strand[i - 1].position.add(direction);\n\n velocity = strand[i].velocity.multiplyByScaler(delay);\n force = strand[i].force.multiplyByScaler(delay).multiplyByScaler(delay);\n\n strand[i].position = strand[i].position.add(velocity).add(force);\n\n newDirection = strand[i].position.substract(strand[i - 1].position);\n newDirection.normalize();\n\n strand[i].position = strand[i - 1].position.add(\n newDirection.multiplyByScaler(strand[i].radius)\n );\n\n if (CubismMath.abs(strand[i].position.x) < thresholdValue) {\n strand[i].position.x = 0.0;\n }\n\n if (delay != 0.0) {\n strand[i].velocity = strand[i].position.substract(strand[i].lastPosition);\n strand[i].velocity = strand[i].velocity.divisionByScalar(delay);\n strand[i].velocity = strand[i].velocity.multiplyByScaler(\n strand[i].mobility\n );\n }\n\n strand[i].force = new CubismVector2(0.0, 0.0);\n strand[i].lastGravity = new CubismVector2(\n currentGravity.x,\n currentGravity.y\n );\n }\n}\n\n/**\n * Updates particles for stabilization.\n *\n * @param strand Target array of particle.\n * @param strandCount Count of particle.\n * @param totalTranslation Total translation value.\n * @param totalAngle Total angle.\n * @param windDirection Direction of Wind.\n * @param thresholdValue Threshold of movement.\n */\nfunction updateParticlesForStabilization(\n strand: CubismPhysicsParticle[],\n strandCount: number,\n totalTranslation: CubismVector2,\n totalAngle: number,\n windDirection: CubismVector2,\n thresholdValue: number\n) {\n let force: CubismVector2 = new CubismVector2(0.0, 0.0);\n\n strand[0].position = new CubismVector2(\n totalTranslation.x,\n totalTranslation.y\n );\n\n const totalRadian: number = CubismMath.degreesToRadian(totalAngle);\n const currentGravity: CubismVector2 =\n CubismMath.radianToDirection(totalRadian);\n currentGravity.normalize();\n\n for (let i = 1; i < strandCount; ++i) {\n strand[i].force = currentGravity\n .multiplyByScaler(strand[i].acceleration)\n .add(windDirection);\n\n strand[i].lastPosition = new CubismVector2(\n strand[i].position.x,\n strand[i].position.y\n );\n\n strand[i].velocity = new CubismVector2(0.0, 0.0);\n force = strand[i].force;\n force.normalize();\n\n force = force.multiplyByScaler(strand[i].radius);\n strand[i].position = strand[i - 1].position.add(force);\n\n if (CubismMath.abs(strand[i].position.x) < thresholdValue) {\n strand[i].position.x = 0.0;\n }\n\n strand[i].force = new CubismVector2(0.0, 0.0);\n strand[i].lastGravity = new CubismVector2(\n currentGravity.x,\n currentGravity.y\n );\n }\n}\n\n/**\n * Updates output parameter value.\n * @param parameterValue Target parameter value.\n * @param parameterValueMinimum Minimum of parameter value.\n * @param parameterValueMaximum Maximum of parameter value.\n * @param translation Translation value.\n */\nfunction updateOutputParameterValue(\n parameterValue: Float32Array,\n parameterValueMinimum: number,\n parameterValueMaximum: number,\n translation: number,\n output: CubismPhysicsOutput\n): void {\n let value: number;\n const outputScale: number = output.getScale(\n output.translationScale,\n output.angleScale\n );\n\n value = translation * outputScale;\n\n if (value < parameterValueMinimum) {\n if (value < output.valueBelowMinimum) {\n output.valueBelowMinimum = value;\n }\n\n value = parameterValueMinimum;\n } else if (value > parameterValueMaximum) {\n if (value > output.valueExceededMaximum) {\n output.valueExceededMaximum = value;\n }\n\n value = parameterValueMaximum;\n }\n\n const weight: number = output.weight / MaximumWeight;\n\n if (weight >= 1.0) {\n parameterValue[0] = value;\n } else {\n value = parameterValue[0] * (1.0 - weight) + value * weight;\n parameterValue[0] = value;\n }\n}\n\nfunction normalizeParameterValue(\n value: number,\n parameterMinimum: number,\n parameterMaximum: number,\n parameterDefault: number,\n normalizedMinimum: number,\n normalizedMaximum: number,\n normalizedDefault: number,\n isInverted: boolean\n) {\n let result = 0.0;\n\n const maxValue: number = CubismMath.max(parameterMaximum, parameterMinimum);\n\n if (maxValue < value) {\n value = maxValue;\n }\n\n const minValue: number = CubismMath.min(parameterMaximum, parameterMinimum);\n\n if (minValue > value) {\n value = minValue;\n }\n\n const minNormValue: number = CubismMath.min(\n normalizedMinimum,\n normalizedMaximum\n );\n const maxNormValue: number = CubismMath.max(\n normalizedMinimum,\n normalizedMaximum\n );\n const middleNormValue: number = normalizedDefault;\n\n const middleValue: number = getDefaultValue(minValue, maxValue);\n const paramValue: number = value - middleValue;\n\n switch (sign(paramValue)) {\n case 1: {\n const nLength: number = maxNormValue - middleNormValue;\n const pLength: number = maxValue - middleValue;\n\n if (pLength != 0.0) {\n result = paramValue * (nLength / pLength);\n result += middleNormValue;\n }\n\n break;\n }\n case -1: {\n const nLength: number = minNormValue - middleNormValue;\n const pLength: number = minValue - middleValue;\n\n if (pLength != 0.0) {\n result = paramValue * (nLength / pLength);\n result += middleNormValue;\n }\n\n break;\n }\n case 0: {\n result = middleNormValue;\n\n break;\n }\n default: {\n break;\n }\n }\n\n return isInverted ? result : result * -1.0;\n}\n\n// Namespace definition for compatibility.\nimport * as $ from './cubismphysics';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const CubismPhysics = $.CubismPhysics;\n export type CubismPhysics = $.CubismPhysics;\n export const Options = $.Options;\n export type Options = $.Options;\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\n/**\n * @brief パラメータIDのデフォルト値を保持する定数<br>\n * デフォルト値の仕様は以下のマニュアルに基づく<br>\n * https://docs.live2d.com/cubism-editor-manual/standard-parametor-list/\n */\nexport const CubismDefaultParameterId = Object.freeze<Record<string, string>>({\n // パーツID\n HitAreaPrefix: 'HitArea',\n HitAreaHead: 'Head',\n HitAreaBody: 'Body',\n PartsIdCore: 'Parts01Core',\n PartsArmPrefix: 'Parts01Arm_',\n PartsArmLPrefix: 'Parts01ArmL_',\n PartsArmRPrefix: 'Parts01ArmR_',\n // パラメータID\n ParamAngleX: 'ParamAngleX',\n ParamAngleY: 'ParamAngleY',\n ParamAngleZ: 'ParamAngleZ',\n ParamEyeLOpen: 'ParamEyeLOpen',\n ParamEyeLSmile: 'ParamEyeLSmile',\n ParamEyeROpen: 'ParamEyeROpen',\n ParamEyeRSmile: 'ParamEyeRSmile',\n ParamEyeBallX: 'ParamEyeBallX',\n ParamEyeBallY: 'ParamEyeBallY',\n ParamEyeBallForm: 'ParamEyeBallForm',\n ParamBrowLY: 'ParamBrowLY',\n ParamBrowRY: 'ParamBrowRY',\n ParamBrowLX: 'ParamBrowLX',\n ParamBrowRX: 'ParamBrowRX',\n ParamBrowLAngle: 'ParamBrowLAngle',\n ParamBrowRAngle: 'ParamBrowRAngle',\n ParamBrowLForm: 'ParamBrowLForm',\n ParamBrowRForm: 'ParamBrowRForm',\n ParamMouthForm: 'ParamMouthForm',\n ParamMouthOpenY: 'ParamMouthOpenY',\n ParamCheek: 'ParamCheek',\n ParamBodyAngleX: 'ParamBodyAngleX',\n ParamBodyAngleY: 'ParamBodyAngleY',\n ParamBodyAngleZ: 'ParamBodyAngleZ',\n ParamBreath: 'ParamBreath',\n ParamArmLA: 'ParamArmLA',\n ParamArmRA: 'ParamArmRA',\n ParamArmLB: 'ParamArmLB',\n ParamArmRB: 'ParamArmRB',\n ParamHandL: 'ParamHandL',\n ParamHandR: 'ParamHandR',\n ParamHairFront: 'ParamHairFront',\n ParamHairSide: 'ParamHairSide',\n ParamHairBack: 'ParamHairBack',\n ParamHairFluffy: 'ParamHairFluffy',\n ParamShoulderY: 'ParamShoulderY',\n ParamBustX: 'ParamBustX',\n ParamBustY: 'ParamBustY',\n ParamBaseX: 'ParamBaseX',\n ParamBaseY: 'ParamBaseY',\n ParamNONE: 'NONE:'\n});\n\n// Namespace definition for compatibility.\nimport * as $ from './cubismdefaultparameterid';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const HitAreaBody = $.CubismDefaultParameterId.HitAreaBody;\n export const HitAreaHead = $.CubismDefaultParameterId.HitAreaHead;\n export const HitAreaPrefix = $.CubismDefaultParameterId.HitAreaPrefix;\n export const ParamAngleX = $.CubismDefaultParameterId.ParamAngleX;\n export const ParamAngleY = $.CubismDefaultParameterId.ParamAngleY;\n export const ParamAngleZ = $.CubismDefaultParameterId.ParamAngleZ;\n export const ParamArmLA = $.CubismDefaultParameterId.ParamArmLA;\n export const ParamArmLB = $.CubismDefaultParameterId.ParamArmLB;\n export const ParamArmRA = $.CubismDefaultParameterId.ParamArmRA;\n export const ParamArmRB = $.CubismDefaultParameterId.ParamArmRB;\n export const ParamBaseX = $.CubismDefaultParameterId.ParamBaseX;\n export const ParamBaseY = $.CubismDefaultParameterId.ParamBaseY;\n export const ParamBodyAngleX = $.CubismDefaultParameterId.ParamBodyAngleX;\n export const ParamBodyAngleY = $.CubismDefaultParameterId.ParamBodyAngleY;\n export const ParamBodyAngleZ = $.CubismDefaultParameterId.ParamBodyAngleZ;\n export const ParamBreath = $.CubismDefaultParameterId.ParamBreath;\n export const ParamBrowLAngle = $.CubismDefaultParameterId.ParamBrowLAngle;\n export const ParamBrowLForm = $.CubismDefaultParameterId.ParamBrowLForm;\n export const ParamBrowLX = $.CubismDefaultParameterId.ParamBrowLX;\n export const ParamBrowLY = $.CubismDefaultParameterId.ParamBrowLY;\n export const ParamBrowRAngle = $.CubismDefaultParameterId.ParamBrowRAngle;\n export const ParamBrowRForm = $.CubismDefaultParameterId.ParamBrowRForm;\n export const ParamBrowRX = $.CubismDefaultParameterId.ParamBrowRX;\n export const ParamBrowRY = $.CubismDefaultParameterId.ParamBrowRY;\n export const ParamBustX = $.CubismDefaultParameterId.ParamBustX;\n export const ParamBustY = $.CubismDefaultParameterId.ParamBustY;\n export const ParamCheek = $.CubismDefaultParameterId.ParamCheek;\n export const ParamEyeBallForm = $.CubismDefaultParameterId.ParamEyeBallForm;\n export const ParamEyeBallX = $.CubismDefaultParameterId.ParamEyeBallX;\n export const ParamEyeBallY = $.CubismDefaultParameterId.ParamEyeBallY;\n export const ParamEyeLOpen = $.CubismDefaultParameterId.ParamEyeLOpen;\n export const ParamEyeLSmile = $.CubismDefaultParameterId.ParamEyeLSmile;\n export const ParamEyeROpen = $.CubismDefaultParameterId.ParamEyeROpen;\n export const ParamEyeRSmile = $.CubismDefaultParameterId.ParamEyeRSmile;\n export const ParamHairBack = $.CubismDefaultParameterId.ParamHairBack;\n export const ParamHairFluffy = $.CubismDefaultParameterId.ParamHairFluffy;\n export const ParamHairFront = $.CubismDefaultParameterId.ParamHairFront;\n export const ParamHairSide = $.CubismDefaultParameterId.ParamHairSide;\n export const ParamHandL = $.CubismDefaultParameterId.ParamHandL;\n export const ParamHandR = $.CubismDefaultParameterId.ParamHandR;\n export const ParamMouthForm = $.CubismDefaultParameterId.ParamMouthForm;\n export const ParamMouthOpenY = $.CubismDefaultParameterId.ParamMouthOpenY;\n export const ParamNONE = $.CubismDefaultParameterId.ParamNONE;\n export const ParamShoulderY = $.CubismDefaultParameterId.ParamShoulderY;\n export const PartsArmLPrefix = $.CubismDefaultParameterId.PartsArmLPrefix;\n export const PartsArmPrefix = $.CubismDefaultParameterId.PartsArmPrefix;\n export const PartsArmRPrefix = $.CubismDefaultParameterId.PartsArmRPrefix;\n export const PartsIdCore = $.CubismDefaultParameterId.PartsIdCore;\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport { CubismIdHandle } from '../id/cubismid';\nimport { CubismModel } from '../model/cubismmodel';\n\n/**\n * 呼吸機能\n *\n * 呼吸機能を提供する。\n */\nexport class CubismBreath {\n /**\n * インスタンスの作成\n */\n public static create(): CubismBreath {\n return new CubismBreath();\n }\n\n /**\n * インスタンスの破棄\n * @param instance 対象のCubismBreath\n */\n public static delete(instance: CubismBreath): void {\n if (instance != null) {\n instance = null;\n }\n }\n\n /**\n * 呼吸のパラメータの紐づけ\n * @param breathParameters 呼吸を紐づけたいパラメータのリスト\n */\n public setParameters(breathParameters: Array<BreathParameterData>): void {\n this._breathParameters = breathParameters;\n }\n\n /**\n * 呼吸に紐づいているパラメータの取得\n * @return 呼吸に紐づいているパラメータのリスト\n */\n public getParameters(): Array<BreathParameterData> {\n return this._breathParameters;\n }\n\n /**\n * モデルのパラメータの更新\n * @param model 対象のモデル\n * @param deltaTimeSeconds デルタ時間[秒]\n */\n public updateParameters(model: CubismModel, deltaTimeSeconds: number): void {\n this._currentTime += deltaTimeSeconds;\n\n const t: number = this._currentTime * 2.0 * Math.PI;\n\n for (let i = 0; i < this._breathParameters.length; ++i) {\n const data: BreathParameterData = this._breathParameters[i];\n\n model.addParameterValueById(\n data.parameterId,\n data.offset + data.peak * Math.sin(t / data.cycle),\n data.weight\n );\n }\n }\n\n /**\n * コンストラクタ\n */\n public constructor() {\n this._currentTime = 0.0;\n }\n\n _breathParameters: Array<BreathParameterData>; // 呼吸にひもづいているパラメータのリスト\n _currentTime: number; // 積算時間[秒]\n}\n\n/**\n * 呼吸のパラメータ情報\n */\nexport class BreathParameterData {\n /**\n * コンストラクタ\n * @param parameterId 呼吸をひもづけるパラメータID\n * @param offset 呼吸を正弦波としたときの、波のオフセット\n * @param peak 呼吸を正弦波としたときの、波の高さ\n * @param cycle 呼吸を正弦波としたときの、波の周期\n * @param weight パラメータへの重み\n */\n constructor(\n parameterId?: CubismIdHandle,\n offset?: number,\n peak?: number,\n cycle?: number,\n weight?: number\n ) {\n this.parameterId = parameterId == undefined ? null : parameterId;\n this.offset = offset == undefined ? 0.0 : offset;\n this.peak = peak == undefined ? 0.0 : peak;\n this.cycle = cycle == undefined ? 0.0 : cycle;\n this.weight = weight == undefined ? 0.0 : weight;\n }\n\n parameterId: CubismIdHandle; // 呼吸をひもづけるパラメータID\\\n offset: number; // 呼吸を正弦波としたときの、波のオフセット\n peak: number; // 呼吸を正弦波としたときの、波の高さ\n cycle: number; // 呼吸を正弦波としたときの、波の周期\n weight: number; // パラメータへの重み\n}\n\n// Namespace definition for compatibility.\nimport * as $ from './cubismbreath';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const BreathParameterData = $.BreathParameterData;\n export type BreathParameterData = $.BreathParameterData;\n export const CubismBreath = $.CubismBreath;\n export type CubismBreath = $.CubismBreath;\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport { ICubismModelSetting } from '../icubismmodelsetting';\nimport { CubismIdHandle } from '../id/cubismid';\nimport { CubismModel } from '../model/cubismmodel';\n\n/**\n * 自動まばたき機能\n *\n * 自動まばたき機能を提供する。\n */\nexport class CubismEyeBlink {\n /**\n * インスタンスを作成する\n * @param modelSetting モデルの設定情報\n * @return 作成されたインスタンス\n * @note 引数がNULLの場合、パラメータIDが設定されていない空のインスタンスを作成する。\n */\n public static create(\n modelSetting: ICubismModelSetting = null\n ): CubismEyeBlink {\n return new CubismEyeBlink(modelSetting);\n }\n\n /**\n * インスタンスの破棄\n * @param eyeBlink 対象のCubismEyeBlink\n */\n public static delete(eyeBlink: CubismEyeBlink): void {\n if (eyeBlink != null) {\n eyeBlink = null;\n }\n }\n\n /**\n * まばたきの間隔の設定\n * @param blinkingInterval まばたきの間隔の時間[秒]\n */\n public setBlinkingInterval(blinkingInterval: number): void {\n this._blinkingIntervalSeconds = blinkingInterval;\n }\n\n /**\n * まばたきのモーションの詳細設定\n * @param closing まぶたを閉じる動作の所要時間[秒]\n * @param closed まぶたを閉じている動作の所要時間[秒]\n * @param opening まぶたを開く動作の所要時間[秒]\n */\n public setBlinkingSetting(\n closing: number,\n closed: number,\n opening: number\n ): void {\n this._closingSeconds = closing;\n this._closedSeconds = closed;\n this._openingSeconds = opening;\n }\n\n /**\n * まばたきさせるパラメータIDのリストの設定\n * @param parameterIds パラメータのIDのリスト\n */\n public setParameterIds(parameterIds: Array<CubismIdHandle>): void {\n this._parameterIds = parameterIds;\n }\n\n /**\n * まばたきさせるパラメータIDのリストの取得\n * @return パラメータIDのリスト\n */\n public getParameterIds(): Array<CubismIdHandle> {\n return this._parameterIds;\n }\n\n /**\n * モデルのパラメータの更新\n * @param model 対象のモデル\n * @param deltaTimeSeconds デルタ時間[秒]\n */\n public updateParameters(model: CubismModel, deltaTimeSeconds: number): void {\n this._userTimeSeconds += deltaTimeSeconds;\n let parameterValue: number;\n let t = 0.0;\n const blinkingState: EyeState = this._blinkingState;\n\n switch (blinkingState) {\n case EyeState.EyeState_Closing:\n t =\n (this._userTimeSeconds - this._stateStartTimeSeconds) /\n this._closingSeconds;\n\n if (t >= 1.0) {\n t = 1.0;\n this._blinkingState = EyeState.EyeState_Closed;\n this._stateStartTimeSeconds = this._userTimeSeconds;\n }\n\n parameterValue = 1.0 - t;\n\n break;\n case EyeState.EyeState_Closed:\n t =\n (this._userTimeSeconds - this._stateStartTimeSeconds) /\n this._closedSeconds;\n\n if (t >= 1.0) {\n this._blinkingState = EyeState.EyeState_Opening;\n this._stateStartTimeSeconds = this._userTimeSeconds;\n }\n\n parameterValue = 0.0;\n\n break;\n case EyeState.EyeState_Opening:\n t =\n (this._userTimeSeconds - this._stateStartTimeSeconds) /\n this._openingSeconds;\n\n if (t >= 1.0) {\n t = 1.0;\n this._blinkingState = EyeState.EyeState_Interval;\n this._nextBlinkingTime = this.determinNextBlinkingTiming();\n }\n\n parameterValue = t;\n\n break;\n case EyeState.EyeState_Interval:\n if (this._nextBlinkingTime < this._userTimeSeconds) {\n this._blinkingState = EyeState.EyeState_Closing;\n this._stateStartTimeSeconds = this._userTimeSeconds;\n }\n\n parameterValue = 1.0;\n\n break;\n case EyeState.EyeState_First:\n default:\n this._blinkingState = EyeState.EyeState_Interval;\n this._nextBlinkingTime = this.determinNextBlinkingTiming();\n\n parameterValue = 1.0;\n break;\n }\n\n if (!CubismEyeBlink.CloseIfZero) {\n parameterValue = -parameterValue;\n }\n\n for (let i = 0; i < this._parameterIds.length; ++i) {\n model.setParameterValueById(this._parameterIds[i], parameterValue);\n }\n }\n\n /**\n * コンストラクタ\n * @param modelSetting モデルの設定情報\n */\n public constructor(modelSetting: ICubismModelSetting) {\n this._blinkingState = EyeState.EyeState_First;\n this._nextBlinkingTime = 0.0;\n this._stateStartTimeSeconds = 0.0;\n this._blinkingIntervalSeconds = 4.0;\n this._closingSeconds = 0.1;\n this._closedSeconds = 0.05;\n this._openingSeconds = 0.15;\n this._userTimeSeconds = 0.0;\n this._parameterIds = new Array<CubismIdHandle>();\n\n if (modelSetting == null) {\n return;\n }\n\n this._parameterIds.length = modelSetting.getEyeBlinkParameterCount();\n for (let i = 0; i < modelSetting.getEyeBlinkParameterCount(); ++i) {\n this._parameterIds[i] = modelSetting.getEyeBlinkParameterId(i);\n }\n }\n\n /**\n * 次の瞬きのタイミングの決定\n *\n * @return 次のまばたきを行う時刻[秒]\n */\n public determinNextBlinkingTiming(): number {\n const r: number = Math.random();\n return (\n this._userTimeSeconds + r * (2.0 * this._blinkingIntervalSeconds - 1.0)\n );\n }\n\n _blinkingState: number; // 現在の状態\n _parameterIds: Array<CubismIdHandle>; // 操作対象のパラメータのIDのリスト\n _nextBlinkingTime: number; // 次のまばたきの時刻[秒]\n _stateStartTimeSeconds: number; // 現在の状態が開始した時刻[秒]\n _blinkingIntervalSeconds: number; // まばたきの間隔[秒]\n _closingSeconds: number; // まぶたを閉じる動作の所要時間[秒]\n _closedSeconds: number; // まぶたを閉じている動作の所要時間[秒]\n _openingSeconds: number; // まぶたを開く動作の所要時間[秒]\n _userTimeSeconds: number; // デルタ時間の積算値[秒]\n\n /**\n * IDで指定された目のパラメータが、0のときに閉じるなら true 、1の時に閉じるなら false 。\n */\n static readonly CloseIfZero: boolean = true;\n}\n\n/**\n * まばたきの状態\n *\n * まばたきの状態を表す列挙型\n */\nexport enum EyeState {\n EyeState_First = 0, // 初期状態\n EyeState_Interval, // まばたきしていない状態\n EyeState_Closing, // まぶたが閉じていく途中の状態\n EyeState_Closed, // まぶたが閉じている状態\n EyeState_Opening // まぶたが開いていく途中の状態\n}\n\n// Namespace definition for compatibility.\nimport * as $ from './cubismeyeblink';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const CubismEyeBlink = $.CubismEyeBlink;\n export type CubismEyeBlink = $.CubismEyeBlink;\n export const EyeState = $.EyeState;\n export type EyeState = $.EyeState;\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport { Constant } from '../live2dcubismframework';\nimport { csmRect } from '../type/csmrectf';\nimport { CubismMatrix44 } from '../math/cubismmatrix44';\nimport { CubismModel } from '../model/cubismmodel';\nimport { CubismClippingContext, CubismTextureColor } from './cubismrenderer';\nimport { CubismLogError, CubismLogWarning } from '../utils/cubismdebug';\n\nconst ColorChannelCount = 4; // 実験時に1チャンネルの場合は1、RGBだけの場合は3、アルファも含める場合は4\nconst ClippingMaskMaxCountOnDefault = 36; // 通常のフレームバッファ一枚あたりのマスク最大数\nconst ClippingMaskMaxCountOnMultiRenderTexture = 32; // フレームバッファが2枚以上ある場合のフレームバッファ一枚あたりのマスク最大数\n\nexport type ClippingContextConstructor<\n T_ClippingContext extends CubismClippingContext\n> = new (\n manager: CubismClippingManager<T_ClippingContext>,\n drawableMasks: Int32Array,\n drawableMaskCounts: number\n) => T_ClippingContext;\n\nexport interface ICubismClippingManager {\n getClippingMaskBufferSize(): number;\n}\n\nexport abstract class CubismClippingManager<\n T_ClippingContext extends CubismClippingContext\n> implements ICubismClippingManager {\n /**\n * コンストラクタ\n */\n public constructor(\n clippingContextFactory: ClippingContextConstructor<T_ClippingContext>\n ) {\n this._renderTextureCount = 0;\n this._clippingMaskBufferSize = 256;\n this._clippingContextListForMask = new Array<T_ClippingContext>();\n this._clippingContextListForDraw = new Array<T_ClippingContext>();\n this._clippingContextListForOffscreen = new Array<T_ClippingContext>();\n this._tmpBoundsOnModel = new csmRect();\n this._tmpMatrix = new CubismMatrix44();\n this._tmpMatrixForMask = new CubismMatrix44();\n this._tmpMatrixForDraw = new CubismMatrix44();\n this._clearedMaskBufferFlags = new Array<boolean>();\n\n this._clippingContexttConstructor = clippingContextFactory;\n\n this._channelColors = [\n new CubismTextureColor(1.0, 0.0, 0.0, 0.0),\n new CubismTextureColor(0.0, 1.0, 0.0, 0.0),\n new CubismTextureColor(0.0, 0.0, 1.0, 0.0),\n new CubismTextureColor(0.0, 0.0, 0.0, 1.0)\n ];\n }\n\n /**\n * デストラクタ相当の処理\n */\n public release(): void {\n for (let i = 0; i < this._clippingContextListForMask.length; i++) {\n if (this._clippingContextListForMask[i]) {\n this._clippingContextListForMask[i].release();\n this._clippingContextListForMask[i] = void 0;\n }\n this._clippingContextListForMask[i] = null;\n }\n this._clippingContextListForMask = null;\n\n // _clippingContextListForDrawは_clippingContextListForMaskにあるインスタンスを指している。上記の処理により要素ごとのDELETEは不要。\n for (let i = 0; i < this._clippingContextListForDraw.length; i++) {\n this._clippingContextListForDraw[i] = null;\n }\n this._clippingContextListForDraw = null;\n\n for (let i = 0; i < this._channelColors.length; i++) {\n this._channelColors[i] = null;\n }\n\n this._channelColors = null;\n\n if (this._clearedMaskBufferFlags != null) {\n this._clearedMaskBufferFlags.length = 0;\n }\n this._clearedMaskBufferFlags = null;\n }\n\n /**\n * マネージャの初期化処理\n * クリッピングマスクを使う描画オブジェクトの登録を行う\n * @param model モデルのインスタンス\n * @param renderTextureCount バッファの生成数\n */\n public initializeForDrawable(\n model: CubismModel,\n renderTextureCount: number\n ): void {\n // レンダーテクスチャの合計枚数の設定\n // 1以上の整数でない場合はそれぞれ警告を出す\n if (renderTextureCount % 1 != 0) {\n CubismLogWarning(\n 'The number of render textures must be specified as an integer. The decimal point is rounded down and corrected to an integer.'\n );\n // 小数点以下を除去\n renderTextureCount = ~~renderTextureCount;\n }\n if (renderTextureCount < 1) {\n CubismLogWarning(\n 'The number of render textures must be an integer greater than or equal to 1. Set the number of render textures to 1.'\n );\n }\n // 負の値が使われている場合は強制的に1枚と設定する\n this._renderTextureCount = renderTextureCount < 1 ? 1 : renderTextureCount;\n\n this._clearedMaskBufferFlags = new Array<boolean>(this._renderTextureCount);\n\n // クリッピングマスクを使う描画オブジェクトをすべて登録する\n // クリッピングマスクは、通常数個程度に限定して使うものとする\n this._clippingContextListForDraw.length = model.getDrawableCount();\n for (let i = 0; i < model.getDrawableCount(); i++) {\n if (model.getDrawableMaskCounts()[i] <= 0) {\n // クリッピングマスクが使用されていないアートメッシュ(多くの場合使用しない)\n this._clippingContextListForDraw[i] = null;\n continue;\n }\n\n // 既にあるClipContextと同じかチェックする\n let clippingContext: T_ClippingContext = this.findSameClip(\n model.getDrawableMasks()[i],\n model.getDrawableMaskCounts()[i]\n );\n if (clippingContext == null) {\n // 同一のマスクが存在していない場合は生成する\n\n clippingContext = new this._clippingContexttConstructor(\n this,\n model.getDrawableMasks()[i],\n model.getDrawableMaskCounts()[i]\n );\n this._clippingContextListForMask.push(clippingContext);\n }\n\n clippingContext.addClippedDrawable(i);\n\n this._clippingContextListForDraw[i] = clippingContext;\n }\n }\n\n /**\n * オフスクリーン用の初期化処理\n *\n * @param model モデルのインスタンス\n * @param maskBufferCount オフスクリーン用のマスクバッファの数\n */\n public initializeForOffscreen(\n model: CubismModel,\n maskBufferCount: number\n ): void {\n this._renderTextureCount = maskBufferCount;\n\n // レンダーテクスチャのクリアフラグの設定\n this._clearedMaskBufferFlags.length = this._renderTextureCount;\n for (let i = 0; i < this._renderTextureCount; ++i) {\n this._clearedMaskBufferFlags[i] = false;\n }\n\n //クリッピングマスクを使う描画オブジェクトを全て登録する\n //クリッピングマスクは、通常数個程度に限定して使うものとする\n this._clippingContextListForOffscreen.length = model.getOffscreenCount();\n for (let i = 0; i < model.getOffscreenCount(); ++i) {\n if (model.getOffscreenMaskCounts()[i] <= 0) {\n //クリッピングマスクが使用されていないオフスクリーン(多くの場合使用しない)\n this._clippingContextListForOffscreen.push(null);\n continue;\n }\n\n // 既にあるClipContextと同じかチェックする\n let cc = this.findSameClip(\n model.getOffscreenMasks()[i],\n model.getOffscreenMaskCounts()[i]\n );\n if (cc == null) {\n // 同一のマスクが存在していない場合は生成する\n cc = new this._clippingContexttConstructor(\n this,\n model.getOffscreenMasks()[i],\n model.getOffscreenMaskCounts()[i]\n );\n this._clippingContextListForMask.push(cc);\n }\n\n cc.addClippedOffscreen(i);\n\n this._clippingContextListForOffscreen[i] = cc;\n }\n }\n\n /**\n * 既にマスクを作っているかを確認\n * 作っている様であれば該当するクリッピングマスクのインスタンスを返す\n * 作っていなければNULLを返す\n * @param drawableMasks 描画オブジェクトをマスクする描画オブジェクトのリスト\n * @param drawableMaskCounts 描画オブジェクトをマスクする描画オブジェクトの数\n * @return 該当するクリッピングマスクが存在すればインスタンスを返し、なければNULLを返す\n */\n public findSameClip(\n drawableMasks: Int32Array,\n drawableMaskCounts: number\n ): T_ClippingContext {\n // 作成済みClippingContextと一致するか確認\n for (let i = 0; i < this._clippingContextListForMask.length; i++) {\n const clippingContext: T_ClippingContext =\n this._clippingContextListForMask[i];\n const count: number = clippingContext._clippingIdCount;\n\n // 個数が違う場合は別物\n if (count != drawableMaskCounts) {\n continue;\n }\n\n let sameCount = 0;\n\n // 同じIDを持つか確認。配列の数が同じなので、一致した個数が同じなら同じ物を持つとする\n for (let j = 0; j < count; j++) {\n const clipId: number = clippingContext._clippingIdList[j];\n\n for (let k = 0; k < count; k++) {\n if (drawableMasks[k] == clipId) {\n sameCount++;\n break;\n }\n }\n }\n\n if (sameCount == count) {\n return clippingContext;\n }\n }\n\n return null; // 見つからなかった\n }\n\n /**\n * 高精細マスク処理用の行列を計算する\n * @param model モデルのインスタンス\n * @param isRightHanded 処理が右手系であるか\n */\n public setupMatrixForHighPrecision(\n model: CubismModel,\n isRightHanded: boolean\n ): void {\n // 全てのクリッピングを用意する\n // 同じクリップ(複数の場合はまとめて一つのクリップ)を使う場合は1度だけ設定する\n let usingClipCount = 0;\n for (\n let clipIndex = 0;\n clipIndex < this._clippingContextListForMask.length;\n clipIndex++\n ) {\n // 1つのクリッピングマスクに関して\n const cc: T_ClippingContext = this._clippingContextListForMask[clipIndex];\n\n // このクリップを利用する描画オブジェクト群全体を囲む矩形を計算\n this.calcClippedDrawableTotalBounds(model, cc);\n\n if (cc._isUsing) {\n usingClipCount++; // 使用中としてカウント\n }\n }\n\n // マスク行列作成処理\n if (usingClipCount > 0) {\n this.setupLayoutBounds(0);\n\n // サイズがレンダーテクスチャの枚数と合わない場合は合わせる\n if (this._clearedMaskBufferFlags.length != this._renderTextureCount) {\n this._clearedMaskBufferFlags.length = this._renderTextureCount;\n for (let i = 0; i < this._renderTextureCount; i++) {\n this._clearedMaskBufferFlags[i] = false;\n }\n } else {\n // マスクのクリアフラグを毎フレーム開始時に初期化\n for (let i = 0; i < this._renderTextureCount; i++) {\n this._clearedMaskBufferFlags[i] = false;\n }\n }\n\n // 実際にマスクを生成する\n // 全てのマスクをどの様にレイアウトして描くかを決定し、ClipContext , ClippedDrawContext に記憶する\n for (\n let clipIndex = 0;\n clipIndex < this._clippingContextListForMask.length;\n clipIndex++\n ) {\n // --- 実際に1つのマスクを描く ---\n const clipContext: T_ClippingContext =\n this._clippingContextListForMask[clipIndex];\n const allClippedDrawRect: csmRect = clipContext._allClippedDrawRect; //このマスクを使う、全ての描画オブジェクトの論理座標上の囲み矩形\n const layoutBoundsOnTex01 = clipContext._layoutBounds; //この中にマスクを収める\n const margin = 0.05;\n let scaleX = 0.0;\n let scaleY = 0.0;\n const ppu: number = model.getPixelsPerUnit();\n const maskPixelSize: number = clipContext\n .getClippingManager()\n .getClippingMaskBufferSize();\n const physicalMaskWidth: number =\n layoutBoundsOnTex01.width * maskPixelSize;\n const physicalMaskHeight: number =\n layoutBoundsOnTex01.height * maskPixelSize;\n\n this._tmpBoundsOnModel.setRect(allClippedDrawRect);\n if (this._tmpBoundsOnModel.width * ppu > physicalMaskWidth) {\n this._tmpBoundsOnModel.expand(allClippedDrawRect.width * margin, 0.0);\n scaleX = layoutBoundsOnTex01.width / this._tmpBoundsOnModel.width;\n } else {\n scaleX = ppu / physicalMaskWidth;\n }\n\n if (this._tmpBoundsOnModel.height * ppu > physicalMaskHeight) {\n this._tmpBoundsOnModel.expand(\n 0.0,\n allClippedDrawRect.height * margin\n );\n scaleY = layoutBoundsOnTex01.height / this._tmpBoundsOnModel.height;\n } else {\n scaleY = ppu / physicalMaskHeight;\n }\n\n // マスク生成時に使う行列を求める\n this.createMatrixForMask(\n isRightHanded,\n layoutBoundsOnTex01,\n scaleX,\n scaleY\n );\n\n clipContext._matrixForMask.setMatrix(this._tmpMatrixForMask.getArray());\n clipContext._matrixForDraw.setMatrix(this._tmpMatrixForDraw.getArray());\n }\n }\n }\n\n /**\n * オフスクリーンの高精細マスク処理用の行列を計算する\n *\n * @param model モデルのインスタンス\n * @param isRightHanded 処理が右手系であるか\n * @param mvp モデルビュー投影行列\n */\n public setupMatrixForOffscreenHighPrecision(\n model: CubismModel,\n isRightHanded: boolean,\n mvp: CubismMatrix44\n ): void {\n // 全てのクリッピングを用意する\n // 同じクリップ(複数の場合はまとめて1つのクリップ)を使う場合は1度だけ設定する\n let usingClipCount = 0;\n for (\n let clipIndex = 0;\n clipIndex < this._clippingContextListForMask.length;\n clipIndex++\n ) {\n // 1つのクリッピングマスクに関して\n const cc: T_ClippingContext = this._clippingContextListForMask[clipIndex];\n\n // このクリップを利用する描画オブジェクト群全体を囲む矩形を計算\n this.calcClippedOffscreenTotalBounds(model, cc);\n\n if (cc._isUsing) {\n usingClipCount++; //使用中としてカウント\n }\n }\n\n if (usingClipCount <= 0) {\n return;\n }\n // マスク行列作成処理\n this.setupLayoutBounds(0);\n\n // サイズがレンダーテクスチャの枚数と合わない場合は合わせる\n if (this._clearedMaskBufferFlags.length != this._renderTextureCount) {\n this._clearedMaskBufferFlags.length = this._renderTextureCount;\n\n for (let i = 0; i < this._renderTextureCount; ++i) {\n this._clearedMaskBufferFlags[i] = false;\n }\n } else {\n // マスクのクリアフラグを毎フレーム開始時に初期化\n for (let i = 0; i < this._renderTextureCount; ++i) {\n this._clearedMaskBufferFlags[i] = false;\n }\n }\n\n // 実際にマスクを生成する\n // 全てのマスクをどの様にレイアウトして描くかを決定し、ClipContext , ClippedDrawContext に記憶する\n for (\n let clipIndex = 0;\n clipIndex < this._clippingContextListForMask.length;\n clipIndex++\n ) {\n // --- 実際に1つのマスクを描く ---\n const clipContext = this._clippingContextListForMask[clipIndex];\n const allClippedDrawRect = clipContext._allClippedDrawRect; //このマスクを使う、全ての描画オブジェクトの論理座標上の囲み矩形\n const layoutBoundsOnTex01 = clipContext._layoutBounds; //この中にマスクを収める\n const margin = 0.05;\n let scaleX = 0.0;\n let scaleY = 0.0;\n const ppu = model.getPixelsPerUnit();\n const maskPixel = clipContext\n .getClippingManager()\n .getClippingMaskBufferSize();\n const physicalMaskWidth = layoutBoundsOnTex01.width * maskPixel;\n const physicalMaskHeight = layoutBoundsOnTex01.height * maskPixel;\n\n this._tmpBoundsOnModel.setRect(allClippedDrawRect);\n if (this._tmpBoundsOnModel.width * ppu > physicalMaskWidth) {\n this._tmpBoundsOnModel.expand(allClippedDrawRect.width * margin, 0.0);\n scaleX = layoutBoundsOnTex01.width / this._tmpBoundsOnModel.width;\n } else {\n scaleX = ppu / physicalMaskWidth;\n }\n\n if (this._tmpBoundsOnModel.height * ppu > physicalMaskHeight) {\n this._tmpBoundsOnModel.expand(0.0, allClippedDrawRect.height * margin);\n scaleY = layoutBoundsOnTex01.height / this._tmpBoundsOnModel.height;\n } else {\n scaleY = ppu / physicalMaskHeight;\n }\n\n // マスク生成時に使う行列を求める\n this.createMatrixForMask(\n isRightHanded,\n layoutBoundsOnTex01,\n scaleX,\n scaleY\n );\n\n clipContext._matrixForMask.setMatrix(this._tmpMatrixForMask.getArray());\n clipContext._matrixForDraw.setMatrix(this._tmpMatrixForDraw.getArray());\n\n // clipContext * mvp^-1\n const invertMvp = mvp.getInvert();\n clipContext._matrixForDraw.multiplyByMatrix(invertMvp);\n }\n }\n\n /**\n * マスクを使う描画オブジェクトの全体の矩形を計算する。\n *\n * @param model モデルのインスタンス\n * @param clippingContext クリッピングコンテキスト\n */\n public calcClippedOffscreenTotalBounds(\n model: CubismModel,\n clippingContext: T_ClippingContext\n ): void {\n // 被クリッピングマスク(マスクされる描画オブジェクト)の全体の矩形\n let clippedDrawTotalMinX = Number.MAX_VALUE,\n clippedDrawTotalMinY = Number.MAX_VALUE;\n let clippedDrawTotalMaxX = -Number.MAX_VALUE,\n clippedDrawTotalMaxY = -Number.MAX_VALUE;\n\n // このマスクが実際に必要か判定する\n // このクリッピングを利用する「描画オブジェクト」がひとつでも使用可能であればマスクを生成する必要がある\n const clippedOffscreenCount =\n clippingContext._clippedOffscreenIndexList.length;\n\n const clippedOffscreenChildDrawableIndexList = new Array<number>();\n for (\n let clippedOffscreenIndex = 0;\n clippedOffscreenIndex < clippedOffscreenCount;\n clippedOffscreenIndex++\n ) {\n // マスクを使用する描画オブジェクトの描画される矩形を求める\n const offscreenIndex =\n clippingContext._clippedOffscreenIndexList[clippedOffscreenIndex];\n\n this.getOffscreenChildDrawableIndexList(\n model,\n offscreenIndex,\n clippedOffscreenChildDrawableIndexList\n );\n }\n\n const childDrawableCount = clippedOffscreenChildDrawableIndexList.length;\n for (\n let childDrawableIndex = 0;\n childDrawableIndex < childDrawableCount;\n childDrawableIndex++\n ) {\n const drawableVertexCount = model.getDrawableVertexCount(\n clippedOffscreenChildDrawableIndexList[childDrawableIndex]\n );\n const drawableVertexes = model.getDrawableVertices(\n clippedOffscreenChildDrawableIndexList[childDrawableIndex]\n );\n\n let minX = Number.MAX_VALUE,\n minY = Number.MAX_VALUE;\n let maxX = -Number.MAX_VALUE,\n maxY = -Number.MAX_VALUE;\n\n const loop = drawableVertexCount * Constant.vertexStep;\n for (\n let pi = Constant.vertexOffset;\n pi < loop;\n pi += Constant.vertexStep\n ) {\n const x = drawableVertexes[pi];\n const y = drawableVertexes[pi + 1];\n if (x < minX) minX = x;\n if (x > maxX) maxX = x;\n if (y < minY) minY = y;\n if (y > maxY) maxY = y;\n }\n\n if (minX == Number.MAX_VALUE) continue; //有効な点がひとつも取れなかったのでスキップする\n\n // 全体の矩形に反映\n if (minX < clippedDrawTotalMinX) clippedDrawTotalMinX = minX;\n if (minY < clippedDrawTotalMinY) clippedDrawTotalMinY = minY;\n if (maxX > clippedDrawTotalMaxX) clippedDrawTotalMaxX = maxX;\n if (maxY > clippedDrawTotalMaxY) clippedDrawTotalMaxY = maxY;\n }\n\n if (clippedDrawTotalMinX == Number.MAX_VALUE) {\n clippingContext._allClippedDrawRect.x = 0.0;\n clippingContext._allClippedDrawRect.y = 0.0;\n clippingContext._allClippedDrawRect.width = 0.0;\n clippingContext._allClippedDrawRect.height = 0.0;\n clippingContext._isUsing = false;\n } else {\n clippingContext._isUsing = true;\n const w = clippedDrawTotalMaxX - clippedDrawTotalMinX;\n const h = clippedDrawTotalMaxY - clippedDrawTotalMinY;\n clippingContext._allClippedDrawRect.x = clippedDrawTotalMinX;\n clippingContext._allClippedDrawRect.y = clippedDrawTotalMinY;\n clippingContext._allClippedDrawRect.width = w;\n clippingContext._allClippedDrawRect.height = h;\n }\n }\n\n /**\n * マスクを使う描画オブジェクトの全体の矩形を計算する。\n *\n * @param model モデルのインスタンス\n * @param offscreenIndex オフスクリーンのインデックス\n * @param childDrawableIndexList オフスクリーンの子Drawableのインデックスリスト\n */\n public getOffscreenChildDrawableIndexList(\n model: CubismModel,\n offscreenIndex: number,\n childDrawableIndexList: Array<number>\n ): void {\n // 親オブジェクトを取得\n const ownerIndex = model.getOffscreenOwnerIndices()[offscreenIndex];\n\n // パーツのみ\n this.getPartChildDrawableIndexList(\n model,\n ownerIndex,\n childDrawableIndexList\n );\n }\n\n /**\n * パーツの子Drawableのインデックスリストを取得する。\n *\n * @param model モデルのインスタンス\n * @param partIndex パーツのインデックス\n * @param childDrawableIndexList パーツの子Drawableのインデックスリスト\n */\n public getPartChildDrawableIndexList(\n model: CubismModel,\n partIndex: number,\n childDrawableIndexList: Array<number>\n ): void {\n const childDrawObjects =\n model.getPartsHierarchy()[partIndex].childDrawObjects;\n childDrawableIndexList.push(...childDrawObjects.drawableIndices);\n\n for (let i = 0; i < childDrawObjects.offscreenIndices.length; ++i) {\n this.getOffscreenChildDrawableIndexList(\n model,\n childDrawObjects.offscreenIndices[i],\n childDrawableIndexList\n );\n }\n }\n\n /**\n * マスク作成・描画用の行列を作成する。\n * @param isRightHanded 座標を右手系として扱うかを指定\n * @param layoutBoundsOnTex01 マスクを収める領域\n * @param scaleX 描画オブジェクトの伸縮率\n * @param scaleY 描画オブジェクトの伸縮率\n */\n public createMatrixForMask(\n isRightHanded: boolean,\n layoutBoundsOnTex01: csmRect,\n scaleX: number,\n scaleY: number\n ): void {\n this._tmpMatrix.loadIdentity();\n {\n // Layout0..1 を -1..1に変換\n this._tmpMatrix.translateRelative(-1.0, -1.0);\n this._tmpMatrix.scaleRelative(2.0, 2.0);\n }\n {\n // view to Layout0..1\n this._tmpMatrix.translateRelative(\n layoutBoundsOnTex01.x,\n layoutBoundsOnTex01.y\n ); //new = [translate]\n this._tmpMatrix.scaleRelative(scaleX, scaleY); //new = [translate][scale]\n this._tmpMatrix.translateRelative(\n -this._tmpBoundsOnModel.x,\n -this._tmpBoundsOnModel.y\n ); //new = [translate][scale][translate]\n }\n // tmpMatrixForMask が計算結果\n this._tmpMatrixForMask.setMatrix(this._tmpMatrix.getArray());\n\n this._tmpMatrix.loadIdentity();\n {\n this._tmpMatrix.translateRelative(\n layoutBoundsOnTex01.x,\n layoutBoundsOnTex01.y * (isRightHanded ? -1.0 : 1.0)\n ); //new = [translate]\n this._tmpMatrix.scaleRelative(\n scaleX,\n scaleY * (isRightHanded ? -1.0 : 1.0)\n ); //new = [translate][scale]\n this._tmpMatrix.translateRelative(\n -this._tmpBoundsOnModel.x,\n -this._tmpBoundsOnModel.y\n ); //new = [translate][scale][translate]\n }\n\n this._tmpMatrixForDraw.setMatrix(this._tmpMatrix.getArray());\n }\n\n /**\n * クリッピングコンテキストを配置するレイアウト\n * 指定された数のレンダーテクスチャを極力いっぱいに使ってマスクをレイアウトする\n * マスクグループの数が4以下ならRGBA各チャンネルに一つずつマスクを配置し、5以上6以下ならRGBAを2,2,1,1と配置する。\n *\n * @param usingClipCount 配置するクリッピングコンテキストの数\n */\n public setupLayoutBounds(usingClipCount: number): void {\n const useClippingMaskMaxCount =\n this._renderTextureCount <= 1\n ? ClippingMaskMaxCountOnDefault\n : ClippingMaskMaxCountOnMultiRenderTexture * this._renderTextureCount;\n\n if (usingClipCount <= 0 || usingClipCount > useClippingMaskMaxCount) {\n if (usingClipCount > useClippingMaskMaxCount) {\n // マスクの制限数の警告を出す\n CubismLogError(\n 'not supported mask count : {0}\\n[Details] render texture count : {1}, mask count : {2}',\n usingClipCount - useClippingMaskMaxCount,\n this._renderTextureCount,\n usingClipCount\n );\n }\n // この場合は一つのマスクターゲットを毎回クリアして使用する\n for (\n let index = 0;\n index < this._clippingContextListForMask.length;\n index++\n ) {\n const clipContext: T_ClippingContext =\n this._clippingContextListForMask[index];\n clipContext._layoutChannelIndex = 0; // どうせ毎回消すので固定\n clipContext._layoutBounds.x = 0.0;\n clipContext._layoutBounds.y = 0.0;\n clipContext._layoutBounds.width = 1.0;\n clipContext._layoutBounds.height = 1.0;\n clipContext._bufferIndex = 0;\n }\n return;\n }\n\n // レンダーテクスチャが1枚なら9分割する(最大36枚)\n const layoutCountMaxValue = this._renderTextureCount <= 1 ? 9 : 8;\n\n // 指定された数のレンダーテクスチャを極力いっぱいに使ってマスクをレイアウトする(デフォルトなら1)。\n // マスクグループの数が4以下ならRGBA各チャンネルに1つずつマスクを配置し、5以上6以下ならRGBAを2,2,1,1と配置する。\n let countPerSheetDiv: number = usingClipCount / this._renderTextureCount; // レンダーテクスチャ1枚あたり何枚割り当てるか。\n const reduceLayoutTextureCount: number =\n usingClipCount % this._renderTextureCount; // レイアウトの数を1枚減らすレンダーテクスチャの数(この数だけのレンダーテクスチャが対象)。\n\n // 1枚に割り当てるマスクの分割数を取りたいため、小数点は切り上げる\n countPerSheetDiv = Math.ceil(countPerSheetDiv);\n\n // RGBAを順番に使っていく\n let divCount: number = countPerSheetDiv / ColorChannelCount; // 1チャンネルに配置する基本のマスク\n const modCount: number = countPerSheetDiv % ColorChannelCount; // 余り、この番号のチャンネルまでに一つずつ配分する(インデックスではない)\n\n // 小数点は切り捨てる\n divCount = ~~divCount;\n\n // RGBAそれぞれのチャンネルを用意していく(0:R, 1:G, 2:B, 3:A)\n let curClipIndex = 0; // 順番に設定していく\n\n for (\n let renderTextureIndex = 0;\n renderTextureIndex < this._renderTextureCount;\n renderTextureIndex++\n ) {\n for (\n let channelIndex = 0;\n channelIndex < ColorChannelCount;\n channelIndex++\n ) {\n // このチャンネルにレイアウトする数\n // NOTE: レイアウト数 = 1チャンネルに配置する基本のマスク + 余りのマスクを置くチャンネルなら1つ追加\n let layoutCount: number = divCount + (channelIndex < modCount ? 1 : 0);\n\n // レイアウトの数を1枚減らす場合にそれを行うチャンネルを決定\n // divが0の時は正常なインデックスの範囲内になるように調整\n const checkChannelIndex = modCount + (divCount < 1 ? -1 : 0);\n\n // 今回が対象のチャンネルかつ、レイアウトの数を1枚減らすレンダーテクスチャが存在する場合\n if (channelIndex == checkChannelIndex && reduceLayoutTextureCount > 0) {\n // 現在のレンダーテクスチャが、対象のレンダーテクスチャであればレイアウトの数を1枚減らす。\n layoutCount -= !(renderTextureIndex < reduceLayoutTextureCount)\n ? 1\n : 0;\n }\n\n // 分割方法を決定する\n if (layoutCount == 0) {\n // 何もしない\n } else if (layoutCount == 1) {\n // 全てをそのまま使う\n const clipContext: T_ClippingContext =\n this._clippingContextListForMask[curClipIndex++];\n clipContext._layoutChannelIndex = channelIndex;\n clipContext._layoutBounds.x = 0.0;\n clipContext._layoutBounds.y = 0.0;\n clipContext._layoutBounds.width = 1.0;\n clipContext._layoutBounds.height = 1.0;\n clipContext._bufferIndex = renderTextureIndex;\n } else if (layoutCount == 2) {\n for (let i = 0; i < layoutCount; i++) {\n let xpos: number = i % 2;\n\n // 小数点は切り捨てる\n xpos = ~~xpos;\n\n const cc: T_ClippingContext =\n this._clippingContextListForMask[curClipIndex++];\n cc._layoutChannelIndex = channelIndex;\n\n // UVを2つに分解して使う\n cc._layoutBounds.x = xpos * 0.5;\n cc._layoutBounds.y = 0.0;\n cc._layoutBounds.width = 0.5;\n cc._layoutBounds.height = 1.0;\n cc._bufferIndex = renderTextureIndex;\n }\n } else if (layoutCount <= 4) {\n // 4分割して使う\n for (let i = 0; i < layoutCount; i++) {\n let xpos: number = i % 2;\n let ypos: number = i / 2;\n\n // 小数点は切り捨てる\n xpos = ~~xpos;\n ypos = ~~ypos;\n\n const cc = this._clippingContextListForMask[curClipIndex++];\n cc._layoutChannelIndex = channelIndex;\n\n cc._layoutBounds.x = xpos * 0.5;\n cc._layoutBounds.y = ypos * 0.5;\n cc._layoutBounds.width = 0.5;\n cc._layoutBounds.height = 0.5;\n cc._bufferIndex = renderTextureIndex;\n }\n } else if (layoutCount <= layoutCountMaxValue) {\n // 9分割して使う\n for (let i = 0; i < layoutCount; i++) {\n let xpos = i % 3;\n let ypos = i / 3;\n\n // 小数点は切り捨てる\n xpos = ~~xpos;\n ypos = ~~ypos;\n\n const cc: T_ClippingContext =\n this._clippingContextListForMask[curClipIndex++];\n cc._layoutChannelIndex = channelIndex;\n\n cc._layoutBounds.x = xpos / 3.0;\n cc._layoutBounds.y = ypos / 3.0;\n cc._layoutBounds.width = 1.0 / 3.0;\n cc._layoutBounds.height = 1.0 / 3.0;\n cc._bufferIndex = renderTextureIndex;\n }\n } else {\n // マスクの制限枚数を超えた場合の処理\n CubismLogError(\n 'not supported mask count : {0}\\n[Details] render texture count : {1}, mask count : {2}',\n usingClipCount - useClippingMaskMaxCount,\n this._renderTextureCount,\n usingClipCount\n );\n\n // SetupShaderProgramでオーバーアクセスが発生するので仮で数値を入れる\n // もちろん描画結果は正しいものではなくなる\n for (let index = 0; index < layoutCount; index++) {\n const cc: T_ClippingContext =\n this._clippingContextListForMask[curClipIndex++];\n\n cc._layoutChannelIndex = 0;\n\n cc._layoutBounds.x = 0.0;\n cc._layoutBounds.y = 0.0;\n cc._layoutBounds.width = 1.0;\n cc._layoutBounds.height = 1.0;\n cc._bufferIndex = 0;\n }\n }\n }\n }\n }\n\n /**\n * マスクされる描画オブジェクト群全体を囲む矩形(モデル座標系)を計算する\n * @param model モデルのインスタンス\n * @param clippingContext クリッピングマスクのコンテキスト\n */\n public calcClippedDrawableTotalBounds(\n model: CubismModel,\n clippingContext: T_ClippingContext\n ): void {\n // 被クリッピングマスク(マスクされる描画オブジェクト)の全体の矩形\n let clippedDrawTotalMinX: number = Number.MAX_VALUE;\n let clippedDrawTotalMinY: number = Number.MAX_VALUE;\n let clippedDrawTotalMaxX: number = Number.MIN_VALUE;\n let clippedDrawTotalMaxY: number = Number.MIN_VALUE;\n\n // このマスクが実際に必要か判定する\n // このクリッピングを利用する「描画オブジェクト」がひとつでも使用可能であればマスクを生成する必要がある\n const clippedDrawCount: number =\n clippingContext._clippedDrawableIndexList.length;\n\n for (\n let clippedDrawableIndex = 0;\n clippedDrawableIndex < clippedDrawCount;\n clippedDrawableIndex++\n ) {\n // マスクを使用する描画オブジェクトの描画される矩形を求める\n const drawableIndex: number =\n clippingContext._clippedDrawableIndexList[clippedDrawableIndex];\n\n const drawableVertexCount: number =\n model.getDrawableVertexCount(drawableIndex);\n const drawableVertexes: Float32Array =\n model.getDrawableVertices(drawableIndex);\n\n let minX: number = Number.MAX_VALUE;\n let minY: number = Number.MAX_VALUE;\n let maxX: number = -Number.MAX_VALUE;\n let maxY: number = -Number.MAX_VALUE;\n\n const loop: number = drawableVertexCount * Constant.vertexStep;\n for (\n let pi: number = Constant.vertexOffset;\n pi < loop;\n pi += Constant.vertexStep\n ) {\n const x: number = drawableVertexes[pi];\n const y: number = drawableVertexes[pi + 1];\n\n if (x < minX) {\n minX = x;\n }\n if (x > maxX) {\n maxX = x;\n }\n if (y < minY) {\n minY = y;\n }\n if (y > maxY) {\n maxY = y;\n }\n }\n\n // 有効な点が一つも取れなかったのでスキップ\n if (minX == Number.MAX_VALUE) {\n continue;\n }\n\n // 全体の矩形に反映\n if (minX < clippedDrawTotalMinX) {\n clippedDrawTotalMinX = minX;\n }\n if (minY < clippedDrawTotalMinY) {\n clippedDrawTotalMinY = minY;\n }\n if (maxX > clippedDrawTotalMaxX) {\n clippedDrawTotalMaxX = maxX;\n }\n if (maxY > clippedDrawTotalMaxY) {\n clippedDrawTotalMaxY = maxY;\n }\n\n if (clippedDrawTotalMinX == Number.MAX_VALUE) {\n clippingContext._allClippedDrawRect.x = 0.0;\n clippingContext._allClippedDrawRect.y = 0.0;\n clippingContext._allClippedDrawRect.width = 0.0;\n clippingContext._allClippedDrawRect.height = 0.0;\n clippingContext._isUsing = false;\n } else {\n clippingContext._isUsing = true;\n const w: number = clippedDrawTotalMaxX - clippedDrawTotalMinX;\n const h: number = clippedDrawTotalMaxY - clippedDrawTotalMinY;\n clippingContext._allClippedDrawRect.x = clippedDrawTotalMinX;\n clippingContext._allClippedDrawRect.y = clippedDrawTotalMinY;\n clippingContext._allClippedDrawRect.width = w;\n clippingContext._allClippedDrawRect.height = h;\n }\n }\n }\n\n /**\n * 画面描画に使用するクリッピングマスクのリストを取得する\n * @return 画面描画に使用するクリッピングマスクのリスト\n */\n public getClippingContextListForDraw(): Array<T_ClippingContext> {\n return this._clippingContextListForDraw;\n }\n\n public getClippingContextListForOffscreen(): Array<T_ClippingContext> {\n return this._clippingContextListForOffscreen;\n }\n\n /**\n * クリッピングマスクバッファのサイズを取得する\n * @return クリッピングマスクバッファのサイズ\n */\n public getClippingMaskBufferSize(): number {\n return this._clippingMaskBufferSize;\n }\n\n /**\n * このバッファのレンダーテクスチャの枚数を取得する\n * @return このバッファのレンダーテクスチャの枚数\n */\n public getRenderTextureCount(): number {\n return this._renderTextureCount;\n }\n\n /**\n * カラーチャンネル(RGBA)のフラグを取得する\n * @param channelNo カラーチャンネル(RGBA)の番号(0:R, 1:G, 2:B, 3:A)\n */\n public getChannelFlagAsColor(channelNo: number): CubismTextureColor {\n return this._channelColors[channelNo];\n }\n\n /**\n * クリッピングマスクバッファのサイズを設定する\n * @param size クリッピングマスクバッファのサイズ\n */\n public setClippingMaskBufferSize(size: number): void {\n this._clippingMaskBufferSize = size;\n }\n\n protected _clearedMaskBufferFlags: Array<boolean>; //マスクのクリアフラグの配列\n\n protected _channelColors: Array<CubismTextureColor>;\n protected _clippingContextListForMask: Array<T_ClippingContext>; // マスク用クリッピングコンテキストのリスト\n protected _clippingContextListForDraw: Array<T_ClippingContext>; // 描画用クリッピングコンテキストのリスト\n protected _clippingContextListForOffscreen: Array<T_ClippingContext>; // オフスクリーン用クリッピングコンテキストのリスト\n protected _clippingMaskBufferSize: number; // クリッピングマスクのバッファサイズ(初期値:256)\n protected _renderTextureCount: number; // 生成するレンダーテクスチャの枚数\n\n protected _tmpMatrix: CubismMatrix44; // マスク計算用の行列\n protected _tmpMatrixForMask: CubismMatrix44; // マスク計算用の行列\n protected _tmpMatrixForDraw: CubismMatrix44; // マスク計算用の行列\n protected _tmpBoundsOnModel: csmRect; // マスク配置計算用の矩形\n\n protected _clippingContexttConstructor: ClippingContextConstructor<T_ClippingContext>;\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport { CubismLogError } from '../utils/cubismdebug';\n\n/**\n * WebGL用オフスクリーンサーフェス\n * マスクの描画に必要なフレームバッファなどを管理する。\n */\nexport class CubismRenderTarget_WebGL {\n /**\n * WebGL2RenderingContext.blitFramebuffer() でバッファのコピーを行う。\n *\n * @param src コピー元のオフスクリーンサーフェス\n * @param dst コピー先のオフスクリーンサーフェス\n */\n public static copyBuffer(\n gl: WebGL2RenderingContext,\n src: CubismRenderTarget_WebGL,\n dst: CubismRenderTarget_WebGL\n ): void {\n if (src == null || dst == null) {\n return;\n }\n\n if (!(gl instanceof WebGL2RenderingContext)) {\n throw new Error('WebGL2RenderingContext is required for buffer copy.');\n }\n\n const previousFramebuffer = gl.getParameter(\n gl.FRAMEBUFFER_BINDING\n ) as WebGLFramebuffer;\n\n // 各オフスクリーンサーフェスのレンダーテクスチャをバインド\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, src.getRenderTexture());\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, dst.getRenderTexture());\n\n // バッファのコピーを実行\n gl.blitFramebuffer(\n 0,\n 0,\n src.getBufferWidth(),\n src.getBufferHeight(),\n 0,\n 0,\n dst.getBufferWidth(),\n dst.getBufferHeight(),\n gl.COLOR_BUFFER_BIT,\n gl.NEAREST\n );\n\n // コピー後、元のフレームバッファを復元\n gl.bindFramebuffer(gl.FRAMEBUFFER, previousFramebuffer);\n }\n\n /**\n * 描画を開始する。\n *\n * @param restoreFbo EndDraw時に復元するFBOを指定する。nullを指定すると、beginDraw時に現在のFBOを記憶しておく。\n */\n public beginDraw(restoreFbo: WebGLFramebuffer = null): void {\n if (this._renderTexture == null) {\n console.error('_renderTexture is null');\n return;\n }\n\n // バックバッファのサーフェイスを記憶しておく。\n if (restoreFbo == null) {\n this._oldFbo = this._gl.getParameter(this._gl.FRAMEBUFFER_BINDING);\n } else {\n this._oldFbo = restoreFbo;\n }\n\n // RenderTextureをactiveにセット\n this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._renderTexture);\n }\n\n /**\n * 描画を終了し、バックバッファのサーフェイスを復元する。\n */\n public endDraw(): void {\n // バックバッファのサーフェイスを復元\n this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._oldFbo);\n }\n\n /**\n * バインドされているカラーバッファのクリアを行う。\n *\n * @param r 赤の成分 (0.0 - 1.0)\n * @param g 緑の成分 (0.0 - 1.0)\n * @param b 青の成分 (0.0 - 1.0)\n * @param a アルファの成分 (0.0 - 1.0)\n */\n public clear(r: number, g: number, b: number, a: number): void {\n // クリア処理\n this._gl.clearColor(r, g, b, a);\n this._gl.clear(this._gl.COLOR_BUFFER_BIT);\n }\n\n /**\n * オフスクリーンサーフェスを作成する。\n *\n * @param gl WebGLRenderingContextまたはWebGL2RenderingContext\n * NOTE: Cubism 5.3以降のモデルが使用される場合はWebGL2RenderingContextを使用すること。\n * @param displayBufferWidth オフスクリーンサーフェスの幅\n * @param displayBufferHeight オフスクリーンサーフェスの高さ\n * @param previousFramebuffer 前のフレームバッファ\n *\n * @return 成功した場合はtrue、失敗した場合はfalse\n */\n public createRenderTarget(\n gl: WebGLRenderingContext | WebGL2RenderingContext,\n displayBufferWidth: number,\n displayBufferHeight: number,\n previousFramebuffer: WebGLFramebuffer\n ): boolean {\n this.destroyRenderTarget();\n\n this._colorBuffer = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, this._colorBuffer);\n gl.texImage2D(\n gl.TEXTURE_2D,\n 0,\n gl.RGBA,\n displayBufferWidth,\n displayBufferHeight,\n 0,\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n null\n );\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n\n gl.bindTexture(gl.TEXTURE_2D, null);\n\n // フレームバッファを作成\n const ret = gl.createFramebuffer();\n if (ret == null) {\n CubismLogError('Failed to create framebuffer');\n return false;\n }\n\n // 作成したフレームバッファをバインド\n gl.bindFramebuffer(gl.FRAMEBUFFER, ret);\n gl.framebufferTexture2D(\n gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0,\n gl.TEXTURE_2D,\n this._colorBuffer,\n 0\n );\n\n // 状態をチェック\n const status = gl.checkFramebufferStatus(gl.FRAMEBUFFER);\n\n // フレームバッファが完全でない場合はエラーを出力して以前のフレームバッファを復元\n if (status !== gl.FRAMEBUFFER_COMPLETE) {\n CubismLogError('Framebuffer is not complete');\n gl.bindFramebuffer(gl.FRAMEBUFFER, previousFramebuffer);\n gl.deleteFramebuffer(ret);\n\n this.destroyRenderTarget();\n\n return false;\n }\n\n this._renderTexture = ret;\n this._bufferWidth = displayBufferWidth;\n this._bufferHeight = displayBufferHeight;\n\n this._gl = gl;\n\n return true;\n }\n\n /**\n * レンダーターゲットを破棄する。\n */\n public destroyRenderTarget(): void {\n if (this._colorBuffer) {\n this._gl.bindTexture(this._gl.TEXTURE_2D, null);\n this._gl.deleteTexture(this._colorBuffer);\n this._colorBuffer = null;\n }\n\n if (this._renderTexture) {\n this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, null);\n this._gl.deleteFramebuffer(this._renderTexture);\n this._renderTexture = null;\n }\n }\n\n /**\n * WebGLのコンテキストを取得する。\n *\n * @return WebGLRenderingContextまたはWebGL2RenderingContext\n */\n public getGL(): WebGLRenderingContext | WebGL2RenderingContext {\n return this._gl;\n }\n\n /**\n * レンダーテクスチャを取得する。\n *\n * @return WebGLFramebuffer\n */\n public getRenderTexture(): WebGLFramebuffer {\n return this._renderTexture;\n }\n\n /**\n * カラーバッファを取得する。\n *\n * @return WebGLTexture\n */\n public getColorBuffer(): WebGLTexture {\n return this._colorBuffer;\n }\n\n /**\n * カラーバッファの幅を取得する。\n *\n * @return カラーバッファの幅\n */\n public getBufferWidth(): number {\n return this._bufferWidth;\n }\n\n /**\n * カラーバッファの高さを取得する。\n *\n * @return カラーバッファの高さ\n */\n public getBufferHeight(): number {\n return this._bufferHeight;\n }\n\n /**\n * オフスクリーンサーフェスが有効かどうかを確認する。\n *\n * @return 有効な場合はtrue、無効な場合はfalse\n */\n public isValid(): boolean {\n return this._renderTexture != null;\n }\n\n /**\n * 以前のフレームバッファを取得する。\n *\n * @return 以前のフレームバッファ\n */\n public getOldFBO(): WebGLFramebuffer {\n return this._oldFbo;\n }\n\n /**\n * コンストラクタ\n */\n constructor() {\n this._gl = null;\n this._colorBuffer = null;\n this._renderTexture = null;\n this._bufferWidth = 0;\n this._bufferHeight = 0;\n this._oldFbo = null;\n }\n\n protected _gl: WebGLRenderingContext | WebGL2RenderingContext; // WebGLのコンテキスト\n protected _colorBuffer: WebGLTexture; // カラーバッファ\n protected _renderTexture: WebGLFramebuffer; // フレームバッファ\n protected _bufferWidth: number; // カラーバッファの幅\n protected _bufferHeight: number; // カラーバッファの高さ\n private _oldFbo: WebGLFramebuffer; // 以前のフレームバッファ\n}\n\n// Namespace definition for compatibility.\nimport * as $ from './cubismrendertarget_webgl';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const CubismOffscreenSurface_WebGL = $.CubismRenderTarget_WebGL;\n export type CubismOffscreenSurface_WebGL = $.CubismRenderTarget_WebGL;\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport { CubismMatrix44 } from '../math/cubismmatrix44';\nimport {\n CubismColorBlend,\n CubismModel,\n CubismAlphaBlend\n} from '../model/cubismmodel';\nimport { csmRect } from '../type/csmrectf';\nimport { CubismLogError, CubismLogWarning } from '../utils/cubismdebug';\nimport { CubismRenderTarget_WebGL } from './cubismrendertarget_webgl';\nimport { CubismOffscreenRenderTarget_WebGL } from './cubismoffscreenrendertarget_webgl';\nimport { CubismBlendMode, CubismTextureColor } from './cubismrenderer';\nimport { CubismRenderer_WebGL } from './cubismrenderer_webgl';\n\n// Shader\nconst VertShaderSrcPath = 'vertshadersrc.vert';\nconst VertShaderSrcMaskedPath = 'vertshadersrcmasked.vert';\nconst VertShaderSrcSetupMaskPath = 'vertshadersrcsetupmask.vert';\nconst FragShaderSrcSetupMaskPath = 'fragshadersrcsetupmask.frag';\nconst FragShaderSrcPremultipliedAlphaPath =\n 'fragshadersrcpremultipliedalpha.frag';\nconst FragShaderSrcMaskPremultipliedAlphaPath =\n 'fragshadersrcmaskpremultipliedalpha.frag';\nconst FragShaderSrcMaskInvertedPremultipliedAlphaPath =\n 'fragshadersrcmaskinvertedpremultipliedalpha.frag';\n\n// Copy & Blend Shader\nconst VertShaderSrcCopyPath = 'vertshadersrccopy.vert';\nconst FragShaderSrcCopyPath = 'fragshadersrccopy.frag';\nconst FragShaderSrcColorBlendPath = 'fragshadersrccolorblend.frag';\nconst FragShaderSrcAlphaBlendPath = 'fragshadersrcalphablend.frag';\nconst VertShaderSrcBlendPath = 'vertshadersrcblend.vert';\nconst FragShaderSrcBlendPath = 'fragshadersrcpremultipliedalphablend.frag';\n\n// Blend mode Prefix\nconst ColorBlendPrefix = 'ColorBlend_';\nconst AlphaBlendPrefix = 'AlphaBlend_';\n\nlet s_instance: CubismShaderManager_WebGL; // インスタンス(シングルトン)\n\nconst s_renderTargetVertexArray: Float32Array = new Float32Array([\n -1.0, -1.0, 1.0, -1.0, -1.0, 1.0, 1.0, 1.0\n]);\nconst s_renderTargetUvArray: Float32Array = new Float32Array([\n 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0\n]);\nconst s_renderTargetReverseUvArray = new Float32Array([\n 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0\n]);\n\n/**\n * WebGL用のシェーダープログラムを生成・破棄するクラス\n */\nexport class CubismShader_WebGL {\n /**\n * 非同期でシェーダーをパスから読み込む\n *\n * @param url シェーダーのURL\n *\n * @return シェーダーのソースコード\n */\n private async loadShader(url: string): Promise<string> {\n const response = await fetch(url);\n return await response.text();\n }\n\n /**\n * ブレンドモード用のシェーダーを読み込む\n */\n private async loadShaders(): Promise<void> {\n // _shaderPathがnullまたはundefinedの場合はデフォルトパスを使用\n const shaderDir = this._shaderPath ?? this._defaultShaderPath;\n\n // シェーダーファイルのパスとプロパティの対応\n // NOTE: prop は CubismShader_WebGL に設定された変数名\n const shaderFiles: { path: string; prop: keyof CubismShader_WebGL }[] = [\n { path: shaderDir + VertShaderSrcPath, prop: '_vertShaderSrc' },\n {\n path: shaderDir + VertShaderSrcMaskedPath,\n prop: '_vertShaderSrcMasked'\n },\n {\n path: shaderDir + VertShaderSrcSetupMaskPath,\n prop: '_vertShaderSrcSetupMask'\n },\n {\n path: shaderDir + FragShaderSrcSetupMaskPath,\n prop: '_fragShaderSrcSetupMask'\n },\n {\n path: shaderDir + FragShaderSrcPremultipliedAlphaPath,\n prop: '_fragShaderSrcPremultipliedAlpha'\n },\n {\n path: shaderDir + FragShaderSrcMaskPremultipliedAlphaPath,\n prop: '_fragShaderSrcMaskPremultipliedAlpha'\n },\n {\n path: shaderDir + FragShaderSrcMaskInvertedPremultipliedAlphaPath,\n prop: '_fragShaderSrcMaskInvertedPremultipliedAlpha'\n },\n\n { path: shaderDir + VertShaderSrcCopyPath, prop: '_vertShaderSrcCopy' },\n { path: shaderDir + FragShaderSrcCopyPath, prop: '_fragShaderSrcCopy' },\n {\n path: shaderDir + FragShaderSrcColorBlendPath,\n prop: '_fragShaderSrcColorBlend'\n },\n {\n path: shaderDir + FragShaderSrcAlphaBlendPath,\n prop: '_fragShaderSrcAlphaBlend'\n },\n { path: shaderDir + VertShaderSrcBlendPath, prop: '_vertShaderSrcBlend' },\n { path: shaderDir + FragShaderSrcBlendPath, prop: '_fragShaderSrcBlend' }\n ];\n\n // シェーダーファイルを非同期で読み込み、結果をプロパティに設定\n const results = await Promise.all(\n shaderFiles.map(file =>\n this.loadShader(file.path)\n .then(data => ({ prop: file.prop, data }))\n .catch(error => {\n console.error(`Error loading ${file.path} shader:`, error);\n return { prop: file.prop, data: '' };\n })\n )\n );\n\n // 変数に内容を登録\n results.forEach(result => {\n (this as any)[result.prop] = result.data;\n });\n }\n\n /**\n * コンストラクタ\n */\n public constructor() {\n this._shaderSets = new Array<CubismShaderSet>();\n this._isShaderLoading = false;\n this._isShaderLoaded = false;\n\n // カラーブレンド用のマップ\n this._colorBlendMap = new Map<CubismColorBlend, string>();\n this._colorBlendValues = new Array<CubismColorBlend>();\n\n const colorBlendKeys = Object.keys(CubismColorBlend);\n\n // Object.values() のポリフィル\n const colorBlendRawValues = Object.keys(CubismColorBlend).map(\n k => CubismColorBlend[k as keyof typeof CubismColorBlend]\n );\n\n for (let i = 0; i < colorBlendKeys.length; i++) {\n const colorBlendKey = colorBlendKeys[i];\n\n if (colorBlendKey.includes(ColorBlendPrefix)) {\n const blendModeName = colorBlendKey.slice(ColorBlendPrefix.length);\n\n const colorBlendNumber = parseInt(colorBlendRawValues[i].toString());\n\n this._colorBlendMap.set(colorBlendNumber, blendModeName);\n\n this._colorBlendValues.push(colorBlendNumber);\n }\n }\n\n // アルファブレンド用のマップ\n this._alphaBlendMap = new Map<CubismAlphaBlend, string>();\n this._alphaBlendValues = new Array<CubismAlphaBlend>();\n\n const alphaBlendKeys = Object.keys(CubismAlphaBlend);\n\n // Object.values() のポリフィル\n const alphaBlendRawValues = Object.keys(CubismAlphaBlend).map(\n k => CubismAlphaBlend[k as keyof typeof CubismAlphaBlend]\n );\n\n for (let i = 0; i < alphaBlendKeys.length; i++) {\n const alphaBlendKey = alphaBlendKeys[i];\n\n if (alphaBlendKey.includes(AlphaBlendPrefix)) {\n const blendModeName = alphaBlendKey.slice(AlphaBlendPrefix.length);\n\n const alphaBlendNumber = parseInt(alphaBlendRawValues[i].toString());\n\n this._alphaBlendMap.set(alphaBlendNumber, blendModeName);\n\n this._alphaBlendValues.push(alphaBlendNumber);\n }\n }\n\n this._blendShaderSetMap = new Map<string, number>();\n\n this._shaderCount =\n ShaderNames.ShaderNames_ShaderCount +\n 1 +\n (this._colorBlendValues.length - 3) *\n (this._alphaBlendValues.length - 1) *\n 3;\n // シェーダーの数 =\n // (マスク生成用 + (通常用 + 加算 + 乗算) * (マスク無の乗算済アルファ対応版 + マスク有の乗算済アルファ対応版 + マスク有反転の乗算済アルファ対応版))\n // + 1(コピー用のシェーダー)\n // + カラーブレンドの数(後方互換とNone除く) * アルファブレンドの数(None除く) * (通常 + マスク + 反転マスク)\n\n this._defaultShaderPath = '../../Framework/Shaders/WebGL/';\n this._shaderPath = this._defaultShaderPath;\n }\n\n /**\n * デストラクタ相当の処理\n */\n public release(): void {\n this.releaseShaderProgram();\n }\n\n /**\n * 描画用のシェーダプログラムの一連のセットアップを実行する\n *\n * @param renderer レンダラー\n * @param model 描画対象のモデル\n * @param index 描画対象のメッシュのインデックス\n */\n public setupShaderProgramForDrawable(\n renderer: CubismRenderer_WebGL,\n model: Readonly<CubismModel>,\n index: number\n ): void {\n if (!renderer.isPremultipliedAlpha()) {\n CubismLogError('NoPremultipliedAlpha is not allowed');\n }\n\n if (this._shaderSets.length == 0) {\n this.generateShaders();\n }\n\n if (this._isShaderLoaded == false) {\n CubismLogWarning('Shader program is not initialized.');\n return;\n }\n\n // Blending\n let srcColor: number;\n let dstColor: number;\n let srcAlpha: number;\n let dstAlpha: number;\n\n // _shaderSets用のオフセット計算\n const masked: boolean =\n renderer.getClippingContextBufferForDrawable() != null; // この描画オブジェクトはマスク対象か\n const invertedMask: boolean = model.getDrawableInvertedMaskBit(index);\n const offset: number = masked ? (invertedMask ? 2 : 1) : 0;\n\n let shaderSet: CubismShaderSet;\n // Cubism 5.2以前のシェーダを使用する場合はtrue\n let isUsingCompatible: boolean = true;\n\n if (model.isBlendModeEnabled()) {\n const colorBlendMode: CubismColorBlend =\n model.getDrawableColorBlend(index);\n const alphaBlendMode: CubismAlphaBlend =\n model.getDrawableAlphaBlend(index);\n\n if (\n colorBlendMode == CubismColorBlend.ColorBlend_None ||\n alphaBlendMode == CubismAlphaBlend.AlphaBlend_None ||\n (colorBlendMode == CubismColorBlend.ColorBlend_Normal &&\n alphaBlendMode == CubismAlphaBlend.AlphaBlend_Over)\n ) {\n // Cubism 5.2以前のシェーダを使用する。\n shaderSet =\n this._shaderSets[\n ShaderNames.ShaderNames_NormalPremultipliedAlpha + offset\n ];\n\n srcColor = this.gl.ONE;\n dstColor = this.gl.ONE_MINUS_SRC_ALPHA;\n srcAlpha = this.gl.ONE;\n dstAlpha = this.gl.ONE_MINUS_SRC_ALPHA;\n } else {\n switch (colorBlendMode) {\n // Cubism 5.2以前のシェーダを使用する。\n case CubismColorBlend.ColorBlend_AddCompatible:\n shaderSet =\n this._shaderSets[\n ShaderNames.ShaderNames_AddPremultipliedAlpha + offset\n ];\n srcColor = this.gl.ONE;\n dstColor = this.gl.ONE;\n srcAlpha = this.gl.ZERO;\n dstAlpha = this.gl.ONE;\n break;\n // Cubism 5.2以前のシェーダを使用する。\n case CubismColorBlend.ColorBlend_MultiplyCompatible:\n shaderSet =\n this._shaderSets[\n ShaderNames.ShaderNames_MultPremultipliedAlpha + offset\n ];\n srcColor = this.gl.DST_COLOR;\n dstColor = this.gl.ONE_MINUS_SRC_ALPHA;\n srcAlpha = this.gl.ZERO;\n dstAlpha = this.gl.ONE;\n break;\n // ブレンドモードの組み合わせでシェーダーを決定\n default:\n {\n const srcBuffer =\n renderer._currentOffscreen != null\n ? renderer._currentOffscreen\n : renderer.getModelRenderTarget(0);\n\n // 先にコピーを行う\n CubismRenderTarget_WebGL.copyBuffer(\n this.gl as WebGL2RenderingContext,\n srcBuffer,\n renderer.getModelRenderTarget(1)\n );\n const baseShaderSetIndex = this._blendShaderSetMap.get(\n this._colorBlendMap.get(colorBlendMode) +\n this._alphaBlendMap.get(alphaBlendMode)\n );\n shaderSet = this._shaderSets[baseShaderSetIndex + offset];\n srcColor = this.gl.ONE;\n dstColor = this.gl.ZERO;\n srcAlpha = this.gl.ONE;\n dstAlpha = this.gl.ZERO;\n isUsingCompatible = false;\n }\n break;\n }\n }\n } else {\n // Cubism 5.2以前のシェーダを使用する。\n switch (model.getDrawableBlendMode(index)) {\n case CubismBlendMode.CubismBlendMode_Normal:\n default:\n shaderSet =\n this._shaderSets[\n ShaderNames.ShaderNames_NormalPremultipliedAlpha + offset\n ];\n srcColor = this.gl.ONE;\n dstColor = this.gl.ONE_MINUS_SRC_ALPHA;\n srcAlpha = this.gl.ONE;\n dstAlpha = this.gl.ONE_MINUS_SRC_ALPHA;\n break;\n\n case CubismBlendMode.CubismBlendMode_Additive:\n shaderSet =\n this._shaderSets[\n ShaderNames.ShaderNames_AddPremultipliedAlpha + offset\n ];\n srcColor = this.gl.ONE;\n dstColor = this.gl.ONE;\n srcAlpha = this.gl.ZERO;\n dstAlpha = this.gl.ONE;\n break;\n\n case CubismBlendMode.CubismBlendMode_Multiplicative:\n shaderSet =\n this._shaderSets[\n ShaderNames.ShaderNames_MultPremultipliedAlpha + offset\n ];\n srcColor = this.gl.DST_COLOR;\n dstColor = this.gl.ONE_MINUS_SRC_ALPHA;\n srcAlpha = this.gl.ZERO;\n dstAlpha = this.gl.ONE;\n break;\n }\n }\n\n this.gl.useProgram(shaderSet.shaderProgram);\n\n // 頂点配列の設定\n if (renderer._bufferData.vertex == null) {\n renderer._bufferData.vertex = this.gl.createBuffer();\n }\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, renderer._bufferData.vertex);\n\n // 頂点配列の設定\n const vertexArray: Float32Array = model.getDrawableVertices(index);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, vertexArray, this.gl.DYNAMIC_DRAW);\n this.gl.enableVertexAttribArray(shaderSet.attributePositionLocation);\n this.gl.vertexAttribPointer(\n shaderSet.attributePositionLocation,\n 2,\n this.gl.FLOAT,\n false,\n 0,\n 0\n );\n\n // テクスチャ頂点の設定\n if (renderer._bufferData.uv == null) {\n renderer._bufferData.uv = this.gl.createBuffer();\n }\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, renderer._bufferData.uv);\n const uvArray: Float32Array = model.getDrawableVertexUvs(index);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, uvArray, this.gl.DYNAMIC_DRAW);\n this.gl.enableVertexAttribArray(shaderSet.attributeTexCoordLocation);\n this.gl.vertexAttribPointer(\n shaderSet.attributeTexCoordLocation,\n 2,\n this.gl.FLOAT,\n false,\n 0,\n 0\n );\n\n if (masked) {\n this.gl.activeTexture(this.gl.TEXTURE1);\n\n // frameBufferに書かれたテクスチャ\n const tex: WebGLTexture = renderer\n .getDrawableMaskBuffer(\n renderer.getClippingContextBufferForDrawable()._bufferIndex\n )\n .getColorBuffer();\n this.gl.bindTexture(this.gl.TEXTURE_2D, tex);\n this.gl.uniform1i(shaderSet.samplerTexture1Location, 1);\n\n // view座標をClippingContextの座標に変換するための行列を設定\n this.gl.uniformMatrix4fv(\n shaderSet.uniformClipMatrixLocation,\n false,\n renderer.getClippingContextBufferForDrawable()._matrixForDraw.getArray()\n );\n\n // 使用するカラーチャンネルを設定\n const channelIndex: number =\n renderer.getClippingContextBufferForDrawable()._layoutChannelIndex;\n const colorChannel: CubismTextureColor = renderer\n .getClippingContextBufferForDrawable()\n .getClippingManager()\n .getChannelFlagAsColor(channelIndex);\n this.gl.uniform4f(\n shaderSet.uniformChannelFlagLocation,\n colorChannel.r,\n colorChannel.g,\n colorChannel.b,\n colorChannel.a\n );\n\n if (model.isBlendModeEnabled()) {\n this.gl.uniform1f(\n shaderSet.uniformInvertMaskFlagLocation,\n invertedMask ? 1.0 : 0.0\n );\n }\n }\n\n // テクスチャ設定\n const textureNo: number = model.getDrawableTextureIndex(index);\n const textureId: WebGLTexture = renderer.getBindedTextures().get(textureNo);\n this.gl.activeTexture(this.gl.TEXTURE0);\n this.gl.bindTexture(this.gl.TEXTURE_2D, textureId);\n this.gl.uniform1i(shaderSet.samplerTexture0Location, 0);\n\n //座標変換\n const matrix4x4: CubismMatrix44 = renderer.getMvpMatrix();\n this.gl.uniformMatrix4fv(\n shaderSet.uniformMatrixLocation,\n false,\n matrix4x4.getArray()\n );\n\n //ベース色の取得\n let baseColor: CubismTextureColor = null;\n\n if (model.isBlendModeEnabled()) {\n // ブレンドモードではモデルカラーは最後に処理するため不透明度のみ対応させる\n const drawableOpacity = model.getDrawableOpacity(index);\n baseColor = new CubismTextureColor(\n drawableOpacity,\n drawableOpacity,\n drawableOpacity,\n drawableOpacity\n );\n } else {\n baseColor = renderer.getModelColorWithOpacity(\n model.getDrawableOpacity(index)\n );\n }\n\n const multiplyAndScreenColor = model.getOverrideMultiplyAndScreenColor();\n const multiplyColor: CubismTextureColor =\n multiplyAndScreenColor.getDrawableMultiplyColor(index);\n const screenColor: CubismTextureColor =\n multiplyAndScreenColor.getDrawableScreenColor(index);\n\n this.gl.uniform4f(\n shaderSet.uniformBaseColorLocation,\n baseColor.r,\n baseColor.g,\n baseColor.b,\n baseColor.a\n );\n\n this.gl.uniform4f(\n shaderSet.uniformMultiplyColorLocation,\n multiplyColor.r,\n multiplyColor.g,\n multiplyColor.b,\n multiplyColor.a\n );\n\n this.gl.uniform4f(\n shaderSet.uniformScreenColorLocation,\n screenColor.r,\n screenColor.g,\n screenColor.b,\n screenColor.a\n );\n\n // Cubism 5.3以降のシェーダを使用する場合\n if (model.isBlendModeEnabled()) {\n this.gl.activeTexture(this.gl.TEXTURE2);\n\n // Cubism 5.2以前のシェーダを使用する場合は不要なのでこの処理をスキップ\n if (!isUsingCompatible) {\n const tex: WebGLTexture = renderer\n .getModelRenderTarget(1)\n .getColorBuffer();\n this.gl.bindTexture(this.gl.TEXTURE_2D, tex);\n this.gl.uniform1i(shaderSet.samplerFrameBufferTextureLocation, 2);\n }\n }\n\n // IBOを作成し、データを転送\n if (renderer._bufferData.index == null) {\n renderer._bufferData.index = this.gl.createBuffer();\n }\n const indexArray: Uint16Array = model.getDrawableVertexIndices(index);\n\n this.gl.bindBuffer(\n this.gl.ELEMENT_ARRAY_BUFFER,\n renderer._bufferData.index\n );\n this.gl.bufferData(\n this.gl.ELEMENT_ARRAY_BUFFER,\n indexArray,\n this.gl.DYNAMIC_DRAW\n );\n\n this.gl.blendFuncSeparate(srcColor, dstColor, srcAlpha, dstAlpha);\n }\n\n /**\n * オフスクリーン用のシェーダプログラムの一連のセットアップを実行する\n *\n * @param renderer レンダラー\n * @param model 描画対象のモデル\n * @param offscreen 描画対象のオフスクリーン\n */\n public setupShaderProgramForOffscreen(\n renderer: CubismRenderer_WebGL,\n model: Readonly<CubismModel>,\n offscreen: CubismOffscreenRenderTarget_WebGL\n ): void {\n if (!renderer.isPremultipliedAlpha()) {\n CubismLogError('NoPremultipliedAlpha is not allowed');\n }\n\n if (this._shaderSets.length == 0) {\n this.generateShaders();\n }\n\n if (this._isShaderLoaded == false) {\n CubismLogWarning('Shader program is not initialized.');\n return;\n }\n\n // Blending\n let srcColor: number;\n let dstColor: number;\n let srcAlpha: number;\n let dstAlpha: number;\n\n const offscreenIndex: number = offscreen.getOffscreenIndex();\n // _shaderSets用のオフセット計算\n const masked: boolean =\n renderer.getClippingContextBufferForOffscreen() != null; // この描画オブジェクトはマスク対象か\n const invertedMask: boolean =\n model.getOffscreenInvertedMask(offscreenIndex);\n const offset: number = masked ? (invertedMask ? 2 : 1) : 0;\n\n let shaderSet: CubismShaderSet;\n // Cubism 5.2以前のシェーダを使用する場合はtrue\n let isUsingCompatible: boolean = true;\n\n const colorBlendMode: CubismColorBlend =\n model.getOffscreenColorBlend(offscreenIndex);\n const alphaBlendMode: CubismAlphaBlend =\n model.getOffscreenAlphaBlend(offscreenIndex);\n\n if (\n colorBlendMode == CubismColorBlend.ColorBlend_None ||\n alphaBlendMode == CubismAlphaBlend.AlphaBlend_None ||\n (colorBlendMode == CubismColorBlend.ColorBlend_Normal &&\n alphaBlendMode == CubismAlphaBlend.AlphaBlend_Over)\n ) {\n // Cubism 5.2以前のシェーダを使用する。\n shaderSet =\n this._shaderSets[\n ShaderNames.ShaderNames_NormalPremultipliedAlpha + offset\n ];\n\n srcColor = this.gl.ONE;\n dstColor = this.gl.ONE_MINUS_SRC_ALPHA;\n srcAlpha = this.gl.ONE;\n dstAlpha = this.gl.ONE_MINUS_SRC_ALPHA;\n } else {\n switch (colorBlendMode as CubismColorBlend) {\n // Cubism 5.2以前のシェーダを使用する。\n case CubismColorBlend.ColorBlend_AddCompatible:\n shaderSet =\n this._shaderSets[\n ShaderNames.ShaderNames_AddPremultipliedAlpha + offset\n ];\n srcColor = this.gl.ONE;\n dstColor = this.gl.ONE;\n srcAlpha = this.gl.ZERO;\n dstAlpha = this.gl.ONE;\n break;\n case CubismColorBlend.ColorBlend_MultiplyCompatible:\n shaderSet =\n this._shaderSets[\n ShaderNames.ShaderNames_MultPremultipliedAlpha + offset\n ];\n srcColor = this.gl.DST_COLOR;\n dstColor = this.gl.ONE_MINUS_SRC_ALPHA;\n srcAlpha = this.gl.ZERO;\n dstAlpha = this.gl.ONE;\n break;\n default:\n {\n const srcBuffer =\n offscreen.getOldOffscreen() != null\n ? offscreen.getOldOffscreen()\n : renderer.getModelRenderTarget(0);\n\n // 先にコピーを行う\n CubismRenderTarget_WebGL.copyBuffer(\n this.gl as WebGL2RenderingContext,\n srcBuffer,\n renderer.getModelRenderTarget(1)\n );\n const baseShaderSetIndex = this._blendShaderSetMap.get(\n this._colorBlendMap.get(colorBlendMode) +\n this._alphaBlendMap.get(alphaBlendMode)\n );\n shaderSet = this._shaderSets[baseShaderSetIndex + offset];\n srcColor = this.gl.ONE;\n dstColor = this.gl.ZERO;\n srcAlpha = this.gl.ONE;\n dstAlpha = this.gl.ZERO;\n isUsingCompatible = false;\n }\n break;\n }\n }\n\n this.gl.useProgram(shaderSet.shaderProgram);\n\n // 頂点配列の設定\n CubismRenderTarget_WebGL.copyBuffer(\n this.gl as WebGL2RenderingContext,\n offscreen,\n renderer.getModelRenderTarget(2)\n );\n this.gl.activeTexture(this.gl.TEXTURE0);\n const tex0 = renderer.getModelRenderTarget(2).getColorBuffer();\n this.gl.bindTexture(this.gl.TEXTURE_2D, tex0);\n this.gl.uniform1i(shaderSet.samplerTexture0Location, 0);\n\n //座標変換\n const matrix4x4: CubismMatrix44 = new CubismMatrix44();\n matrix4x4.loadIdentity();\n this.gl.uniformMatrix4fv(\n shaderSet.uniformMatrixLocation,\n false,\n matrix4x4.getArray()\n );\n\n // ベース色の取得\n const offscreenOpacity = model.getOffscreenOpacity(offscreenIndex);\n // 乗算済みアルファを使用するのでオフスクリーンの透明度を 1.0 に乗算した状態\n const baseColor: CubismTextureColor = new CubismTextureColor(\n offscreenOpacity,\n offscreenOpacity,\n offscreenOpacity,\n offscreenOpacity\n );\n\n const multiplyAndScreenColor = model.getOverrideMultiplyAndScreenColor();\n const multiplyColor: CubismTextureColor =\n multiplyAndScreenColor.getOffscreenMultiplyColor(offscreenIndex);\n const screenColor: CubismTextureColor =\n multiplyAndScreenColor.getOffscreenScreenColor(offscreenIndex);\n\n this.gl.uniform4f(\n shaderSet.uniformBaseColorLocation,\n baseColor.r,\n baseColor.g,\n baseColor.b,\n baseColor.a\n );\n\n this.gl.uniform4f(\n shaderSet.uniformMultiplyColorLocation,\n multiplyColor.r,\n multiplyColor.g,\n multiplyColor.b,\n multiplyColor.a\n );\n\n this.gl.uniform4f(\n shaderSet.uniformScreenColorLocation,\n screenColor.r,\n screenColor.g,\n screenColor.b,\n screenColor.a\n );\n\n this.gl.activeTexture(this.gl.TEXTURE2);\n\n // Cubism 5.2以前のシェーダを使用する場合は不要なのでこの処理をスキップ\n if (!isUsingCompatible) {\n const tex1: WebGLTexture = renderer\n .getModelRenderTarget(1)\n .getColorBuffer();\n this.gl.bindTexture(this.gl.TEXTURE_2D, tex1);\n this.gl.uniform1i(shaderSet.samplerFrameBufferTextureLocation, 2);\n }\n\n if (masked) {\n this.gl.activeTexture(this.gl.TEXTURE1);\n\n // frameBufferに書かれたテクスチャ\n const tex2: WebGLTexture = renderer\n .getOffscreenMaskBuffer(\n renderer.getClippingContextBufferForOffscreen()._bufferIndex\n )\n .getColorBuffer();\n this.gl.bindTexture(this.gl.TEXTURE_2D, tex2);\n this.gl.uniform1i(shaderSet.samplerTexture1Location, 1);\n\n // view座標をClippingContextの座標に変換するための行列を設定\n this.gl.uniformMatrix4fv(\n shaderSet.uniformClipMatrixLocation,\n false,\n renderer\n .getClippingContextBufferForOffscreen()\n ._matrixForDraw.getArray()\n );\n\n // 使用するカラーチャンネルを設定\n const channelIndex: number =\n renderer.getClippingContextBufferForOffscreen()._layoutChannelIndex;\n const colorChannel: CubismTextureColor = renderer\n .getClippingContextBufferForOffscreen()\n .getClippingManager()\n .getChannelFlagAsColor(channelIndex);\n this.gl.uniform4f(\n shaderSet.uniformChannelFlagLocation,\n colorChannel.r,\n colorChannel.g,\n colorChannel.b,\n colorChannel.a\n );\n\n if (model.isBlendModeEnabled()) {\n this.gl.uniform1f(\n shaderSet.uniformInvertMaskFlagLocation,\n invertedMask ? 1.0 : 0.0\n );\n }\n }\n\n // 頂点位置属性の設定\n if (!renderer._bufferData.vertex) {\n renderer._bufferData.vertex = this.gl.createBuffer();\n }\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, renderer._bufferData.vertex);\n this.gl.bufferData(\n this.gl.ARRAY_BUFFER,\n s_renderTargetVertexArray,\n this.gl.STATIC_DRAW\n );\n this.gl.enableVertexAttribArray(shaderSet.attributePositionLocation);\n this.gl.vertexAttribPointer(\n shaderSet.attributePositionLocation,\n 2,\n this.gl.FLOAT,\n false,\n Float32Array.BYTES_PER_ELEMENT * 2,\n 0\n );\n\n // テクスチャ座標属性の設定\n if (!renderer._bufferData.uv) {\n renderer._bufferData.uv = this.gl.createBuffer();\n }\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, renderer._bufferData.uv);\n this.gl.bufferData(\n this.gl.ARRAY_BUFFER,\n s_renderTargetReverseUvArray,\n this.gl.STATIC_DRAW\n );\n this.gl.enableVertexAttribArray(shaderSet.attributeTexCoordLocation);\n this.gl.vertexAttribPointer(\n shaderSet.attributeTexCoordLocation,\n 2,\n this.gl.FLOAT,\n false,\n Float32Array.BYTES_PER_ELEMENT * 2,\n 0\n );\n\n this.gl.blendFuncSeparate(srcColor, dstColor, srcAlpha, dstAlpha);\n }\n\n /**\n * マスク用のシェーダプログラムの一連のセットアップを実行する\n *\n * @param renderer レンダラー\n * @param model 描画対象のモデル\n * @param index 描画対象のメッシュのインデックス\n */\n public setupShaderProgramForMask(\n renderer: CubismRenderer_WebGL,\n model: Readonly<CubismModel>,\n index: number\n ): void {\n if (!renderer.isPremultipliedAlpha()) {\n CubismLogError('NoPremultipliedAlpha is not allowed');\n }\n\n if (this._shaderSets.length == 0) {\n this.generateShaders();\n }\n\n if (this._isShaderLoaded == false) {\n CubismLogWarning('Shader program is not initialized.');\n return;\n }\n\n const shaderSet: CubismShaderSet =\n this._shaderSets[ShaderNames.ShaderNames_SetupMask];\n this.gl.useProgram(shaderSet.shaderProgram);\n\n // 頂点配列の設定\n if (renderer._bufferData.vertex == null) {\n renderer._bufferData.vertex = this.gl.createBuffer();\n }\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, renderer._bufferData.vertex);\n const vertexArray: Float32Array = model.getDrawableVertices(index);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, vertexArray, this.gl.DYNAMIC_DRAW);\n this.gl.enableVertexAttribArray(shaderSet.attributePositionLocation);\n this.gl.vertexAttribPointer(\n shaderSet.attributePositionLocation,\n 2,\n this.gl.FLOAT,\n false,\n 0,\n 0\n );\n\n //テクスチャ設定\n if (renderer._bufferData.uv == null) {\n renderer._bufferData.uv = this.gl.createBuffer();\n }\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, renderer._bufferData.uv);\n const textureNo: number = model.getDrawableTextureIndex(index);\n const textureId: WebGLTexture = renderer.getBindedTextures().get(textureNo);\n this.gl.activeTexture(this.gl.TEXTURE0);\n this.gl.bindTexture(this.gl.TEXTURE_2D, textureId);\n this.gl.uniform1i(shaderSet.samplerTexture0Location, 0);\n\n // テクスチャ頂点の設定\n if (renderer._bufferData.uv == null) {\n renderer._bufferData.uv = this.gl.createBuffer();\n }\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, renderer._bufferData.uv);\n const uvArray: Float32Array = model.getDrawableVertexUvs(index);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, uvArray, this.gl.DYNAMIC_DRAW);\n this.gl.enableVertexAttribArray(shaderSet.attributeTexCoordLocation);\n this.gl.vertexAttribPointer(\n shaderSet.attributeTexCoordLocation,\n 2,\n this.gl.FLOAT,\n false,\n 0,\n 0\n );\n\n // チャンネル\n const channelIndex: number =\n renderer.getClippingContextBufferForMask()._layoutChannelIndex;\n const colorChannel: CubismTextureColor = renderer\n .getClippingContextBufferForMask()\n .getClippingManager()\n .getChannelFlagAsColor(channelIndex);\n this.gl.uniform4f(\n shaderSet.uniformChannelFlagLocation,\n colorChannel.r,\n colorChannel.g,\n colorChannel.b,\n colorChannel.a\n );\n\n this.gl.uniformMatrix4fv(\n shaderSet.uniformClipMatrixLocation,\n false,\n renderer.getClippingContextBufferForMask()._matrixForMask.getArray()\n );\n\n const rect: csmRect =\n renderer.getClippingContextBufferForMask()._layoutBounds;\n\n this.gl.uniform4f(\n shaderSet.uniformBaseColorLocation,\n rect.x * 2.0 - 1.0,\n rect.y * 2.0 - 1.0,\n rect.getRight() * 2.0 - 1.0,\n rect.getBottom() * 2.0 - 1.0\n );\n\n // Blending\n const srcColor: number = this.gl.ZERO;\n const dstColor: number = this.gl.ONE_MINUS_SRC_COLOR;\n const srcAlpha: number = this.gl.ZERO;\n const dstAlpha: number = this.gl.ONE_MINUS_SRC_ALPHA;\n\n // IBOを作成し、データを転送\n if (renderer._bufferData.index == null) {\n renderer._bufferData.index = this.gl.createBuffer();\n }\n const indexArray: Uint16Array = model.getDrawableVertexIndices(index);\n\n this.gl.bindBuffer(\n this.gl.ELEMENT_ARRAY_BUFFER,\n renderer._bufferData.index\n );\n this.gl.bufferData(\n this.gl.ELEMENT_ARRAY_BUFFER,\n indexArray,\n this.gl.DYNAMIC_DRAW\n );\n\n this.gl.blendFuncSeparate(srcColor, dstColor, srcAlpha, dstAlpha);\n }\n\n /**\n * オフスクリーンのレンダリングターゲット用のシェーダープログラムを設定する\n *\n * @param renderer レンダラー\n */\n public setupShaderProgramForOffscreenRenderTarget(\n renderer: CubismRenderer_WebGL\n ): void {\n if (this._shaderSets.length == 0) {\n this.generateShaders();\n }\n\n if (this._isShaderLoaded == false) {\n CubismLogWarning('Shader program is not initialized.');\n return;\n }\n\n // この時点のテクスチャはPMAになっているはずなので計算を行う\n const baseColor = renderer.getModelColor();\n baseColor.r *= baseColor.a;\n baseColor.g *= baseColor.a;\n baseColor.b *= baseColor.a;\n this.copyTexture(renderer, baseColor);\n }\n\n /**\n * オフスクリーンのレンダリングターゲットの内容をコピーする\n *\n * @param renderer レンダラー\n * @param baseColor ベースカラー\n */\n public copyTexture(\n renderer: CubismRenderer_WebGL,\n baseColor: CubismTextureColor\n ) {\n // Blending\n const srcColor = this.gl.ONE;\n const dstColor = this.gl.ONE_MINUS_SRC_ALPHA;\n const srcAlpha = this.gl.ONE;\n const dstAlpha = this.gl.ONE_MINUS_SRC_ALPHA;\n\n const shaderSet = this._shaderSets[10]; // ShaderNames_Copy = 10\n\n this.gl.useProgram(shaderSet.shaderProgram);\n\n this.gl.uniform4f(\n shaderSet.uniformBaseColorLocation,\n baseColor.r,\n baseColor.g,\n baseColor.b,\n baseColor.a\n );\n\n // オフスクリーンの内容を設定\n this.gl.activeTexture(this.gl.TEXTURE0);\n const tex = renderer.getModelRenderTarget(0).getColorBuffer();\n this.gl.bindTexture(this.gl.TEXTURE_2D, tex);\n this.gl.uniform1i(shaderSet.samplerTexture0Location, 0);\n\n // 頂点位置属性の設定\n if (!renderer._bufferData.vertex) {\n renderer._bufferData.vertex = this.gl.createBuffer();\n }\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, renderer._bufferData.vertex);\n this.gl.bufferData(\n this.gl.ARRAY_BUFFER,\n s_renderTargetVertexArray,\n this.gl.STATIC_DRAW\n );\n this.gl.enableVertexAttribArray(shaderSet.attributePositionLocation);\n this.gl.vertexAttribPointer(\n shaderSet.attributePositionLocation,\n 2,\n this.gl.FLOAT,\n false,\n Float32Array.BYTES_PER_ELEMENT * 2,\n 0\n );\n\n // テクスチャ座標属性の設定\n if (!renderer._bufferData.uv) {\n renderer._bufferData.uv = this.gl.createBuffer();\n }\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, renderer._bufferData.uv);\n this.gl.bufferData(\n this.gl.ARRAY_BUFFER,\n s_renderTargetUvArray,\n this.gl.STATIC_DRAW\n );\n this.gl.enableVertexAttribArray(shaderSet.attributeTexCoordLocation);\n this.gl.vertexAttribPointer(\n shaderSet.attributeTexCoordLocation,\n 2,\n this.gl.FLOAT,\n false,\n Float32Array.BYTES_PER_ELEMENT * 2,\n 0\n );\n\n this.gl.blendFuncSeparate(srcColor, dstColor, srcAlpha, dstAlpha);\n }\n\n /**\n * シェーダープログラムを解放する\n */\n public releaseShaderProgram(): void {\n for (let i = 0; i < this._shaderSets.length; i++) {\n this.gl.deleteProgram(this._shaderSets[i].shaderProgram);\n this._shaderSets[i].shaderProgram = 0;\n this._shaderSets[i] = void 0;\n this._shaderSets[i] = null;\n }\n }\n\n /**\n * シェーダープログラムを初期化する\n *\n * @param vertShaderSrc 頂点シェーダのソース\n * @param fragShaderSrc フラグメントシェーダのソース\n */\n public generateShaders(): void {\n if (this._isShaderLoading) {\n return;\n }\n this._isShaderLoading = true;\n this._isShaderLoaded = false;\n this._shaderSets.length = this._shaderCount;\n for (let i = 0; i < this._shaderCount; i++) {\n this._shaderSets[i] = new CubismShaderSet();\n }\n\n // シェーダーのソースの読み込み\n this.loadShaders()\n .then(() => {\n // NOTE: ファイルの読み込みを待つ必要があるためこのようにする\n this.registerShader(); // 通常シェーダーの登録\n this.registerBlendShader(); // ブレンドモードシェーダーの登録\n this._isShaderLoading = false;\n this._isShaderLoaded = true;\n })\n .catch(error => {\n this._isShaderLoading = false;\n console.error('Failed to load shaders:', error);\n });\n }\n\n /**\n * シェーダープログラムを登録する\n */\n public registerShader(): void {\n const vertexShaderSrc = this._vertShaderSrc;\n const vertexShaderSrcMasked = this._vertShaderSrcMasked;\n const vertexShaderSrcSetupMask = this._vertShaderSrcSetupMask;\n const fragmentShaderSrcSetupMask = this._fragShaderSrcSetupMask;\n const fragmentShaderSrcPremultipliedAlpha =\n this._fragShaderSrcPremultipliedAlpha;\n const fragmentShaderSrcMaskPremultipliedAlpha =\n this._fragShaderSrcMaskPremultipliedAlpha;\n const fragmentShaderSrcMaskInvertedPremultipliedAlpha =\n this._fragShaderSrcMaskInvertedPremultipliedAlpha;\n\n this._shaderSets[0].shaderProgram = this.loadShaderProgram(\n vertexShaderSrcSetupMask,\n fragmentShaderSrcSetupMask\n );\n this._shaderSets[1].shaderProgram = this.loadShaderProgram(\n vertexShaderSrc,\n fragmentShaderSrcPremultipliedAlpha\n );\n this._shaderSets[2].shaderProgram = this.loadShaderProgram(\n vertexShaderSrcMasked,\n fragmentShaderSrcMaskPremultipliedAlpha\n );\n this._shaderSets[3].shaderProgram = this.loadShaderProgram(\n vertexShaderSrcMasked,\n fragmentShaderSrcMaskInvertedPremultipliedAlpha\n );\n\n // 加算も通常と同じシェーダーを利用する\n this._shaderSets[4].shaderProgram = this._shaderSets[1].shaderProgram;\n this._shaderSets[5].shaderProgram = this._shaderSets[2].shaderProgram;\n this._shaderSets[6].shaderProgram = this._shaderSets[3].shaderProgram;\n\n // 乗算も通常と同じシェーダーを利用する\n this._shaderSets[7].shaderProgram = this._shaderSets[1].shaderProgram;\n this._shaderSets[8].shaderProgram = this._shaderSets[2].shaderProgram;\n this._shaderSets[9].shaderProgram = this._shaderSets[3].shaderProgram;\n\n // SetupMask\n this._shaderSets[0].attributePositionLocation = this.gl.getAttribLocation(\n this._shaderSets[0].shaderProgram,\n 'a_position'\n );\n this._shaderSets[0].attributeTexCoordLocation = this.gl.getAttribLocation(\n this._shaderSets[0].shaderProgram,\n 'a_texCoord'\n );\n this._shaderSets[0].samplerTexture0Location = this.gl.getUniformLocation(\n this._shaderSets[0].shaderProgram,\n 's_texture0'\n );\n this._shaderSets[0].uniformClipMatrixLocation = this.gl.getUniformLocation(\n this._shaderSets[0].shaderProgram,\n 'u_clipMatrix'\n );\n this._shaderSets[0].uniformChannelFlagLocation = this.gl.getUniformLocation(\n this._shaderSets[0].shaderProgram,\n 'u_channelFlag'\n );\n this._shaderSets[0].uniformBaseColorLocation = this.gl.getUniformLocation(\n this._shaderSets[0].shaderProgram,\n 'u_baseColor'\n );\n\n // 通常(PremultipliedAlpha)\n this._shaderSets[1].attributePositionLocation = this.gl.getAttribLocation(\n this._shaderSets[1].shaderProgram,\n 'a_position'\n );\n this._shaderSets[1].attributeTexCoordLocation = this.gl.getAttribLocation(\n this._shaderSets[1].shaderProgram,\n 'a_texCoord'\n );\n this._shaderSets[1].samplerTexture0Location = this.gl.getUniformLocation(\n this._shaderSets[1].shaderProgram,\n 's_texture0'\n );\n this._shaderSets[1].uniformMatrixLocation = this.gl.getUniformLocation(\n this._shaderSets[1].shaderProgram,\n 'u_matrix'\n );\n this._shaderSets[1].uniformBaseColorLocation = this.gl.getUniformLocation(\n this._shaderSets[1].shaderProgram,\n 'u_baseColor'\n );\n this._shaderSets[1].uniformMultiplyColorLocation =\n this.gl.getUniformLocation(\n this._shaderSets[1].shaderProgram,\n 'u_multiplyColor'\n );\n this._shaderSets[1].uniformScreenColorLocation = this.gl.getUniformLocation(\n this._shaderSets[1].shaderProgram,\n 'u_screenColor'\n );\n\n // 通常(クリッピング、PremultipliedAlpha)\n this._shaderSets[2].attributePositionLocation = this.gl.getAttribLocation(\n this._shaderSets[2].shaderProgram,\n 'a_position'\n );\n this._shaderSets[2].attributeTexCoordLocation = this.gl.getAttribLocation(\n this._shaderSets[2].shaderProgram,\n 'a_texCoord'\n );\n this._shaderSets[2].samplerTexture0Location = this.gl.getUniformLocation(\n this._shaderSets[2].shaderProgram,\n 's_texture0'\n );\n this._shaderSets[2].samplerTexture1Location = this.gl.getUniformLocation(\n this._shaderSets[2].shaderProgram,\n 's_texture1'\n );\n this._shaderSets[2].uniformMatrixLocation = this.gl.getUniformLocation(\n this._shaderSets[2].shaderProgram,\n 'u_matrix'\n );\n this._shaderSets[2].uniformClipMatrixLocation = this.gl.getUniformLocation(\n this._shaderSets[2].shaderProgram,\n 'u_clipMatrix'\n );\n this._shaderSets[2].uniformChannelFlagLocation = this.gl.getUniformLocation(\n this._shaderSets[2].shaderProgram,\n 'u_channelFlag'\n );\n this._shaderSets[2].uniformBaseColorLocation = this.gl.getUniformLocation(\n this._shaderSets[2].shaderProgram,\n 'u_baseColor'\n );\n this._shaderSets[2].uniformMultiplyColorLocation =\n this.gl.getUniformLocation(\n this._shaderSets[2].shaderProgram,\n 'u_multiplyColor'\n );\n this._shaderSets[2].uniformScreenColorLocation = this.gl.getUniformLocation(\n this._shaderSets[2].shaderProgram,\n 'u_screenColor'\n );\n\n // 通常(クリッピング・反転, PremultipliedAlpha)\n this._shaderSets[3].attributePositionLocation = this.gl.getAttribLocation(\n this._shaderSets[3].shaderProgram,\n 'a_position'\n );\n this._shaderSets[3].attributeTexCoordLocation = this.gl.getAttribLocation(\n this._shaderSets[3].shaderProgram,\n 'a_texCoord'\n );\n this._shaderSets[3].samplerTexture0Location = this.gl.getUniformLocation(\n this._shaderSets[3].shaderProgram,\n 's_texture0'\n );\n this._shaderSets[3].samplerTexture1Location = this.gl.getUniformLocation(\n this._shaderSets[3].shaderProgram,\n 's_texture1'\n );\n this._shaderSets[3].uniformMatrixLocation = this.gl.getUniformLocation(\n this._shaderSets[3].shaderProgram,\n 'u_matrix'\n );\n this._shaderSets[3].uniformClipMatrixLocation = this.gl.getUniformLocation(\n this._shaderSets[3].shaderProgram,\n 'u_clipMatrix'\n );\n this._shaderSets[3].uniformChannelFlagLocation = this.gl.getUniformLocation(\n this._shaderSets[3].shaderProgram,\n 'u_channelFlag'\n );\n this._shaderSets[3].uniformBaseColorLocation = this.gl.getUniformLocation(\n this._shaderSets[3].shaderProgram,\n 'u_baseColor'\n );\n this._shaderSets[3].uniformMultiplyColorLocation =\n this.gl.getUniformLocation(\n this._shaderSets[3].shaderProgram,\n 'u_multiplyColor'\n );\n this._shaderSets[3].uniformScreenColorLocation = this.gl.getUniformLocation(\n this._shaderSets[3].shaderProgram,\n 'u_screenColor'\n );\n\n // 加算(PremultipliedAlpha)\n this._shaderSets[4].attributePositionLocation = this.gl.getAttribLocation(\n this._shaderSets[4].shaderProgram,\n 'a_position'\n );\n this._shaderSets[4].attributeTexCoordLocation = this.gl.getAttribLocation(\n this._shaderSets[4].shaderProgram,\n 'a_texCoord'\n );\n this._shaderSets[4].samplerTexture0Location = this.gl.getUniformLocation(\n this._shaderSets[4].shaderProgram,\n 's_texture0'\n );\n this._shaderSets[4].uniformMatrixLocation = this.gl.getUniformLocation(\n this._shaderSets[4].shaderProgram,\n 'u_matrix'\n );\n this._shaderSets[4].uniformBaseColorLocation = this.gl.getUniformLocation(\n this._shaderSets[4].shaderProgram,\n 'u_baseColor'\n );\n this._shaderSets[4].uniformMultiplyColorLocation =\n this.gl.getUniformLocation(\n this._shaderSets[4].shaderProgram,\n 'u_multiplyColor'\n );\n this._shaderSets[4].uniformScreenColorLocation = this.gl.getUniformLocation(\n this._shaderSets[4].shaderProgram,\n 'u_screenColor'\n );\n\n // 加算(クリッピング、PremultipliedAlpha)\n this._shaderSets[5].attributePositionLocation = this.gl.getAttribLocation(\n this._shaderSets[5].shaderProgram,\n 'a_position'\n );\n this._shaderSets[5].attributeTexCoordLocation = this.gl.getAttribLocation(\n this._shaderSets[5].shaderProgram,\n 'a_texCoord'\n );\n this._shaderSets[5].samplerTexture0Location = this.gl.getUniformLocation(\n this._shaderSets[5].shaderProgram,\n 's_texture0'\n );\n this._shaderSets[5].samplerTexture1Location = this.gl.getUniformLocation(\n this._shaderSets[5].shaderProgram,\n 's_texture1'\n );\n this._shaderSets[5].uniformMatrixLocation = this.gl.getUniformLocation(\n this._shaderSets[5].shaderProgram,\n 'u_matrix'\n );\n this._shaderSets[5].uniformClipMatrixLocation = this.gl.getUniformLocation(\n this._shaderSets[5].shaderProgram,\n 'u_clipMatrix'\n );\n this._shaderSets[5].uniformChannelFlagLocation = this.gl.getUniformLocation(\n this._shaderSets[5].shaderProgram,\n 'u_channelFlag'\n );\n this._shaderSets[5].uniformBaseColorLocation = this.gl.getUniformLocation(\n this._shaderSets[5].shaderProgram,\n 'u_baseColor'\n );\n this._shaderSets[5].uniformMultiplyColorLocation =\n this.gl.getUniformLocation(\n this._shaderSets[5].shaderProgram,\n 'u_multiplyColor'\n );\n this._shaderSets[5].uniformScreenColorLocation = this.gl.getUniformLocation(\n this._shaderSets[5].shaderProgram,\n 'u_screenColor'\n );\n\n // 加算(クリッピング・反転、PremultipliedAlpha)\n this._shaderSets[6].attributePositionLocation = this.gl.getAttribLocation(\n this._shaderSets[6].shaderProgram,\n 'a_position'\n );\n this._shaderSets[6].attributeTexCoordLocation = this.gl.getAttribLocation(\n this._shaderSets[6].shaderProgram,\n 'a_texCoord'\n );\n this._shaderSets[6].samplerTexture0Location = this.gl.getUniformLocation(\n this._shaderSets[6].shaderProgram,\n 's_texture0'\n );\n this._shaderSets[6].samplerTexture1Location = this.gl.getUniformLocation(\n this._shaderSets[6].shaderProgram,\n 's_texture1'\n );\n this._shaderSets[6].uniformMatrixLocation = this.gl.getUniformLocation(\n this._shaderSets[6].shaderProgram,\n 'u_matrix'\n );\n this._shaderSets[6].uniformClipMatrixLocation = this.gl.getUniformLocation(\n this._shaderSets[6].shaderProgram,\n 'u_clipMatrix'\n );\n this._shaderSets[6].uniformChannelFlagLocation = this.gl.getUniformLocation(\n this._shaderSets[6].shaderProgram,\n 'u_channelFlag'\n );\n this._shaderSets[6].uniformBaseColorLocation = this.gl.getUniformLocation(\n this._shaderSets[6].shaderProgram,\n 'u_baseColor'\n );\n this._shaderSets[6].uniformMultiplyColorLocation =\n this.gl.getUniformLocation(\n this._shaderSets[6].shaderProgram,\n 'u_multiplyColor'\n );\n this._shaderSets[6].uniformScreenColorLocation = this.gl.getUniformLocation(\n this._shaderSets[6].shaderProgram,\n 'u_screenColor'\n );\n\n // 乗算(PremultipliedAlpha)\n this._shaderSets[7].attributePositionLocation = this.gl.getAttribLocation(\n this._shaderSets[7].shaderProgram,\n 'a_position'\n );\n this._shaderSets[7].attributeTexCoordLocation = this.gl.getAttribLocation(\n this._shaderSets[7].shaderProgram,\n 'a_texCoord'\n );\n this._shaderSets[7].samplerTexture0Location = this.gl.getUniformLocation(\n this._shaderSets[7].shaderProgram,\n 's_texture0'\n );\n this._shaderSets[7].uniformMatrixLocation = this.gl.getUniformLocation(\n this._shaderSets[7].shaderProgram,\n 'u_matrix'\n );\n this._shaderSets[7].uniformBaseColorLocation = this.gl.getUniformLocation(\n this._shaderSets[7].shaderProgram,\n 'u_baseColor'\n );\n this._shaderSets[7].uniformMultiplyColorLocation =\n this.gl.getUniformLocation(\n this._shaderSets[7].shaderProgram,\n 'u_multiplyColor'\n );\n this._shaderSets[7].uniformScreenColorLocation = this.gl.getUniformLocation(\n this._shaderSets[7].shaderProgram,\n 'u_screenColor'\n );\n\n // 乗算(クリッピング、PremultipliedAlpha)\n this._shaderSets[8].attributePositionLocation = this.gl.getAttribLocation(\n this._shaderSets[8].shaderProgram,\n 'a_position'\n );\n this._shaderSets[8].attributeTexCoordLocation = this.gl.getAttribLocation(\n this._shaderSets[8].shaderProgram,\n 'a_texCoord'\n );\n this._shaderSets[8].samplerTexture0Location = this.gl.getUniformLocation(\n this._shaderSets[8].shaderProgram,\n 's_texture0'\n );\n this._shaderSets[8].samplerTexture1Location = this.gl.getUniformLocation(\n this._shaderSets[8].shaderProgram,\n 's_texture1'\n );\n this._shaderSets[8].uniformMatrixLocation = this.gl.getUniformLocation(\n this._shaderSets[8].shaderProgram,\n 'u_matrix'\n );\n this._shaderSets[8].uniformClipMatrixLocation = this.gl.getUniformLocation(\n this._shaderSets[8].shaderProgram,\n 'u_clipMatrix'\n );\n this._shaderSets[8].uniformChannelFlagLocation = this.gl.getUniformLocation(\n this._shaderSets[8].shaderProgram,\n 'u_channelFlag'\n );\n this._shaderSets[8].uniformBaseColorLocation = this.gl.getUniformLocation(\n this._shaderSets[8].shaderProgram,\n 'u_baseColor'\n );\n this._shaderSets[8].uniformMultiplyColorLocation =\n this.gl.getUniformLocation(\n this._shaderSets[8].shaderProgram,\n 'u_multiplyColor'\n );\n this._shaderSets[8].uniformScreenColorLocation = this.gl.getUniformLocation(\n this._shaderSets[8].shaderProgram,\n 'u_screenColor'\n );\n\n // 乗算(クリッピング・反転、PremultipliedAlpha)\n this._shaderSets[9].attributePositionLocation = this.gl.getAttribLocation(\n this._shaderSets[9].shaderProgram,\n 'a_position'\n );\n this._shaderSets[9].attributeTexCoordLocation = this.gl.getAttribLocation(\n this._shaderSets[9].shaderProgram,\n 'a_texCoord'\n );\n this._shaderSets[9].samplerTexture0Location = this.gl.getUniformLocation(\n this._shaderSets[9].shaderProgram,\n 's_texture0'\n );\n this._shaderSets[9].samplerTexture1Location = this.gl.getUniformLocation(\n this._shaderSets[9].shaderProgram,\n 's_texture1'\n );\n this._shaderSets[9].uniformMatrixLocation = this.gl.getUniformLocation(\n this._shaderSets[9].shaderProgram,\n 'u_matrix'\n );\n this._shaderSets[9].uniformClipMatrixLocation = this.gl.getUniformLocation(\n this._shaderSets[9].shaderProgram,\n 'u_clipMatrix'\n );\n this._shaderSets[9].uniformChannelFlagLocation = this.gl.getUniformLocation(\n this._shaderSets[9].shaderProgram,\n 'u_channelFlag'\n );\n this._shaderSets[9].uniformBaseColorLocation = this.gl.getUniformLocation(\n this._shaderSets[9].shaderProgram,\n 'u_baseColor'\n );\n this._shaderSets[9].uniformMultiplyColorLocation =\n this.gl.getUniformLocation(\n this._shaderSets[9].shaderProgram,\n 'u_multiplyColor'\n );\n this._shaderSets[9].uniformScreenColorLocation = this.gl.getUniformLocation(\n this._shaderSets[9].shaderProgram,\n 'u_screenColor'\n );\n }\n\n /**\n * ブレンドモード用のシェーダープログラムを登録する\n */\n public registerBlendShader(): void {\n // コピー用シェーダーの設定\n const vertShaderSrcCopy = this._vertShaderSrcCopy;\n const fragShaderSrcCopy = this._fragShaderSrcCopy;\n\n const copyShaderSet = this._shaderSets[10]; // ShaderNames.Copy = 10\n copyShaderSet.shaderProgram = this.loadShaderProgram(\n vertShaderSrcCopy,\n fragShaderSrcCopy\n );\n copyShaderSet.attributeTexCoordLocation = this.gl.getAttribLocation(\n copyShaderSet.shaderProgram,\n 'a_texCoord'\n );\n copyShaderSet.attributePositionLocation = this.gl.getAttribLocation(\n copyShaderSet.shaderProgram,\n 'a_position'\n );\n copyShaderSet.uniformBaseColorLocation = this.gl.getUniformLocation(\n copyShaderSet.shaderProgram,\n 'u_baseColor'\n );\n\n let shaderSetIndex = 11;\n // ブレンドモード用シェーダーの設定\n for (\n let colorBlendIndex = 0;\n colorBlendIndex < this._colorBlendValues.length;\n colorBlendIndex++\n ) {\n // NONEと後方互換はスキップ\n if (\n this._colorBlendValues[colorBlendIndex] ==\n CubismColorBlend.ColorBlend_None ||\n this._colorBlendValues[colorBlendIndex] ==\n CubismColorBlend.ColorBlend_AddCompatible ||\n this._colorBlendValues[colorBlendIndex] ==\n CubismColorBlend.ColorBlend_MultiplyCompatible\n ) {\n continue;\n }\n\n // カラーブレンド用のマクロ\n const colorBlendValue = this._colorBlendValues[colorBlendIndex];\n const colorBlendName = this._colorBlendMap\n .get(colorBlendValue)\n .toUpperCase();\n const colorBlendMacro = `#define COLOR_BLEND_${colorBlendName}\\n`;\n\n for (\n let alphablendIndex = 0;\n alphablendIndex < this._alphaBlendValues.length;\n alphablendIndex++\n ) {\n // NONEと、カラーブレンド「Normal」かつアルファブレンド「Over」はスキップ\n if (\n this._alphaBlendValues[alphablendIndex] ==\n CubismAlphaBlend.AlphaBlend_None ||\n (this._colorBlendValues[colorBlendIndex] ==\n CubismColorBlend.ColorBlend_Normal &&\n this._alphaBlendValues[alphablendIndex] ==\n CubismAlphaBlend.AlphaBlend_Over)\n ) {\n continue;\n }\n\n // アルファブレンド用のマクロ\n const alphaBlendValue = this._alphaBlendValues[alphablendIndex];\n const alphaBlendName = this._alphaBlendMap\n .get(alphaBlendValue)\n .toUpperCase();\n const alphaBlendMacro = `#define ALPHA_BLEND_${alphaBlendName}\\n`;\n\n // シェーダーのソースを生成\n this.generateBlendShader(\n colorBlendMacro,\n alphaBlendMacro,\n shaderSetIndex\n );\n\n this._blendShaderSetMap.set(\n this._colorBlendMap.get(this._colorBlendValues[colorBlendIndex]) +\n this._alphaBlendMap.get(this._alphaBlendValues[alphablendIndex]),\n shaderSetIndex\n );\n\n // 1つの組み合わせが終わるこのタイミングでシェーダーのインデックスを更新\n shaderSetIndex += ShaderType.ShaderType_Count;\n }\n }\n }\n\n /**\n * ブレンドモード用のシェーダープログラムを生成する\n *\n * @param colorBlendMacro カラーブレンド用のマクロ\n * @param alphaBlendMacro アルファブレンド用のマクロ\n * @param shaderSetBaseIndex _shaderSets のインデックス\n */\n private generateBlendShader(\n colorBlendMacro: string,\n alphaBlendMacro: string,\n shaderSetBaseIndex: number\n ): void {\n for (\n let shaderTypeIndex: ShaderType = 0;\n shaderTypeIndex < ShaderType.ShaderType_Count;\n shaderTypeIndex++\n ) {\n // ループごとにシェーダーのソースを初期化\n let vertexShaderSrc: string = '';\n let fragmentShaderStr: string = 'precision mediump float;\\n';\n\n // シェーダの種類が変わるたびにインデックスを変更\n const shaderSetIndex = shaderSetBaseIndex + shaderTypeIndex;\n\n // マクロの定義\n fragmentShaderStr += colorBlendMacro;\n fragmentShaderStr += alphaBlendMacro;\n\n // ブレンドモードの種類に応じたマクロの定義\n fragmentShaderStr += this._fragShaderSrcColorBlend;\n fragmentShaderStr += this._fragShaderSrcAlphaBlend;\n\n // シェーダの種類に応じたマクロの定義\n if (\n shaderTypeIndex == ShaderType.ShaderType_Masked ||\n shaderTypeIndex == ShaderType.ShaderType_MaskedInverted\n ) {\n const clippingMaskMacro = '#define CLIPPING_MASK\\n';\n vertexShaderSrc += clippingMaskMacro;\n fragmentShaderStr += clippingMaskMacro;\n }\n\n // シェーダの本体のソースをファイルから読み込み\n vertexShaderSrc += this._vertShaderSrcBlend;\n fragmentShaderStr += this._fragShaderSrcBlend;\n\n // シェーダープログラムの生成\n this._shaderSets[shaderSetIndex].shaderProgram = this.loadShaderProgram(\n vertexShaderSrc,\n fragmentShaderStr\n );\n\n // シェーダープログラムへの変数のリンク\n this._shaderSets[shaderSetIndex].attributePositionLocation =\n this.gl.getAttribLocation(\n this._shaderSets[shaderSetIndex].shaderProgram,\n 'a_position'\n );\n this._shaderSets[shaderSetIndex].attributeTexCoordLocation =\n this.gl.getAttribLocation(\n this._shaderSets[shaderSetIndex].shaderProgram,\n 'a_texCoord'\n );\n this._shaderSets[shaderSetIndex].samplerTexture0Location =\n this.gl.getUniformLocation(\n this._shaderSets[shaderSetIndex].shaderProgram,\n 's_texture0'\n );\n this._shaderSets[shaderSetIndex].uniformMatrixLocation =\n this.gl.getUniformLocation(\n this._shaderSets[shaderSetIndex].shaderProgram,\n 'u_matrix'\n );\n this._shaderSets[shaderSetIndex].uniformBaseColorLocation =\n this.gl.getUniformLocation(\n this._shaderSets[shaderSetIndex].shaderProgram,\n 'u_baseColor'\n );\n this._shaderSets[shaderSetIndex].uniformMultiplyColorLocation =\n this.gl.getUniformLocation(\n this._shaderSets[shaderSetIndex].shaderProgram,\n 'u_multiplyColor'\n );\n this._shaderSets[shaderSetIndex].uniformScreenColorLocation =\n this.gl.getUniformLocation(\n this._shaderSets[shaderSetIndex].shaderProgram,\n 'u_screenColor'\n );\n\n // ブレンドモード用のテクスチャ\n this._shaderSets[shaderSetIndex].samplerFrameBufferTextureLocation =\n this.gl.getUniformLocation(\n this._shaderSets[shaderSetIndex].shaderProgram,\n 's_blendTexture'\n );\n\n // クリップ対象の場合\n if (\n shaderTypeIndex == ShaderType.ShaderType_Masked ||\n shaderTypeIndex == ShaderType.ShaderType_MaskedInverted\n ) {\n // マスク用テクスチャ\n this._shaderSets[shaderSetIndex].samplerTexture1Location =\n this.gl.getUniformLocation(\n this._shaderSets[shaderSetIndex].shaderProgram,\n 's_texture1'\n );\n\n // クリップ用の行列\n this._shaderSets[shaderSetIndex].uniformClipMatrixLocation =\n this.gl.getUniformLocation(\n this._shaderSets[shaderSetIndex].shaderProgram,\n 'u_clipMatrix'\n );\n\n // チャンネルフラグ\n this._shaderSets[shaderSetIndex].uniformChannelFlagLocation =\n this.gl.getUniformLocation(\n this._shaderSets[shaderSetIndex].shaderProgram,\n 'u_channelFlag'\n );\n\n // 反転マスク用の値(反転なら 1.0 が代入される)\n this._shaderSets[shaderSetIndex].uniformInvertMaskFlagLocation =\n this.gl.getUniformLocation(\n this._shaderSets[shaderSetIndex].shaderProgram,\n 'u_invertClippingMask'\n );\n }\n }\n }\n\n /**\n * シェーダプログラムをロードしてアドレスを返す\n *\n * @param vertexShaderSource 頂点シェーダのソース\n * @param fragmentShaderSource フラグメントシェーダのソース\n *\n * @return シェーダプログラムのアドレス\n */\n public loadShaderProgram(\n vertexShaderSource: string,\n fragmentShaderSource: string\n ): WebGLProgram {\n // Create Shader Program\n let shaderProgram: WebGLProgram = this.gl.createProgram();\n\n let vertShader = this.compileShaderSource(\n this.gl.VERTEX_SHADER,\n vertexShaderSource\n );\n\n if (!vertShader) {\n CubismLogError('Vertex shader compile error!');\n return 0;\n }\n\n let fragShader = this.compileShaderSource(\n this.gl.FRAGMENT_SHADER,\n fragmentShaderSource\n );\n if (!fragShader) {\n CubismLogError('Fragment shader compile error!');\n return 0;\n }\n\n // Attach vertex shader to program\n this.gl.attachShader(shaderProgram, vertShader);\n\n // Attach fragment shader to program\n this.gl.attachShader(shaderProgram, fragShader);\n\n // link program\n this.gl.linkProgram(shaderProgram);\n const linkStatus = this.gl.getProgramParameter(\n shaderProgram,\n this.gl.LINK_STATUS\n );\n\n // リンクに失敗したらシェーダーを削除\n if (!linkStatus) {\n CubismLogError('Failed to link program: {0}', shaderProgram);\n\n this.gl.deleteShader(vertShader);\n vertShader = 0;\n\n this.gl.deleteShader(fragShader);\n fragShader = 0;\n\n if (shaderProgram) {\n this.gl.deleteProgram(shaderProgram);\n shaderProgram = 0;\n }\n\n return 0;\n }\n\n // Release vertex and fragment shaders.\n this.gl.deleteShader(vertShader);\n this.gl.deleteShader(fragShader);\n\n return shaderProgram;\n }\n\n /**\n * シェーダープログラムをコンパイルする\n *\n * @param shaderType シェーダタイプ(Vertex/Fragment)\n * @param shaderSource シェーダソースコード\n *\n * @return コンパイルされたシェーダープログラム\n */\n public compileShaderSource(\n shaderType: GLenum,\n shaderSource: string\n ): WebGLProgram {\n const source: string = shaderSource;\n\n const shader: WebGLProgram = this.gl.createShader(shaderType);\n this.gl.shaderSource(shader, source);\n this.gl.compileShader(shader);\n\n if (!shader) {\n const log: string = this.gl.getShaderInfoLog(shader);\n CubismLogError('Shader compile log: {0} ', log);\n }\n\n const status: any = this.gl.getShaderParameter(\n shader,\n this.gl.COMPILE_STATUS\n );\n if (!status) {\n const log: string = this.gl.getShaderInfoLog(shader);\n CubismLogError('Shader compile log: {0} ', log);\n this.gl.deleteShader(shader);\n return null;\n }\n\n return shader;\n }\n\n /**\n * WebGLレンダリングコンテキストを設定する\n *\n * @param gl WebGLレンダリングコンテキスト\n */\n public setGl(gl: WebGLRenderingContext | WebGL2RenderingContext): void {\n this.gl = gl;\n }\n\n /**\n * ブレンドモード用のシェーダーパスを設定する\n *\n * @param shaderPath シェーダーパス\n */\n public setShaderPath(shaderPath: string): void {\n this._shaderPath = shaderPath;\n }\n\n /**\n * シェーダーパスを取得する\n *\n * @return シェーダーパス\n */\n public getShaderPath(): string {\n return this._shaderPath;\n }\n\n _shaderSets: Array<CubismShaderSet>; // ロードしたシェーダープログラムを保持する変数\n gl: WebGLRenderingContext | WebGL2RenderingContext; // webglコンテキスト\n\n _colorBlendMap: Map<CubismColorBlend, string>; // カラーブレンドの値と名称を紐づけする変数\n _alphaBlendMap: Map<CubismAlphaBlend, string>; // アルファブレンドの値と名称を紐づけする変数\n\n _colorBlendValues: Array<CubismColorBlend>; // カラーブレンドの値を保持する変数\n _alphaBlendValues: Array<CubismAlphaBlend>; // アルファブレンドの値を保持する変数\n\n _blendShaderSetMap: Map<string, number>; // ブレンドモード用のシェーダーの名称とインデックスを紐づけする変数\n\n _shaderCount: number; // シェーダープログラムの数\n\n _vertShaderSrc: string; // 頂点シェーダーのソース\n _vertShaderSrcMasked: string; // マスク用の頂点シェーダーのソース\n _vertShaderSrcSetupMask: string; // マスク用の頂点シェーダーのソース\n _fragShaderSrcSetupMask: string; // マスク用のフラグメントシェーダーのソース\n _fragShaderSrcPremultipliedAlpha: string; // プレマルチプライドアルファ用のフラグメントシェーダーのソース\n _fragShaderSrcMaskPremultipliedAlpha: string; // マスク用プレマルチプライドアルファのフラグメントシェーダーのソース\n _fragShaderSrcMaskInvertedPremultipliedAlpha: string; // 反転マスク用プレマルチプライドアルファのフラグメントシェーダーのソース\n\n _vertShaderSrcCopy: string; // 頂点シェーダーのソース\n _fragShaderSrcCopy: string; // コピー用のフラグメントシェーダーのソース\n\n _fragShaderSrcColorBlend: string; // ブレンドモード用のシェーダーのソース\n _fragShaderSrcAlphaBlend: string; // アルファブレンド用のシェーダーのソース\n _vertShaderSrcBlend: string; // 頂点シェーダーのソース\n _fragShaderSrcBlend: string; // フラグメントシェーダーのソース\n _isShaderLoading: boolean; // シェーダーの読み込み中かどうか\n _isShaderLoaded: boolean; // シェーダーの読み込みが完了したかどうか\n _defaultShaderPath: string; // デフォルトのシェーダーパス\n _shaderPath: string; // シェーダーパス\n}\n\n/**\n * GLContextごとにCubismShader_WebGLを確保するためのクラス\n * シングルトンなクラスであり、CubismShaderManager_WebGL.getInstanceからアクセスする。\n */\nexport class CubismShaderManager_WebGL {\n /**\n * インスタンスを取得する(シングルトン)\n *\n * @return インスタンス\n */\n public static getInstance(): CubismShaderManager_WebGL {\n if (s_instance == null) {\n s_instance = new CubismShaderManager_WebGL();\n }\n return s_instance;\n }\n\n /**\n * インスタンスを開放する(シングルトン)\n */\n public static deleteInstance(): void {\n if (s_instance) {\n s_instance.release();\n s_instance = null;\n }\n }\n\n /**\n * Privateなコンストラクタ\n */\n private constructor() {\n this._shaderMap = new Map<WebGLRenderingContext, CubismShader_WebGL>();\n }\n\n /**\n * デストラクタ相当の処理\n */\n public release(): void {\n for (const item of this._shaderMap) {\n item[1].release();\n }\n this._shaderMap.clear();\n }\n\n /**\n * GLContextをキーにShaderを取得する\n *\n * @param gl glコンテキスト\n *\n * @return shaderを返す\n */\n public getShader(gl: WebGLRenderingContext): CubismShader_WebGL {\n return this._shaderMap.get(gl);\n }\n\n /**\n * GLContextを登録する\n *\n * @param gl glコンテキスト\n */\n public setGlContext(gl: WebGLRenderingContext): void {\n if (!this._shaderMap.has(gl)) {\n const instance = new CubismShader_WebGL();\n instance.setGl(gl);\n this._shaderMap.set(gl, instance);\n }\n }\n\n /**\n * GLContextごとのShaderを保持する変数\n */\n private _shaderMap: Map<WebGLRenderingContext, CubismShader_WebGL>;\n}\n\n/**\n * CubismShader_WebGLのインナークラス\n */\nexport class CubismShaderSet {\n shaderProgram: WebGLProgram; // シェーダープログラムのアドレス\n attributePositionLocation: GLuint; // シェーダープログラムに渡す変数のアドレス(Position)\n attributeTexCoordLocation: GLuint; // シェーダープログラムに渡す変数のアドレス(TexCoord)\n uniformMatrixLocation: WebGLUniformLocation; // シェーダープログラムに渡す変数のアドレス(Matrix)\n uniformClipMatrixLocation: WebGLUniformLocation; // シェーダープログラムに渡す変数のアドレス(ClipMatrix)\n samplerTexture0Location: WebGLUniformLocation; // シェーダープログラムに渡す変数のアドレス(Texture0)\n samplerTexture1Location: WebGLUniformLocation; // シェーダープログラムに渡す変数のアドレス(Texture1)\n uniformBaseColorLocation: WebGLUniformLocation; // シェーダープログラムに渡す変数のアドレス(BaseColor)\n uniformChannelFlagLocation: WebGLUniformLocation; // シェーダープログラムに渡す変数のアドレス(ChannelFlag)\n uniformMultiplyColorLocation: WebGLUniformLocation; // シェーダープログラムに渡す変数のアドレス(MultiplyColor)\n uniformScreenColorLocation: WebGLUniformLocation; // シェーダープログラムに渡す変数のアドレス(ScreenColor)\n samplerFrameBufferTextureLocation: WebGLUniformLocation; // シェーダープログラムに渡す変数のアドレス(BlendTexture)\n uniformInvertMaskFlagLocation: WebGLUniformLocation; // シェーダープログラムに渡す変数のアドレス(InvertMask)\n}\n\n/**\n * シェーダーの名前を定義する列挙型\n */\nexport enum ShaderNames {\n // SetupMask\n ShaderNames_SetupMask,\n\n // Normal\n ShaderNames_NormalPremultipliedAlpha,\n ShaderNames_NormalMaskedPremultipliedAlpha,\n ShaderNames_NomralMaskedInvertedPremultipliedAlpha,\n\n // Add\n ShaderNames_AddPremultipliedAlpha,\n ShaderNames_AddMaskedPremultipliedAlpha,\n ShaderNames_AddMaskedPremultipliedAlphaInverted,\n\n // Mult\n ShaderNames_MultPremultipliedAlpha,\n ShaderNames_MultMaskedPremultipliedAlpha,\n ShaderNames_MultMaskedPremultipliedAlphaInverted,\n\n // ShaderCount\n ShaderNames_ShaderCount\n}\n\n/**\n * シェーダーの種類を定義する列挙型\n */\nexport enum ShaderType {\n ShaderType_Normal = 0,\n ShaderType_Masked = 1,\n ShaderType_MaskedInverted = 2,\n ShaderType_Count\n}\n\n// Namespace definition for compatibility.\nimport * as $ from './cubismshader_webgl';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const CubismShaderSet = $.CubismShaderSet;\n export type CubismShaderSet = $.CubismShaderSet;\n export const CubismShader_WebGL = $.CubismShader_WebGL;\n export type CubismShader_WebGL = $.CubismShader_WebGL;\n export const CubismShaderManager_WebGL = $.CubismShaderManager_WebGL;\n export type CubismShaderManager_WebGL = $.CubismShaderManager_WebGL;\n export const ShaderNames = $.ShaderNames;\n export type ShaderNames = $.ShaderNames;\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport { updateSize } from '../utils/cubismarrayutils';\nimport { CubismLogError } from '../utils/cubismdebug';\nimport { CubismRenderTarget_WebGL } from './cubismrendertarget_webgl';\n\n/**\n * フレームバッファなどのコンテナのクラス\n */\nclass CubismRenderTargetContainer {\n /**\n * Constructor\n *\n * @param colorBuffer カラーバッファ\n * @param renderTexture レンダーテクスチャ\n * @param inUse 使用中かどうか\n */\n public constructor(\n colorBuffer: WebGLTexture = null,\n renderTexture: WebGLFramebuffer = null,\n inUse: boolean = false\n ) {\n this.colorBuffer = colorBuffer;\n this.renderTexture = renderTexture;\n this.inUse = inUse;\n }\n\n public clear(): void {\n this.colorBuffer = null;\n this.renderTexture = null;\n this.inUse = false;\n }\n\n /**\n * カラーバッファを取得\n *\n * @returns カラーバッファ\n */\n public getColorBuffer(): WebGLTexture {\n return this.colorBuffer;\n }\n\n /**\n * レンダーテクスチャを取得\n *\n * @returns レンダーテクスチャ\n */\n public getRenderTexture(): WebGLFramebuffer {\n return this.renderTexture;\n }\n\n public colorBuffer: WebGLTexture; // colorBuffer\n public renderTexture: WebGLFramebuffer; // renderTarget\n public inUse: boolean; // Whether this container's render target is currently in use\n}\n\n/**\n * WebGLContextごとのリソース管理を行う内部クラス\n */\nclass CubismWebGLContextManager {\n constructor(gl: WebGLRenderingContext | WebGL2RenderingContext) {\n this.gl = gl;\n this.offscreenRenderTargetContainers =\n new Array<CubismRenderTargetContainer>();\n this.previousActiveRenderTextureMaxCount = 0;\n this.currentActiveRenderTextureCount = 0;\n this.hasResetThisFrame = false;\n this.width = 0;\n this.height = 0;\n }\n\n public release(): void {\n if (this.offscreenRenderTargetContainers != null) {\n for (\n let index = 0;\n index < this.offscreenRenderTargetContainers.length;\n ++index\n ) {\n const container = this.offscreenRenderTargetContainers[index];\n this.gl.deleteTexture(container.colorBuffer);\n this.gl.deleteFramebuffer(container.renderTexture);\n }\n this.offscreenRenderTargetContainers.length = 0;\n this.offscreenRenderTargetContainers = null;\n }\n }\n\n public gl: WebGLRenderingContext | WebGL2RenderingContext; // WebGLContext\n public offscreenRenderTargetContainers: Array<CubismRenderTargetContainer>; // オフスクリーン描画用レンダーターゲットのリスト\n public previousActiveRenderTextureMaxCount: number; // 直前のアクティブなレンダーターゲットの最大数\n public currentActiveRenderTextureCount: number; // 現在のアクティブなレンダーターゲットの数\n public hasResetThisFrame: boolean; // 今フレームでリセットされたかどうか\n public width: number; // 幅\n public height: number; // 高さ\n}\n\n/**\n * WebGL用オフスクリーン描画機能を管理するマネージャ\n * オフスクリーン描画機能に必要なフレームバッファなどを含むコンテナを管理する。\n * 複数のWebGLContextに対応。\n */\nexport class CubismWebGLOffscreenManager {\n /**\n * コンストラクタ\n */\n private constructor() {\n this._contextManagers = new Map<\n WebGLRenderingContext | WebGL2RenderingContext,\n CubismWebGLContextManager\n >();\n }\n\n /**\n * デストラクタ相当の処理\n */\n public release(): void {\n if (this._contextManagers != null) {\n for (const manager of this._contextManagers.values()) {\n manager.release();\n }\n this._contextManagers.clear();\n this._contextManagers = null;\n }\n CubismWebGLOffscreenManager._instance = null;\n }\n\n /**\n * インスタンスの取得\n *\n * @return インスタンス\n */\n public static getInstance(): CubismWebGLOffscreenManager {\n if (this._instance == null) {\n this._instance = new CubismWebGLOffscreenManager();\n }\n\n return this._instance;\n }\n\n /**\n * WebGLContextに対応するマネージャーを取得または作成\n *\n * @param gl WebGLRenderingContextまたはWebGL2RenderingContext\n * @return WebGLContextManager\n */\n private getContextManager(\n gl: WebGLRenderingContext | WebGL2RenderingContext\n ): CubismWebGLContextManager {\n if (!this._contextManagers.has(gl)) {\n this._contextManagers.set(gl, new CubismWebGLContextManager(gl));\n }\n return this._contextManagers.get(gl);\n }\n\n /**\n * 指定されたWebGLContextのマネージャーを削除\n *\n * @param gl WebGLRenderingContextまたはWebGL2RenderingContext\n */\n public removeContext(\n gl: WebGLRenderingContext | WebGL2RenderingContext\n ): void {\n if (this._contextManagers.has(gl)) {\n const manager = this._contextManagers.get(gl);\n manager.release();\n this._contextManagers.delete(gl);\n }\n }\n\n /**\n * 初期化処理\n *\n * @param gl WebGLRenderingContextまたはWebGL2RenderingContext\n * @param width 幅\n * @param height 高さ\n */\n public initialize(\n gl: WebGLRenderingContext | WebGL2RenderingContext,\n width: number,\n height: number\n ): void {\n const contextManager = this.getContextManager(gl);\n\n // initialize offscreenRenderTargetContainers\n if (contextManager.offscreenRenderTargetContainers != null) {\n for (\n let index = 0;\n index < contextManager.offscreenRenderTargetContainers.length;\n ++index\n ) {\n const container = contextManager.offscreenRenderTargetContainers[index];\n contextManager.gl.deleteTexture(container.colorBuffer);\n contextManager.gl.deleteFramebuffer(container.renderTexture);\n container.clear();\n }\n contextManager.offscreenRenderTargetContainers.length = 0;\n } else {\n contextManager.offscreenRenderTargetContainers =\n new Array<CubismRenderTargetContainer>();\n }\n\n contextManager.width = width;\n contextManager.height = height;\n contextManager.previousActiveRenderTextureMaxCount = 0;\n contextManager.currentActiveRenderTextureCount = 0;\n contextManager.hasResetThisFrame = false;\n }\n\n /**\n * モデルを描画する前に呼び出すフレーム開始時の処理を行う\n *\n * @param gl WebGLRenderingContextまたはWebGL2RenderingContext\n */\n public beginFrameProcess(\n gl: WebGLRenderingContext | WebGL2RenderingContext\n ): void {\n const contextManager = this.getContextManager(gl);\n if (contextManager.hasResetThisFrame) {\n return;\n }\n contextManager.previousActiveRenderTextureMaxCount = 0;\n contextManager.hasResetThisFrame = true;\n }\n\n /**\n * モデルの描画が終わった後に呼び出すフレーム終了時の処理\n *\n * @param gl WebGLRenderingContextまたはWebGL2RenderingContext\n */\n public endFrameProcess(\n gl: WebGLRenderingContext | WebGL2RenderingContext\n ): void {\n const contextManager = this.getContextManager(gl);\n contextManager.hasResetThisFrame = false;\n }\n\n /**\n * コンテナサイズの取得\n *\n * @param gl WebGLRenderingContextまたはWebGL2RenderingContext\n */\n public getContainerSize(\n gl: WebGLRenderingContext | WebGL2RenderingContext\n ): number {\n const contextManager = this.getContextManager(gl);\n if (contextManager.offscreenRenderTargetContainers == null) {\n return 0;\n }\n return contextManager.offscreenRenderTargetContainers.length;\n }\n\n /**\n * 使用可能なリソースコンテナの取得\n *\n * @param gl WebGLRenderingContextまたはWebGL2RenderingContext\n * @param width 幅\n * @param height 高さ\n * @param previousFramebuffer 前のフレームバッファ\n * @return 使用可能なリソースコンテナ\n */\n public getOffscreenRenderTargetContainers(\n gl: WebGLRenderingContext | WebGL2RenderingContext,\n width: number,\n height: number,\n previousFramebuffer: WebGLFramebuffer\n ): CubismRenderTargetContainer {\n const contextManager = this.getContextManager(gl);\n\n // コンテナが初期化されていないか、サイズが変わったら初期化し直す\n if (\n contextManager.width != width ||\n contextManager.height != height ||\n contextManager.offscreenRenderTargetContainers == null\n ) {\n this.initialize(gl, width, height);\n }\n\n // 使用数を更新\n this.updateRenderTargetContainerCount(gl);\n\n // 使われていないリソースコンテナがあればそれを返す\n const container = this.getUnusedOffscreenRenderTargetContainer(gl);\n if (container != null) {\n return container;\n }\n\n // 使われていないリソースコンテナがなければ新たに作成する\n const offscreenRenderTextureContainer =\n this.createOffscreenRenderTargetContainer(\n gl,\n width,\n height,\n previousFramebuffer\n );\n\n return offscreenRenderTextureContainer;\n }\n\n /**\n * リソースコンテナの使用状態を取得\n *\n * @param gl WebGLRenderingContextまたはWebGL2RenderingContext\n * @param renderTexture WebGLFramebuffer\n * @return 使用中はtrue、未使用の場合はfalse\n */\n public getUsingRenderTextureState(\n gl: WebGLRenderingContext | WebGL2RenderingContext,\n renderTexture: WebGLFramebuffer\n ): boolean {\n const contextManager = this.getContextManager(gl);\n for (\n let index = 0;\n index < contextManager.offscreenRenderTargetContainers.length;\n ++index\n ) {\n if (\n contextManager.offscreenRenderTargetContainers[index].renderTexture ==\n renderTexture\n ) {\n return contextManager.offscreenRenderTargetContainers[index].inUse;\n }\n }\n return true;\n }\n\n /**\n * リソースコンテナの使用を開始する。\n *\n * @param gl WebGLRenderingContextまたはWebGL2RenderingContext\n * @param renderTexture WebGLFramebuffer\n */\n public startUsingRenderTexture(\n gl: WebGLRenderingContext | WebGL2RenderingContext,\n renderTexture: WebGLFramebuffer\n ): void {\n const contextManager = this.getContextManager(gl);\n for (\n let index = 0;\n index < contextManager.offscreenRenderTargetContainers.length;\n ++index\n ) {\n if (\n contextManager.offscreenRenderTargetContainers[index].renderTexture !=\n renderTexture\n ) {\n continue;\n }\n\n contextManager.offscreenRenderTargetContainers[index].inUse = true;\n\n this.updateRenderTargetContainerCount(gl);\n\n break;\n }\n }\n\n /**\n * リソースコンテナの使用を終了する。\n *\n * @param gl WebGLRenderingContextまたはWebGL2RenderingContext\n * @param renderTexture WebGLFramebuffer\n */\n public stopUsingRenderTexture(\n gl: WebGLRenderingContext | WebGL2RenderingContext,\n renderTexture: WebGLFramebuffer\n ): void {\n const contextManager = this.getContextManager(gl);\n for (\n let index = 0;\n index < contextManager.offscreenRenderTargetContainers.length;\n ++index\n ) {\n if (\n contextManager.offscreenRenderTargetContainers[index].renderTexture !=\n renderTexture\n ) {\n continue;\n }\n\n contextManager.offscreenRenderTargetContainers[index].inUse = false;\n\n contextManager.currentActiveRenderTextureCount--;\n if (contextManager.currentActiveRenderTextureCount < 0) {\n contextManager.currentActiveRenderTextureCount = 0;\n }\n break;\n }\n }\n\n /**\n * リソースコンテナの使用を全て終了する。\n *\n * @param gl WebGLRenderingContextまたはWebGL2RenderingContext\n */\n public stopUsingAllRenderTextures(\n gl: WebGLRenderingContext | WebGL2RenderingContext\n ): void {\n const contextManager = this.getContextManager(gl);\n for (\n let index = 0;\n index < contextManager.offscreenRenderTargetContainers.length;\n ++index\n ) {\n contextManager.offscreenRenderTargetContainers[index].inUse = false;\n }\n\n contextManager.currentActiveRenderTextureCount = 0;\n }\n\n /**\n * 使用されていないリソースコンテナを解放する。\n *\n * @param gl WebGLRenderingContextまたはWebGL2RenderingContext\n */\n public releaseStaleRenderTextures(\n gl: WebGLRenderingContext | WebGL2RenderingContext\n ): void {\n const contextManager = this.getContextManager(gl);\n const listSize = contextManager.offscreenRenderTargetContainers.length;\n\n if (contextManager.hasResetThisFrame || listSize === 0) {\n // 使用する量が変化する場合は開放しない\n return;\n }\n\n // 未使用な場所を開放して直前の最大数までリサイズする\n let findPos = 0;\n let resize = contextManager.previousActiveRenderTextureMaxCount;\n for (\n let i = listSize;\n contextManager.previousActiveRenderTextureMaxCount < i;\n --i\n ) {\n const index = i - 1;\n if (contextManager.offscreenRenderTargetContainers[index].inUse) {\n // 空いている場所探して移動させる\n let isFind = false;\n for (\n ;\n findPos < contextManager.previousActiveRenderTextureMaxCount;\n ++findPos\n ) {\n if (!contextManager.offscreenRenderTargetContainers[findPos].inUse) {\n const tempContainer =\n contextManager.offscreenRenderTargetContainers[findPos];\n contextManager.offscreenRenderTargetContainers[findPos] =\n contextManager.offscreenRenderTargetContainers[index];\n contextManager.offscreenRenderTargetContainers[findPos].inUse =\n true;\n contextManager.offscreenRenderTargetContainers[index] =\n tempContainer;\n contextManager.offscreenRenderTargetContainers[index].inUse = false;\n isFind = true;\n break;\n }\n }\n if (!isFind) {\n // 空いている場所が見つからなかったら現状のサイズでリサイズする\n resize = i;\n break;\n }\n }\n const container = contextManager.offscreenRenderTargetContainers[index];\n contextManager.gl.bindTexture(contextManager.gl.TEXTURE_2D, null);\n contextManager.gl.deleteTexture(container.colorBuffer);\n contextManager.gl.bindFramebuffer(contextManager.gl.FRAMEBUFFER, null);\n contextManager.gl.deleteFramebuffer(container.renderTexture);\n container.clear();\n }\n updateSize(contextManager.offscreenRenderTargetContainers, resize);\n }\n\n /**\n * 直前のアクティブなレンダーターゲットの最大数を取得\n *\n * @param gl WebGLRenderingContextまたはWebGL2RenderingContext\n * @returns 直前のアクティブなレンダーターゲットの最大数\n */\n public getPreviousActiveRenderTextureCount(\n gl: WebGLRenderingContext | WebGL2RenderingContext\n ): number {\n const contextManager = this.getContextManager(gl);\n return contextManager.previousActiveRenderTextureMaxCount;\n }\n\n /**\n * 現在のアクティブなレンダーターゲットの数を取得\n *\n * @param gl WebGLRenderingContextまたはWebGL2RenderingContext\n * @returns 現在のアクティブなレンダーターゲットの数\n */\n public getCurrentActiveRenderTextureCount(\n gl: WebGLRenderingContext | WebGL2RenderingContext\n ): number {\n const contextManager = this.getContextManager(gl);\n return contextManager.currentActiveRenderTextureCount;\n }\n\n /**\n * 現在のアクティブなレンダーターゲットの数を更新\n *\n * @param gl WebGLRenderingContextまたはWebGL2RenderingContext\n */\n public updateRenderTargetContainerCount(\n gl: WebGLRenderingContext | WebGL2RenderingContext\n ): void {\n const contextManager = this.getContextManager(gl);\n ++contextManager.currentActiveRenderTextureCount;\n\n // 最大数更新\n contextManager.previousActiveRenderTextureMaxCount =\n contextManager.currentActiveRenderTextureCount >\n contextManager.previousActiveRenderTextureMaxCount\n ? contextManager.currentActiveRenderTextureCount\n : contextManager.previousActiveRenderTextureMaxCount;\n }\n\n /**\n * 使用されていないリソースコンテナの取得\n *\n * @param gl WebGLRenderingContextまたはWebGL2RenderingContext\n * @return 使用されていないリソースコンテナ\n */\n public getUnusedOffscreenRenderTargetContainer(\n gl: WebGLRenderingContext | WebGL2RenderingContext\n ): CubismRenderTargetContainer {\n const contextManager = this.getContextManager(gl);\n // 使われていないリソースコンテナがあればそれを返す\n for (\n let index = 0;\n index < contextManager.offscreenRenderTargetContainers.length;\n ++index\n ) {\n const container = contextManager.offscreenRenderTargetContainers[index];\n if (container.inUse == false) {\n container.inUse = true;\n return container;\n }\n }\n return null;\n }\n\n /**\n * 新たにリソースコンテナを作成する。\n *\n * @param gl WebGLRenderingContextまたはWebGL2RenderingContext\n * @param width 幅\n * @param height 高さ\n * @param previousFramebuffer 前のフレームバッファ\n * @return 作成されたリソースコンテナ\n */\n public createOffscreenRenderTargetContainer(\n gl: WebGLRenderingContext | WebGL2RenderingContext,\n width: number,\n height: number,\n previousFramebuffer: WebGLFramebuffer\n ): CubismRenderTargetContainer {\n const renderTarget = new CubismRenderTarget_WebGL();\n\n if (\n !renderTarget.createRenderTarget(gl, width, height, previousFramebuffer)\n ) {\n CubismLogError('Failed to create offscreen render texture.');\n return null;\n }\n\n const offscreenRenderTextureContainer = new CubismRenderTargetContainer(\n renderTarget.getColorBuffer(),\n renderTarget.getRenderTexture(),\n true\n );\n\n const contextManager = this.getContextManager(gl);\n contextManager.offscreenRenderTargetContainers.push(\n offscreenRenderTextureContainer\n );\n\n return offscreenRenderTextureContainer;\n }\n\n private static _instance: CubismWebGLOffscreenManager; // オフスクリーン描画用レンダーターゲットマネージャ\n private _contextManagers: Map<\n WebGLRenderingContext | WebGL2RenderingContext,\n CubismWebGLContextManager\n >; // WebGLContextごとのマネージャー\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport { CubismRenderTarget_WebGL } from './cubismrendertarget_webgl';\nimport { CubismWebGLOffscreenManager } from './cubismoffscreenmanager';\nimport { CubismLogError } from '../utils/cubismdebug';\n\n/**\n * WebGL用オフスクリーンサーフェス\n * マスクの描画及びオフスクリーン機能に必要なフレームバッファなどを管理する。\n */\nexport class CubismOffscreenRenderTarget_WebGL extends CubismRenderTarget_WebGL {\n /**\n * リソースコンテナマネージャを初期化する。\n *\n * @param displayBufferWidth レンダーターゲットの幅\n * @param displayBufferHeight レンダーターゲットの高さ\n */\n private initializeOffscreenManager(\n gl: WebGLRenderingContext | WebGL2RenderingContext,\n displayBufferWidth: number,\n displayBufferHeight: number\n ): void {\n this._gl = gl;\n this._webGLOffscreenManager = CubismWebGLOffscreenManager.getInstance();\n if (this._webGLOffscreenManager.getContainerSize(gl) === 0) {\n this._webGLOffscreenManager.initialize(\n gl,\n displayBufferWidth,\n displayBufferHeight\n );\n }\n }\n\n /**\n * オフスクリーン描画用レンダーターゲットをセットする。\n *\n * @param gl WebGLRenderingContextまたはWebGL2RenderingContext\n * NOTE: Cubism 5.3以降のモデルが使用される場合はWebGL2RenderingContextを使用すること。\n * @param displayBufferWidth レンダーターゲットの幅\n * @param displayBufferHeight レンダーターゲットの高さ\n * @param previousFramebuffer 前のフレームバッファ\n */\n public setOffscreenRenderTarget(\n gl: WebGLRenderingContext | WebGL2RenderingContext,\n displayBufferWidth: number,\n displayBufferHeight: number,\n previousFramebuffer: WebGLFramebuffer\n ): void {\n // マネージャがなければ初期化\n if (this._webGLOffscreenManager == null) {\n this.initializeOffscreenManager(\n gl,\n displayBufferWidth,\n displayBufferHeight\n );\n }\n\n // 使用可能なリソースコンテナを取得する\n const offscreenRenderTargetContainer =\n this._webGLOffscreenManager.getOffscreenRenderTargetContainers(\n gl,\n displayBufferWidth,\n displayBufferHeight,\n previousFramebuffer\n );\n\n if (offscreenRenderTargetContainer == null) {\n CubismLogError('Failed to acquire offscreen render texture container.');\n return;\n }\n\n this._colorBuffer = offscreenRenderTargetContainer.getColorBuffer();\n this._renderTexture = offscreenRenderTargetContainer.getRenderTexture();\n\n this._bufferWidth = displayBufferWidth;\n this._bufferHeight = displayBufferHeight;\n\n this._gl = gl;\n\n if (this._renderTexture == null) {\n this._renderTexture = previousFramebuffer;\n CubismLogError('Failed to create offscreen render texture.');\n }\n\n return;\n }\n\n /**\n * リソースコンテナの使用状態を取得\n *\n * @return 使用中はtrue、未使用の場合はfalse\n */\n public getUsingRenderTextureState(): boolean {\n if (this._webGLOffscreenManager == null || this._gl == null) {\n return true;\n }\n\n return this._webGLOffscreenManager.getUsingRenderTextureState(\n this._gl,\n this._renderTexture\n );\n }\n\n /**\n * リソースコンテナの使用を開始する。\n */\n public startUsingRenderTexture(): void {\n if (this._webGLOffscreenManager == null || this._gl == null) {\n return;\n }\n\n this._webGLOffscreenManager.startUsingRenderTexture(\n this._gl,\n this._renderTexture\n );\n }\n\n /**\n * リソースコンテナの使用を終了する。\n */\n public stopUsingRenderTexture(): void {\n if (this._webGLOffscreenManager == null || this._gl == null) {\n return;\n }\n\n this._webGLOffscreenManager.stopUsingRenderTexture(\n this._gl,\n this._renderTexture\n );\n }\n\n /**\n * オフスクリーンのインデックスを設定する。\n *\n * @param offscreenIndex オフスクリーンのインデックス\n */\n public setOffscreenIndex(offscreenIndex: number): void {\n this._offscreenIndex = offscreenIndex;\n }\n\n /**\n * オフスクリーンのインデックスを取得する。\n *\n * @return オフスクリーンのインデックス\n */\n public getOffscreenIndex(): number {\n return this._offscreenIndex;\n }\n\n /**\n * 以前のオフスクリーン描画用レンダーターゲットを設定する。\n *\n * @param oldOffscreen 以前のオフスクリーン描画用レンダーターゲット\n */\n public setOldOffscreen(\n oldOffscreen: CubismOffscreenRenderTarget_WebGL\n ): void {\n this._oldOffscreen = oldOffscreen;\n }\n\n /**\n * 以前のオフスクリーン描画用レンダーターゲットを取得する。\n *\n * @return 以前のオフスクリーン描画用レンダーターゲット\n */\n public getOldOffscreen(): CubismOffscreenRenderTarget_WebGL {\n return this._oldOffscreen;\n }\n\n /**\n * 親のオフスクリーン描画用レンダーターゲットを設定する。\n *\n * @param parentOffscreenRenderTarget 親のオフスクリーン描画用レンダーターゲット\n */\n public setParentPartOffscreen(\n parentOffscreenRenderTarget: CubismOffscreenRenderTarget_WebGL\n ): void {\n this._parentOffscreenRenderTarget = parentOffscreenRenderTarget;\n }\n\n /**\n * 親のオフスクリーン描画用レンダーターゲットを取得する。\n *\n * @return 親のオフスクリーン描画用レンダーターゲット\n */\n public getParentPartOffscreen(): CubismOffscreenRenderTarget_WebGL {\n return this._parentOffscreenRenderTarget;\n }\n\n /**\n * コンストラクタ\n */\n constructor() {\n super();\n this._offscreenIndex = -1;\n this._parentOffscreenRenderTarget = null;\n this._oldOffscreen = null;\n this._webGLOffscreenManager = null;\n }\n\n public release(): void {\n if (\n this._webGLOffscreenManager != null &&\n this._gl != null &&\n this._renderTexture != null\n ) {\n this._webGLOffscreenManager.stopUsingRenderTexture(\n this._gl,\n this._renderTexture\n );\n }\n\n if (this._colorBuffer && this._gl) {\n this._gl.deleteTexture(this._colorBuffer);\n this._colorBuffer = null;\n }\n if (this._renderTexture && this._gl) {\n this._gl.deleteFramebuffer(this._renderTexture);\n this._renderTexture = null;\n }\n\n if (this._webGLOffscreenManager != null) {\n this._webGLOffscreenManager = null;\n }\n\n this._oldOffscreen = null;\n this._parentOffscreenRenderTarget = null;\n }\n\n private _offscreenIndex: number; // オフスクリーンのインデックス\n private _parentOffscreenRenderTarget: CubismOffscreenRenderTarget_WebGL; // 親のオフスクリーン描画用レンダーターゲット\n private _oldOffscreen: CubismOffscreenRenderTarget_WebGL; // 以前のオフスクリーン描画用レンダーターゲット\n private _webGLOffscreenManager: CubismWebGLOffscreenManager; // オフスクリーン描画用レンダーターゲットマネージャ\n protected _gl: WebGLRenderingContext | WebGL2RenderingContext; // WebGLコンテキスト\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport { CubismMath } from '../math/cubismmath';\nimport { CubismModel, NoParentIndex } from '../model/cubismmodel';\nimport { csmRect } from '../type/csmrectf';\nimport { CubismLogError } from '../utils/cubismdebug';\nimport { updateSize } from '../utils/cubismarrayutils';\nimport { CubismClippingManager } from './cubismclippingmanager';\nimport {\n CubismClippingContext,\n CubismRenderer,\n DrawableObjectType\n} from './cubismrenderer';\nimport { CubismShaderManager_WebGL } from './cubismshader_webgl';\n\nconst s_invalidValue = -1; // 無効な値を表す定数\n/*\n * シェーダをコピーする際に衣装する頂点のインデックス\n */\nconst s_renderTargetIndexArray: Uint16Array = new Uint16Array([\n 0, 1, 2, 2, 1, 3\n]);\n\n/**\n * クリッピングマスクの処理を実行するクラス\n */\nexport class CubismClippingManager_WebGL extends CubismClippingManager<CubismClippingContext_WebGL> {\n /**\n * WebGLレンダリングコンテキストを設定する\n *\n * @param gl WebGLレンダリングコンテキスト\n */\n public setGL(gl: WebGLRenderingContext): void {\n this.gl = gl;\n }\n\n /**\n * コンストラクタ\n */\n public constructor() {\n super(CubismClippingContext_WebGL);\n }\n\n /**\n * クリッピングコンテキストを作成する。モデル描画時に実行する。\n *\n * @param model モデルのインスタンス\n * @param renderer レンダラのインスタンス\n * @param lastFbo フレームバッファ\n * @param lastViewport ビューポート\n * @param drawObjectType 描画オブジェクトのタイプ\n */\n public setupClippingContext(\n model: CubismModel,\n renderer: CubismRenderer_WebGL,\n lastFbo: WebGLFramebuffer,\n lastViewport: number[],\n drawObjectType: DrawableObjectType\n ): void {\n // 全てのクリッピングを用意する\n // 同じクリップ(複数の場合はまとめて一つのクリップ)を使う場合は1度だけ設定する\n let usingClipCount = 0;\n for (\n let clipIndex = 0;\n clipIndex < this._clippingContextListForMask.length;\n clipIndex++\n ) {\n // 1つのクリッピングマスクに関して\n const cc: CubismClippingContext_WebGL =\n this._clippingContextListForMask[clipIndex];\n\n // このクリップを利用する描画オブジェクト群全体を囲む矩形を計算\n switch (drawObjectType) {\n case DrawableObjectType.DrawableObjectType_Drawable:\n default:\n this.calcClippedDrawableTotalBounds(model, cc);\n break;\n case DrawableObjectType.DrawableObjectType_Offscreen:\n this.calcClippedOffscreenTotalBounds(model, cc);\n break;\n }\n\n if (cc._isUsing) {\n usingClipCount++; // 使用中としてカウント\n }\n }\n\n if (usingClipCount <= 0) {\n return;\n }\n\n // 生成したFrameBufferと同じサイズでビューポートを設定\n this.gl.viewport(\n 0,\n 0,\n this._clippingMaskBufferSize,\n this._clippingMaskBufferSize\n );\n\n // 後の計算のためにインデックスの最初をセット\n switch (drawObjectType) {\n case DrawableObjectType.DrawableObjectType_Drawable:\n default:\n this._currentMaskBuffer = renderer.getDrawableMaskBuffer(0);\n break;\n case DrawableObjectType.DrawableObjectType_Offscreen:\n this._currentMaskBuffer = renderer.getOffscreenMaskBuffer(0);\n break;\n }\n\n // ---------- マスク描画処理 ----------\n this._currentMaskBuffer.beginDraw(lastFbo);\n\n renderer.preDraw(); // バッファをクリアする\n\n this.setupLayoutBounds(usingClipCount);\n\n // サイズがレンダーテクスチャの枚数と合わない場合は合わせる\n if (this._clearedMaskBufferFlags.length != this._renderTextureCount) {\n this._clearedMaskBufferFlags.length = 0;\n this._clearedMaskBufferFlags = new Array<boolean>(\n this._renderTextureCount\n );\n for (let i = 0; i < this._clearedMaskBufferFlags.length; i++) {\n this._clearedMaskBufferFlags[i] = false;\n }\n }\n\n // マスクのクリアフラグを毎フレーム開始時に初期化\n for (let index = 0; index < this._clearedMaskBufferFlags.length; index++) {\n this._clearedMaskBufferFlags[index] = false;\n }\n\n // 実際にマスクを生成する\n // 全てのマスクをどのようにレイアウトして描くかを決定し、ClipContext, ClippedDrawContextに記憶する\n for (\n let clipIndex = 0;\n clipIndex < this._clippingContextListForMask.length;\n clipIndex++\n ) {\n // --- 実際に1つのマスクを描く ---\n const clipContext: CubismClippingContext_WebGL =\n this._clippingContextListForMask[clipIndex];\n const allClipedDrawRect: csmRect = clipContext._allClippedDrawRect; // このマスクを使う、すべての描画オブジェクトの論理座標上の囲み矩形\n const layoutBoundsOnTex01: csmRect = clipContext._layoutBounds; // この中にマスクを収める\n const margin = 0.05; // モデル座標上の矩形を、適宜マージンを付けて使う\n let scaleX = 0;\n let scaleY = 0;\n\n // clipContextに設定したレンダーテクスチャをインデックスで取得\n let maskBuffer: CubismRenderTarget_WebGL;\n switch (drawObjectType) {\n case DrawableObjectType.DrawableObjectType_Drawable:\n default:\n maskBuffer = renderer.getDrawableMaskBuffer(clipContext._bufferIndex);\n break;\n case DrawableObjectType.DrawableObjectType_Offscreen:\n maskBuffer = renderer.getOffscreenMaskBuffer(\n clipContext._bufferIndex\n );\n break;\n }\n\n // 現在のレンダーテクスチャがclipContextのものと異なる場合\n if (this._currentMaskBuffer != maskBuffer) {\n this._currentMaskBuffer.endDraw(); // 前のレンダーテクスチャの描画を終了\n this._currentMaskBuffer = maskBuffer;\n this._currentMaskBuffer.beginDraw(lastFbo); // 新しいレンダーテクスチャの描画を開始\n\n renderer.preDraw(); // バッファをクリアする\n }\n\n this._tmpBoundsOnModel.setRect(allClipedDrawRect);\n this._tmpBoundsOnModel.expand(\n allClipedDrawRect.width * margin,\n allClipedDrawRect.height * margin\n );\n //########## 本来は割り当てられた領域の全体を使わず必要最低限のサイズがよい\n\n // シェーダ用の計算式を求める。回転を考慮しない場合は以下のとおり\n // movePeriod' = movePeriod * scaleX + offX\t\t [[ movePeriod' = (movePeriod - tmpBoundsOnModel.movePeriod)*scale + layoutBoundsOnTex01.movePeriod ]]\n scaleX = layoutBoundsOnTex01.width / this._tmpBoundsOnModel.width;\n scaleY = layoutBoundsOnTex01.height / this._tmpBoundsOnModel.height;\n\n //--------- draw時の mask 参照用行列を計算---------\n this.createMatrixForMask(false, layoutBoundsOnTex01, scaleX, scaleY);\n\n clipContext._matrixForMask.setMatrix(this._tmpMatrixForMask.getArray());\n clipContext._matrixForDraw.setMatrix(this._tmpMatrixForDraw.getArray());\n\n if (drawObjectType == DrawableObjectType.DrawableObjectType_Offscreen) {\n // clipContext * mvp^-1\n const invertMvp = renderer.getMvpMatrix().getInvert();\n clipContext._matrixForDraw.multiplyByMatrix(invertMvp);\n }\n\n const clipDrawCount: number = clipContext._clippingIdCount;\n for (let i = 0; i < clipDrawCount; i++) {\n const clipDrawIndex: number = clipContext._clippingIdList[i];\n\n // 頂点情報が更新されておらず、信頼性がない場合は描画をパスする\n if (\n !model.getDrawableDynamicFlagVertexPositionsDidChange(clipDrawIndex)\n ) {\n continue;\n }\n\n renderer.setIsCulling(model.getDrawableCulling(clipDrawIndex) != false);\n\n // マスクがクリアされていないなら処理する\n if (!this._clearedMaskBufferFlags[clipContext._bufferIndex]) {\n // マスクをクリアする\n // (仮仕様) 1が無効(描かれない)領域、0が有効(描かれる)領域。(シェーダーCd*Csで0に近い値をかけてマスクを作る。1をかけると何も起こらない)\n this.gl.clearColor(1.0, 1.0, 1.0, 1.0);\n this.gl.clear(this.gl.COLOR_BUFFER_BIT);\n this._clearedMaskBufferFlags[clipContext._bufferIndex] = true;\n }\n\n // 今回専用の変換を適用して描く\n // チャンネルも切り替える必要がある(A,R,G,B)\n renderer.setClippingContextBufferForMask(clipContext);\n\n renderer.drawMeshWebGL(model, clipDrawIndex);\n }\n }\n\n // --- 後処理 ---\n this._currentMaskBuffer.endDraw(); // マスクの描画を終了\n renderer.setClippingContextBufferForMask(null);\n\n this.gl.viewport(\n lastViewport[0],\n lastViewport[1],\n lastViewport[2],\n lastViewport[3]\n );\n }\n\n /**\n * マスクの合計数をカウント\n *\n * @return マスクの合計数を返す\n */\n public getClippingMaskCount(): number {\n return this._clippingContextListForMask.length;\n }\n\n _currentMaskBuffer: CubismRenderTarget_WebGL; // マスク用オフスクリーンサーフェス\n\n gl: WebGLRenderingContext; // WebGLレンダリングコンテキスト\n}\n\n/**\n * クリッピングマスクのコンテキスト\n */\nexport class CubismClippingContext_WebGL extends CubismClippingContext {\n /**\n * 引数付きコンストラクタ\n *\n * @param manager マスクを管理しているマネージャのインスタンス\n * @param clippingDrawableIndices クリップしているDrawableのインデックスリスト\n * @param clipCount クリップしているDrawableの個数\n */\n public constructor(\n manager: CubismClippingManager_WebGL,\n clippingDrawableIndices: Int32Array,\n clipCount: number\n ) {\n super(clippingDrawableIndices, clipCount);\n this._owner = manager;\n }\n\n /**\n * このマスクを管理するマネージャのインスタンスを取得する\n *\n * @return クリッピングマネージャのインスタンス\n */\n public getClippingManager(): CubismClippingManager_WebGL {\n return this._owner;\n }\n\n /**\n * WebGLレンダリングコンテキストを設定する\n *\n * @param gl WebGLレンダリングコンテキスト\n */\n public setGl(gl: WebGLRenderingContext): void {\n this._owner.setGL(gl);\n }\n\n private _owner: CubismClippingManager_WebGL; // このマスクを管理しているマネージャのインスタンス\n}\n\n/**\n * Cubismモデルを描画する直前のWebGLのステートを保持・復帰させるクラス\n */\nexport class CubismRendererProfile_WebGL {\n /**\n * WebGLの有効・無効をセットする\n *\n * @param index 有効・無効にする機能\n * @param enabled trueなら有効にする\n */\n private setGlEnable(index: GLenum, enabled: GLboolean): void {\n if (enabled) this.gl.enable(index);\n else this.gl.disable(index);\n }\n\n /**\n * WebGLのVertex Attribute Array機能の有効・無効をセットする\n *\n * @param index 有効・無効にする機能\n * @param enabled trueなら有効にする\n */\n private setGlEnableVertexAttribArray(\n index: GLuint,\n enabled: GLboolean\n ): void {\n if (enabled) this.gl.enableVertexAttribArray(index);\n else this.gl.disableVertexAttribArray(index);\n }\n\n /**\n * WebGLのステートを保持する\n */\n public save(): void {\n if (this.gl == null) {\n CubismLogError(\n \"'gl' is null. WebGLRenderingContext is required.\\nPlease call 'CubimRenderer_WebGL.startUp' function.\"\n );\n return;\n }\n //-- push state --\n this._lastArrayBufferBinding = this.gl.getParameter(\n this.gl.ARRAY_BUFFER_BINDING\n );\n this._lastElementArrayBufferBinding = this.gl.getParameter(\n this.gl.ELEMENT_ARRAY_BUFFER_BINDING\n );\n this._lastProgram = this.gl.getParameter(this.gl.CURRENT_PROGRAM);\n\n this._lastActiveTexture = this.gl.getParameter(this.gl.ACTIVE_TEXTURE);\n this.gl.activeTexture(this.gl.TEXTURE1); //テクスチャユニット1をアクティブに(以後の設定対象とする)\n this._lastTexture1Binding2D = this.gl.getParameter(\n this.gl.TEXTURE_BINDING_2D\n );\n\n this.gl.activeTexture(this.gl.TEXTURE0); //テクスチャユニット0をアクティブに(以後の設定対象とする)\n this._lastTexture0Binding2D = this.gl.getParameter(\n this.gl.TEXTURE_BINDING_2D\n );\n\n this._lastVertexAttribArrayEnabled[0] = this.gl.getVertexAttrib(\n 0,\n this.gl.VERTEX_ATTRIB_ARRAY_ENABLED\n );\n this._lastVertexAttribArrayEnabled[1] = this.gl.getVertexAttrib(\n 1,\n this.gl.VERTEX_ATTRIB_ARRAY_ENABLED\n );\n this._lastVertexAttribArrayEnabled[2] = this.gl.getVertexAttrib(\n 2,\n this.gl.VERTEX_ATTRIB_ARRAY_ENABLED\n );\n this._lastVertexAttribArrayEnabled[3] = this.gl.getVertexAttrib(\n 3,\n this.gl.VERTEX_ATTRIB_ARRAY_ENABLED\n );\n\n this._lastScissorTest = this.gl.isEnabled(this.gl.SCISSOR_TEST);\n this._lastStencilTest = this.gl.isEnabled(this.gl.STENCIL_TEST);\n this._lastDepthTest = this.gl.isEnabled(this.gl.DEPTH_TEST);\n this._lastCullFace = this.gl.isEnabled(this.gl.CULL_FACE);\n this._lastBlend = this.gl.isEnabled(this.gl.BLEND);\n\n this._lastFrontFace = this.gl.getParameter(this.gl.FRONT_FACE);\n\n this._lastColorMask = this.gl.getParameter(this.gl.COLOR_WRITEMASK);\n\n // backup blending\n this._lastBlending[0] = this.gl.getParameter(this.gl.BLEND_SRC_RGB);\n this._lastBlending[1] = this.gl.getParameter(this.gl.BLEND_DST_RGB);\n this._lastBlending[2] = this.gl.getParameter(this.gl.BLEND_SRC_ALPHA);\n this._lastBlending[3] = this.gl.getParameter(this.gl.BLEND_DST_ALPHA);\n }\n\n /**\n * 保持したWebGLのステートを復帰させる\n */\n public restore(): void {\n if (this.gl == null) {\n CubismLogError(\n \"'gl' is null. WebGLRenderingContext is required.\\nPlease call 'CubimRenderer_WebGL.startUp' function.\"\n );\n return;\n }\n this.gl.useProgram(this._lastProgram);\n\n this.setGlEnableVertexAttribArray(0, this._lastVertexAttribArrayEnabled[0]);\n this.setGlEnableVertexAttribArray(1, this._lastVertexAttribArrayEnabled[1]);\n this.setGlEnableVertexAttribArray(2, this._lastVertexAttribArrayEnabled[2]);\n this.setGlEnableVertexAttribArray(3, this._lastVertexAttribArrayEnabled[3]);\n\n this.setGlEnable(this.gl.SCISSOR_TEST, this._lastScissorTest);\n this.setGlEnable(this.gl.STENCIL_TEST, this._lastStencilTest);\n this.setGlEnable(this.gl.DEPTH_TEST, this._lastDepthTest);\n this.setGlEnable(this.gl.CULL_FACE, this._lastCullFace);\n this.setGlEnable(this.gl.BLEND, this._lastBlend);\n\n this.gl.frontFace(this._lastFrontFace);\n\n this.gl.colorMask(\n this._lastColorMask[0],\n this._lastColorMask[1],\n this._lastColorMask[2],\n this._lastColorMask[3]\n );\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this._lastArrayBufferBinding); //前にバッファがバインドされていたら破棄する必要がある\n this.gl.bindBuffer(\n this.gl.ELEMENT_ARRAY_BUFFER,\n this._lastElementArrayBufferBinding\n );\n\n this.gl.activeTexture(this.gl.TEXTURE1); //テクスチャユニット1を復元\n this.gl.bindTexture(this.gl.TEXTURE_2D, this._lastTexture1Binding2D);\n\n this.gl.activeTexture(this.gl.TEXTURE0); //テクスチャユニット0を復元\n this.gl.bindTexture(this.gl.TEXTURE_2D, this._lastTexture0Binding2D);\n\n this.gl.activeTexture(this._lastActiveTexture);\n\n this.gl.blendFuncSeparate(\n this._lastBlending[0],\n this._lastBlending[1],\n this._lastBlending[2],\n this._lastBlending[3]\n );\n }\n\n /**\n * WebGLレンダリングコンテキストを設定する\n *\n * @param gl WebGLレンダリングコンテキスト\n */\n public setGl(gl: WebGLRenderingContext): void {\n this.gl = gl;\n }\n\n /**\n * コンストラクタ\n */\n constructor() {\n this._lastVertexAttribArrayEnabled = new Array<GLboolean>(4);\n this._lastColorMask = new Array<GLboolean>(4);\n this._lastBlending = new Array<GLint>(4);\n }\n\n private _lastArrayBufferBinding: GLint; ///< モデル描画直前の頂点バッファ\n private _lastElementArrayBufferBinding: GLint; ///< モデル描画直前のElementバッファ\n private _lastProgram: GLint; ///< モデル描画直前のシェーダプログラムバッファ\n private _lastActiveTexture: GLint; ///< モデル描画直前のアクティブなテクスチャ\n private _lastTexture0Binding2D: GLint; ///< モデル描画直前のテクスチャユニット0\n private _lastTexture1Binding2D: GLint; ///< モデル描画直前のテクスチャユニット1\n private _lastVertexAttribArrayEnabled: GLboolean[]; ///< モデル描画直前のテクスチャユニット1\n private _lastScissorTest: GLboolean; ///< モデル描画直前のGL_VERTEX_ATTRIB_ARRAY_ENABLEDパラメータ\n private _lastBlend: GLboolean; ///< モデル描画直前のGL_SCISSOR_TESTパラメータ\n private _lastStencilTest: GLboolean; ///< モデル描画直前のGL_STENCIL_TESTパラメータ\n private _lastDepthTest: GLboolean; ///< モデル描画直前のGL_DEPTH_TESTパラメータ\n private _lastCullFace: GLboolean; ///< モデル描画直前のGL_CULL_FACEパラメータ\n private _lastFrontFace: GLint; ///< モデル描画直前のGL_CULL_FACEパラメータ\n private _lastColorMask: GLboolean[]; ///< モデル描画直前のGL_COLOR_WRITEMASKパラメータ\n private _lastBlending: GLint[]; ///< モデル描画直前のカラーブレンディングパラメータ\n\n gl: WebGLRenderingContext;\n}\n\n/**\n * WebGL用の描画命令を実装したクラス\n */\nexport class CubismRenderer_WebGL extends CubismRenderer {\n /**\n * レンダラの初期化処理を実行する\n * 引数に渡したモデルからレンダラの初期化処理に必要な情報を取り出すことができる\n * NOTE: WebGLコンテキストが初期化されていない可能性があるため、ここではWebGLコンテキストを使う初期化は行わない。\n *\n * @param model モデルのインスタンス\n * @param maskBufferCount バッファの生成数\n */\n public initialize(model: CubismModel, maskBufferCount = 1): void {\n if (model.isUsingMasking()) {\n this._drawableClippingManager = new CubismClippingManager_WebGL(); // クリッピングマスク・バッファ前処理方式を初期化\n this._drawableClippingManager.initializeForDrawable(\n model,\n maskBufferCount\n );\n }\n\n if (model.isUsingMaskingForOffscreen()) {\n this._offscreenClippingManager = new CubismClippingManager_WebGL(); //クリッピングマスク・バッファ前処理方式を初期化\n this._offscreenClippingManager.initializeForOffscreen(\n model,\n maskBufferCount\n );\n }\n\n // IndexList と TypeListのサイズをモデルの描画オブジェクト数に合わせる\n updateSize(\n this._sortedObjectsIndexList,\n model.getDrawableCount() +\n (model.getOffscreenCount ? model.getOffscreenCount() : 0),\n 0,\n true\n );\n updateSize(\n this._sortedObjectsTypeList,\n model.getDrawableCount() +\n (model.getOffscreenCount ? model.getOffscreenCount() : 0),\n 0,\n true\n );\n\n super.initialize(model); // 親クラスの処理を呼ぶ\n }\n\n /**\n * オフスクリーンの親を探して設定する\n *\n * @param model モデルのインスタンス\n * @param offscreenCount オフスクリーンの数\n */\n private setupParentOffscreens(\n model: CubismModel,\n offscreenCount: number\n ): void {\n let parentOffscreen: CubismOffscreenRenderTarget_WebGL | null;\n for (\n let offscreenIndex = 0;\n offscreenIndex < offscreenCount;\n ++offscreenIndex\n ) {\n parentOffscreen = null;\n const ownerIndex = model.getOffscreenOwnerIndices()[offscreenIndex];\n let parentIndex = model.getPartParentPartIndices()[ownerIndex];\n\n // 親のオフスクリーンを探す\n while (parentIndex != NoParentIndex) {\n for (let i = 0; i < offscreenCount; ++i) {\n const ownerIndex =\n model.getOffscreenOwnerIndices()[\n this._offscreenList[i].getOffscreenIndex()\n ];\n if (ownerIndex != parentIndex) {\n continue; //オフスクリーンの所有者がパーツではない場合はスキップ\n }\n\n parentOffscreen = this._offscreenList[i];\n break;\n }\n\n if (parentOffscreen != null) {\n break; // 親のオフスクリーンが見つかった場合はループを抜ける\n }\n\n parentIndex = model.getPartParentPartIndices()[parentIndex];\n }\n\n // 親のオフスクリーンを設定\n this._offscreenList[offscreenIndex].setParentPartOffscreen(\n parentOffscreen\n );\n }\n }\n\n /**\n * WebGLテクスチャのバインド処理\n * CubismRendererにテクスチャを設定し、CubismRenderer内でその画像を参照するためのIndex値を戻り値とする\n *\n * @param modelTextureNo セットするモデルテクスチャの番号\n * @param glTextureNo WebGLテクスチャの番号\n */\n public bindTexture(modelTextureNo: number, glTexture: WebGLTexture): void {\n this._textures.set(modelTextureNo, glTexture);\n }\n\n /**\n * WebGLにバインドされたテクスチャのリストを取得する\n *\n * @return テクスチャのリスト\n */\n public getBindedTextures(): Map<number, WebGLTexture> {\n return this._textures;\n }\n\n /**\n * クリッピングマスクバッファのサイズを設定する\n * マスク用のFrameBufferを破棄、再作成する為処理コストは高い\n *\n * @param size クリッピングマスクバッファのサイズ\n */\n public setClippingMaskBufferSize(size: number) {\n // クリッピングマスクを利用しない場合は早期リターン\n if (!this._model.isUsingMasking()) {\n return;\n }\n\n // インスタンス破棄前にレンダーテクスチャの数を保存\n const renderTextureCount: number =\n this._drawableClippingManager.getRenderTextureCount();\n\n // FrameBufferのサイズを変更するためにインスタンスを破棄・再作成する\n this._drawableClippingManager.release();\n this._drawableClippingManager = void 0;\n this._drawableClippingManager = null;\n\n this._drawableClippingManager = new CubismClippingManager_WebGL();\n\n this._drawableClippingManager.setClippingMaskBufferSize(size);\n\n this._drawableClippingManager.initializeForDrawable(\n this.getModel(),\n renderTextureCount // インスタンス破棄前に保存したレンダーテクスチャの数\n );\n }\n\n /**\n * クリッピングマスクバッファのサイズを取得する\n *\n * @return クリッピングマスクバッファのサイズ\n */\n public getClippingMaskBufferSize(): number {\n return this._model.isUsingMasking()\n ? this._drawableClippingManager.getClippingMaskBufferSize()\n : s_invalidValue;\n }\n\n /**\n * ブレンドモード用のフレームバッファを取得する\n *\n * @return ブレンドモード用のフレームバッファ\n */\n public getModelRenderTarget(index: number): CubismRenderTarget_WebGL {\n return this._modelRenderTargets[index];\n }\n\n /**\n * レンダーテクスチャの枚数を取得する\n * @return レンダーテクスチャの枚数\n */\n public getRenderTextureCount(): number {\n return this._model.isUsingMasking()\n ? this._drawableClippingManager.getRenderTextureCount()\n : s_invalidValue;\n }\n\n /**\n * コンストラクタ\n */\n public constructor(width: number, height: number) {\n super(width, height);\n this._clippingContextBufferForMask = null;\n this._clippingContextBufferForDraw = null;\n this._rendererProfile = new CubismRendererProfile_WebGL();\n this._textures = new Map<number, number>();\n this._sortedObjectsIndexList = new Array<number>();\n this._sortedObjectsTypeList = new Array<number>();\n this._bufferData = {\n vertex: (WebGLBuffer = null),\n uv: (WebGLBuffer = null),\n index: (WebGLBuffer = null)\n };\n this._modelRenderTargets = new Array<CubismOffscreenRenderTarget_WebGL>();\n this._drawableMasks = new Array<CubismRenderTarget_WebGL>();\n this._currentFbo = null;\n this._drawableClippingManager = null;\n this._offscreenClippingManager = null;\n this._offscreenMasks = new Array<CubismRenderTarget_WebGL>();\n this._offscreenList = new Array<CubismOffscreenRenderTarget_WebGL>();\n\n // テクスチャ対応マップの容量を確保しておく\n // this._textures.prepareCapacity(32, true);\n }\n\n /**\n * デストラクタ相当の処理\n */\n public release(): void {\n if (this._drawableClippingManager) {\n this._drawableClippingManager.release();\n this._drawableClippingManager = void 0;\n this._drawableClippingManager = null;\n }\n\n if (this.gl == null) {\n return;\n }\n this.gl.deleteBuffer(this._bufferData.vertex);\n this._bufferData.vertex = null;\n this.gl.deleteBuffer(this._bufferData.uv);\n this._bufferData.uv = null;\n this.gl.deleteBuffer(this._bufferData.index);\n this._bufferData.index = null;\n this._bufferData = null;\n\n this._textures = null;\n\n for (let i = 0; i < this._modelRenderTargets.length; i++) {\n if (\n this._modelRenderTargets[i] != null &&\n this._modelRenderTargets[i].isValid()\n ) {\n this._modelRenderTargets[i].destroyRenderTarget();\n }\n }\n this._modelRenderTargets.length = 0;\n this._modelRenderTargets = null;\n\n for (let i = 0; i < this._drawableMasks.length; i++) {\n if (this._drawableMasks[i] != null && this._drawableMasks[i].isValid()) {\n this._drawableMasks[i].destroyRenderTarget();\n }\n }\n this._drawableMasks.length = 0;\n this._drawableMasks = null;\n\n for (let i = 0; i < this._offscreenMasks.length; i++) {\n if (\n this._offscreenMasks[i] != null &&\n this._offscreenMasks[i].isValid()\n ) {\n this._offscreenMasks[i].destroyRenderTarget();\n }\n }\n this._offscreenMasks.length = 0;\n this._offscreenMasks = null;\n\n for (let i = 0; i < this._offscreenList.length; i++) {\n if (this._offscreenList[i] != null && this._offscreenList[i].isValid()) {\n this._offscreenList[i].destroyRenderTarget();\n }\n }\n this._offscreenList.length = 0;\n this._offscreenList = null;\n\n this._offscreenClippingManager = null;\n this._drawableClippingManager = null;\n this._clippingContextBufferForMask = null;\n this._clippingContextBufferForDraw = null;\n\n this._rendererProfile = null;\n this._sortedObjectsIndexList = null;\n this._sortedObjectsTypeList = null;\n this._currentFbo = null;\n this._model = null;\n this.gl = null;\n }\n\n /**\n * Shaderの読み込みを行う\n * @param shaderPath シェーダのパス\n */\n public loadShaders(shaderPath: string = null): void {\n if (this.gl == null) {\n CubismLogError(\n \"'gl' is null. WebGLRenderingContext is required.\\nPlease call 'CubimRenderer_WebGL.startUp' function.\"\n );\n return;\n }\n\n if (\n CubismShaderManager_WebGL.getInstance().getShader(this.gl)._shaderSets\n .length == 0 ||\n !CubismShaderManager_WebGL.getInstance().getShader(this.gl)\n ._isShaderLoaded\n ) {\n const shader = CubismShaderManager_WebGL.getInstance().getShader(this.gl);\n if (shaderPath != null) {\n shader.setShaderPath(shaderPath);\n }\n shader.generateShaders();\n }\n }\n\n /**\n * モデルを描画する実際の処理\n * @param shaderPath シェーダのパス\n */\n public doDrawModel(shaderPath: string = null): void {\n this.loadShaders(shaderPath);\n this.beforeDrawModelRenderTarget();\n\n const lastFbo = this.gl.getParameter(\n this.gl.FRAMEBUFFER_BINDING\n ) as WebGLFramebuffer;\n const lastViewport = this.gl.getParameter(this.gl.VIEWPORT) as number[];\n\n // //------------ クリッピングマスク・バッファ前処理方式の場合 ------------\n if (this._drawableClippingManager != null) {\n this.preDraw();\n for (\n let i = 0;\n i < this._drawableClippingManager.getRenderTextureCount();\n ++i\n ) {\n if (\n this._drawableMasks[i].getBufferWidth() !=\n this._drawableClippingManager.getClippingMaskBufferSize() ||\n this._drawableMasks[i].getBufferHeight() !=\n this._drawableClippingManager.getClippingMaskBufferSize()\n ) {\n // クリッピングマスクのサイズが変更された場合は、オフスクリーンサーフェスを再作成する\n this._drawableMasks[i].createRenderTarget(\n this.gl,\n this._drawableClippingManager.getClippingMaskBufferSize(),\n this._drawableClippingManager.getClippingMaskBufferSize(),\n lastFbo\n );\n }\n }\n\n if (this.isUsingHighPrecisionMask()) {\n this._drawableClippingManager.setupMatrixForHighPrecision(\n this.getModel(),\n false\n );\n } else {\n this._drawableClippingManager.setupClippingContext(\n this.getModel(),\n this,\n lastFbo,\n lastViewport,\n DrawableObjectType.DrawableObjectType_Drawable\n );\n }\n }\n\n if (this._offscreenClippingManager != null) {\n this.preDraw();\n\n // サイズが違う場合はここで作成しなおし\n for (\n let i = 0;\n i < this._offscreenClippingManager.getRenderTextureCount();\n ++i\n ) {\n if (\n this._offscreenMasks[i].getBufferWidth() !=\n this._offscreenClippingManager.getClippingMaskBufferSize() ||\n this._offscreenMasks[i].getBufferHeight() !=\n this._offscreenClippingManager.getClippingMaskBufferSize()\n ) {\n this._offscreenMasks[i].createRenderTarget(\n this.gl,\n this._offscreenClippingManager.getClippingMaskBufferSize(),\n this._offscreenClippingManager.getClippingMaskBufferSize(),\n lastFbo\n );\n }\n }\n\n if (this.isUsingHighPrecisionMask()) {\n this._offscreenClippingManager.setupMatrixForOffscreenHighPrecision(\n this.getModel(),\n false,\n this.getMvpMatrix()\n );\n } else {\n this._offscreenClippingManager.setupClippingContext(\n this.getModel(),\n this,\n lastFbo,\n lastViewport,\n DrawableObjectType.DrawableObjectType_Offscreen\n );\n }\n }\n\n // 上記クリッピング処理内でも一度PreDrawを呼ぶので注意!!\n this.preDraw();\n\n this.drawObjectLoop(lastFbo);\n\n this.afterDrawModelRenderTarget();\n }\n\n /**\n * 描画オブジェクトのループ処理を行う。\n *\n * @param lastFbo 前回のフレームバッファ\n */\n public drawObjectLoop(lastFbo: WebGLFramebuffer): void {\n const model = this.getModel();\n const drawableCount = model.getDrawableCount();\n const offscreenCount = model.getOffscreenCount();\n const totalCount = drawableCount + offscreenCount;\n const renderOrder = model.getRenderOrders();\n\n this._currentOffscreen = null; // 現在のオフスクリーンを初期化\n this._currentFbo = lastFbo;\n this._modelRootFbo = lastFbo;\n\n // インデックスを描画順でソート\n for (let i = 0; i < totalCount; ++i) {\n const order = renderOrder[i];\n\n if (i < drawableCount) {\n this._sortedObjectsIndexList[order] = i;\n this._sortedObjectsTypeList[order] =\n DrawableObjectType.DrawableObjectType_Drawable;\n } else if (i < totalCount) {\n this._sortedObjectsIndexList[order] = i - drawableCount;\n this._sortedObjectsTypeList[order] =\n DrawableObjectType.DrawableObjectType_Offscreen;\n }\n }\n\n // 描画\n for (let i = 0; i < totalCount; ++i) {\n const objectIndex = this._sortedObjectsIndexList[i];\n const objectType = this._sortedObjectsTypeList[i];\n\n this.renderObject(objectIndex, objectType);\n }\n\n while (this._currentOffscreen != null) {\n // オフスクリーンが残っている場合は親オフスクリーンへの伝搬を行う\n this.submitDrawToParentOffscreen(\n this._currentOffscreen.getOffscreenIndex(),\n DrawableObjectType.DrawableObjectType_Offscreen\n );\n }\n }\n\n /**\n * 描画オブジェクトを描画する。\n *\n * @param objectIndex 描画対象のオブジェクトのインデックス\n * @param objectType 描画対象のオブジェクトのタイプ\n * @param lastFbo 前回のフレームバッファ\n * @param lastViewport 前回のビューポート\n */\n protected renderObject(\n objectIndex: number,\n objectType: DrawableObjectType\n ): void {\n switch (objectType) {\n case DrawableObjectType.DrawableObjectType_Drawable:\n this.drawDrawable(objectIndex, this._modelRootFbo);\n break;\n case DrawableObjectType.DrawableObjectType_Offscreen:\n this.addOffscreen(objectIndex);\n break;\n default:\n CubismLogError('Unknown object type: ' + objectType);\n break;\n }\n }\n\n /**\n * 描画オブジェクト(アートメッシュ)を描画する。\n *\n * @param model 描画対象のモデル\n * @param index 描画対象のメッシュのインデックス\n */\n public drawDrawable(drawableIndex: number, rootFbo: WebGLFramebuffer): void {\n // Drawableが表示状態でなければ処理をパスする\n if (!this.getModel().getDrawableDynamicFlagIsVisible(drawableIndex)) {\n return;\n }\n\n this.submitDrawToParentOffscreen(\n drawableIndex,\n DrawableObjectType.DrawableObjectType_Drawable\n );\n\n const clipContext =\n this._drawableClippingManager != null\n ? this._drawableClippingManager.getClippingContextListForDraw()[\n drawableIndex\n ]\n : null;\n\n if (clipContext != null && this.isUsingHighPrecisionMask()) {\n // 描くことになっていた\n if (clipContext._isUsing) {\n // 生成したFrameBufferと同じサイズでビューポートを設定\n this.gl.viewport(\n 0,\n 0,\n this._drawableClippingManager.getClippingMaskBufferSize(),\n this._drawableClippingManager.getClippingMaskBufferSize()\n );\n\n this.preDraw(); // バッファをクリアする\n\n // ---------- マスク描画処理 ----------\n // マスク用RenderTextureをactiveにセット\n this.getDrawableMaskBuffer(clipContext._bufferIndex).beginDraw(\n this._currentFbo\n );\n\n // マスクをクリアする\n // (仮仕様) 1が無効(描かれない)領域、0が有効(描かれる)領域。(シェーダーCd*Csで0に近い値をかけてマスクを作る。1をかけると何も起こらない)\n this.gl.clearColor(1.0, 1.0, 1.0, 1.0);\n this.gl.clear(this.gl.COLOR_BUFFER_BIT);\n }\n\n {\n const clipDrawCount: number = clipContext._clippingIdCount;\n\n for (let index = 0; index < clipDrawCount; index++) {\n const clipDrawIndex: number = clipContext._clippingIdList[index];\n\n // 頂点情報が更新されておらず、信頼性がない場合は描画をパスする\n if (\n !this._model.getDrawableDynamicFlagVertexPositionsDidChange(\n clipDrawIndex\n )\n ) {\n continue;\n }\n\n this.setIsCulling(\n this._model.getDrawableCulling(clipDrawIndex) != false\n );\n\n // 今回専用の変換を適用して描く\n // チャンネルも切り替える必要がある(A,R,G,B)\n this.setClippingContextBufferForMask(clipContext);\n\n this.drawMeshWebGL(this._model, clipDrawIndex);\n }\n\n // --- 後処理 ---\n this.getDrawableMaskBuffer(clipContext._bufferIndex).endDraw();\n this.setClippingContextBufferForMask(null);\n\n this.gl.viewport(\n 0,\n 0,\n this._modelRenderTargetWidth,\n this._modelRenderTargetHeight\n );\n\n this.preDraw(); // バッファをクリアする\n }\n }\n\n // クリッピングマスクをセットする\n this.setClippingContextBufferForDrawable(clipContext);\n\n this.setIsCulling(this.getModel().getDrawableCulling(drawableIndex));\n\n this.drawMeshWebGL(this._model, drawableIndex);\n }\n\n /**\n * 描画オブジェクト(アートメッシュ)を描画する。\n *\n * @param model 描画対象のモデル\n * @param index 描画対象のメッシュのインデックス\n */\n public drawMeshWebGL(model: Readonly<CubismModel>, index: number): void {\n // 裏面描画の有効・無効\n if (this.isCulling()) {\n this.gl.enable(this.gl.CULL_FACE);\n } else {\n this.gl.disable(this.gl.CULL_FACE);\n }\n\n this.gl.frontFace(this.gl.CCW); // Cubism SDK OpenGLはマスク・アートメッシュ共にCCWが表面\n\n if (this.isGeneratingMask()) {\n CubismShaderManager_WebGL.getInstance()\n .getShader(this.gl)\n .setupShaderProgramForMask(this, model, index);\n } else {\n CubismShaderManager_WebGL.getInstance()\n .getShader(this.gl)\n .setupShaderProgramForDrawable(this, model, index);\n }\n\n if (\n !CubismShaderManager_WebGL.getInstance().getShader(this.gl)\n ._isShaderLoaded\n ) {\n // シェーダーがロードされていない場合は描画を行わない\n // NOTE: Cubism 5.2 以前のモデル描画時にのみ、マスク無しのモデルが描画されてしまうためここで早期リターン\n return;\n }\n\n {\n const indexCount: number = model.getDrawableVertexIndexCount(index);\n this.gl.drawElements(\n this.gl.TRIANGLES,\n indexCount,\n this.gl.UNSIGNED_SHORT,\n 0\n );\n }\n\n // 後処理\n this.gl.useProgram(null);\n this.setClippingContextBufferForDrawable(null);\n this.setClippingContextBufferForMask(null);\n }\n\n /**\n * オフスクリーンを親のオフスクリーンにコピーする。\n *\n * @param objectIndex オブジェクトのインデックス\n * @param objectType オブジェクトの種類\n */\n submitDrawToParentOffscreen(\n objectIndex: number,\n objectType: DrawableObjectType\n ): void {\n if (this._currentOffscreen == null || objectIndex == s_invalidValue) {\n return;\n }\n\n const currentOwnerIndex =\n this.getModel().getOffscreenOwnerIndices()[\n this._currentOffscreen.getOffscreenIndex()\n ];\n\n // オーナーが不明な場合は処理を終了\n if (currentOwnerIndex == s_invalidValue) {\n return;\n }\n\n let targetParentIndex = NoParentIndex;\n\n switch (objectType) {\n case DrawableObjectType.DrawableObjectType_Drawable:\n targetParentIndex =\n this.getModel().getDrawableParentPartIndex(objectIndex);\n break;\n case DrawableObjectType.DrawableObjectType_Offscreen:\n targetParentIndex =\n this.getModel().getPartParentPartIndices()[\n this.getModel().getOffscreenOwnerIndices()[objectIndex]\n ];\n break;\n default:\n // 不明なタイプだった場合は処理を終了\n return;\n }\n while (targetParentIndex != NoParentIndex) {\n // オブジェクトの親が現在のオーナーと同じ場合は処理を終了\n if (targetParentIndex == currentOwnerIndex) {\n return;\n }\n\n targetParentIndex =\n this.getModel().getPartParentPartIndices()[targetParentIndex];\n }\n\n // 描画\n this.drawOffscreen(this._currentOffscreen);\n\n // さらに親のオフスクリーンに伝搬可能なら伝搬する\n this.submitDrawToParentOffscreen(objectIndex, objectType);\n }\n\n /**\n * 描画オブジェクト(オフスクリーン)を追加する。\n *\n * @param offscreenIndex オフスクリーンのインデックス\n */\n public addOffscreen(offscreenIndex: number): void {\n // 以前のオフスクリーンレンダリングターゲットを親に伝搬する処理を追加する\n if (\n this._currentOffscreen != null &&\n this._currentOffscreen.getOffscreenIndex() != offscreenIndex\n ) {\n let isParent = false;\n const ownerIndex =\n this.getModel().getOffscreenOwnerIndices()[offscreenIndex];\n let parentIndex = this.getModel().getPartParentPartIndices()[ownerIndex];\n\n const currentOffscreenIndex = this._currentOffscreen.getOffscreenIndex();\n const currentOffscreenOwnerIndex =\n this.getModel().getOffscreenOwnerIndices()[currentOffscreenIndex];\n while (parentIndex != NoParentIndex) {\n if (parentIndex == currentOffscreenOwnerIndex) {\n isParent = true;\n break;\n }\n parentIndex = this.getModel().getPartParentPartIndices()[parentIndex];\n }\n\n if (!isParent) {\n // 現在のオフスクリーンレンダリングターゲットがあるなら、親に伝搬する\n this.submitDrawToParentOffscreen(\n offscreenIndex,\n DrawableObjectType.DrawableObjectType_Offscreen\n );\n }\n }\n\n const offscreen = this._offscreenList[offscreenIndex];\n\n // レンダーターゲットが未生成、レンダーテクスチャ使用中、もしくはサイズが異なるなら新しいオフスクリーンレンダリングターゲットを作成\n if (\n offscreen.getRenderTexture() == null ||\n offscreen.getBufferWidth() != this._modelRenderTargetWidth ||\n offscreen.getBufferHeight() != this._modelRenderTargetHeight ||\n offscreen.getUsingRenderTextureState()\n ) {\n offscreen.setOffscreenRenderTarget(\n this.gl,\n this._modelRenderTargetWidth,\n this._modelRenderTargetHeight,\n this._currentFbo\n );\n } else {\n // 既存のRenderTextureを使用するので使用フラグを立てる。\n offscreen.startUsingRenderTexture();\n }\n\n // 以前のオフスクリーンレンダリングターゲットを取得\n const oldOffscreen = offscreen.getParentPartOffscreen();\n offscreen.setOldOffscreen(oldOffscreen);\n\n let oldFBO: WebGLFramebuffer = null;\n if (oldOffscreen != null) {\n oldFBO = oldOffscreen.getRenderTexture();\n }\n if (oldFBO == null) {\n oldFBO = this._modelRootFbo; // ルートのFBOを使用\n }\n\n // 別バッファに描画を開始\n offscreen.beginDraw(oldFBO);\n this.gl.viewport(\n 0,\n 0,\n this._modelRenderTargetWidth,\n this._modelRenderTargetHeight\n );\n offscreen.clear(0.0, 0.0, 0.0, 0.0);\n\n // 現在のオフスクリーンレンダリングターゲットを設定\n this._currentOffscreen = offscreen;\n this._currentFbo = offscreen.getRenderTexture();\n }\n\n /**\n * オフスクリーン描画を行う。\n *\n * @param offscreen オフスクリーンレンダリングターゲット\n */\n public drawOffscreen(offscreen: CubismOffscreenRenderTarget_WebGL): void {\n const offscreenIndex = offscreen.getOffscreenIndex();\n\n // クリッピングマスク\n const clipContext =\n this._offscreenClippingManager != null\n ? this._offscreenClippingManager.getClippingContextListForOffscreen()[\n offscreenIndex\n ]\n : null;\n\n if (clipContext != null && this.isUsingHighPrecisionMask()) {\n // マスクを書く必要がある\n if (clipContext._isUsing) {\n // 書くことになっていた\n // 生成したRenderTargetと同じサイズでビューポートを設定\n this.gl.viewport(\n 0,\n 0,\n this._offscreenClippingManager.getClippingMaskBufferSize(),\n this._offscreenClippingManager.getClippingMaskBufferSize()\n );\n\n this.preDraw(); // バッファをクリアする\n\n // ---------- マスク描画処理 ----------\n // マスク用RenderTextureをactiveにセット\n this.getOffscreenMaskBuffer(clipContext._bufferIndex).beginDraw(\n this._currentFbo\n );\n\n // マスクをクリアする\n // 1が無効(描かれない)領域、0が有効(描かれる)領域。(シェーダで Cd*Csで0に近い値をかけてマスクを作る。1をかけると何も起こらない)\n this.gl.clearColor(1.0, 1.0, 1.0, 1.0);\n this.gl.clear(this.gl.COLOR_BUFFER_BIT);\n }\n\n {\n const clipDrawCount = clipContext._clippingIdCount;\n for (let index = 0; index < clipDrawCount; index++) {\n const clipDrawIndex = clipContext._clippingIdList[index];\n\n // 頂点情報が更新されておらず、信頼性がない場合は描画をパスする\n if (\n !this.getModel().getDrawableDynamicFlagVertexPositionsDidChange(\n clipDrawIndex\n )\n ) {\n continue;\n }\n\n this.setIsCulling(\n this.getModel().getDrawableCulling(clipDrawIndex) != false\n );\n\n // 今回専用の変換を適用して描く\n // チャンネルも切り替える必要がある(A,R,G,B)\n this.setClippingContextBufferForMask(clipContext);\n\n this.drawMeshWebGL(this.getModel(), clipDrawIndex);\n }\n }\n\n {\n // --- 後処理 ---\n this.getOffscreenMaskBuffer(clipContext._bufferIndex).endDraw();\n this.setClippingContextBufferForMask(null);\n this.gl.viewport(\n 0,\n 0,\n this._modelRenderTargetWidth,\n this._modelRenderTargetHeight\n );\n\n this.preDraw(); // バッファをクリアする\n }\n }\n\n // クリッピングマスクをセットする\n this.setClippingContextBufferForOffscreen(clipContext);\n\n this.setIsCulling(this._model.getOffscreenCulling(offscreenIndex) != false);\n\n this.drawOffscreenWebGL(this.getModel(), offscreen);\n }\n\n /**\n * オフスクリーン描画のWebGL実装\n *\n * @param model モデル\n * @param index オフスクリーンインデックス\n */\n public drawOffscreenWebGL(\n model: Readonly<CubismModel>,\n offscreen: CubismOffscreenRenderTarget_WebGL\n ): void {\n // 裏面描画の有効・無効\n if (this.isCulling()) {\n this.gl.enable(this.gl.CULL_FACE);\n } else {\n this.gl.disable(this.gl.CULL_FACE);\n }\n\n this.gl.frontFace(this.gl.CCW); // Cubism SDK OpenGLはマスク・アートメッシュ共にCCWが表面\n\n CubismShaderManager_WebGL.getInstance()\n .getShader(this.gl)\n .setupShaderProgramForOffscreen(this, model, offscreen);\n\n offscreen.endDraw();\n this._currentOffscreen = this._currentOffscreen.getOldOffscreen();\n this._currentFbo = offscreen.getOldFBO();\n if (this._currentFbo == null) {\n this._currentOffscreen = this._modelRenderTargets[0];\n this._currentFbo = this._modelRenderTargets[0].getRenderTexture();\n this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, this._currentFbo);\n }\n\n // ポリゴンメッシュを描画する\n {\n // インデックスバッファの作成とバインド\n const indexBuffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, indexBuffer);\n this.gl.bufferData(\n this.gl.ELEMENT_ARRAY_BUFFER,\n s_renderTargetIndexArray,\n this.gl.STATIC_DRAW\n );\n\n // 描画\n this.gl.drawElements(\n this.gl.TRIANGLES,\n s_renderTargetIndexArray.length,\n this.gl.UNSIGNED_SHORT,\n 0\n );\n this.gl.deleteBuffer(indexBuffer);\n }\n\n // 後処理\n offscreen.stopUsingRenderTexture();\n this.gl.useProgram(null);\n this.setClippingContextBufferForMask(null);\n this.setClippingContextBufferForOffscreen(null);\n }\n\n /**\n * モデル描画直前のレンダラのステートを保持する\n */\n protected saveProfile(): void {\n this._rendererProfile.save();\n }\n\n /**\n * モデル描画直前のレンダラのステートを復帰させる\n */\n protected restoreProfile(): void {\n this._rendererProfile.restore();\n }\n\n /**\n * モデル描画直前のオフスクリーン設定を行う\n */\n public beforeDrawModelRenderTarget(): void {\n if (this._modelRenderTargets.length == 0) {\n return;\n }\n\n // オフスクリーンのバッファのサイズが違う場合は作り直し\n for (let i = 0; i < this._modelRenderTargets.length; ++i) {\n if (\n this._modelRenderTargets[i].getBufferWidth() !=\n this._modelRenderTargetWidth ||\n this._modelRenderTargets[i].getBufferHeight() !=\n this._modelRenderTargetHeight\n ) {\n this._modelRenderTargets[i].createRenderTarget(\n this.gl,\n this._modelRenderTargetWidth,\n this._modelRenderTargetHeight,\n this._currentFbo\n );\n }\n }\n\n // 別バッファに描画を開始\n this._modelRenderTargets[0].beginDraw();\n this._modelRenderTargets[0].clear(0.0, 0.0, 0.0, 0.0);\n }\n\n /**\n * モデル描画後のオフスクリーン設定を行う\n */\n public afterDrawModelRenderTarget(): void {\n if (this._modelRenderTargets.length == 0) {\n return;\n }\n\n // 元のバッファに描画する\n this._modelRenderTargets[0].endDraw();\n\n CubismShaderManager_WebGL.getInstance()\n .getShader(this.gl)\n .setupShaderProgramForOffscreenRenderTarget(this);\n\n if (\n CubismShaderManager_WebGL.getInstance().getShader(this.gl)._isShaderLoaded\n ) {\n // インデックスバッファの作成とバインド\n const indexBuffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, indexBuffer);\n this.gl.bufferData(\n this.gl.ELEMENT_ARRAY_BUFFER,\n s_renderTargetIndexArray,\n this.gl.STATIC_DRAW\n );\n\n // 描画\n this.gl.drawElements(\n this.gl.TRIANGLES,\n s_renderTargetIndexArray.length,\n this.gl.UNSIGNED_SHORT,\n 0\n );\n this.gl.deleteBuffer(indexBuffer);\n }\n\n this.gl.useProgram(null);\n }\n\n /**\n * オフスクリーンのクリッピングマスクのバッファを取得する\n *\n * @param index オフスクリーンのクリッピングマスクのバッファのインデックス\n *\n * @return オフスクリーンのクリッピングマスクのバッファへのポインタ\n */\n getOffscreenMaskBuffer(index: number): CubismRenderTarget_WebGL {\n return this._offscreenMasks[index];\n }\n\n /**\n * レンダラが保持する静的なリソースを解放する\n * WebGLの静的なシェーダープログラムを解放する\n */\n public static doStaticRelease(): void {\n CubismShaderManager_WebGL.deleteInstance();\n }\n\n /**\n * レンダーステートを設定する\n *\n * @param fbo アプリケーション側で指定しているフレームバッファ\n * @param viewport ビューポート\n */\n public setRenderState(fbo: WebGLFramebuffer, viewport: number[]): void {\n this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, fbo);\n this.gl.viewport(viewport[0], viewport[1], viewport[2], viewport[3]);\n\n if (\n this._modelRenderTargetWidth != viewport[2] ||\n this._modelRenderTargetHeight != viewport[3]\n ) {\n this._modelRenderTargetWidth = viewport[2];\n this._modelRenderTargetHeight = viewport[3];\n }\n }\n\n /**\n * 描画開始時の追加処理\n * モデルを描画する前にクリッピングマスクに必要な処理を実装している\n */\n public preDraw(): void {\n this.gl.disable(this.gl.SCISSOR_TEST);\n this.gl.disable(this.gl.STENCIL_TEST);\n this.gl.disable(this.gl.DEPTH_TEST);\n\n // カリング(1.0beta3)\n this.gl.frontFace(this.gl.CW);\n\n this.gl.enable(this.gl.BLEND);\n this.gl.colorMask(true, true, true, true);\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, null); // 前にバッファがバインドされていたら破棄する必要がある\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, null);\n\n // 異方性フィルタリングを適用する\n if (this.getAnisotropy() > 0.0 && this._extension) {\n for (let i = 0; i < this._textures.size; ++i) {\n this.gl.bindTexture(this.gl.TEXTURE_2D, this._textures.get(i));\n this.gl.texParameterf(\n this.gl.TEXTURE_2D,\n this._extension.TEXTURE_MAX_ANISOTROPY_EXT,\n this.getAnisotropy()\n );\n }\n }\n }\n\n /**\n * Drawableのマスク用のオフスクリーンサーフェースを取得する\n *\n * @param index オフスクリーンサーフェースのインデックス\n *\n * @return マスク用のオフスクリーンサーフェース\n */\n public getDrawableMaskBuffer(index: number): CubismRenderTarget_WebGL {\n return this._drawableMasks[index];\n }\n\n /**\n * マスクテクスチャに描画するクリッピングコンテキストをセットする\n */\n public setClippingContextBufferForMask(clip: CubismClippingContext_WebGL) {\n this._clippingContextBufferForMask = clip;\n }\n\n /**\n * マスクテクスチャに描画するクリッピングコンテキストを取得する\n *\n * @return マスクテクスチャに描画するクリッピングコンテキスト\n */\n public getClippingContextBufferForMask(): CubismClippingContext_WebGL {\n return this._clippingContextBufferForMask;\n }\n\n /**\n * Drawableの画面上に描画するクリッピングコンテキストをセットする\n *\n * @param clip drawableで画面上に描画するクリッピングコンテキスト\n */\n public setClippingContextBufferForDrawable(\n clip: CubismClippingContext_WebGL\n ): void {\n this._clippingContextBufferForDraw = clip;\n }\n\n /**\n * Drawableの画面上に描画するクリッピングコンテキストを取得する\n *\n * @return Drawableの画面上に描画するクリッピングコンテキスト\n */\n public getClippingContextBufferForDrawable(): CubismClippingContext_WebGL {\n return this._clippingContextBufferForDraw;\n }\n\n /**\n * offscreenで画面上に描画するクリッピングコンテキストをセットする。\n *\n * @param clip offscreenで画面上に描画するクリッピングコンテキスト\n */\n public setClippingContextBufferForOffscreen(\n clip: CubismClippingContext_WebGL\n ): void {\n this._clippingContextBufferForOffscreen = clip;\n }\n\n /**\n * offscreenで画面上に描画するクリッピングコンテキストを取得する。\n *\n * @return offscreenで画面上に描画するクリッピングコンテキスト\n */\n public getClippingContextBufferForOffscreen(): CubismClippingContext_WebGL {\n return this._clippingContextBufferForOffscreen;\n }\n\n /**\n * マスク生成時かを判定する\n *\n * @return 判定値\n */\n public isGeneratingMask() {\n return this.getClippingContextBufferForMask() != null;\n }\n\n /**\n * glの設定\n */\n public startUp(gl: WebGLRenderingContext | WebGL2RenderingContext): void {\n this.gl = gl;\n\n if (this._drawableClippingManager) {\n this._drawableClippingManager.setGL(gl);\n }\n\n if (this._offscreenClippingManager) {\n this._offscreenClippingManager.setGL(gl);\n }\n\n CubismShaderManager_WebGL.getInstance().setGlContext(gl);\n this._rendererProfile.setGl(gl);\n\n // 異方性フィルタリングが使用できるかチェック\n this._extension =\n this.gl.getExtension('EXT_texture_filter_anisotropic') ||\n this.gl.getExtension('WEBKIT_EXT_texture_filter_anisotropic') ||\n this.gl.getExtension('MOZ_EXT_texture_filter_anisotropic');\n\n if (this._model.isUsingMasking()) {\n this._drawableMasks.length =\n this._drawableClippingManager.getRenderTextureCount();\n for (let i = 0; i < this._drawableMasks.length; ++i) {\n const renderTarget = new CubismRenderTarget_WebGL();\n renderTarget.createRenderTarget(\n this.gl,\n this._drawableClippingManager.getClippingMaskBufferSize(),\n this._drawableClippingManager.getClippingMaskBufferSize(),\n this._currentFbo\n );\n this._drawableMasks[i] = renderTarget;\n }\n }\n\n if (this._model.isBlendModeEnabled()) {\n // オフスクリーンの作成\n this._modelRenderTargets.length = 0;\n\n // TextureBarrierの代替用にオフスクリーンを2つ作成する\n const createSize = 3;\n this._modelRenderTargets.length = createSize;\n for (let i = 0; i < createSize; ++i) {\n const offscreenRenderTarget: CubismOffscreenRenderTarget_WebGL =\n new CubismOffscreenRenderTarget_WebGL();\n offscreenRenderTarget.createRenderTarget(\n this.gl,\n this._modelRenderTargetWidth,\n this._modelRenderTargetHeight,\n this._currentFbo\n );\n this._modelRenderTargets[i] = offscreenRenderTarget;\n }\n\n if (this._model.isUsingMaskingForOffscreen()) {\n this._offscreenMasks.length =\n this._offscreenClippingManager.getRenderTextureCount();\n for (let i = 0; i < this._offscreenMasks.length; ++i) {\n const offscreenMask = new CubismRenderTarget_WebGL();\n offscreenMask.createRenderTarget(\n this.gl,\n this._offscreenClippingManager.getClippingMaskBufferSize(),\n this._offscreenClippingManager.getClippingMaskBufferSize(),\n this._currentFbo\n );\n this._offscreenMasks[i] = offscreenMask;\n }\n }\n\n const offscreenCount = this._model.getOffscreenCount();\n // オフスクリーンの数が0の場合は何もしない\n if (offscreenCount > 0) {\n this._offscreenList = new Array<CubismOffscreenRenderTarget_WebGL>(\n offscreenCount\n );\n for (\n let offscreenIndex = 0;\n offscreenIndex < offscreenCount;\n ++offscreenIndex\n ) {\n const offscreenRenderTarget = new CubismOffscreenRenderTarget_WebGL();\n offscreenRenderTarget.setOffscreenIndex(offscreenIndex);\n this._offscreenList[offscreenIndex] = offscreenRenderTarget;\n }\n\n // 全てのオフスクリーンを登録し終わってから行う\n this.setupParentOffscreens(this._model, offscreenCount);\n }\n }\n\n // 描画対象を初期状態に戻す\n this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, this._currentFbo);\n }\n\n _textures: Map<number, WebGLTexture>; // モデルが参照するテクスチャとレンダラでバインドしているテクスチャとのマップ\n _sortedObjectsIndexList: Array<number>; // 描画オブジェクトのインデックスを描画順に並べたリスト\n _sortedObjectsTypeList: Array<number>; // 描画オブジェクトのオブジェクトタイプを描画順に並べたリスト\n _rendererProfile: CubismRendererProfile_WebGL;\n _drawableClippingManager: CubismClippingManager_WebGL; // クリッピングマスク管理オブジェクト\n _clippingContextBufferForMask: CubismClippingContext_WebGL; // マスクテクスチャに描画するためのクリッピングコンテキスト\n _clippingContextBufferForDraw: CubismClippingContext_WebGL; // 画面上描画するためのクリッピングコンテキスト\n _clippingContextBufferForOffscreen: CubismClippingContext_WebGL; // オフスクリーン描画用のクリッピングコンテキスト\n _offscreenClippingManager: CubismClippingManager_WebGL; // オフスクリーン描画用のクリッピングマスク管理オブジェクト\n\n _modelRenderTargets: Array<CubismOffscreenRenderTarget_WebGL>; ///< モデル全体を描画する先のフレームバッファ\n\n _drawableMasks: Array<CubismRenderTarget_WebGL>; // マスク用のオフスクリーンサーフェースのリスト\n _offscreenMasks: Array<CubismRenderTarget_WebGL>; ///< オフスクリーン機能マスク描画用のフレームバッファ\n\n _offscreenList: Array<CubismOffscreenRenderTarget_WebGL>; ///< モデルのオフスクリーン\n _currentFbo: WebGLFramebuffer; ///< 現在のフレームバッファオブジェクト\n _currentOffscreen: CubismOffscreenRenderTarget_WebGL | null; // 現在のオフスクリーン\n\n _modelRootFbo: WebGLFramebuffer; // モデルのルートフレームバッファ\n\n _bufferData: {\n vertex: WebGLBuffer;\n uv: WebGLBuffer;\n index: WebGLBuffer;\n }; // 頂点バッファデータ\n _extension: any; // 拡張機能\n gl: WebGLRenderingContext | WebGL2RenderingContext; // webglコンテキスト\n}\n\n/**\n * レンダラが保持する静的なリソースを開放する\n */\nCubismRenderer.staticRelease = (): void => {\n CubismRenderer_WebGL.doStaticRelease();\n};\n\n// Namespace definition for compatibility.\nimport * as $ from './cubismrenderer_webgl';\nimport { CubismRenderTarget_WebGL as CubismRenderTarget_WebGL } from './cubismrendertarget_webgl';\nimport { CubismOffscreenRenderTarget_WebGL as CubismOffscreenRenderTarget_WebGL } from './cubismoffscreenrendertarget_webgl';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const CubismClippingContext = $.CubismClippingContext_WebGL;\n export type CubismClippingContext = $.CubismClippingContext_WebGL;\n export const CubismClippingManager_WebGL = $.CubismClippingManager_WebGL;\n export type CubismClippingManager_WebGL = $.CubismClippingManager_WebGL;\n export const CubismRenderer_WebGL = $.CubismRenderer_WebGL;\n export type CubismRenderer_WebGL = $.CubismRenderer_WebGL;\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport { CubismMath } from '../math/cubismmath';\nimport { CubismModel } from '../model/cubismmodel';\nimport { CSM_ASSERT, CubismDebug } from '../utils/cubismdebug';\nimport { CubismMotionQueueEntry } from './cubismmotionqueueentry';\n\n/** モーション再生開始コールバック関数定義 */\nexport type BeganMotionCallback = (self: ACubismMotion) => void;\n\n/** モーション再生終了コールバック関数定義 */\nexport type FinishedMotionCallback = (self: ACubismMotion) => void;\n\n/**\n * モーションの抽象基底クラス\n *\n * モーションの抽象基底クラス。MotionQueueManagerによってモーションの再生を管理する。\n */\nexport abstract class ACubismMotion {\n /**\n * インスタンスの破棄\n */\n public static delete(motion: ACubismMotion): void {\n motion.release();\n motion = null;\n }\n\n /**\n * コンストラクタ\n */\n public constructor() {\n this._fadeInSeconds = -1.0;\n this._fadeOutSeconds = -1.0;\n this._weight = 1.0;\n this._offsetSeconds = 0.0; // 再生の開始時刻\n this._isLoop = false; // ループするか\n this._isLoopFadeIn = true; // ループ時にフェードインが有効かどうかのフラグ。初期値では有効。\n this._previousLoopState = this._isLoop;\n this._firedEventValues = new Array<string>();\n }\n\n /**\n * デストラクタ相当の処理\n */\n public release(): void {\n this._weight = 0.0;\n }\n\n /**\n * モデルのパラメータ\n * @param model 対象のモデル\n * @param motionQueueEntry CubismMotionQueueManagerで管理されているモーション\n * @param userTimeSeconds デルタ時間の積算値[秒]\n */\n public updateParameters(\n model: CubismModel,\n motionQueueEntry: CubismMotionQueueEntry,\n userTimeSeconds: number\n ): void {\n if (!motionQueueEntry.isAvailable() || motionQueueEntry.isFinished()) {\n return;\n }\n\n this.setupMotionQueueEntry(motionQueueEntry, userTimeSeconds);\n\n const fadeWeight = this.updateFadeWeight(motionQueueEntry, userTimeSeconds);\n\n //---- 全てのパラメータIDをループする ----\n this.doUpdateParameters(\n model,\n userTimeSeconds,\n fadeWeight,\n motionQueueEntry\n );\n\n // 後処理\n // 終了時刻を過ぎたら終了フラグを立てる(CubismMotionQueueManager)\n if (\n motionQueueEntry.getEndTime() > 0 &&\n motionQueueEntry.getEndTime() < userTimeSeconds\n ) {\n motionQueueEntry.setIsFinished(true); // 終了\n }\n }\n\n /**\n * @brief モデルの再生開始処理\n *\n * モーションの再生を開始するためのセットアップを行う。\n *\n * @param[in] motionQueueEntry CubismMotionQueueManagerで管理されているモーション\n * @param[in] userTimeSeconds デルタ時間の積算値[秒]\n */\n public setupMotionQueueEntry(\n motionQueueEntry: CubismMotionQueueEntry,\n userTimeSeconds: number\n ) {\n if (motionQueueEntry == null || motionQueueEntry.isStarted()) {\n return;\n }\n\n if (!motionQueueEntry.isAvailable()) {\n return;\n }\n\n motionQueueEntry.setIsStarted(true);\n motionQueueEntry.setStartTime(userTimeSeconds - this._offsetSeconds); // モーションの開始時刻を記録\n motionQueueEntry.setFadeInStartTime(userTimeSeconds); // フェードインの開始時刻\n\n if (motionQueueEntry.getEndTime() < 0.0) {\n // 開始していないうちに終了設定している場合がある\n this.adjustEndTime(motionQueueEntry);\n }\n\n // 再生開始コールバック\n if (motionQueueEntry._motion._onBeganMotion) {\n motionQueueEntry._motion._onBeganMotion(motionQueueEntry._motion);\n }\n }\n\n /**\n * @brief モデルのウェイト更新\n *\n * モーションのウェイトを更新する。\n *\n * @param[in] motionQueueEntry CubismMotionQueueManagerで管理されているモーション\n * @param[in] userTimeSeconds デルタ時間の積算値[秒]\n */\n public updateFadeWeight(\n motionQueueEntry: CubismMotionQueueEntry,\n userTimeSeconds: number\n ): number {\n if (motionQueueEntry == null) {\n CubismDebug.print(LogLevel.LogLevel_Error, 'motionQueueEntry is null.');\n }\n\n let fadeWeight: number = this._weight; // 現在の値と掛け合わせる割合\n\n //---- フェードイン・アウトの処理 ----\n // 単純なサイン関数でイージングする\n const fadeIn: number =\n this._fadeInSeconds == 0.0\n ? 1.0\n : CubismMath.getEasingSine(\n (userTimeSeconds - motionQueueEntry.getFadeInStartTime()) /\n this._fadeInSeconds\n );\n\n const fadeOut: number =\n this._fadeOutSeconds == 0.0 || motionQueueEntry.getEndTime() < 0.0\n ? 1.0\n : CubismMath.getEasingSine(\n (motionQueueEntry.getEndTime() - userTimeSeconds) /\n this._fadeOutSeconds\n );\n\n fadeWeight = fadeWeight * fadeIn * fadeOut;\n\n motionQueueEntry.setState(userTimeSeconds, fadeWeight);\n\n CSM_ASSERT(0.0 <= fadeWeight && fadeWeight <= 1.0);\n\n return fadeWeight;\n }\n\n /**\n * フェードインの時間を設定する\n * @param fadeInSeconds フェードインにかかる時間[秒]\n */\n public setFadeInTime(fadeInSeconds: number): void {\n this._fadeInSeconds = fadeInSeconds;\n }\n\n /**\n * フェードアウトの時間を設定する\n * @param fadeOutSeconds フェードアウトにかかる時間[秒]\n */\n public setFadeOutTime(fadeOutSeconds: number): void {\n this._fadeOutSeconds = fadeOutSeconds;\n }\n\n /**\n * フェードアウトにかかる時間の取得\n * @return フェードアウトにかかる時間[秒]\n */\n public getFadeOutTime(): number {\n return this._fadeOutSeconds;\n }\n\n /**\n * フェードインにかかる時間の取得\n * @return フェードインにかかる時間[秒]\n */\n public getFadeInTime(): number {\n return this._fadeInSeconds;\n }\n\n /**\n * モーション適用の重みの設定\n * @param weight 重み(0.0 - 1.0)\n */\n public setWeight(weight: number): void {\n this._weight = weight;\n }\n\n /**\n * モーション適用の重みの取得\n * @return 重み(0.0 - 1.0)\n */\n public getWeight(): number {\n return this._weight;\n }\n\n /**\n * モーションの長さの取得\n * @return モーションの長さ[秒]\n *\n * @note ループの時は「-1」。\n * ループでない場合は、オーバーライドする。\n * 正の値の時は取得される時間で終了する。\n * 「-1」の時は外部から停止命令がない限り終わらない処理となる。\n */\n public getDuration(): number {\n return -1.0;\n }\n\n /**\n * モーションのループ1回分の長さの取得\n * @return モーションのループ一回分の長さ[秒]\n *\n * @note ループしない場合は、getDuration()と同じ値を返す\n * ループ一回分の長さが定義できない場合(プログラム的に動き続けるサブクラスなど)の場合は「-1」を返す\n */\n public getLoopDuration(): number {\n return -1.0;\n }\n\n /**\n * モーション再生の開始時刻の設定\n * @param offsetSeconds モーション再生の開始時刻[秒]\n */\n public setOffsetTime(offsetSeconds: number): void {\n this._offsetSeconds = offsetSeconds;\n }\n\n /**\n * ループ情報の設定\n * @param loop ループ情報\n */\n public setLoop(loop: boolean): void {\n this._isLoop = loop;\n }\n\n /**\n * ループ情報の取得\n * @return true ループする\n * @return false ループしない\n */\n public getLoop(): boolean {\n return this._isLoop;\n }\n\n /**\n * ループ時のフェードイン情報の設定\n * @param loopFadeIn ループ時のフェードイン情報\n */\n public setLoopFadeIn(loopFadeIn: boolean) {\n this._isLoopFadeIn = loopFadeIn;\n }\n\n /**\n * ループ時のフェードイン情報の取得\n *\n * @return true する\n * @return false しない\n */\n public getLoopFadeIn(): boolean {\n return this._isLoopFadeIn;\n }\n\n /**\n * モデルのパラメータ更新\n *\n * イベント発火のチェック。\n * 入力する時間は呼ばれるモーションタイミングを0とした秒数で行う。\n *\n * @param beforeCheckTimeSeconds 前回のイベントチェック時間[秒]\n * @param motionTimeSeconds 今回の再生時間[秒]\n */\n public getFiredEvent(\n beforeCheckTimeSeconds: number,\n motionTimeSeconds: number\n ): Array<string> {\n return this._firedEventValues;\n }\n\n /**\n * モーションを更新して、モデルにパラメータ値を反映する\n * @param model 対象のモデル\n * @param userTimeSeconds デルタ時間の積算値[秒]\n * @param weight モーションの重み\n * @param motionQueueEntry CubismMotionQueueManagerで管理されているモーション\n * @return true モデルへパラメータ値の反映あり\n * @return false モデルへのパラメータ値の反映なし(モーションの変化なし)\n */\n public abstract doUpdateParameters(\n model: CubismModel,\n userTimeSeconds: number,\n weight: number,\n motionQueueEntry: CubismMotionQueueEntry\n ): void;\n\n /**\n * モーション再生開始コールバックの登録\n *\n * モーション再生開始コールバックを登録する。\n * 以下の状態の際には呼び出されない:\n * 1. 再生中のモーションが「ループ」として設定されているとき\n * 2. コールバックが登録されていない時\n *\n * @param onBeganMotionHandler モーション再生開始コールバック関数\n */\n public setBeganMotionHandler = (onBeganMotionHandler: BeganMotionCallback) =>\n (this._onBeganMotion = onBeganMotionHandler);\n\n /**\n * モーション再生開始コールバックの取得\n *\n * モーション再生開始コールバックを取得する。\n *\n * @return 登録されているモーション再生開始コールバック関数\n */\n public getBeganMotionHandler = () => this._onBeganMotion;\n\n /**\n * モーション再生終了コールバックの登録\n *\n * モーション再生終了コールバックを登録する。\n * isFinishedフラグを設定するタイミングで呼び出される。\n * 以下の状態の際には呼び出されない:\n * 1. 再生中のモーションが「ループ」として設定されているとき\n * 2. コールバックが登録されていない時\n *\n * @param onFinishedMotionHandler モーション再生終了コールバック関数\n */\n public setFinishedMotionHandler = (\n onFinishedMotionHandler: FinishedMotionCallback\n ) => (this._onFinishedMotion = onFinishedMotionHandler);\n\n /**\n * モーション再生終了コールバックの取得\n *\n * モーション再生終了コールバックを取得する。\n *\n * @return 登録されているモーション再生終了コールバック関数\n */\n public getFinishedMotionHandler = () => this._onFinishedMotion;\n\n /**\n * 透明度のカーブが存在するかどうかを確認する\n *\n * @return true -> キーが存在する\n * false -> キーが存在しない\n */\n public isExistModelOpacity(): boolean {\n return false;\n }\n\n /**\n * 透明度のカーブのインデックスを返す\n *\n * @return success:透明度のカーブのインデックス\n */\n public getModelOpacityIndex(): number {\n return -1;\n }\n\n /**\n * 透明度のIdを返す\n *\n * @param index モーションカーブのインデックス\n * @return success:透明度のId\n */\n public getModelOpacityId(index: number): CubismIdHandle {\n return null;\n }\n\n /**\n * 指定時間の透明度の値を返す\n *\n * @return success:モーションの現在時間におけるOpacityの値\n *\n * @note 更新後の値を取るにはUpdateParameters() の後に呼び出す。\n */\n protected getModelOpacityValue(): number {\n return 1.0;\n }\n\n /**\n * 終了時刻の調整\n * @param motionQueueEntry CubismMotionQueueManagerで管理されているモーション\n */\n protected adjustEndTime(motionQueueEntry: CubismMotionQueueEntry) {\n const duration = this.getDuration();\n\n // duration == -1 の場合はループする\n const endTime =\n duration <= 0.0 ? -1 : motionQueueEntry.getStartTime() + duration;\n\n motionQueueEntry.setEndTime(endTime);\n }\n\n public _fadeInSeconds: number; // フェードインにかかる時間[秒]\n public _fadeOutSeconds: number; // フェードアウトにかかる時間[秒]\n public _weight: number; // モーションの重み\n public _offsetSeconds: number; // モーション再生の開始時間[秒]\n public _isLoop: boolean; // ループが有効かのフラグ\n public _isLoopFadeIn: boolean; // ループ時にフェードインが有効かどうかのフラグ\n public _previousLoopState: boolean; // 前回の `_isLoop` の状態\n public _firedEventValues: Array<string>;\n\n // モーション再生開始コールバック関数\n public _onBeganMotion?: BeganMotionCallback;\n // モーション再生終了コールバック関数\n public _onFinishedMotion?: FinishedMotionCallback;\n}\n\n// Namespace definition for compatibility.\nimport * as $ from './acubismmotion';\nimport { CubismIdHandle } from '../id/cubismid';\nimport { LogLevel } from '../live2dcubismframework';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const ACubismMotion = $.ACubismMotion;\n export type ACubismMotion = $.ACubismMotion;\n export type BeganMotionCallback = $.BeganMotionCallback;\n export type FinishedMotionCallback = $.FinishedMotionCallback;\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport { CubismIdHandle } from '../id/cubismid';\n\n/**\n * @brief モーションカーブの種類\n *\n * モーションカーブの種類。\n */\nexport enum CubismMotionCurveTarget {\n CubismMotionCurveTarget_Model, // モデルに対して\n CubismMotionCurveTarget_Parameter, // パラメータに対して\n CubismMotionCurveTarget_PartOpacity // パーツの不透明度に対して\n}\n\n/**\n * @brief モーションカーブのセグメントの種類\n *\n * モーションカーブのセグメントの種類。\n */\nexport enum CubismMotionSegmentType {\n CubismMotionSegmentType_Linear = 0, // リニア\n CubismMotionSegmentType_Bezier = 1, // ベジェ曲線\n CubismMotionSegmentType_Stepped = 2, // ステップ\n CubismMotionSegmentType_InverseStepped = 3 // インバースステップ\n}\n\n/**\n * @brief モーションカーブの制御点\n *\n * モーションカーブの制御点。\n */\nexport class CubismMotionPoint {\n time = 0.0; // 時間[秒]\n value = 0.0; // 値\n}\n\n/**\n * モーションカーブのセグメントの評価関数\n *\n * @param points モーションカーブの制御点リスト\n * @param time 評価する時間[秒]\n */\nexport interface csmMotionSegmentEvaluationFunction {\n (points: CubismMotionPoint[], time: number): number;\n}\n\n/**\n * @brief モーションカーブのセグメント\n *\n * モーションカーブのセグメント。\n */\nexport class CubismMotionSegment {\n /**\n * @brief コンストラクタ\n *\n * コンストラクタ。\n */\n public constructor() {\n this.evaluate = null;\n this.basePointIndex = 0;\n this.segmentType = 0;\n }\n\n evaluate: csmMotionSegmentEvaluationFunction; // 使用する評価関数\n basePointIndex: number; // 最初のセグメントへのインデックス\n segmentType: number; // セグメントの種類\n}\n\n/**\n * @brief モーションカーブ\n *\n * モーションカーブ。\n */\nexport class CubismMotionCurve {\n public constructor() {\n this.type = CubismMotionCurveTarget.CubismMotionCurveTarget_Model;\n this.segmentCount = 0;\n this.baseSegmentIndex = 0;\n this.fadeInTime = 0.0;\n this.fadeOutTime = 0.0;\n }\n\n type: CubismMotionCurveTarget; // カーブの種類\n id: CubismIdHandle; // カーブのID\n segmentCount: number; // セグメントの個数\n baseSegmentIndex: number; // 最初のセグメントのインデックス\n fadeInTime: number; // フェードインにかかる時間[秒]\n fadeOutTime: number; // フェードアウトにかかる時間[秒]\n}\n\n/**\n * イベント。\n */\nexport class CubismMotionEvent {\n fireTime = 0.0;\n value: string;\n}\n\n/**\n * @brief モーションデータ\n *\n * モーションデータ。\n */\nexport class CubismMotionData {\n public constructor() {\n this.duration = 0.0;\n this.loop = false;\n this.curveCount = 0;\n this.eventCount = 0;\n this.fps = 0.0;\n\n this.curves = new Array<CubismMotionCurve>();\n this.segments = new Array<CubismMotionSegment>();\n this.points = new Array<CubismMotionPoint>();\n this.events = new Array<CubismMotionEvent>();\n }\n\n duration: number; // モーションの長さ[秒]\n loop: boolean; // ループするかどうか\n curveCount: number; // カーブの個数\n eventCount: number; // UserDataの個数\n fps: number; // フレームレート\n curves: Array<CubismMotionCurve>; // カーブのリスト\n segments: Array<CubismMotionSegment>; // セグメントのリスト\n points: Array<CubismMotionPoint>; // ポイントのリスト\n events: Array<CubismMotionEvent>; // イベントのリスト\n}\n\n// Namespace definition for compatibility.\nimport * as $ from './cubismmotioninternal';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const CubismMotionCurve = $.CubismMotionCurve;\n export type CubismMotionCurve = $.CubismMotionCurve;\n export const CubismMotionCurveTarget = $.CubismMotionCurveTarget;\n export type CubismMotionCurveTarget = $.CubismMotionCurveTarget;\n export const CubismMotionData = $.CubismMotionData;\n export type CubismMotionData = $.CubismMotionData;\n export const CubismMotionEvent = $.CubismMotionEvent;\n export type CubismMotionEvent = $.CubismMotionEvent;\n export const CubismMotionPoint = $.CubismMotionPoint;\n export type CubismMotionPoint = $.CubismMotionPoint;\n export const CubismMotionSegment = $.CubismMotionSegment;\n export type CubismMotionSegment = $.CubismMotionSegment;\n export const CubismMotionSegmentType = $.CubismMotionSegmentType;\n export type CubismMotionSegmentType = $.CubismMotionSegmentType;\n export type csmMotionSegmentEvaluationFunction =\n $.csmMotionSegmentEvaluationFunction;\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport { CubismIdHandle } from '../id/cubismid';\nimport { CubismFramework } from '../live2dcubismframework';\nimport { CSM_ASSERT, CubismLogWarning } from '../utils/cubismdebug';\nimport { CubismJson, JsonMap } from '../utils/cubismjson';\nimport { CubismMotionSegmentType } from './cubismmotioninternal';\n\n// JSON keys\nconst Meta = 'Meta';\nconst Duration = 'Duration';\nconst Loop = 'Loop';\nconst AreBeziersRestricted = 'AreBeziersRestricted';\nconst CurveCount = 'CurveCount';\nconst Fps = 'Fps';\nconst TotalSegmentCount = 'TotalSegmentCount';\nconst TotalPointCount = 'TotalPointCount';\nconst Curves = 'Curves';\nconst Target = 'Target';\nconst Id = 'Id';\nconst FadeInTime = 'FadeInTime';\nconst FadeOutTime = 'FadeOutTime';\nconst Segments = 'Segments';\nconst UserData = 'UserData';\nconst UserDataCount = 'UserDataCount';\nconst TotalUserDataSize = 'TotalUserDataSize';\nconst Time = 'Time';\nconst Value = 'Value';\n\n/**\n * motion3.jsonのコンテナ。\n */\nexport class CubismMotionJson {\n /**\n * コンストラクタ\n * @param buffer motion3.jsonが読み込まれているバッファ\n * @param size バッファのサイズ\n */\n public constructor(buffer: ArrayBuffer, size: number) {\n this._json = CubismJson.create(buffer, size);\n }\n\n /**\n * デストラクタ相当の処理\n */\n public release(): void {\n CubismJson.delete(this._json);\n }\n\n /**\n * モーションの長さを取得する\n * @return モーションの長さ[秒]\n */\n public getMotionDuration(): number {\n return this._json\n .getRoot()\n .getValueByString(Meta)\n .getValueByString(Duration)\n .toFloat();\n }\n\n /**\n * モーションのループ情報の取得\n * @return true ループする\n * @return false ループしない\n */\n public isMotionLoop(): boolean {\n return this._json\n .getRoot()\n .getValueByString(Meta)\n .getValueByString(Loop)\n .toBoolean();\n }\n\n /**\n * motion3.jsonファイルの整合性チェック\n *\n * @return 正常なファイルの場合はtrueを返す。\n */\n hasConsistency(): boolean {\n let result = true;\n\n if (!this._json || !this._json.getRoot()) {\n return false;\n }\n\n const actualCurveListSize = this._json\n .getRoot()\n .getValueByString(Curves)\n .getVector().length;\n let actualTotalSegmentCount = 0;\n let actualTotalPointCount = 0;\n\n // カウント処理\n for (\n let curvePosition = 0;\n curvePosition < actualCurveListSize;\n ++curvePosition\n ) {\n for (\n let segmentPosition = 0;\n segmentPosition < this.getMotionCurveSegmentCount(curvePosition);\n ) {\n if (segmentPosition == 0) {\n actualTotalPointCount += 1;\n segmentPosition += 2;\n }\n\n const segment = this.getMotionCurveSegment(\n curvePosition,\n segmentPosition\n ) as CubismMotionSegmentType;\n\n switch (segment) {\n case CubismMotionSegmentType.CubismMotionSegmentType_Linear:\n actualTotalPointCount += 1;\n segmentPosition += 3;\n break;\n case CubismMotionSegmentType.CubismMotionSegmentType_Bezier:\n actualTotalPointCount += 3;\n segmentPosition += 7;\n break;\n case CubismMotionSegmentType.CubismMotionSegmentType_Stepped:\n actualTotalPointCount += 1;\n segmentPosition += 3;\n break;\n case CubismMotionSegmentType.CubismMotionSegmentType_InverseStepped:\n actualTotalPointCount += 1;\n segmentPosition += 3;\n break;\n default:\n CSM_ASSERT(0);\n break;\n }\n\n ++actualTotalSegmentCount;\n }\n }\n\n // 個数チェック\n if (actualCurveListSize != this.getMotionCurveCount()) {\n CubismLogWarning('The number of curves does not match the metadata.');\n result = false;\n }\n if (actualTotalSegmentCount != this.getMotionTotalSegmentCount()) {\n CubismLogWarning('The number of segment does not match the metadata.');\n result = false;\n }\n if (actualTotalPointCount != this.getMotionTotalPointCount()) {\n CubismLogWarning('The number of point does not match the metadata.');\n result = false;\n }\n\n return result;\n }\n\n public getEvaluationOptionFlag(flagType: EvaluationOptionFlag): boolean {\n if (\n EvaluationOptionFlag.EvaluationOptionFlag_AreBeziersRistricted == flagType\n ) {\n return this._json\n .getRoot()\n .getValueByString(Meta)\n .getValueByString(AreBeziersRestricted)\n .toBoolean();\n }\n\n return false;\n }\n\n /**\n * モーションカーブの個数の取得\n * @return モーションカーブの個数\n */\n public getMotionCurveCount(): number {\n return this._json\n .getRoot()\n .getValueByString(Meta)\n .getValueByString(CurveCount)\n .toInt();\n }\n\n /**\n * モーションのフレームレートの取得\n * @return フレームレート[FPS]\n */\n public getMotionFps(): number {\n return this._json\n .getRoot()\n .getValueByString(Meta)\n .getValueByString(Fps)\n .toFloat();\n }\n\n /**\n * モーションのセグメントの総合計の取得\n * @return モーションのセグメントの取得\n */\n public getMotionTotalSegmentCount(): number {\n return this._json\n .getRoot()\n .getValueByString(Meta)\n .getValueByString(TotalSegmentCount)\n .toInt();\n }\n\n /**\n * モーションのカーブの制御店の総合計の取得\n * @return モーションのカーブの制御点の総合計\n */\n public getMotionTotalPointCount(): number {\n return this._json\n .getRoot()\n .getValueByString(Meta)\n .getValueByString(TotalPointCount)\n .toInt();\n }\n\n /**\n * モーションのフェードイン時間の存在\n * @return true 存在する\n * @return false 存在しない\n */\n public isExistMotionFadeInTime(): boolean {\n return !this._json\n .getRoot()\n .getValueByString(Meta)\n .getValueByString(FadeInTime)\n .isNull();\n }\n\n /**\n * モーションのフェードアウト時間の存在\n * @return true 存在する\n * @return false 存在しない\n */\n public isExistMotionFadeOutTime(): boolean {\n return !this._json\n .getRoot()\n .getValueByString(Meta)\n .getValueByString(FadeOutTime)\n .isNull();\n }\n\n /**\n * モーションのフェードイン時間の取得\n * @return フェードイン時間[秒]\n */\n public getMotionFadeInTime(): number {\n return this._json\n .getRoot()\n .getValueByString(Meta)\n .getValueByString(FadeInTime)\n .toFloat();\n }\n\n /**\n * モーションのフェードアウト時間の取得\n * @return フェードアウト時間[秒]\n */\n public getMotionFadeOutTime(): number {\n return this._json\n .getRoot()\n .getValueByString(Meta)\n .getValueByString(FadeOutTime)\n .toFloat();\n }\n\n /**\n * モーションのカーブの種類の取得\n * @param curveIndex カーブのインデックス\n * @return カーブの種類\n */\n public getMotionCurveTarget(curveIndex: number): string {\n return this._json\n .getRoot()\n .getValueByString(Curves)\n .getValueByIndex(curveIndex)\n .getValueByString(Target)\n .getRawString();\n }\n\n /**\n * モーションのカーブのIDの取得\n * @param curveIndex カーブのインデックス\n * @return カーブのID\n */\n public getMotionCurveId(curveIndex: number): CubismIdHandle {\n return CubismFramework.getIdManager().getId(\n this._json\n .getRoot()\n .getValueByString(Curves)\n .getValueByIndex(curveIndex)\n .getValueByString(Id)\n .getRawString()\n );\n }\n\n /**\n * モーションのカーブのフェードイン時間の存在\n * @param curveIndex カーブのインデックス\n * @return true 存在する\n * @return false 存在しない\n */\n public isExistMotionCurveFadeInTime(curveIndex: number): boolean {\n return !this._json\n .getRoot()\n .getValueByString(Curves)\n .getValueByIndex(curveIndex)\n .getValueByString(FadeInTime)\n .isNull();\n }\n\n /**\n * モーションのカーブのフェードアウト時間の存在\n * @param curveIndex カーブのインデックス\n * @return true 存在する\n * @return false 存在しない\n */\n public isExistMotionCurveFadeOutTime(curveIndex: number): boolean {\n return !this._json\n .getRoot()\n .getValueByString(Curves)\n .getValueByIndex(curveIndex)\n .getValueByString(FadeOutTime)\n .isNull();\n }\n\n /**\n * モーションのカーブのフェードイン時間の取得\n * @param curveIndex カーブのインデックス\n * @return フェードイン時間[秒]\n */\n public getMotionCurveFadeInTime(curveIndex: number): number {\n return this._json\n .getRoot()\n .getValueByString(Curves)\n .getValueByIndex(curveIndex)\n .getValueByString(FadeInTime)\n .toFloat();\n }\n\n /**\n * モーションのカーブのフェードアウト時間の取得\n * @param curveIndex カーブのインデックス\n * @return フェードアウト時間[秒]\n */\n public getMotionCurveFadeOutTime(curveIndex: number): number {\n return this._json\n .getRoot()\n .getValueByString(Curves)\n .getValueByIndex(curveIndex)\n .getValueByString(FadeOutTime)\n .toFloat();\n }\n\n /**\n * モーションのカーブのセグメントの個数を取得する\n * @param curveIndex カーブのインデックス\n * @return モーションのカーブのセグメントの個数\n */\n public getMotionCurveSegmentCount(curveIndex: number): number {\n return this._json\n .getRoot()\n .getValueByString(Curves)\n .getValueByIndex(curveIndex)\n .getValueByString(Segments)\n .getVector().length;\n }\n\n /**\n * モーションのカーブのセグメントの値の取得\n * @param curveIndex カーブのインデックス\n * @param segmentIndex セグメントのインデックス\n * @return セグメントの値\n */\n public getMotionCurveSegment(\n curveIndex: number,\n segmentIndex: number\n ): number {\n return this._json\n .getRoot()\n .getValueByString(Curves)\n .getValueByIndex(curveIndex)\n .getValueByString(Segments)\n .getValueByIndex(segmentIndex)\n .toFloat();\n }\n\n /**\n * イベントの個数の取得\n * @return イベントの個数\n */\n public getEventCount(): number {\n return this._json\n .getRoot()\n .getValueByString(Meta)\n .getValueByString(UserDataCount)\n .toInt();\n }\n\n /**\n * イベントの総文字数の取得\n * @return イベントの総文字数\n */\n public getTotalEventValueSize(): number {\n return this._json\n .getRoot()\n .getValueByString(Meta)\n .getValueByString(TotalUserDataSize)\n .toInt();\n }\n\n /**\n * イベントの時間の取得\n * @param userDataIndex イベントのインデックス\n * @return イベントの時間[秒]\n */\n public getEventTime(userDataIndex: number): number {\n return this._json\n .getRoot()\n .getValueByString(UserData)\n .getValueByIndex(userDataIndex)\n .getValueByString(Time)\n .toFloat();\n }\n\n /**\n * イベントの取得\n * @param userDataIndex イベントのインデックス\n * @return イベントの文字列\n */\n public getEventValue(userDataIndex: number): string {\n return this._json\n .getRoot()\n .getValueByString(UserData)\n .getValueByIndex(userDataIndex)\n .getValueByString(Value)\n .getRawString();\n }\n\n _json: CubismJson; // motion3.jsonのデータ\n}\n\n/**\n * @brief ベジェカーブの解釈方法のフラグタイプ\n */\nexport enum EvaluationOptionFlag {\n EvaluationOptionFlag_AreBeziersRistricted = 0 ///< ベジェハンドルの規制状態\n}\n\n// Namespace definition for compatibility.\nimport * as $ from './cubismmotionjson';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const CubismMotionJson = $.CubismMotionJson;\n export type CubismMotionJson = $.CubismMotionJson;\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport { CubismIdHandle } from '../id/cubismid';\nimport { csmDelete, CubismFramework } from '../live2dcubismframework';\nimport { CubismMath } from '../math/cubismmath';\nimport { updateSize } from '../utils/cubismarrayutils';\nimport { CubismModel } from '../model/cubismmodel';\nimport {\n CSM_ASSERT,\n CubismLogDebug,\n CubismLogError,\n CubismLogWarning\n} from '../utils/cubismdebug';\nimport {\n ACubismMotion,\n BeganMotionCallback,\n FinishedMotionCallback\n} from './acubismmotion';\nimport {\n CubismMotionCurve,\n CubismMotionCurveTarget,\n CubismMotionData,\n CubismMotionEvent,\n CubismMotionPoint,\n CubismMotionSegment,\n CubismMotionSegmentType\n} from './cubismmotioninternal';\nimport { CubismMotionJson, EvaluationOptionFlag } from './cubismmotionjson';\nimport { CubismMotionQueueEntry } from './cubismmotionqueueentry';\n\nconst EffectNameEyeBlink = 'EyeBlink';\nconst EffectNameLipSync = 'LipSync';\nconst TargetNameModel = 'Model';\nconst TargetNameParameter = 'Parameter';\nconst TargetNamePartOpacity = 'PartOpacity';\n\n// Id\nconst IdNameOpacity = 'Opacity';\n\n/**\n * Cubism SDK R2 以前のモーションを再現させるなら true 、アニメータのモーションを正しく再現するなら false 。\n */\nconst UseOldBeziersCurveMotion = false;\n\nfunction lerpPoints(\n a: CubismMotionPoint,\n b: CubismMotionPoint,\n t: number\n): CubismMotionPoint {\n const result: CubismMotionPoint = new CubismMotionPoint();\n\n result.time = a.time + (b.time - a.time) * t;\n result.value = a.value + (b.value - a.value) * t;\n\n return result;\n}\n\nfunction linearEvaluate(points: CubismMotionPoint[], time: number): number {\n let t: number = (time - points[0].time) / (points[1].time - points[0].time);\n\n if (t < 0.0) {\n t = 0.0;\n }\n\n return points[0].value + (points[1].value - points[0].value) * t;\n}\n\nfunction bezierEvaluate(points: CubismMotionPoint[], time: number): number {\n let t: number = (time - points[0].time) / (points[3].time - points[0].time);\n\n if (t < 0.0) {\n t = 0.0;\n }\n\n const p01: CubismMotionPoint = lerpPoints(points[0], points[1], t);\n const p12: CubismMotionPoint = lerpPoints(points[1], points[2], t);\n const p23: CubismMotionPoint = lerpPoints(points[2], points[3], t);\n\n const p012: CubismMotionPoint = lerpPoints(p01, p12, t);\n const p123: CubismMotionPoint = lerpPoints(p12, p23, t);\n\n return lerpPoints(p012, p123, t).value;\n}\n\nfunction bezierEvaluateBinarySearch(\n points: CubismMotionPoint[],\n time: number\n): number {\n const xError = 0.01;\n\n const x: number = time;\n let x1: number = points[0].time;\n let x2: number = points[3].time;\n let cx1: number = points[1].time;\n let cx2: number = points[2].time;\n\n let ta = 0.0;\n let tb = 1.0;\n let t = 0.0;\n let i = 0;\n\n for (let var33 = true; i < 20; ++i) {\n if (x < x1 + xError) {\n t = ta;\n break;\n }\n\n if (x2 - xError < x) {\n t = tb;\n break;\n }\n\n let centerx: number = (cx1 + cx2) * 0.5;\n cx1 = (x1 + cx1) * 0.5;\n cx2 = (x2 + cx2) * 0.5;\n const ctrlx12: number = (cx1 + centerx) * 0.5;\n const ctrlx21: number = (cx2 + centerx) * 0.5;\n centerx = (ctrlx12 + ctrlx21) * 0.5;\n if (x < centerx) {\n tb = (ta + tb) * 0.5;\n if (centerx - xError < x) {\n t = tb;\n break;\n }\n\n x2 = centerx;\n cx2 = ctrlx12;\n } else {\n ta = (ta + tb) * 0.5;\n if (x < centerx + xError) {\n t = ta;\n break;\n }\n\n x1 = centerx;\n cx1 = ctrlx21;\n }\n }\n\n if (i == 20) {\n t = (ta + tb) * 0.5;\n }\n\n if (t < 0.0) {\n t = 0.0;\n }\n if (t > 1.0) {\n t = 1.0;\n }\n\n const p01: CubismMotionPoint = lerpPoints(points[0], points[1], t);\n const p12: CubismMotionPoint = lerpPoints(points[1], points[2], t);\n const p23: CubismMotionPoint = lerpPoints(points[2], points[3], t);\n\n const p012: CubismMotionPoint = lerpPoints(p01, p12, t);\n const p123: CubismMotionPoint = lerpPoints(p12, p23, t);\n\n return lerpPoints(p012, p123, t).value;\n}\n\nfunction bezierEvaluateCardanoInterpretation(\n points: CubismMotionPoint[],\n time: number\n): number {\n const x: number = time;\n const x1: number = points[0].time;\n const x2: number = points[3].time;\n const cx1: number = points[1].time;\n const cx2: number = points[2].time;\n\n const a: number = x2 - 3.0 * cx2 + 3.0 * cx1 - x1;\n const b: number = 3.0 * cx2 - 6.0 * cx1 + 3.0 * x1;\n const c: number = 3.0 * cx1 - 3.0 * x1;\n const d: number = x1 - x;\n\n const t: number = CubismMath.cardanoAlgorithmForBezier(a, b, c, d);\n\n const p01: CubismMotionPoint = lerpPoints(points[0], points[1], t);\n const p12: CubismMotionPoint = lerpPoints(points[1], points[2], t);\n const p23: CubismMotionPoint = lerpPoints(points[2], points[3], t);\n\n const p012: CubismMotionPoint = lerpPoints(p01, p12, t);\n const p123: CubismMotionPoint = lerpPoints(p12, p23, t);\n\n return lerpPoints(p012, p123, t).value;\n}\n\nfunction steppedEvaluate(points: CubismMotionPoint[], time: number): number {\n return points[0].value;\n}\n\nfunction inverseSteppedEvaluate(\n points: CubismMotionPoint[],\n time: number\n): number {\n return points[1].value;\n}\n\nfunction evaluateCurve(\n motionData: CubismMotionData,\n index: number,\n time: number,\n isCorrection: boolean,\n endTime: number\n): number {\n // Find segment to evaluate.\n const curve: CubismMotionCurve = motionData.curves[index];\n\n let target = -1;\n const totalSegmentCount: number = curve.baseSegmentIndex + curve.segmentCount;\n let pointPosition = 0;\n for (let i: number = curve.baseSegmentIndex; i < totalSegmentCount; ++i) {\n // Get first point of next segment.\n pointPosition =\n motionData.segments[i].basePointIndex +\n ((motionData.segments[i].segmentType as CubismMotionSegmentType) ==\n CubismMotionSegmentType.CubismMotionSegmentType_Bezier\n ? 3\n : 1);\n\n // Break if time lies within current segment.\n if (motionData.points[pointPosition].time > time) {\n target = i;\n break;\n }\n }\n\n if (target == -1) {\n if (isCorrection && time < endTime) {\n return correctEndPoint(\n motionData,\n totalSegmentCount - 1,\n motionData.segments[curve.baseSegmentIndex].basePointIndex,\n pointPosition,\n time,\n endTime\n );\n }\n return motionData.points[pointPosition].value;\n }\n\n const segment: CubismMotionSegment = motionData.segments[target];\n\n return segment.evaluate(\n motionData.points.slice(segment.basePointIndex),\n time\n );\n}\n\n/**\n * 終点から始点への補正処理\n * @param motionData\n * @param segmentIndex\n * @param beginIndex\n * @param endIndex\n * @param time\n * @param endTime\n * @return\n */\nfunction correctEndPoint(\n motionData: CubismMotionData,\n segmentIndex: number,\n beginIndex: number,\n endIndex: number,\n time: number,\n endTime: number\n): number {\n const motionPoint: CubismMotionPoint[] = [\n new CubismMotionPoint(),\n new CubismMotionPoint()\n ];\n {\n const src = motionData.points[endIndex];\n motionPoint[0].time = src.time;\n motionPoint[0].value = src.value;\n }\n {\n const src = motionData.points[beginIndex];\n motionPoint[1].time = endTime;\n motionPoint[1].value = src.value;\n }\n\n switch (\n motionData.segments[segmentIndex].segmentType as CubismMotionSegmentType\n ) {\n case CubismMotionSegmentType.CubismMotionSegmentType_Linear:\n case CubismMotionSegmentType.CubismMotionSegmentType_Bezier:\n default:\n return linearEvaluate(motionPoint, time);\n case CubismMotionSegmentType.CubismMotionSegmentType_Stepped:\n return steppedEvaluate(motionPoint, time);\n case CubismMotionSegmentType.CubismMotionSegmentType_InverseStepped:\n return inverseSteppedEvaluate(motionPoint, time);\n }\n}\n\n/**\n * Enumerator for version control of Motion Behavior.\n * For details, see the SDK Manual.\n */\nexport enum MotionBehavior {\n MotionBehavior_V1,\n MotionBehavior_V2\n}\n\n/**\n * モーションクラス\n *\n * モーションのクラス。\n */\nexport class CubismMotion extends ACubismMotion {\n /**\n * インスタンスを作成する\n *\n * @param buffer motion3.jsonが読み込まれているバッファ\n * @param size バッファのサイズ\n * @param onFinishedMotionHandler モーション再生終了時に呼び出されるコールバック関数\n * @param onBeganMotionHandler モーション再生開始時に呼び出されるコールバック関数\n * @param shouldCheckMotionConsistency motion3.json整合性チェックするかどうか\n * @return 作成されたインスタンス\n */\n public static create(\n buffer: ArrayBuffer,\n size: number,\n onFinishedMotionHandler?: FinishedMotionCallback,\n onBeganMotionHandler?: BeganMotionCallback,\n shouldCheckMotionConsistency: boolean = false\n ): CubismMotion {\n const ret = new CubismMotion();\n\n ret.parse(buffer, size, shouldCheckMotionConsistency);\n if (ret._motionData) {\n ret._sourceFrameRate = ret._motionData.fps;\n ret._loopDurationSeconds = ret._motionData.duration;\n ret._onFinishedMotion = onFinishedMotionHandler;\n ret._onBeganMotion = onBeganMotionHandler;\n } else {\n csmDelete(ret);\n return null;\n }\n\n // NOTE: Editorではループありのモーション書き出しは非対応\n // ret->_loop = (ret->_motionData->Loop > 0);\n return ret;\n }\n\n /**\n * モデルのパラメータの更新の実行\n * @param model 対象のモデル\n * @param userTimeSeconds 現在の時刻[秒]\n * @param fadeWeight モーションの重み\n * @param motionQueueEntry CubismMotionQueueManagerで管理されているモーション\n */\n public doUpdateParameters(\n model: CubismModel,\n userTimeSeconds: number,\n fadeWeight: number,\n motionQueueEntry: CubismMotionQueueEntry\n ): void {\n if (this._modelCurveIdEyeBlink == null) {\n this._modelCurveIdEyeBlink =\n CubismFramework.getIdManager().getId(EffectNameEyeBlink);\n }\n\n if (this._modelCurveIdLipSync == null) {\n this._modelCurveIdLipSync =\n CubismFramework.getIdManager().getId(EffectNameLipSync);\n }\n\n if (this._modelCurveIdOpacity == null) {\n this._modelCurveIdOpacity =\n CubismFramework.getIdManager().getId(IdNameOpacity);\n }\n\n if (this._motionBehavior === MotionBehavior.MotionBehavior_V2) {\n if (this._previousLoopState !== this._isLoop) {\n // 終了時間を計算する\n this.adjustEndTime(motionQueueEntry);\n this._previousLoopState = this._isLoop;\n }\n }\n\n let timeOffsetSeconds: number =\n userTimeSeconds - motionQueueEntry.getStartTime();\n\n if (timeOffsetSeconds < 0.0) {\n timeOffsetSeconds = 0.0; // エラー回避\n }\n\n let lipSyncValue: number = Number.MAX_VALUE;\n let eyeBlinkValue: number = Number.MAX_VALUE;\n\n //まばたき、リップシンクのうちモーションの適用を検出するためのビット(maxFlagCount個まで\n const maxTargetSize = 64;\n let lipSyncFlags = 0;\n let eyeBlinkFlags = 0;\n\n //瞬き、リップシンクのターゲット数が上限を超えている場合\n if (this._eyeBlinkParameterIds.length > maxTargetSize) {\n CubismLogDebug(\n 'too many eye blink targets : {0}',\n this._eyeBlinkParameterIds.length\n );\n }\n if (this._lipSyncParameterIds.length > maxTargetSize) {\n CubismLogDebug(\n 'too many lip sync targets : {0}',\n this._lipSyncParameterIds.length\n );\n }\n\n const tmpFadeIn: number =\n this._fadeInSeconds <= 0.0\n ? 1.0\n : CubismMath.getEasingSine(\n (userTimeSeconds - motionQueueEntry.getFadeInStartTime()) /\n this._fadeInSeconds\n );\n\n const tmpFadeOut: number =\n this._fadeOutSeconds <= 0.0 || motionQueueEntry.getEndTime() < 0.0\n ? 1.0\n : CubismMath.getEasingSine(\n (motionQueueEntry.getEndTime() - userTimeSeconds) /\n this._fadeOutSeconds\n );\n let value: number;\n let c: number, parameterIndex: number;\n\n // 'Repeat' time as necessary.\n let time: number = timeOffsetSeconds;\n let duration: number = this._motionData.duration;\n const isCorrection: boolean =\n this._motionBehavior === MotionBehavior.MotionBehavior_V2 && this._isLoop;\n\n if (this._isLoop) {\n if (this._motionBehavior === MotionBehavior.MotionBehavior_V2) {\n duration += 1.0 / this._motionData.fps;\n }\n while (time > duration) {\n time -= duration;\n }\n }\n\n const curves: Array<CubismMotionCurve> = this._motionData.curves;\n\n // Evaluate model curves.\n for (\n c = 0;\n c < this._motionData.curveCount &&\n curves[c].type == CubismMotionCurveTarget.CubismMotionCurveTarget_Model;\n ++c\n ) {\n // Evaluate curve and call handler.\n value = evaluateCurve(this._motionData, c, time, isCorrection, duration);\n\n if (curves[c].id == this._modelCurveIdEyeBlink) {\n eyeBlinkValue = value;\n } else if (curves[c].id == this._modelCurveIdLipSync) {\n lipSyncValue = value;\n } else if (curves[c].id == this._modelCurveIdOpacity) {\n this._modelOpacity = value;\n model.setModelOapcity(this.getModelOpacityValue());\n }\n }\n\n let parameterMotionCurveCount = 0;\n\n for (\n ;\n c < this._motionData.curveCount &&\n curves[c].type ==\n CubismMotionCurveTarget.CubismMotionCurveTarget_Parameter;\n ++c\n ) {\n parameterMotionCurveCount++;\n\n // Find parameter index.\n parameterIndex = model.getParameterIndex(curves[c].id);\n\n // Skip curve evaluation if no value in sink.\n if (parameterIndex == -1) {\n continue;\n }\n\n const sourceValue: number =\n model.getParameterValueByIndex(parameterIndex);\n\n // Evaluate curve and apply value.\n value = evaluateCurve(this._motionData, c, time, isCorrection, duration);\n\n if (eyeBlinkValue != Number.MAX_VALUE) {\n for (\n let i = 0;\n i < this._eyeBlinkParameterIds.length && i < maxTargetSize;\n ++i\n ) {\n if (this._eyeBlinkParameterIds[i] == curves[c].id) {\n value *= eyeBlinkValue;\n eyeBlinkFlags |= 1 << i;\n break;\n }\n }\n }\n\n if (lipSyncValue != Number.MAX_VALUE) {\n for (\n let i = 0;\n i < this._lipSyncParameterIds.length && i < maxTargetSize;\n ++i\n ) {\n if (this._lipSyncParameterIds[i] == curves[c].id) {\n value += lipSyncValue;\n lipSyncFlags |= 1 << i;\n break;\n }\n }\n }\n\n // Process \"repeats only\" for compatibility\n if (model.isRepeat(parameterIndex)) {\n value = model.getParameterRepeatValue(parameterIndex, value);\n }\n\n let v: number;\n\n // パラメータごとのフェード\n if (curves[c].fadeInTime < 0.0 && curves[c].fadeOutTime < 0.0) {\n // モーションのフェードを適用\n v = sourceValue + (value - sourceValue) * fadeWeight;\n } else {\n // パラメータに対してフェードインかフェードアウトが設定してある場合はそちらを適用\n let fin: number;\n let fout: number;\n\n if (curves[c].fadeInTime < 0.0) {\n fin = tmpFadeIn;\n } else {\n fin =\n curves[c].fadeInTime == 0.0\n ? 1.0\n : CubismMath.getEasingSine(\n (userTimeSeconds - motionQueueEntry.getFadeInStartTime()) /\n curves[c].fadeInTime\n );\n }\n\n if (curves[c].fadeOutTime < 0.0) {\n fout = tmpFadeOut;\n } else {\n fout =\n curves[c].fadeOutTime == 0.0 || motionQueueEntry.getEndTime() < 0.0\n ? 1.0\n : CubismMath.getEasingSine(\n (motionQueueEntry.getEndTime() - userTimeSeconds) /\n curves[c].fadeOutTime\n );\n }\n\n const paramWeight: number = this._weight * fin * fout;\n\n // パラメータごとのフェードを適用\n v = sourceValue + (value - sourceValue) * paramWeight;\n }\n\n model.setParameterValueByIndex(parameterIndex, v, 1.0);\n }\n\n {\n if (eyeBlinkValue != Number.MAX_VALUE) {\n for (\n let i = 0;\n i < this._eyeBlinkParameterIds.length && i < maxTargetSize;\n ++i\n ) {\n const sourceValue: number = model.getParameterValueById(\n this._eyeBlinkParameterIds[i]\n );\n\n // モーションでの上書きがあった時にはまばたきは適用しない\n if ((eyeBlinkFlags >> i) & 0x01) {\n continue;\n }\n\n const v: number =\n sourceValue + (eyeBlinkValue - sourceValue) * fadeWeight;\n\n model.setParameterValueById(this._eyeBlinkParameterIds[i], v);\n }\n }\n\n if (lipSyncValue != Number.MAX_VALUE) {\n for (\n let i = 0;\n i < this._lipSyncParameterIds.length && i < maxTargetSize;\n ++i\n ) {\n const sourceValue: number = model.getParameterValueById(\n this._lipSyncParameterIds[i]\n );\n\n // モーションでの上書きがあった時にはリップシンクは適用しない\n if ((lipSyncFlags >> i) & 0x01) {\n continue;\n }\n\n const v: number =\n sourceValue + (lipSyncValue - sourceValue) * fadeWeight;\n\n model.setParameterValueById(this._lipSyncParameterIds[i], v);\n }\n }\n }\n\n for (\n ;\n c < this._motionData.curveCount &&\n curves[c].type ==\n CubismMotionCurveTarget.CubismMotionCurveTarget_PartOpacity;\n ++c\n ) {\n // Find parameter index.\n parameterIndex = model.getParameterIndex(curves[c].id);\n\n // Skip curve evaluation if no value in sink.\n if (parameterIndex == -1) {\n continue;\n }\n\n // Evaluate curve and apply value.\n value = evaluateCurve(this._motionData, c, time, isCorrection, duration);\n\n model.setParameterValueByIndex(parameterIndex, value);\n }\n\n if (timeOffsetSeconds >= duration) {\n if (this._isLoop) {\n this.updateForNextLoop(motionQueueEntry, userTimeSeconds, time);\n } else {\n if (this._onFinishedMotion) {\n this._onFinishedMotion(this);\n }\n\n motionQueueEntry.setIsFinished(true);\n }\n }\n this._lastWeight = fadeWeight;\n }\n\n /**\n * Sets the version of the Motion Behavior.\n *\n * @param Specifies the version of the Motion Behavior.\n */\n public setMotionBehavior(motionBehavior: MotionBehavior) {\n this._motionBehavior = motionBehavior;\n }\n\n /**\n * Gets the version of the Motion Behavior.\n *\n * @return Returns the version of the Motion Behavior.\n */\n public getMotionBehavior(): MotionBehavior {\n return this._motionBehavior;\n }\n\n /**\n * モーションの長さを取得する。\n *\n * @return モーションの長さ[秒]\n */\n public getDuration(): number {\n return this._isLoop ? -1.0 : this._loopDurationSeconds;\n }\n\n /**\n * モーションのループ時の長さを取得する。\n *\n * @return モーションのループ時の長さ[秒]\n */\n public getLoopDuration(): number {\n return this._loopDurationSeconds;\n }\n\n /**\n * パラメータに対するフェードインの時間を設定する。\n *\n * @param parameterId パラメータID\n * @param value フェードインにかかる時間[秒]\n */\n public setParameterFadeInTime(\n parameterId: CubismIdHandle,\n value: number\n ): void {\n const curves: Array<CubismMotionCurve> = this._motionData.curves;\n\n for (let i = 0; i < this._motionData.curveCount; ++i) {\n if (parameterId == curves[i].id) {\n curves[i].fadeInTime = value;\n return;\n }\n }\n }\n\n /**\n * パラメータに対するフェードアウトの時間の設定\n * @param parameterId パラメータID\n * @param value フェードアウトにかかる時間[秒]\n */\n public setParameterFadeOutTime(\n parameterId: CubismIdHandle,\n value: number\n ): void {\n const curves: Array<CubismMotionCurve> = this._motionData.curves;\n\n for (let i = 0; i < this._motionData.curveCount; ++i) {\n if (parameterId == curves[i].id) {\n curves[i].fadeOutTime = value;\n return;\n }\n }\n }\n\n /**\n * パラメータに対するフェードインの時間の取得\n * @param parameterId パラメータID\n * @return フェードインにかかる時間[秒]\n */\n public getParameterFadeInTime(parameterId: CubismIdHandle): number {\n const curves: Array<CubismMotionCurve> = this._motionData.curves;\n\n for (let i = 0; i < this._motionData.curveCount; ++i) {\n if (parameterId == curves[i].id) {\n return curves[i].fadeInTime;\n }\n }\n\n return -1;\n }\n\n /**\n * パラメータに対するフェードアウトの時間を取得\n *\n * @param parameterId パラメータID\n * @return フェードアウトにかかる時間[秒]\n */\n public getParameterFadeOutTime(parameterId: CubismIdHandle): number {\n const curves: Array<CubismMotionCurve> = this._motionData.curves;\n\n for (let i = 0; i < this._motionData.curveCount; ++i) {\n if (parameterId == curves[i].id) {\n return curves[i].fadeOutTime;\n }\n }\n\n return -1;\n }\n\n /**\n * 自動エフェクトがかかっているパラメータIDリストの設定\n * @param eyeBlinkParameterIds 自動まばたきがかかっているパラメータIDのリスト\n * @param lipSyncParameterIds リップシンクがかかっているパラメータIDのリスト\n */\n public setEffectIds(\n eyeBlinkParameterIds: Array<CubismIdHandle>,\n lipSyncParameterIds: Array<CubismIdHandle>\n ): void {\n this._eyeBlinkParameterIds = eyeBlinkParameterIds;\n this._lipSyncParameterIds = lipSyncParameterIds;\n }\n\n /**\n * コンストラクタ\n */\n public constructor() {\n super();\n this._sourceFrameRate = 30.0;\n this._loopDurationSeconds = -1.0;\n this._isLoop = false; // trueから false へデフォルトを変更\n this._isLoopFadeIn = true; // ループ時にフェードインが有効かどうかのフラグ\n this._lastWeight = 0.0;\n this._motionData = null;\n this._modelCurveIdEyeBlink = null;\n this._modelCurveIdLipSync = null;\n this._modelCurveIdOpacity = null;\n this._eyeBlinkParameterIds = null;\n this._lipSyncParameterIds = null;\n this._modelOpacity = 1.0;\n this._debugMode = false;\n }\n\n /**\n * デストラクタ相当の処理\n */\n public release(): void {\n this._motionData = void 0;\n this._motionData = null;\n }\n\n /**\n *\n * @param motionQueueEntry\n * @param userTimeSeconds\n * @param time\n */\n public updateForNextLoop(\n motionQueueEntry: CubismMotionQueueEntry,\n userTimeSeconds: number,\n time: number\n ) {\n switch (this._motionBehavior) {\n case MotionBehavior.MotionBehavior_V2:\n default:\n motionQueueEntry.setStartTime(userTimeSeconds - time); // 最初の状態へ\n if (this._isLoopFadeIn) {\n // ループ中でループ用フェードインが有効のときは、フェードイン設定し直し\n motionQueueEntry.setFadeInStartTime(userTimeSeconds - time);\n }\n\n if (this._onFinishedMotion != null) {\n this._onFinishedMotion(this);\n }\n break;\n case MotionBehavior.MotionBehavior_V1:\n // 旧ループ処理\n motionQueueEntry.setStartTime(userTimeSeconds); // 最初の状態へ\n if (this._isLoopFadeIn) {\n // ループ中でループ用フェードインが有効のときは、フェードイン設定し直し\n motionQueueEntry.setFadeInStartTime(userTimeSeconds);\n }\n break;\n }\n }\n\n /**\n * motion3.jsonをパースする。\n *\n * @param motionJson motion3.jsonが読み込まれているバッファ\n * @param size バッファのサイズ\n * @param shouldCheckMotionConsistency motion3.json整合性チェックするかどうか\n */\n public parse(\n motionJson: ArrayBuffer,\n size: number,\n shouldCheckMotionConsistency: boolean = false\n ): void {\n let json: CubismMotionJson = new CubismMotionJson(motionJson, size);\n\n if (!json) {\n json.release();\n json = void 0;\n return;\n }\n\n if (shouldCheckMotionConsistency) {\n const consistency = json.hasConsistency();\n if (!consistency) {\n json.release();\n CubismLogError('Inconsistent motion3.json.');\n return;\n }\n }\n\n this._motionData = new CubismMotionData();\n\n this._motionData.duration = json.getMotionDuration();\n this._motionData.loop = json.isMotionLoop();\n this._motionData.curveCount = json.getMotionCurveCount();\n this._motionData.fps = json.getMotionFps();\n this._motionData.eventCount = json.getEventCount();\n\n const areBeziersRestructed: boolean = json.getEvaluationOptionFlag(\n EvaluationOptionFlag.EvaluationOptionFlag_AreBeziersRistricted\n );\n\n if (json.isExistMotionFadeInTime()) {\n this._fadeInSeconds =\n json.getMotionFadeInTime() < 0.0 ? 1.0 : json.getMotionFadeInTime();\n } else {\n this._fadeInSeconds = 1.0;\n }\n\n if (json.isExistMotionFadeOutTime()) {\n this._fadeOutSeconds =\n json.getMotionFadeOutTime() < 0.0 ? 1.0 : json.getMotionFadeOutTime();\n } else {\n this._fadeOutSeconds = 1.0;\n }\n\n updateSize(\n this._motionData.curves,\n this._motionData.curveCount,\n CubismMotionCurve,\n true\n );\n updateSize(\n this._motionData.segments,\n json.getMotionTotalSegmentCount(),\n CubismMotionSegment,\n true\n );\n updateSize(\n this._motionData.points,\n json.getMotionTotalPointCount(),\n CubismMotionPoint,\n true\n );\n updateSize(\n this._motionData.events,\n this._motionData.eventCount,\n CubismMotionEvent,\n true\n );\n\n let totalPointCount = 0;\n let totalSegmentCount = 0;\n\n // Curves\n for (\n let curveCount = 0;\n curveCount < this._motionData.curveCount;\n ++curveCount\n ) {\n if (json.getMotionCurveTarget(curveCount) == TargetNameModel) {\n this._motionData.curves[curveCount].type =\n CubismMotionCurveTarget.CubismMotionCurveTarget_Model;\n } else if (json.getMotionCurveTarget(curveCount) == TargetNameParameter) {\n this._motionData.curves[curveCount].type =\n CubismMotionCurveTarget.CubismMotionCurveTarget_Parameter;\n } else if (\n json.getMotionCurveTarget(curveCount) == TargetNamePartOpacity\n ) {\n this._motionData.curves[curveCount].type =\n CubismMotionCurveTarget.CubismMotionCurveTarget_PartOpacity;\n } else {\n CubismLogWarning(\n 'Warning : Unable to get segment type from Curve! The number of \"CurveCount\" may be incorrect!'\n );\n }\n\n this._motionData.curves[curveCount].id =\n json.getMotionCurveId(curveCount);\n\n this._motionData.curves[curveCount].baseSegmentIndex = totalSegmentCount;\n\n this._motionData.curves[curveCount].fadeInTime =\n json.isExistMotionCurveFadeInTime(curveCount)\n ? json.getMotionCurveFadeInTime(curveCount)\n : -1.0;\n this._motionData.curves[curveCount].fadeOutTime =\n json.isExistMotionCurveFadeOutTime(curveCount)\n ? json.getMotionCurveFadeOutTime(curveCount)\n : -1.0;\n\n // Segments\n for (\n let segmentPosition = 0;\n segmentPosition < json.getMotionCurveSegmentCount(curveCount);\n ) {\n if (segmentPosition == 0) {\n this._motionData.segments[totalSegmentCount].basePointIndex =\n totalPointCount;\n\n this._motionData.points[totalPointCount].time =\n json.getMotionCurveSegment(curveCount, segmentPosition);\n this._motionData.points[totalPointCount].value =\n json.getMotionCurveSegment(curveCount, segmentPosition + 1);\n\n totalPointCount += 1;\n segmentPosition += 2;\n } else {\n this._motionData.segments[totalSegmentCount].basePointIndex =\n totalPointCount - 1;\n }\n\n const segment: number = json.getMotionCurveSegment(\n curveCount,\n segmentPosition\n );\n\n const segmentType: CubismMotionSegmentType = segment;\n switch (segmentType) {\n case CubismMotionSegmentType.CubismMotionSegmentType_Linear: {\n this._motionData.segments[totalSegmentCount].segmentType =\n CubismMotionSegmentType.CubismMotionSegmentType_Linear;\n this._motionData.segments[totalSegmentCount].evaluate =\n linearEvaluate;\n\n this._motionData.points[totalPointCount].time =\n json.getMotionCurveSegment(curveCount, segmentPosition + 1);\n this._motionData.points[totalPointCount].value =\n json.getMotionCurveSegment(curveCount, segmentPosition + 2);\n\n totalPointCount += 1;\n segmentPosition += 3;\n\n break;\n }\n case CubismMotionSegmentType.CubismMotionSegmentType_Bezier: {\n this._motionData.segments[totalSegmentCount].segmentType =\n CubismMotionSegmentType.CubismMotionSegmentType_Bezier;\n\n if (areBeziersRestructed || UseOldBeziersCurveMotion) {\n this._motionData.segments[totalSegmentCount].evaluate =\n bezierEvaluate;\n } else {\n this._motionData.segments[totalSegmentCount].evaluate =\n bezierEvaluateCardanoInterpretation;\n }\n\n this._motionData.points[totalPointCount].time =\n json.getMotionCurveSegment(curveCount, segmentPosition + 1);\n this._motionData.points[totalPointCount].value =\n json.getMotionCurveSegment(curveCount, segmentPosition + 2);\n\n this._motionData.points[totalPointCount + 1].time =\n json.getMotionCurveSegment(curveCount, segmentPosition + 3);\n this._motionData.points[totalPointCount + 1].value =\n json.getMotionCurveSegment(curveCount, segmentPosition + 4);\n\n this._motionData.points[totalPointCount + 2].time =\n json.getMotionCurveSegment(curveCount, segmentPosition + 5);\n this._motionData.points[totalPointCount + 2].value =\n json.getMotionCurveSegment(curveCount, segmentPosition + 6);\n\n totalPointCount += 3;\n segmentPosition += 7;\n\n break;\n }\n\n case CubismMotionSegmentType.CubismMotionSegmentType_Stepped: {\n this._motionData.segments[totalSegmentCount].segmentType =\n CubismMotionSegmentType.CubismMotionSegmentType_Stepped;\n this._motionData.segments[totalSegmentCount].evaluate =\n steppedEvaluate;\n\n this._motionData.points[totalPointCount].time =\n json.getMotionCurveSegment(curveCount, segmentPosition + 1);\n this._motionData.points[totalPointCount].value =\n json.getMotionCurveSegment(curveCount, segmentPosition + 2);\n\n totalPointCount += 1;\n segmentPosition += 3;\n\n break;\n }\n\n case CubismMotionSegmentType.CubismMotionSegmentType_InverseStepped: {\n this._motionData.segments[totalSegmentCount].segmentType =\n CubismMotionSegmentType.CubismMotionSegmentType_InverseStepped;\n this._motionData.segments[totalSegmentCount].evaluate =\n inverseSteppedEvaluate;\n\n this._motionData.points[totalPointCount].time =\n json.getMotionCurveSegment(curveCount, segmentPosition + 1);\n this._motionData.points[totalPointCount].value =\n json.getMotionCurveSegment(curveCount, segmentPosition + 2);\n\n totalPointCount += 1;\n segmentPosition += 3;\n\n break;\n }\n default: {\n CSM_ASSERT(0);\n break;\n }\n }\n\n ++this._motionData.curves[curveCount].segmentCount;\n ++totalSegmentCount;\n }\n }\n\n for (\n let userdatacount = 0;\n userdatacount < json.getEventCount();\n ++userdatacount\n ) {\n this._motionData.events[userdatacount].fireTime =\n json.getEventTime(userdatacount);\n this._motionData.events[userdatacount].value =\n json.getEventValue(userdatacount);\n }\n\n json.release();\n json = void 0;\n json = null;\n }\n\n /**\n * モデルのパラメータ更新\n *\n * イベント発火のチェック。\n * 入力する時間は呼ばれるモーションタイミングを0とした秒数で行う。\n *\n * @param beforeCheckTimeSeconds 前回のイベントチェック時間[秒]\n * @param motionTimeSeconds 今回の再生時間[秒]\n */\n public getFiredEvent(\n beforeCheckTimeSeconds: number,\n motionTimeSeconds: number\n ): Array<string> {\n updateSize(this._firedEventValues, 0);\n\n // イベントの発火チェック\n for (let u = 0; u < this._motionData.eventCount; ++u) {\n if (\n this._motionData.events[u].fireTime > beforeCheckTimeSeconds &&\n this._motionData.events[u].fireTime <= motionTimeSeconds\n ) {\n this._firedEventValues.push(this._motionData.events[u].value);\n }\n }\n\n return this._firedEventValues;\n }\n\n /**\n * 透明度のカーブが存在するかどうかを確認する\n *\n * @return true -> キーが存在する\n * false -> キーが存在しない\n */\n public isExistModelOpacity(): boolean {\n for (let i = 0; i < this._motionData.curveCount; i++) {\n const curve: CubismMotionCurve = this._motionData.curves[i];\n\n if (curve.type != CubismMotionCurveTarget.CubismMotionCurveTarget_Model) {\n continue;\n }\n\n if (curve.id.getString().localeCompare(IdNameOpacity) == 0) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * 透明度のカーブのインデックスを返す\n *\n * @return success:透明度のカーブのインデックス\n */\n public getModelOpacityIndex(): number {\n if (this.isExistModelOpacity()) {\n for (let i = 0; i < this._motionData.curveCount; i++) {\n const curve: CubismMotionCurve = this._motionData.curves[i];\n\n if (\n curve.type != CubismMotionCurveTarget.CubismMotionCurveTarget_Model\n ) {\n continue;\n }\n\n if (curve.id.getString().localeCompare(IdNameOpacity) == 0) {\n return i;\n }\n }\n }\n return -1;\n }\n\n /**\n * 透明度のIdを返す\n *\n * @param index モーションカーブのインデックス\n * @return success:透明度のカーブのインデックス\n */\n public getModelOpacityId(index: number): CubismIdHandle {\n if (index != -1) {\n const curve: CubismMotionCurve = this._motionData.curves[index];\n\n if (curve.type == CubismMotionCurveTarget.CubismMotionCurveTarget_Model) {\n if (curve.id.getString().localeCompare(IdNameOpacity) == 0) {\n return CubismFramework.getIdManager().getId(curve.id.getString());\n }\n }\n }\n\n return null;\n }\n\n /**\n * 現在時間の透明度の値を返す\n *\n * @return success:モーションの当該時間におけるOpacityの値\n */\n public getModelOpacityValue(): number {\n return this._modelOpacity;\n }\n\n /**\n * デバッグ用フラグを設定する\n *\n * @param debugMode デバッグモードの有効・無効\n */\n public setDebugMode(debugMode: boolean): void {\n this._debugMode = debugMode;\n }\n\n public _sourceFrameRate: number; // ロードしたファイルのFPS。記述が無ければデフォルト値15fpsとなる\n public _loopDurationSeconds: number; // mtnファイルで定義される一連のモーションの長さ\n public _motionBehavior: MotionBehavior = MotionBehavior.MotionBehavior_V2;\n public _lastWeight: number; // 最後に設定された重み\n\n public _motionData: CubismMotionData; // 実際のモーションデータ本体\n\n public _eyeBlinkParameterIds: Array<CubismIdHandle>; // 自動まばたきを適用するパラメータIDハンドルのリスト。 モデル(モデルセッティング)とパラメータを対応付ける。\n public _lipSyncParameterIds: Array<CubismIdHandle>; // リップシンクを適用するパラメータIDハンドルのリスト。 モデル(モデルセッティング)とパラメータを対応付ける。\n\n public _modelCurveIdEyeBlink: CubismIdHandle; // モデルが持つ自動まばたき用パラメータIDのハンドル。 モデルとモーションを対応付ける。\n public _modelCurveIdLipSync: CubismIdHandle; // モデルが持つリップシンク用パラメータIDのハンドル。 モデルとモーションを対応付ける。\n public _modelCurveIdOpacity: CubismIdHandle; // モデルが持つ不透明度用パラメータIDのハンドル。 モデルとモーションを対応付ける。\n\n public _modelOpacity: number; // モーションから取得した不透明度\n\n private _debugMode: boolean; // デバッグモードかどうか\n}\n\n// Namespace definition for compatibility.\nimport * as $ from './cubismmotion';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const CubismMotion = $.CubismMotion;\n export type CubismMotion = $.CubismMotion;\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport { ACubismMotion } from './acubismmotion';\nimport { CubismMotionQueueEntryHandle } from './cubismmotionqueuemanager';\n\n/**\n * CubismMotionQueueManagerで再生している各モーションの管理クラス。\n */\nexport class CubismMotionQueueEntry {\n /**\n * コンストラクタ\n */\n public constructor() {\n this._autoDelete = false;\n this._motion = null;\n this._available = true;\n this._finished = false;\n this._started = false;\n this._startTimeSeconds = -1.0;\n this._fadeInStartTimeSeconds = 0.0;\n this._endTimeSeconds = -1.0;\n this._stateTimeSeconds = 0.0;\n this._stateWeight = 0.0;\n this._lastEventCheckSeconds = 0.0;\n this._motionQueueEntryHandle = this;\n this._fadeOutSeconds = 0.0;\n this._isTriggeredFadeOut = false;\n }\n\n /**\n * デストラクタ相当の処理\n */\n public release(): void {\n if (this._autoDelete && this._motion) {\n ACubismMotion.delete(this._motion); //\n }\n }\n\n /**\n * フェードアウト時間と開始判定の設定\n * @param fadeOutSeconds フェードアウトにかかる時間[秒]\n */\n public setFadeOut(fadeOutSeconds: number): void {\n this._fadeOutSeconds = fadeOutSeconds;\n this._isTriggeredFadeOut = true;\n }\n\n /**\n * フェードアウトの開始\n * @param fadeOutSeconds フェードアウトにかかる時間[秒]\n * @param userTimeSeconds デルタ時間の積算値[秒]\n */\n public startFadeOut(fadeOutSeconds: number, userTimeSeconds: number): void {\n const newEndTimeSeconds: number = userTimeSeconds + fadeOutSeconds;\n this._isTriggeredFadeOut = true;\n\n if (\n this._endTimeSeconds < 0.0 ||\n newEndTimeSeconds < this._endTimeSeconds\n ) {\n this._endTimeSeconds = newEndTimeSeconds;\n }\n }\n\n /**\n * モーションの終了の確認\n *\n * @return true モーションが終了した\n * @return false 終了していない\n */\n public isFinished(): boolean {\n return this._finished;\n }\n\n /**\n * モーションの開始の確認\n * @return true モーションが開始した\n * @return false 開始していない\n */\n public isStarted(): boolean {\n return this._started;\n }\n\n /**\n * モーションの開始時刻の取得\n * @return モーションの開始時刻[秒]\n */\n public getStartTime(): number {\n return this._startTimeSeconds;\n }\n\n /**\n * フェードインの開始時刻の取得\n * @return フェードインの開始時刻[秒]\n */\n public getFadeInStartTime(): number {\n return this._fadeInStartTimeSeconds;\n }\n\n /**\n * フェードインの終了時刻の取得\n * @return フェードインの終了時刻の取得\n */\n public getEndTime(): number {\n return this._endTimeSeconds;\n }\n\n /**\n * モーションの開始時刻の設定\n * @param startTime モーションの開始時刻\n */\n public setStartTime(startTime: number): void {\n this._startTimeSeconds = startTime;\n }\n\n /**\n * フェードインの開始時刻の設定\n * @param startTime フェードインの開始時刻[秒]\n */\n public setFadeInStartTime(startTime: number): void {\n this._fadeInStartTimeSeconds = startTime;\n }\n\n /**\n * フェードインの終了時刻の設定\n * @param endTime フェードインの終了時刻[秒]\n */\n public setEndTime(endTime: number): void {\n this._endTimeSeconds = endTime;\n }\n\n /**\n * モーションの終了の設定\n * @param f trueならモーションの終了\n */\n public setIsFinished(f: boolean): void {\n this._finished = f;\n }\n\n /**\n * モーション開始の設定\n * @param f trueならモーションの開始\n */\n public setIsStarted(f: boolean): void {\n this._started = f;\n }\n\n /**\n * モーションの有効性の確認\n * @return true モーションは有効\n * @return false モーションは無効\n */\n public isAvailable(): boolean {\n return this._available;\n }\n\n /**\n * モーションの有効性の設定\n * @param v trueならモーションは有効\n */\n public setIsAvailable(v: boolean): void {\n this._available = v;\n }\n\n /**\n * モーションの状態の設定\n * @param timeSeconds 現在時刻[秒]\n * @param weight モーション尾重み\n */\n public setState(timeSeconds: number, weight: number): void {\n this._stateTimeSeconds = timeSeconds;\n this._stateWeight = weight;\n }\n\n /**\n * モーションの現在時刻の取得\n * @return モーションの現在時刻[秒]\n */\n public getStateTime(): number {\n return this._stateTimeSeconds;\n }\n\n /**\n * モーションの重みの取得\n * @return モーションの重み\n */\n public getStateWeight(): number {\n return this._stateWeight;\n }\n\n /**\n * 最後にイベントの発火をチェックした時間を取得\n *\n * @return 最後にイベントの発火をチェックした時間[秒]\n */\n public getLastCheckEventSeconds(): number {\n return this._lastEventCheckSeconds;\n }\n\n /**\n * 最後にイベントをチェックした時間を設定\n * @param checkSeconds 最後にイベントをチェックした時間[秒]\n */\n public setLastCheckEventSeconds(checkSeconds: number): void {\n this._lastEventCheckSeconds = checkSeconds;\n }\n\n /**\n * フェードアウト開始判定の取得\n * @return フェードアウト開始するかどうか\n */\n public isTriggeredFadeOut(): boolean {\n return this._isTriggeredFadeOut;\n }\n\n /**\n * フェードアウト時間の取得\n * @return フェードアウト時間[秒]\n */\n public getFadeOutSeconds(): number {\n return this._fadeOutSeconds;\n }\n\n /**\n * モーションの取得\n *\n * @return モーション\n */\n public getCubismMotion(): ACubismMotion {\n return this._motion;\n }\n\n _autoDelete: boolean; // 自動削除\n _motion: ACubismMotion; // モーション\n\n _available: boolean; // 有効化フラグ\n _finished: boolean; // 終了フラグ\n _started: boolean; // 開始フラグ\n _startTimeSeconds: number; // モーション再生開始時刻[秒]\n _fadeInStartTimeSeconds: number; // フェードイン開始時刻(ループの時は初回のみ)[秒]\n _endTimeSeconds: number; // 終了予定時刻[秒]\n _stateTimeSeconds: number; // 時刻の状態[秒]\n _stateWeight: number; // 重みの状態\n _lastEventCheckSeconds: number; // 最終のMotion側のチェックした時間\n private _fadeOutSeconds: number; // フェードアウト時間[秒]\n private _isTriggeredFadeOut: boolean; // フェードアウト開始フラグ\n\n _motionQueueEntryHandle: CubismMotionQueueEntryHandle; // インスタンスごとに一意の値を持つ識別番号\n}\n\n// Namespace definition for compatibility.\nimport * as $ from './cubismmotionqueueentry';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const CubismMotionQueueEntry = $.CubismMotionQueueEntry;\n export type CubismMotionQueueEntry = $.CubismMotionQueueEntry;\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport { ACubismMotion } from './acubismmotion';\nimport { CubismMotionQueueEntry } from './cubismmotionqueueentry';\nimport { CubismModel } from '../model/cubismmodel';\n\n/**\n * モーション再生の管理\n *\n * モーション再生の管理用クラス。CubismMotionモーションなどACubismMotionのサブクラスを再生するために使用する。\n *\n * @note 再生中に別のモーションが StartMotion()された場合は、新しいモーションに滑らかに変化し旧モーションは中断する。\n * 表情用モーション、体用モーションなどを分けてモーション化した場合など、\n * 複数のモーションを同時に再生させる場合は、複数のCubismMotionQueueManagerインスタンスを使用する。\n */\nexport class CubismMotionQueueManager {\n /**\n * コンストラクタ\n */\n public constructor() {\n this._userTimeSeconds = 0.0;\n this._eventCallBack = null;\n this._eventCustomData = null;\n this._motions = new Array<CubismMotionQueueEntry>();\n }\n\n /**\n * デストラクタ\n */\n public release(): void {\n for (let i = 0; i < this._motions.length; ++i) {\n if (this._motions[i]) {\n this._motions[i].release();\n this._motions[i] = null;\n }\n }\n\n this._motions = null;\n }\n\n /**\n * 指定したモーションの開始\n *\n * 指定したモーションを開始する。同じタイプのモーションが既にある場合は、既存のモーションに終了フラグを立て、フェードアウトを開始させる。\n *\n * @param motion 開始するモーション\n * @param autoDelete 再生が終了したモーションのインスタンスを削除するなら true\n * @param userTimeSeconds Deprecated: デルタ時間の積算値[秒] 関数内で参照していないため使用は非推奨。\n * @return 開始したモーションの識別番号を返す。個別のモーションが終了したか否かを判定するIsFinished()の引数で使用する。開始できない時は「-1」\n */\n public startMotion(\n motion: ACubismMotion,\n autoDelete: boolean,\n userTimeSeconds?: number\n ): CubismMotionQueueEntryHandle {\n if (motion == null) {\n return InvalidMotionQueueEntryHandleValue;\n }\n\n let motionQueueEntry: CubismMotionQueueEntry = null;\n\n // 既にモーションがあれば終了フラグを立てる\n for (let i = 0; i < this._motions.length; ++i) {\n motionQueueEntry = this._motions[i];\n if (motionQueueEntry == null) {\n continue;\n }\n\n motionQueueEntry.setFadeOut(motionQueueEntry._motion.getFadeOutTime()); // フェードアウト設定\n }\n\n motionQueueEntry = new CubismMotionQueueEntry(); // 終了時に破棄する\n motionQueueEntry._autoDelete = autoDelete;\n motionQueueEntry._motion = motion;\n\n this._motions.push(motionQueueEntry);\n\n return motionQueueEntry._motionQueueEntryHandle;\n }\n\n /**\n * 全てのモーションの終了の確認\n * @return true 全て終了している\n * @return false 終了していない\n */\n public isFinished(): boolean {\n // ------- 処理を行う -------\n // 既にモーションがあれば終了フラグを立てる\n\n for (let i = 0; i < this._motions.length; ) {\n let motionQueueEntry: CubismMotionQueueEntry = this._motions[i];\n\n if (motionQueueEntry == null) {\n this._motions.splice(i, 1); // 削除\n continue;\n }\n\n const motion: ACubismMotion = motionQueueEntry._motion;\n\n if (motion == null) {\n motionQueueEntry.release();\n motionQueueEntry = null;\n this._motions.splice(i, 1); // 削除\n continue;\n }\n\n // ----- 終了済みの処理があれば削除する ------\n if (!motionQueueEntry.isFinished()) {\n return false;\n } else {\n i++;\n }\n }\n\n return true;\n }\n\n /**\n * 指定したモーションの終了の確認\n * @param motionQueueEntryNumber モーションの識別番号\n * @return true 全て終了している\n * @return false 終了していない\n */\n public isFinishedByHandle(\n motionQueueEntryNumber: CubismMotionQueueEntryHandle\n ): boolean {\n for (let i = 0; i < this._motions.length; i++) {\n const motionQueueEntry: CubismMotionQueueEntry = this._motions[i];\n\n if (motionQueueEntry == null) {\n continue;\n }\n\n if (\n motionQueueEntry._motionQueueEntryHandle == motionQueueEntryNumber &&\n !motionQueueEntry.isFinished()\n ) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * 全てのモーションを停止する\n */\n public stopAllMotions(): void {\n // ------- 処理を行う -------\n // 既にモーションがあれば終了フラグを立てる\n\n for (let i = 0; i < this._motions.length; i++) {\n const motionQueueEntry: CubismMotionQueueEntry = this._motions[i];\n\n if (motionQueueEntry == null) {\n this._motions.splice(i, 1); // 削除\n\n continue;\n }\n\n // ----- 終了済みの処理があれば削除する ------\n motionQueueEntry.release();\n this._motions.splice(i, 1); // 削除\n continue;\n }\n }\n\n /**\n * @brief CubismMotionQueueEntryの配列の取得\n *\n * CubismMotionQueueEntryの配列を取得する。\n *\n * @return CubismMotionQueueEntryの配列へのポインタ\n * NULL 見つからなかった\n */\n public getCubismMotionQueueEntries(): Array<CubismMotionQueueEntry> {\n return this._motions;\n }\n\n /**\n * 指定したCubismMotionQueueEntryの取得\n\n * @param motionQueueEntryNumber モーションの識別番号\n * @return 指定したCubismMotionQueueEntry\n * @return null 見つからなかった\n */\n public getCubismMotionQueueEntry(\n motionQueueEntryNumber: any\n ): CubismMotionQueueEntry {\n //------- 処理を行う -------\n\n for (let i = 0; i < this._motions.length; i++) {\n const motionQueueEntry: CubismMotionQueueEntry = this._motions[i];\n\n if (motionQueueEntry == null) {\n continue;\n }\n\n if (motionQueueEntry._motionQueueEntryHandle == motionQueueEntryNumber) {\n return motionQueueEntry;\n }\n }\n\n return null;\n }\n\n /**\n * イベントを受け取るCallbackの登録\n *\n * @param callback コールバック関数\n * @param customData コールバックに返されるデータ\n */\n public setEventCallback(\n callback: CubismMotionEventFunction,\n customData: any = null\n ): void {\n this._eventCallBack = callback;\n this._eventCustomData = customData;\n }\n\n /**\n * モーションを更新して、モデルにパラメータ値を反映する。\n *\n * @param model 対象のモデル\n * @param userTimeSeconds デルタ時間の積算値[秒]\n * @return true モデルへパラメータ値の反映あり\n * @return false モデルへパラメータ値の反映なし(モーションの変化なし)\n */\n public doUpdateMotion(model: CubismModel, userTimeSeconds: number): boolean {\n let updated = false;\n\n // ------- 処理を行う --------\n // 既にモーションがあれば終了フラグを立てる\n\n for (let i = 0; i < this._motions.length; ) {\n let motionQueueEntry: CubismMotionQueueEntry = this._motions[i];\n\n if (motionQueueEntry == null) {\n this._motions.splice(i, 1); // 削除\n continue;\n }\n\n const motion: ACubismMotion = motionQueueEntry._motion;\n\n if (motion == null) {\n motionQueueEntry.release();\n motionQueueEntry = null;\n this._motions.splice(i, 1); // 削除\n continue;\n }\n\n // ------ 値を反映する ------\n motion.updateParameters(model, motionQueueEntry, userTimeSeconds);\n updated = true;\n\n // ------ ユーザトリガーイベントを検査する ----\n const firedList: Array<string> = motion.getFiredEvent(\n motionQueueEntry.getLastCheckEventSeconds() -\n motionQueueEntry.getStartTime(),\n userTimeSeconds - motionQueueEntry.getStartTime()\n );\n\n for (let i = 0; i < firedList.length; ++i) {\n this._eventCallBack(this, firedList[i], this._eventCustomData);\n }\n\n motionQueueEntry.setLastCheckEventSeconds(userTimeSeconds);\n\n // ------ 終了済みの処理があれば削除する ------\n if (motionQueueEntry.isFinished()) {\n motionQueueEntry.release();\n motionQueueEntry = null;\n this._motions.splice(i, 1); // 削除\n } else {\n if (motionQueueEntry.isTriggeredFadeOut()) {\n motionQueueEntry.startFadeOut(\n motionQueueEntry.getFadeOutSeconds(),\n userTimeSeconds\n );\n }\n i++;\n }\n }\n\n return updated;\n }\n _userTimeSeconds: number; // デルタ時間の積算値[秒]\n\n _motions: Array<CubismMotionQueueEntry>; // モーション\n _eventCallBack: CubismMotionEventFunction; // コールバック関数\n _eventCustomData: any; // コールバックに戻されるデータ\n}\n\n/**\n * イベントのコールバック関数を定義\n *\n * イベントのコールバックに登録できる関数の型情報\n * @param caller 発火したイベントを再生させたCubismMotionQueueManager\n * @param eventValue 発火したイベントの文字列データ\n * @param customData コールバックに返される登録時に指定されたデータ\n */\nexport interface CubismMotionEventFunction {\n (caller: CubismMotionQueueManager, eventValue: string, customData: any): void;\n}\n\n/**\n * モーションの識別番号\n *\n * モーションの識別番号の定義\n */\nexport declare type CubismMotionQueueEntryHandle = any;\nexport const InvalidMotionQueueEntryHandleValue: CubismMotionQueueEntryHandle =\n -1;\n\n// Namespace definition for compatibility.\nimport * as $ from './cubismmotionqueuemanager';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const CubismMotionQueueManager = $.CubismMotionQueueManager;\n export type CubismMotionQueueManager = $.CubismMotionQueueManager;\n export const InvalidMotionQueueEntryHandleValue =\n $.InvalidMotionQueueEntryHandleValue;\n export type CubismMotionQueueEntryHandle = $.CubismMotionQueueEntryHandle;\n export type CubismMotionEventFunction = $.CubismMotionEventFunction;\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport { CubismIdHandle } from '../id/cubismid';\nimport { CubismFramework } from '../live2dcubismframework';\nimport { CubismModel } from '../model/cubismmodel';\nimport { CubismJson, Value } from '../utils/cubismjson';\nimport { ACubismMotion } from './acubismmotion';\nimport { CubismMotionQueueEntry } from './cubismmotionqueueentry';\n\n// exp3.jsonのキーとデフォルト\nconst ExpressionKeyFadeIn = 'FadeInTime';\nconst ExpressionKeyFadeOut = 'FadeOutTime';\nconst ExpressionKeyParameters = 'Parameters';\nconst ExpressionKeyId = 'Id';\nconst ExpressionKeyValue = 'Value';\nconst ExpressionKeyBlend = 'Blend';\nconst BlendValueAdd = 'Add';\nconst BlendValueMultiply = 'Multiply';\nconst BlendValueOverwrite = 'Overwrite';\nconst DefaultFadeTime = 1.0;\n\n/**\n * 表情のモーション\n *\n * 表情のモーションクラス。\n */\nexport class CubismExpressionMotion extends ACubismMotion {\n static readonly DefaultAdditiveValue = 0.0; // 加算適用の初期値\n static readonly DefaultMultiplyValue = 1.0; // 乗算適用の初期値\n\n /**\n * インスタンスを作成する。\n * @param buffer expファイルが読み込まれているバッファ\n * @param size バッファのサイズ\n * @return 作成されたインスタンス\n */\n public static create(\n buffer: ArrayBuffer,\n size: number\n ): CubismExpressionMotion {\n const expression: CubismExpressionMotion = new CubismExpressionMotion();\n expression.parse(buffer, size);\n return expression;\n }\n\n /**\n * モデルのパラメータの更新の実行\n * @param model 対象のモデル\n * @param userTimeSeconds デルタ時間の積算値[秒]\n * @param weight モーションの重み\n * @param motionQueueEntry CubismMotionQueueManagerで管理されているモーション\n */\n public doUpdateParameters(\n model: CubismModel,\n userTimeSeconds: number,\n weight: number,\n motionQueueEntry: CubismMotionQueueEntry\n ): void {\n for (let i = 0; i < this._parameters.length; ++i) {\n const parameter: ExpressionParameter = this._parameters[i];\n\n switch (parameter.blendType) {\n case ExpressionBlendType.Additive: {\n model.addParameterValueById(\n parameter.parameterId,\n parameter.value,\n weight\n );\n break;\n }\n case ExpressionBlendType.Multiply: {\n model.multiplyParameterValueById(\n parameter.parameterId,\n parameter.value,\n weight\n );\n break;\n }\n case ExpressionBlendType.Overwrite: {\n model.setParameterValueById(\n parameter.parameterId,\n parameter.value,\n weight\n );\n break;\n }\n default:\n // 仕様にない値を設定した時はすでに加算モードになっている\n break;\n }\n }\n }\n\n /**\n * @brief 表情によるモデルのパラメータの計算\n *\n * モデルの表情に関するパラメータを計算する。\n *\n * @param[in] model 対象のモデル\n * @param[in] userTimeSeconds デルタ時間の積算値[秒]\n * @param[in] motionQueueEntry CubismMotionQueueManagerで管理されているモーション\n * @param[in] expressionParameterValues モデルに適用する各パラメータの値\n * @param[in] expressionIndex 表情のインデックス\n * @param[in] fadeWeight 表情のウェイト\n */\n public calculateExpressionParameters(\n model: CubismModel,\n userTimeSeconds: number,\n motionQueueEntry: CubismMotionQueueEntry,\n expressionParameterValues: Array<ExpressionParameterValue>,\n expressionIndex: number,\n fadeWeight: number\n ) {\n if (motionQueueEntry == null || expressionParameterValues == null) {\n return;\n }\n\n if (!motionQueueEntry.isAvailable()) {\n return;\n }\n\n // モデルに適用する値を計算\n for (let i = 0; i < expressionParameterValues.length; ++i) {\n const expressionParameterValue = expressionParameterValues[i];\n\n if (expressionParameterValue.parameterId == null) {\n continue;\n }\n\n const currentParameterValue = (expressionParameterValue.overwriteValue =\n model.getParameterValueById(expressionParameterValue.parameterId));\n\n const expressionParameters = this.getExpressionParameters();\n let parameterIndex = -1;\n for (let j = 0; j < expressionParameters.length; ++j) {\n if (\n expressionParameterValue.parameterId !=\n expressionParameters[j].parameterId\n ) {\n continue;\n }\n\n parameterIndex = j;\n\n break;\n }\n\n // 再生中のExpressionが参照していないパラメータは初期値を適用\n if (parameterIndex < 0) {\n if (expressionIndex == 0) {\n expressionParameterValue.additiveValue =\n CubismExpressionMotion.DefaultAdditiveValue;\n expressionParameterValue.multiplyValue =\n CubismExpressionMotion.DefaultMultiplyValue;\n expressionParameterValue.overwriteValue = currentParameterValue;\n } else {\n expressionParameterValue.additiveValue = this.calculateValue(\n expressionParameterValue.additiveValue,\n CubismExpressionMotion.DefaultAdditiveValue,\n fadeWeight\n );\n expressionParameterValue.multiplyValue = this.calculateValue(\n expressionParameterValue.multiplyValue,\n CubismExpressionMotion.DefaultMultiplyValue,\n fadeWeight\n );\n expressionParameterValue.overwriteValue = this.calculateValue(\n expressionParameterValue.overwriteValue,\n currentParameterValue,\n fadeWeight\n );\n }\n continue;\n }\n\n // 値を計算\n const value = expressionParameters[parameterIndex].value;\n let newAdditiveValue, newMultiplyValue, newOverwriteValue;\n switch (expressionParameters[parameterIndex].blendType) {\n case ExpressionBlendType.Additive:\n newAdditiveValue = value;\n newMultiplyValue = CubismExpressionMotion.DefaultMultiplyValue;\n newOverwriteValue = currentParameterValue;\n break;\n\n case ExpressionBlendType.Multiply:\n newAdditiveValue = CubismExpressionMotion.DefaultAdditiveValue;\n newMultiplyValue = value;\n newOverwriteValue = currentParameterValue;\n break;\n\n case ExpressionBlendType.Overwrite:\n newAdditiveValue = CubismExpressionMotion.DefaultAdditiveValue;\n newMultiplyValue = CubismExpressionMotion.DefaultMultiplyValue;\n newOverwriteValue = value;\n break;\n\n default:\n return;\n }\n\n if (expressionIndex == 0) {\n expressionParameterValue.additiveValue = newAdditiveValue;\n expressionParameterValue.multiplyValue = newMultiplyValue;\n expressionParameterValue.overwriteValue = newOverwriteValue;\n } else {\n expressionParameterValue.additiveValue =\n expressionParameterValue.additiveValue * (1.0 - fadeWeight) +\n newAdditiveValue * fadeWeight;\n expressionParameterValue.multiplyValue =\n expressionParameterValue.multiplyValue * (1.0 - fadeWeight) +\n newMultiplyValue * fadeWeight;\n expressionParameterValue.overwriteValue =\n expressionParameterValue.overwriteValue * (1.0 - fadeWeight) +\n newOverwriteValue * fadeWeight;\n }\n }\n }\n\n /**\n * @brief 表情が参照しているパラメータを取得\n *\n * 表情が参照しているパラメータを取得する\n *\n * @return 表情パラメータ\n */\n public getExpressionParameters() {\n return this._parameters;\n }\n\n protected parse(buffer: ArrayBuffer, size: number) {\n const json: CubismJson = CubismJson.create(buffer, size);\n if (!json) {\n return;\n }\n\n const root: Value = json.getRoot();\n\n this.setFadeInTime(\n root.getValueByString(ExpressionKeyFadeIn).toFloat(DefaultFadeTime)\n ); // フェードイン\n this.setFadeOutTime(\n root.getValueByString(ExpressionKeyFadeOut).toFloat(DefaultFadeTime)\n ); // フェードアウト\n\n // 各パラメータについて\n const parameterCount = root\n .getValueByString(ExpressionKeyParameters)\n .getSize();\n\n let dstIndex: number = this._parameters.length;\n this._parameters.length += parameterCount;\n for (let i = 0; i < parameterCount; ++i) {\n const param: Value = root\n .getValueByString(ExpressionKeyParameters)\n .getValueByIndex(i);\n const parameterId: CubismIdHandle = CubismFramework.getIdManager().getId(\n param.getValueByString(ExpressionKeyId).getRawString()\n ); // パラメータID\n\n const value: number = param\n .getValueByString(ExpressionKeyValue)\n .toFloat(); // 値\n\n // 計算方法の設定\n let blendType: ExpressionBlendType;\n\n if (\n param.getValueByString(ExpressionKeyBlend).isNull() ||\n param.getValueByString(ExpressionKeyBlend).getString() == BlendValueAdd\n ) {\n blendType = ExpressionBlendType.Additive;\n } else if (\n param.getValueByString(ExpressionKeyBlend).getString() ==\n BlendValueMultiply\n ) {\n blendType = ExpressionBlendType.Multiply;\n } else if (\n param.getValueByString(ExpressionKeyBlend).getString() ==\n BlendValueOverwrite\n ) {\n blendType = ExpressionBlendType.Overwrite;\n } else {\n // その他 仕様にない値を設定した時は加算モードにすることで復旧\n blendType = ExpressionBlendType.Additive;\n }\n\n // 設定オブジェクトを作成してリストに追加する\n const item: ExpressionParameter = new ExpressionParameter();\n\n item.parameterId = parameterId;\n item.blendType = blendType;\n item.value = value;\n\n this._parameters[dstIndex++] = item;\n }\n\n CubismJson.delete(json); // JSONデータは不要になったら削除する\n }\n\n /**\n * @brief ブレンド計算\n *\n * 入力された値でブレンド計算をする。\n *\n * @param source 現在の値\n * @param destination 適用する値\n * @param weight ウェイト\n * @return 計算結果\n */\n public calculateValue(\n source: number,\n destination: number,\n fadeWeight: number\n ): number {\n return source * (1.0 - fadeWeight) + destination * fadeWeight;\n }\n\n /**\n * コンストラクタ\n */\n protected constructor() {\n super();\n this._parameters = new Array<ExpressionParameter>();\n }\n\n private _parameters: Array<ExpressionParameter>; // 表情のパラメータ情報リスト\n}\n\n/**\n * 表情パラメータ値の計算方式\n */\nexport enum ExpressionBlendType {\n Additive = 0, // 加算\n Multiply = 1, // 乗算\n Overwrite = 2 // 上書き\n}\n\n/**\n * 表情のパラメータ情報\n */\nexport class ExpressionParameter {\n parameterId: CubismIdHandle; // パラメータID\n blendType: ExpressionBlendType; // パラメータの演算種類\n value: number; // 値\n}\n\n// Namespace definition for compatibility.\nimport * as $ from './cubismexpressionmotion';\nimport { ExpressionParameterValue } from './cubismexpressionmotionmanager';\nimport { CubismDefaultParameterId } from '../cubismdefaultparameterid';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const CubismExpressionMotion = $.CubismExpressionMotion;\n export type CubismExpressionMotion = $.CubismExpressionMotion;\n export const ExpressionBlendType = $.ExpressionBlendType;\n export type ExpressionBlendType = $.ExpressionBlendType;\n export const ExpressionParameter = $.ExpressionParameter;\n export type ExpressionParameter = $.ExpressionParameter;\n}\n","import type * as CubismSpec from '@cubism/CubismSpec'\nimport type { CubismIdHandle } from '@cubism/id/cubismid'\nimport { CubismMath } from '@cubism/math/cubismmath'\nimport type { CubismModel } from '@cubism/model/cubismmodel'\nimport { CubismExpressionMotion, ExpressionBlendType } from '@cubism/motion/cubismexpressionmotion'\n\nimport type { CubismModelSettings } from '@/cubism/CubismModelSettings'\nimport type { MotionManagerOptions } from '@/cubism-common'\n\nimport { ExpressionManager } from '@/cubism-common/ExpressionManager'\n\n/** A toggled expression being faded in, held, or faded out. */\ninterface ExpressionToggleEntry {\n index: number\n motion: CubismExpressionMotion\n /** Current eased weight, 0..1. */\n weight: number\n /** Weight when the current fade started, so mid-fade reversals stay continuous. */\n fadeStartWeight: number\n /** Timestamp (seconds) the current fade started; -1 until stamped by the next update. */\n fadeStartTime: number\n fadingOut: boolean\n /** Fade-in duration override (seconds) from the activation; undefined uses the motion's FadeInTime. */\n fadeInOverride: number | undefined\n}\n\n/** Per-parameter VTS-style blend state: Add sums, Multiply stacks, Overwrite folds in activation order. */\ninterface ParameterBlendState {\n add: number\n multiply: number\n overwrite: number\n}\n\nexport class CubismExpressionManager extends ExpressionManager<CubismExpressionMotion, CubismSpec.Expression> {\n readonly expressionDataType = 'arraybuffer' as const\n\n readonly definitions: CubismSpec.Expression[]\n\n /** Active fade entries in activation order; deactivated ones stay until fully faded out. */\n private entries: ExpressionToggleEntry[] = []\n\n constructor(settings: CubismModelSettings, options?: MotionManagerOptions) {\n super(settings, options)\n\n // Name is required too: getExpressionName must return a string for every definition,\n // or activeExpressionNames() breaks its string[] contract.\n this.definitions =\n settings.expressions?.filter(\n (expression): expression is CubismSpec.Expression =>\n !!expression && typeof expression.File === 'string' && typeof expression.Name === 'string'\n ) ?? []\n }\n\n isFinished(): boolean {\n return this.entries.length === 0\n }\n\n getExpressionIndex(name: string): number {\n return this.definitions.findIndex(def => def.Name === name)\n }\n\n getExpressionFile(definition: CubismSpec.Expression): string {\n return definition.File\n }\n\n getExpressionName(definition: CubismSpec.Expression): string {\n return definition.Name\n }\n\n createExpression(data: ArrayBuffer, _definition: CubismSpec.Expression | undefined) {\n return CubismExpressionMotion.create(data, data.byteLength)\n }\n\n protected activateExpression(\n index: number,\n expression: CubismExpressionMotion,\n fadeSeconds: number | undefined\n ): void {\n const existing = this.entries.findIndex(entry => entry.index === index)\n\n if (existing >= 0) {\n // Revive a fading-out entry from its current weight, moved to the end so it\n // becomes the most recent activation for Overwrite precedence.\n const entry = this.entries.splice(existing, 1)[0]!\n entry.fadingOut = false\n entry.fadeStartWeight = entry.weight\n entry.fadeStartTime = -1\n entry.fadeInOverride = fadeSeconds\n this.entries.push(entry)\n return\n }\n\n const entry: ExpressionToggleEntry = {\n index,\n motion: expression,\n weight: 0,\n fadeStartWeight: 0,\n fadeStartTime: -1,\n fadingOut: false,\n fadeInOverride: fadeSeconds,\n }\n\n // Mirror activeIndices: a late-settling earlier request slots beneath expressions\n // requested after it, preserving request-order Overwrite precedence.\n const successor = this.activeIndices[this.activeIndices.indexOf(index) + 1]\n const at = successor === undefined ? -1 : this.entries.findIndex(e => e.index === successor && !e.fadingOut)\n\n if (at < 0) {\n this.entries.push(entry)\n } else {\n this.entries.splice(at, 0, entry)\n }\n }\n\n protected deactivateExpression(index: number): void {\n const entry = this.entries.find(e => e.index === index && !e.fadingOut)\n\n if (entry) {\n entry.fadingOut = true\n entry.fadeStartWeight = entry.weight\n entry.fadeStartTime = -1\n }\n }\n\n protected stopAllExpressions(): void {\n this.entries.length = 0\n }\n\n protected updateParameters(model: CubismModel, now: DOMHighResTimeStamp): boolean {\n this.advanceWeights(now)\n\n if (!this.entries.length) {\n return false\n }\n\n // Union of referenced parameters; `overwrite` starts from the model's current\n // (motion/tracking) value, so a partial weight blends against the live base.\n const states = new Map<CubismIdHandle, ParameterBlendState>()\n\n for (const entry of this.entries) {\n const weight = entry.weight\n\n for (const parameter of entry.motion.getExpressionParameters()) {\n if (parameter.parameterId == null) {\n continue\n }\n\n let state = states.get(parameter.parameterId)\n\n if (!state) {\n state = {\n add: 0,\n multiply: 1,\n overwrite: model.getParameterValueById(parameter.parameterId),\n }\n states.set(parameter.parameterId, state)\n }\n\n switch (parameter.blendType) {\n case ExpressionBlendType.Additive:\n state.add += parameter.value * weight\n break\n case ExpressionBlendType.Multiply:\n state.multiply *= 1 + (parameter.value - 1) * weight\n break\n case ExpressionBlendType.Overwrite:\n state.overwrite = state.overwrite * (1 - weight) + parameter.value * weight\n break\n }\n }\n }\n\n for (const [parameterId, state] of states) {\n model.setParameterValueById(parameterId, (state.overwrite + state.add) * state.multiply)\n }\n\n return true\n }\n\n /** Advances fade weights to `now` (seconds) and drops entries that finished fading out. */\n private advanceWeights(now: number): void {\n for (let i = this.entries.length - 1; i >= 0; i--) {\n const entry = this.entries[i]!\n\n if (entry.fadeStartTime < 0) {\n entry.fadeStartTime = now\n }\n\n const fadeTime = entry.fadingOut\n ? entry.motion.getFadeOutTime()\n : (entry.fadeInOverride ?? entry.motion.getFadeInTime())\n const progress = fadeTime > 0 ? CubismMath.getEasingSine((now - entry.fadeStartTime) / fadeTime) : 1\n\n entry.weight = entry.fadingOut\n ? entry.fadeStartWeight * (1 - progress)\n : entry.fadeStartWeight + (1 - entry.fadeStartWeight) * progress\n\n if (entry.fadingOut && entry.weight <= 0) {\n this.entries.splice(i, 1)\n }\n }\n }\n}\n","import type { CubismMotion } from '@cubism/motion/cubismmotion'\nimport type { CubismMotionQueueManager } from '@cubism/motion/cubismmotionqueuemanager'\n\nimport type { CubismInternalModel } from '@/cubism/CubismInternalModel'\n\nexport function motionSkipToLastFrame(\n queueManager: CubismMotionQueueManager,\n internalModel: CubismInternalModel,\n motion: CubismMotion\n) {\n const motionQueueEntryHandle = queueManager.startMotion(motion, false) as number\n\n const motionQueueEntry = queueManager.getCubismMotionQueueEntry(motionQueueEntryHandle)\n\n if (!motionQueueEntry) {\n return false\n }\n\n motionQueueEntry.setStartTime(0)\n motionQueueEntry.setFadeInStartTime(0)\n\n const duration = motion.getDuration()\n const currentTime = motionQueueEntry.getStartTime() + duration\n\n motion.doUpdateParameters(internalModel.coreModel, currentTime, 1.0, motionQueueEntry)\n motionQueueEntry.setIsFinished(true)\n return true\n}\n","// noinspection DuplicatedCode\n\nimport type * as CubismSpec from '@cubism/CubismSpec'\nimport type { CubismIdHandle } from '@cubism/id/cubismid'\nimport { CubismFramework } from '@cubism/live2dcubismframework'\nimport type { CubismModel } from '@cubism/model/cubismmodel'\nimport type { ACubismMotion } from '@cubism/motion/acubismmotion'\nimport { CubismMotion } from '@cubism/motion/cubismmotion'\nimport { CubismMotionJson } from '@cubism/motion/cubismmotionjson'\nimport { CubismMotionQueueManager } from '@cubism/motion/cubismmotionqueuemanager'\n\nimport type { CubismInternalModel } from '@/cubism/CubismInternalModel'\nimport type { CubismModelSettings } from '@/cubism/CubismModelSettings'\nimport type { MotionManagerOptions } from '@/cubism-common/MotionManager'\nimport type { Mutable } from '@/types/helpers'\n\nimport { config } from '@/config'\nimport { CubismExpressionManager } from '@/cubism/CubismExpressionManager'\nimport { motionSkipToLastFrame } from '@/cubism/MotionSkipLastFrameHelper'\nimport { MotionManager } from '@/cubism-common/MotionManager'\n\nexport class CubismMotionManager extends MotionManager<CubismMotion, CubismSpec.Motion> {\n readonly definitions: Partial<Record<string, CubismSpec.Motion[]>>\n\n readonly groups = { idle: 'Idle' } as const\n\n readonly motionDataType = 'arraybuffer'\n\n readonly queueManager = new CubismMotionQueueManager()\n\n declare readonly settings: CubismModelSettings\n\n expressionManager?: CubismExpressionManager\n\n eyeBlinkIds: string[]\n lipSyncIds = ['ParamMouthOpenY']\n\n constructor(parent: CubismInternalModel) {\n super(parent)\n\n this.definitions = parent.settings.motions ?? {}\n this.eyeBlinkIds = parent.settings.getEyeBlinkParameters() || []\n\n const lipSyncIds = parent.settings.getLipSyncParameters()\n\n if (lipSyncIds?.length) {\n this.lipSyncIds = lipSyncIds\n }\n this.init(parent.options)\n }\n\n protected init(options?: MotionManagerOptions) {\n super.init(options)\n\n if (this.settings.expressions) {\n this.expressionManager = new CubismExpressionManager(this.settings, options)\n }\n\n this.queueManager.setEventCallback((_caller: unknown, eventValue: MotionEventValue) => {\n const value = eventValue == null ? 'undefined' : String(eventValue)\n this.emit(`motion:${value}`)\n })\n }\n\n isFinished(): boolean {\n return this.queueManager.isFinished()\n }\n\n protected _startMotion(\n motion: CubismMotion,\n onFinish?: (motion: CubismMotion) => void,\n ignoreParamIds?: string[],\n loop?: boolean\n ): number {\n motion.setFinishedMotionHandler(onFinish as (motion: ACubismMotion) => void)\n motion.setLoop(loop ?? motion._motionData.loop)\n\n if (ignoreParamIds && ignoreParamIds.length > 0) {\n const filtered = motion._motionData.curves.filter(curve => {\n const id = getCurveId(curve)\n\n return !id || !ignoreParamIds.includes(id)\n })\n\n motion._motionData.curves = filtered\n motion._motionData.curveCount = filtered.length\n }\n\n this.queueManager.stopAllMotions()\n\n return this.queueManager.startMotion(motion, false) as number\n }\n\n protected _stopAllMotions(): void {\n this.queueManager.stopAllMotions()\n }\n\n createMotion(data: ArrayBuffer, group: string, definition: CubismSpec.Motion): CubismMotion {\n const shouldCheckMotionConsistency = !!this.parent.options.checkMotionConsistency\n const motion = CubismMotion.create(data, data.byteLength, undefined, undefined, shouldCheckMotionConsistency)\n const json = new CubismMotionJson(data, data.byteLength)\n\n motion.setLoop(json.isMotionLoop())\n\n const defaultFadingDuration =\n (group === this.groups.idle ? config.idleMotionFadingDuration : config.motionFadingDuration) / 1000\n\n // fading duration priorities: model.json > motion.json > config (default)\n\n // overwrite the fading duration only when it's not defined in the motion JSON\n if (json.getMotionFadeInTime() === undefined) {\n motion.setFadeInTime(definition.FadeInTime! > 0 ? definition.FadeInTime! : defaultFadingDuration)\n }\n\n if (json.getMotionFadeOutTime() === undefined) {\n motion.setFadeOutTime(definition.FadeOutTime! > 0 ? definition.FadeOutTime! : defaultFadingDuration)\n }\n\n motion.setEffectIds(this.createIdList(this.eyeBlinkIds), this.createIdList(this.lipSyncIds))\n\n return motion\n }\n\n getMotionFile(definition: CubismSpec.Motion): string {\n return definition.File\n }\n\n protected getMotionName(definition: CubismSpec.Motion): string {\n return definition.File\n }\n\n protected getSoundFile(definition: CubismSpec.Motion): string | undefined {\n return definition.Sound\n }\n\n protected updateParameters(model: CubismModel, now: DOMHighResTimeStamp): boolean {\n return this.queueManager.doUpdateMotion(model, now)\n }\n\n destroy() {\n super.destroy()\n\n this.queueManager.release()\n ;(this as Partial<Mutable<this>>).queueManager = undefined\n }\n\n async motionLastFrame(\n group: string,\n index: number,\n {\n expression = undefined,\n }: {\n expression?: number | string\n } = {}\n ): Promise<boolean> {\n const motion = await this.getMotionAndApplyExpression(group, index, expression)\n\n if (!motion) {\n return false\n }\n\n this.playing = true\n\n motionSkipToLastFrame(this.queueManager, this.parent as CubismInternalModel, motion as CubismMotion)\n\n this.playing = false\n return true\n }\n\n private createIdList(ids: string[]): CubismIdHandle[] {\n const idManager = CubismFramework.getIdManager()\n\n return ids.map(id => idManager.getId(id))\n }\n}\n\ntype MotionEventValue = string | number | undefined\n\nfunction getCurveId(curve: unknown): string | undefined {\n if (!curve || typeof curve !== 'object') {\n return undefined\n }\n\n const id = (curve as { id?: unknown }).id\n\n if (typeof id === 'string') {\n return id\n }\n\n if (id && typeof (id as { getString?: () => string }).getString === 'function') {\n return (id as { getString: () => string }).getString()\n }\n\n return undefined\n}\n","// noinspection JSCommentMatchesSignature,JSUnusedGlobalSymbols\n\nimport { EventEmitter } from 'pixi.js'\n\nimport type { InternalModel } from '@/cubism-common/InternalModel'\nimport type { ModelSettings } from '@/cubism-common/ModelSettings'\nimport type { MotionManager } from '@/cubism-common/MotionManager'\n\nimport { MotionPriority, MotionState } from '@/cubism-common/MotionState'\nimport { logger } from '@/utils'\n\nexport interface ParallelMotionStartOptions {\n ignoreParamIds?: string[]\n /**\n * Whether the motion should loop. Overrides Cubism 3/4/5 motion JSON loop metadata when specified.\n */\n loop?: boolean\n}\n\nexport type ParallelMotionStartRandomOptions = Omit<ParallelMotionStartOptions, 'ignoreParamIds'>\n\n/**\n * Handles the motion playback.\n * @emits {@link MotionManagerEvents}\n */\nexport abstract class ParallelMotionManager<Motion = never, MotionSpec = never> extends EventEmitter {\n /**\n * Tag for logging.\n */\n tag: string\n\n manager: MotionManager\n\n /**\n * The ModelSettings reference.\n */\n readonly settings: ModelSettings\n\n /**\n * Maintains the state of this MotionManager.\n */\n state = new MotionState()\n\n /**\n * Flags there's a motion playing.\n */\n playing = false\n\n /**\n * Flags the instances has been destroyed.\n */\n destroyed = false\n\n readonly parent: InternalModel\n\n protected constructor(parent: InternalModel) {\n super()\n this.settings = parent.settings\n this.tag = `ParallelMotionManager(${this.settings.name})`\n this.state.tag = this.tag\n this.manager = parent.motionManager\n this.parent = parent\n }\n\n /**\n * Starts a motion as given priority.\n * @param group - The motion group.\n * @param index - Index in the motion group.\n * @param priority - The priority to be applied. default: 2 (NORMAL)\n * @param ignoreParamIds - The ids to be ignored.\n * @param loop - Whether the motion should loop. Overrides Cubism 3/4/5 motion JSON loop metadata when specified.\n * @return Promise that resolves with true if the motion is successfully started, with false otherwise.\n */\n async startMotion(\n group: string,\n index: number,\n priority: MotionPriority = MotionPriority.NORMAL,\n options: ParallelMotionStartOptions | string[] = {}\n ): Promise<boolean> {\n const { ignoreParamIds = [], loop } = Array.isArray(options)\n ? { ignoreParamIds: options, loop: undefined }\n : options\n\n if (!this.state.reserve(group, index, priority)) {\n return false\n }\n\n const definition = this.manager.definitions[group]?.[index]\n if (!definition) {\n return false\n }\n\n const motion = await this.manager.loadMotion(group, index)\n\n if (!this.state.start(motion, group, index, priority)) {\n return false\n }\n logger.log(this.tag, 'Start motion:', this.getMotionName(definition as MotionSpec))\n\n this.emit('motionStart', group, index, undefined)\n\n this.playing = true\n\n this._startMotion(motion! as Motion, undefined, ignoreParamIds, loop)\n\n return true\n }\n\n /**\n * Starts a random Motion as given priority.\n * @param group - The motion group.\n * @param priority - The priority to be applied. (default: 1 `IDLE`)\n * @param loop - Whether the motion should loop. Overrides Cubism 3/4/5 motion JSON loop metadata when specified.\n * @return Promise that resolves with true if the motion is successfully started, with false otherwise.\n */\n async startRandomMotion(\n group: string,\n priority?: MotionPriority,\n { loop = undefined }: ParallelMotionStartRandomOptions = {}\n ): Promise<boolean> {\n const groupDefs = this.manager.definitions[group]\n\n if (groupDefs?.length) {\n const availableIndices: number[] = []\n const groupMotions = this.manager.motionGroups[group] ?? []\n\n for (let i = 0; i < groupDefs.length; i++) {\n if (groupMotions[i] !== null && !this.state.isActive(group, i)) {\n availableIndices.push(i)\n }\n }\n\n if (availableIndices.length) {\n const index = availableIndices[Math.floor(Math.random() * availableIndices.length)]!\n\n return this.startMotion(group, index, priority, { loop: loop })\n }\n }\n\n return false\n }\n\n /**\n * Stops all playing motions as well as the sound.\n */\n stopAllMotions(): void {\n this._stopAllMotions()\n\n this.state.reset()\n }\n\n /**\n * Updates parameters of the core model.\n * @param model - The core model.\n * @param now - Current time in milliseconds.\n * @return True if the parameters have been actually updated.\n */\n update(model: object, now: DOMHighResTimeStamp): boolean {\n if (this.isFinished()) {\n if (this.playing) {\n this.playing = false\n this.emit('motionFinish')\n }\n\n this.state.complete()\n }\n return this.updateParameters(model, now)\n }\n\n /**\n * Destroys the instance.\n * @emits {@link MotionManagerEvents.destroy}\n */\n destroy() {\n this.destroyed = true\n this.emit('destroy')\n\n this.stopAllMotions()\n }\n\n /**\n * Checks if the motion playback has finished.\n */\n abstract isFinished(): boolean\n\n /**\n * Retrieves the motion's name by its definition.\n * @return The motion's name.\n */\n protected abstract getMotionName(definition: MotionSpec): string\n\n /**\n * Starts the Motion.\n */\n protected abstract _startMotion(\n motion: Motion,\n onFinish?: (motion: Motion) => void,\n ignoreParamIds?: string[],\n loop?: boolean\n ): number\n\n /**\n * Stops all playing motions.\n */\n protected abstract _stopAllMotions(): void\n\n /**\n * Updates parameters of the core model.\n * @param model - The core model.\n * @param now - Current time in milliseconds.\n * @return True if the parameters have been actually updated.\n */\n protected abstract updateParameters(model: object, now: DOMHighResTimeStamp): boolean\n\n abstract playMotionLastFrame(group: string, index: number): Promise<boolean>\n}\n","// noinspection DuplicatedCode\n\nimport type * as CubismSpec from '@cubism/CubismSpec'\nimport type { CubismModel } from '@cubism/model/cubismmodel'\nimport type { ACubismMotion } from '@cubism/motion/acubismmotion'\nimport type { CubismMotion } from '@cubism/motion/cubismmotion'\nimport { CubismMotionQueueManager } from '@cubism/motion/cubismmotionqueuemanager'\n\nimport type { CubismInternalModel } from '@/cubism/CubismInternalModel'\nimport type { CubismModelSettings } from '@/cubism/CubismModelSettings'\nimport type { Mutable } from '@/types/helpers'\n\nimport { motionSkipToLastFrame } from '@/cubism/MotionSkipLastFrameHelper'\nimport { MotionPriority } from '@/cubism-common'\nimport { ParallelMotionManager } from '@/cubism-common/ParallelMotionManager'\nimport { logger } from '@/utils'\n\nexport class CubismParallelMotionManager extends ParallelMotionManager<CubismMotion, CubismSpec.Motion> {\n readonly queueManager = new CubismMotionQueueManager()\n\n declare readonly settings: CubismModelSettings\n\n constructor(parent: CubismInternalModel) {\n super(parent)\n\n this.init()\n }\n\n protected init() {\n this.queueManager.setEventCallback((_caller: unknown, eventValue: MotionEventValue) => {\n const value = eventValue == null ? 'undefined' : String(eventValue)\n this.emit(`motion:${value}`)\n })\n }\n\n isFinished(): boolean {\n return this.queueManager.isFinished()\n }\n\n protected _startMotion(\n motion: CubismMotion,\n onFinish?: (motion: CubismMotion) => void,\n ignoreParamIds?: string[],\n loop?: boolean\n ): number {\n motion.setFinishedMotionHandler(onFinish as (motion: ACubismMotion) => void)\n motion.setLoop(loop ?? motion._motionData.loop)\n\n if (ignoreParamIds && ignoreParamIds.length > 0) {\n const filtered = motion._motionData.curves.filter(curve => {\n const id = getCurveId(curve)\n\n return !id || !ignoreParamIds.includes(id)\n })\n\n motion._motionData.curves = filtered\n motion._motionData.curveCount = filtered.length\n }\n\n this.queueManager.stopAllMotions()\n return this.queueManager.startMotion(motion, false) as number\n }\n\n protected _stopAllMotions(): void {\n this.queueManager.stopAllMotions()\n }\n\n protected updateParameters(model: CubismModel, now: DOMHighResTimeStamp): boolean {\n return this.queueManager.doUpdateMotion(model, now)\n }\n\n protected getMotionName(definition: CubismSpec.Motion): string {\n return definition.File\n }\n\n destroy() {\n super.destroy()\n\n this.queueManager.release()\n ;(this as Partial<Mutable<this>>).queueManager = undefined\n }\n\n async playMotionLastFrame(group: string, index: number): Promise<boolean> {\n if (!this.state.reserve(group, index, MotionPriority.FORCE)) {\n return false\n }\n\n const definition = this.manager.definitions[group]?.[index]\n if (!definition) {\n return false\n }\n\n const motion = (await this.manager.loadMotion(group, index)) as CubismMotion\n if (!this.state.start(motion, group, index, MotionPriority.FORCE)) {\n return false\n }\n\n logger.log(this.tag, 'Start motion:', this.getMotionName(definition as CubismSpec.Motion))\n\n this.emit('motionStart', group, index, undefined)\n\n this.playing = true\n\n this.queueManager.stopAllMotions()\n\n if (!motionSkipToLastFrame(this.queueManager, this.parent as CubismInternalModel, motion)) {\n this.playing = false\n return false\n }\n this.playing = false\n\n return true\n }\n}\n\ntype MotionEventValue = string | number | undefined\n\nfunction getCurveId(curve: unknown): string | undefined {\n if (!curve || typeof curve !== 'object') {\n return undefined\n }\n\n const id = (curve as { id?: unknown }).id\n\n if (typeof id === 'string') {\n return id\n }\n\n if (id && typeof (id as { getString?: () => string }).getString === 'function') {\n return (id as { getString: () => string }).getString()\n }\n\n return undefined\n}\n","import { CubismWebGLOffscreenManager } from '@cubism/rendering/cubismoffscreenmanager'\nimport type { CubismRenderer_WebGL } from '@cubism/rendering/cubismrenderer_webgl'\n\ntype GLContext = WebGLRenderingContext | WebGL2RenderingContext\n\n/**\n * Structural view of a render target that borrows its GL objects from the shared offscreen pool.\n * The fields are `private`/`protected` in the framework, which is compile-time only.\n */\ntype PooledRenderTarget = {\n _webGLOffscreenManager: unknown\n _colorBuffer: WebGLTexture | null\n _renderTexture: WebGLFramebuffer | null\n stopUsingRenderTexture: () => void\n}\n\n/** Live internal models per GL context; the pool is context-wide, so it outlives any one model. */\nconst liveModelsPerContext = new Map<GLContext, number>()\n\nfunction asPooledRenderTarget(target: unknown): PooledRenderTarget | undefined {\n const candidate = target as PooledRenderTarget | null | undefined\n\n return candidate?._webGLOffscreenManager != null ? candidate : undefined\n}\n\n/**\n * Returns a model's borrowed offscreen buffers to the pool before the framework releases them.\n *\n * `CubismRenderer_WebGL.release()` calls `destroyRenderTarget()` on every render target, deleting\n * GL objects the shared pool still owns — later models then get already-deleted containers.\n */\nexport function detachPooledRenderTargets(renderer: CubismRenderer_WebGL): void {\n const targetLists: readonly (readonly unknown[] | null | undefined)[] = [\n renderer._modelRenderTargets,\n renderer._drawableMasks,\n renderer._offscreenMasks,\n renderer._offscreenList,\n ]\n\n for (const targets of targetLists) {\n if (!targets) {\n continue\n }\n\n for (const target of targets) {\n const pooled = asPooledRenderTarget(target)\n\n // Non-borrowers own their FBOs; leave those for the framework to delete.\n if (!pooled) {\n continue\n }\n\n pooled.stopUsingRenderTexture()\n\n // Nulled so the framework's isValid()/destroyRenderTarget() guards skip the GL deletion.\n pooled._colorBuffer = null\n pooled._renderTexture = null\n }\n }\n}\n\n/** Registers a live internal model against `gl`, keeping the shared offscreen pool alive. */\nexport function retainOffscreenPool(gl: GLContext): void {\n liveModelsPerContext.set(gl, (liveModelsPerContext.get(gl) ?? 0) + 1)\n}\n\n/** Drops a live internal model; frees the pool's VRAM for `gl` once the last one is gone. */\nexport function releaseOffscreenPool(gl: GLContext): void {\n const count = liveModelsPerContext.get(gl)\n\n if (count === undefined) {\n return\n }\n\n if (count > 1) {\n liveModelsPerContext.set(gl, count - 1)\n return\n }\n\n liveModelsPerContext.delete(gl)\n CubismWebGLOffscreenManager.getInstance().removeContext(gl)\n}\n","export default \"/**\\n * Copyright(c) Live2D Inc. All rights reserved.\\n *\\n * Use of this source code is governed by the Live2D Open Software license\\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\\n */\\n\\n\\nvec4 OverlapRgba(vec3 color, vec3 colorSource, vec3 colorDestination, vec3 parameter)\\n{\\n vec3 rgb = color * parameter.x + colorSource * parameter.y + colorDestination * parameter.z;\\n float alpha = parameter.x + parameter.y + parameter.z;\\n return vec4(rgb, alpha);\\n}\\n\\n#if defined(ALPHA_BLEND_OVER)\\nvec4 AlphaBlend(vec3 color, vec4 colorSource, vec4 colorDestination)\\n{\\n vec3 parameter = vec3(colorSource.a * colorDestination.a, colorSource.a * (1.0 - colorDestination.a), colorDestination.a * (1.0 - colorSource.a));\\n return OverlapRgba(color, colorSource.rgb, colorDestination.rgb, parameter);\\n}\\n\\n#elif defined(ALPHA_BLEND_ATOP)\\nvec4 AlphaBlend(vec3 color, vec4 colorSource, vec4 colorDestination)\\n{\\n vec3 parameter = vec3(colorSource.a * colorDestination.a, 0, colorDestination.a * (1.0 - colorSource.a));\\n return OverlapRgba(color, colorSource.rgb, colorDestination.rgb, parameter);\\n}\\n\\n#elif defined(ALPHA_BLEND_OUT)\\nvec4 AlphaBlend(vec3 color, vec4 colorSource, vec4 colorDestination)\\n{\\n vec3 parameter = vec3(0.0, 0.0, colorDestination.a * (1.0 - colorSource.a));\\n return OverlapRgba(color, colorSource.rgb, colorDestination.rgb, parameter);\\n}\\n\\n#elif defined(ALPHA_BLEND_CONJOINTOVER)\\nvec4 AlphaBlend(vec3 color, vec4 colorSource, vec4 colorDestination)\\n{\\n vec3 parameter = vec3(min(colorSource.a, colorDestination.a), max(colorSource.a - colorDestination.a, 0.0), max(colorDestination.a - colorSource.a, 0.0));\\n return OverlapRgba(color, colorSource.rgb, colorDestination.rgb, parameter);\\n}\\n\\n#elif defined(ALPHA_BLEND_DISJOINTOVER)\\nvec4 AlphaBlend(vec3 color, vec4 colorSource, vec4 colorDestination)\\n{\\n vec3 parameter = vec3(max(colorSource.a + colorDestination.a - 1.0, 0.0), min(colorSource.a, 1.0 - colorDestination.a), min(colorDestination.a, 1.0 - colorSource.a));\\n return OverlapRgba(color, colorSource.rgb, colorDestination.rgb, parameter);\\n}\\n\\n#else\\n#error not supported alpha blend function\\n\\n#endif\\n\"","export default \"/**\\n * Copyright(c) Live2D Inc. All rights reserved.\\n *\\n * Use of this source code is governed by the Live2D Open Software license\\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\\n */\\n\\n\\n#if defined(COLOR_BLEND_NORMAL)\\nvec3 ColorBlend(vec3 colorSource, vec3 colorDestination)\\n{\\n return colorSource;\\n}\\n\\n#elif defined(COLOR_BLEND_ADDCOMPATIBLE)\\nvec3 ColorBlend(vec3 colorSource, vec3 colorDestination)\\n{\\n return vec3(0.0);\\n}\\n\\n#elif defined(COLOR_BLEND_MULTCOMPATIBLE)\\nvec3 ColorBlend(vec3 colorSource, vec3 colorDestination)\\n{\\n return vec3(0.0);\\n}\\n\\n#elif defined(COLOR_BLEND_ADD)\\nvec3 ColorBlend(vec3 colorSource, vec3 colorDestination)\\n{\\n return min(colorSource + colorDestination, 1.0);\\n}\\n\\n#elif defined(COLOR_BLEND_ADDGLOW)\\nvec3 ColorBlend(vec3 colorSource, vec3 colorDestination)\\n{\\n return colorSource + colorDestination;\\n}\\n\\n#elif defined(COLOR_BLEND_DARKEN)\\nvec3 ColorBlend(vec3 colorSource, vec3 colorDestination)\\n{\\n return min(colorSource, colorDestination);\\n}\\n\\n#elif defined(COLOR_BLEND_MULTIPLY)\\nvec3 ColorBlend(vec3 colorSource, vec3 colorDestination)\\n{\\n return colorSource * colorDestination;\\n}\\n\\n#elif defined(COLOR_BLEND_COLORBURN)\\nfloat ColorBurn(float colorSource, float colorDestination)\\n{\\n if (abs(colorDestination - 1.0) < 0.000001)\\n {\\n return 1.0;\\n }\\n else if (abs(colorSource) < 0.000001)\\n {\\n return 0.0;\\n }\\n\\n return 1.0 - min(1.0, (1.0 - colorDestination) / colorSource);\\n}\\n\\nvec3 ColorBlend(vec3 colorSource, vec3 colorDestination)\\n{\\n return vec3(\\n ColorBurn(colorSource.r, colorDestination.r),\\n ColorBurn(colorSource.g, colorDestination.g),\\n ColorBurn(colorSource.b, colorDestination.b)\\n );\\n}\\n\\n#elif defined(COLOR_BLEND_LINEARBURN)\\nvec3 ColorBlend(vec3 colorSource, vec3 colorDestination)\\n{\\n return max(vec3(0.0), colorSource + colorDestination - 1.0);\\n}\\n\\n#elif defined(COLOR_BLEND_LIGHTEN)\\nvec3 ColorBlend(vec3 colorSource, vec3 colorDestination)\\n{\\n return max(colorSource, colorDestination);\\n}\\n\\n#elif defined(COLOR_BLEND_SCREEN)\\nvec3 ColorBlend(vec3 colorSource, vec3 colorDestination)\\n{\\n return colorSource + colorDestination - colorSource * colorDestination;\\n}\\n\\n#elif defined(COLOR_BLEND_COLORDODGE)\\nfloat ColorDodge(float colorSource, float colorDestination)\\n{\\n if (colorDestination <= 0.0)\\n {\\n return 0.0;\\n }\\n else if (colorSource == 1.0)\\n {\\n return 1.0;\\n }\\n\\n return min(1.0, colorDestination / (1.0 - colorSource));\\n}\\n\\nvec3 ColorBlend(vec3 colorSource, vec3 colorDestination)\\n{\\n return vec3(\\n ColorDodge(colorSource.r, colorDestination.r),\\n ColorDodge(colorSource.g, colorDestination.g),\\n ColorDodge(colorSource.b, colorDestination.b)\\n );\\n}\\n\\n#elif defined(COLOR_BLEND_OVERLAY)\\nfloat Overlay(float colorSource, float colorDestination)\\n{\\n float mul = 2.0 * colorSource * colorDestination;\\n float scr = 1.0 - 2.0 * (1.0 - colorSource) * (1.0 - colorDestination) ;\\n return colorDestination < 0.5 ? mul : scr ;\\n}\\n\\nvec3 ColorBlend(vec3 colorSource, vec3 colorDestination)\\n{\\n return vec3(\\n Overlay(colorSource.r, colorDestination.r),\\n Overlay(colorSource.g, colorDestination.g),\\n Overlay(colorSource.b, colorDestination.b)\\n );\\n}\\n\\n#elif defined(COLOR_BLEND_SOFTLIGHT)\\nfloat SoftLight(float colorSource, float colorDestination)\\n{\\n float val1 = colorDestination - (1.0 - 2.0 * colorSource) * colorDestination * (1.0 - colorDestination);\\n float val2 = colorDestination + (2.0 * colorSource - 1.0) * colorDestination * ((16.0 * colorDestination - 12.0) * colorDestination + 3.0);\\n float val3 = colorDestination + (2.0 * colorSource - 1.0) * (sqrt(colorDestination) - colorDestination);\\n\\n if (colorSource <= 0.5)\\n {\\n return val1;\\n }\\n else if (colorDestination <= 0.25)\\n {\\n return val2;\\n }\\n\\n return val3;\\n}\\n\\nvec3 ColorBlend(vec3 colorSource, vec3 colorDestination)\\n{\\n return vec3(\\n SoftLight(colorSource.r, colorDestination.r),\\n SoftLight(colorSource.g, colorDestination.g),\\n SoftLight(colorSource.b, colorDestination.b)\\n );\\n}\\n\\n#elif defined(COLOR_BLEND_HARDLIGHT)\\nfloat HardLight(float colorSource, float colorDestination)\\n{\\n float mul = 2.0 * colorSource * colorDestination;\\n float scr = 1.0 - 2.0 * (1.0 - colorSource) * (1.0 - colorDestination);\\n\\n if (colorSource < 0.5)\\n {\\n return mul;\\n }\\n\\n return scr;\\n}\\n\\nvec3 ColorBlend(vec3 colorSource, vec3 colorDestination)\\n{\\n return vec3(\\n HardLight(colorSource.r, colorDestination.r),\\n HardLight(colorSource.g, colorDestination.g),\\n HardLight(colorSource.b, colorDestination.b)\\n );\\n}\\n\\n#elif defined(COLOR_BLEND_LINEARLIGHT)\\nfloat LinearLight(float colorSource, float colorDestination)\\n{\\n float burn = max(0.0, 2.0 * colorSource + colorDestination - 1.0);\\n float dodge = min(1.0, 2.0 * (colorSource - 0.5) + colorDestination);\\n\\n if (colorSource < 0.5)\\n {\\n return burn;\\n }\\n\\n return dodge;\\n}\\n\\nvec3 ColorBlend(vec3 colorSource, vec3 colorDestination)\\n{\\n return vec3(\\n LinearLight(colorSource.r, colorDestination.r),\\n LinearLight(colorSource.g, colorDestination.g),\\n LinearLight(colorSource.b, colorDestination.b)\\n );\\n}\\n\\n#elif defined(COLOR_BLEND_HUE) || defined(COLOR_BLEND_COLOR)\\nconst float rCoeff = 0.30;\\nconst float gCoeff = 0.59;\\nconst float bCoeff = 0.11;\\n\\nfloat GetMax(vec3 rgbC)\\n{\\n return max(rgbC.r, max(rgbC.g, rgbC.b));\\n}\\n\\nfloat GetMin(vec3 rgbC)\\n{\\n return min(rgbC.r, min(rgbC.g, rgbC.b));\\n}\\n\\nfloat GetRange(vec3 rgbC)\\n{\\n return max(rgbC.r, max(rgbC.g, rgbC.b)) - min(rgbC.r, min(rgbC.g, rgbC.b));\\n}\\n\\nfloat Saturation(vec3 rgbC)\\n{\\n return GetRange(rgbC);\\n}\\n\\nfloat Luma(vec3 rgbC)\\n{\\n return rCoeff * rgbC.r + gCoeff * rgbC.g + bCoeff * rgbC.b;\\n}\\n\\nvec3 ClipColor(vec3 rgbC)\\n{\\n float luma = Luma(rgbC);\\n float maxv = GetMax(rgbC);\\n float minv = GetMin(rgbC);\\n vec3 outputColor = rgbC;\\n\\n outputColor = minv < 0.0 ? luma + (outputColor - luma) * luma / (luma - minv) : outputColor;\\n outputColor = maxv > 1.0 ? luma + (outputColor - luma) * (1.0 - luma) / (maxv - luma) : outputColor;\\n\\n return outputColor;\\n}\\n\\nvec3 SetLuma(vec3 rgbC, float luma)\\n{\\n return ClipColor(rgbC + (luma - Luma(rgbC)));\\n}\\n\\nvec3 SetSaturation(vec3 rgbC, float saturation)\\n{\\n float maxv = GetMax(rgbC);\\n float minv = GetMin(rgbC);\\n float medv = rgbC.r + rgbC.g + rgbC.b - maxv - minv;\\n float outputMax, outputMed, outputMin;\\n\\n outputMax = minv < maxv ? saturation : 0.0;\\n outputMed = minv < maxv ? (medv - minv) * saturation / (maxv - minv) : 0.0;\\n outputMin = 0.0;\\n\\n if(rgbC.r == maxv)\\n {\\n return rgbC.b < rgbC.g ? vec3(outputMax, outputMed, outputMin) : vec3(outputMax, outputMin, outputMed);\\n }\\n else if(rgbC.g == maxv)\\n {\\n return rgbC.r < rgbC.b ? vec3(outputMin, outputMax, outputMed) : vec3(outputMed, outputMax, outputMin);\\n }\\n else // if(rgbC.b == maxv)\\n {\\n return rgbC.g < rgbC.r ? vec3(outputMed, outputMin, outputMax) : vec3(outputMin, outputMed, outputMax);\\n }\\n}\\n\\n#if defined(COLOR_BLEND_HUE)\\nvec3 ColorBlend(vec3 colorSource, vec3 colorDestination)\\n{\\n return SetLuma(SetSaturation(colorSource, Saturation(colorDestination)), Luma(colorDestination));\\n}\\n\\n#else\\nvec3 ColorBlend(vec3 colorSource, vec3 colorDestination)\\n{\\n return SetLuma(colorSource, Luma(colorDestination)) ;\\n}\\n\\n#endif\\n\\n#else\\n#error not supported color blend function.\\n\\n#endif\\n\"","export default \"/**\\n * Copyright(c) Live2D Inc. All rights reserved.\\n *\\n * Use of this source code is governed by the Live2D Open Software license\\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\\n */\\n\\n\\nprecision mediump float;\\n\\nvarying vec2 v_texCoord;\\nuniform vec4 u_baseColor;\\nuniform sampler2D s_texture0;\\n\\nvoid main()\\n{\\n gl_FragColor = texture2D(s_texture0, v_texCoord) * u_baseColor;\\n}\\n\"","export default \"/**\\n * Copyright(c) Live2D Inc. All rights reserved.\\n *\\n * Use of this source code is governed by the Live2D Open Software license\\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\\n */\\n\\n\\nprecision mediump float;\\nvarying vec2 v_texCoord; //v2f.texcoord\\nvarying vec4 v_clipPos;\\nuniform sampler2D s_texture0; //_MainTex\\nuniform sampler2D s_texture1; // _ClippingMaskTex\\nuniform vec4 u_channelFlag;\\nuniform vec4 u_baseColor; //v2f.color\\nuniform vec4 u_multiplyColor;\\nuniform vec4 u_screenColor;\\n\\nvoid main()\\n{\\n vec4 texColor = texture2D(s_texture0, v_texCoord);\\n texColor.rgb = texColor.rgb * u_multiplyColor.rgb;\\n texColor.rgb = (texColor.rgb + u_screenColor.rgb * texColor.a) - (texColor.rgb * u_screenColor.rgb);\\n vec4 col_formask = texColor * u_baseColor;\\n vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag;\\n float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a;\\n col_formask = col_formask * (1.0 - maskVal);\\n gl_FragColor = col_formask;\\n}\\n\"","export default \"/**\\n * Copyright(c) Live2D Inc. All rights reserved.\\n *\\n * Use of this source code is governed by the Live2D Open Software license\\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\\n */\\n\\n\\nprecision mediump float;\\nvarying vec2 v_texCoord; //v2f.texcoord\\nvarying vec4 v_clipPos;\\nuniform vec4 u_baseColor; //v2f.color\\nuniform vec4 u_channelFlag;\\nuniform sampler2D s_texture0; //_MainTex\\nuniform sampler2D s_texture1; // _ClippingMaskTex\\nuniform vec4 u_multiplyColor;\\nuniform vec4 u_screenColor;\\n\\nvoid main()\\n{\\n vec4 texColor = texture2D(s_texture0, v_texCoord);\\n texColor.rgb = texColor.rgb * u_multiplyColor.rgb;\\n texColor.rgb = (texColor.rgb + u_screenColor.rgb * texColor.a) - (texColor.rgb * u_screenColor.rgb);\\n vec4 col_formask = texColor * u_baseColor;\\n vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag;\\n float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a;\\n col_formask = col_formask * maskVal;\\n gl_FragColor = col_formask;\\n}\\n\"","export default \"/**\\n * Copyright(c) Live2D Inc. All rights reserved.\\n *\\n * Use of this source code is governed by the Live2D Open Software license\\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\\n */\\n\\n\\nprecision mediump float;\\nvarying vec2 v_texCoord; //v2f.texcoord\\nuniform vec4 u_baseColor; //v2f.color\\nuniform sampler2D s_texture0; //_MainTex\\nuniform vec4 u_multiplyColor;\\nuniform vec4 u_screenColor;\\n\\nvoid main()\\n{\\n vec4 texColor = texture2D(s_texture0, v_texCoord);\\n texColor.rgb = texColor.rgb * u_multiplyColor.rgb;\\n texColor.rgb = (texColor.rgb + u_screenColor.rgb * texColor.a) - (texColor.rgb * u_screenColor.rgb);\\n vec4 color = texColor * u_baseColor;\\n gl_FragColor = vec4(color.rgb, color.a);\\n}\\n\"","export default \"/**\\n * Copyright(c) Live2D Inc. All rights reserved.\\n *\\n * Use of this source code is governed by the Live2D Open Software license\\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\\n */\\n\\n\\nvarying vec2 v_texCoord; //v2f.texcoord\\nvarying vec2 v_blendCoord;\\nvarying vec4 v_clipPos;\\nuniform sampler2D s_texture0; //_MainTex\\nuniform sampler2D s_blendTexture;\\nuniform vec4 u_baseColor; //v2f.color\\nuniform vec4 u_multiplyColor;\\nuniform vec4 u_screenColor;\\nuniform sampler2D s_texture1; // _ClippingMaskTex\\nuniform float u_invertClippingMask;\\nuniform vec4 u_channelFlag;\\n\\nvec3 ColorBlend(vec3 colorSource, vec3 colorDestination);\\nvec4 AlphaBlend(vec3 C, vec3 Cs, float As, vec3 Cd, float Ad);\\n\\nvoid main()\\n{\\n vec4 renderTextureColor = texture2D(s_blendTexture, v_blendCoord);\\n vec3 colorDestination = renderTextureColor.rgb;\\n float alphaDestination = renderTextureColor.a;\\n\\n if (alphaDestination < 0.00001)\\n {\\n colorDestination = vec3(0.0, 0.0, 0.0);\\n }\\n else {\\n colorDestination /= alphaDestination;\\n }\\n\\n vec4 texColor = texture2D(s_texture0, v_texCoord);\\n texColor.rgb *= u_multiplyColor.rgb;\\n texColor.rgb = (texColor.rgb + u_screenColor.rgb) - (texColor.rgb * u_screenColor.rgb);\\n\\n texColor *= u_baseColor;\\n vec3 colorSource = texColor.rgb;\\n float alphaSource = texColor.a;\\n\\n if (alphaSource < 0.00001)\\n {\\n colorSource = vec3(0.0, 0.0, 0.0);\\n }\\n else {\\n colorSource /= alphaSource;\\n }\\n\\n#ifdef CLIPPING_MASK\\n float maskVal = 1.0;\\n vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag;\\n maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a;\\n maskVal = abs(u_invertClippingMask - maskVal);\\n\\n alphaSource *= maskVal;\\n#endif\\n\\n vec4 source = vec4(colorSource.r, colorSource.g, colorSource.b, alphaSource);\\n vec4 destination = vec4(colorDestination.r, colorDestination.g, colorDestination.b, alphaDestination);\\n\\n gl_FragColor = AlphaBlend(ColorBlend(colorSource, colorDestination), source, destination);\\n}\\n\"","export default \"/**\\n * Copyright(c) Live2D Inc. All rights reserved.\\n *\\n * Use of this source code is governed by the Live2D Open Software license\\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\\n */\\n\\n\\nprecision mediump float;\\nvarying vec2 v_texCoord; //v2f.texcoord\\nvarying vec4 v_myPos;\\nuniform vec4 u_baseColor; //v2f.color\\nuniform vec4 u_channelFlag;\\nuniform sampler2D s_texture0; //_MainTex\\n\\n\\nvoid main()\\n{\\n float isInside =\\n step(u_baseColor.x, v_myPos.x/v_myPos.w)\\n * step(u_baseColor.y, v_myPos.y/v_myPos.w)\\n * step(v_myPos.x/v_myPos.w, u_baseColor.z)\\n * step(v_myPos.y/v_myPos.w, u_baseColor.w);\\n gl_FragColor = u_channelFlag * texture2D(s_texture0, v_texCoord).a * isInside;\\n}\\n\"","export default \"/**\\n * Copyright(c) Live2D Inc. All rights reserved.\\n *\\n * Use of this source code is governed by the Live2D Open Software license\\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\\n */\\n\\n\\nattribute vec4 a_position;\\nattribute vec2 a_texCoord;\\nvarying vec2 v_texCoord;\\nuniform mat4 u_matrix;\\n\\nvoid main()\\n{\\n gl_Position = u_matrix * a_position;\\n v_texCoord = a_texCoord;\\n v_texCoord.y = 1.0 - v_texCoord.y;\\n}\\n\"","export default \"/**\\n * Copyright(c) Live2D Inc. All rights reserved.\\n *\\n * Use of this source code is governed by the Live2D Open Software license\\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\\n */\\n\\n\\nattribute vec4 a_position;\\nattribute vec2 a_texCoord;\\nvarying vec2 v_texCoord;\\nvarying vec2 v_blendCoord;\\nvarying vec4 v_clipPos;\\nuniform mat4 u_matrix;\\nuniform mat4 u_clipMatrix;\\n\\nvoid main()\\n{\\n gl_Position = u_matrix * a_position;\\n\\n#ifdef CLIPPING_MASK\\n v_clipPos = u_clipMatrix * a_position;\\n#else\\n v_clipPos = vec4(0.0);\\n#endif\\n\\n v_texCoord = a_texCoord;\\n v_texCoord.y = 1.0 - v_texCoord.y;\\n vec2 ndcPos = gl_Position.xy / gl_Position.w;\\n v_blendCoord = ndcPos * 0.5 + 0.5;\\n}\\n\"","export default \"/**\\n * Copyright(c) Live2D Inc. All rights reserved.\\n *\\n * Use of this source code is governed by the Live2D Open Software license\\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\\n */\\n\\n\\nattribute vec4 a_position;\\nattribute vec2 a_texCoord;\\nvarying vec2 v_texCoord;\\n\\nvoid main()\\n{\\n v_texCoord = a_texCoord;\\n gl_Position = a_position;\\n}\\n\"","export default \"/**\\n * Copyright(c) Live2D Inc. All rights reserved.\\n *\\n * Use of this source code is governed by the Live2D Open Software license\\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\\n */\\n\\n\\nattribute vec4 a_position;\\nattribute vec2 a_texCoord;\\nvarying vec2 v_texCoord;\\nvarying vec4 v_clipPos;\\nuniform mat4 u_matrix;\\nuniform mat4 u_clipMatrix;\\n\\nvoid main()\\n{\\n gl_Position = u_matrix * a_position;\\n v_clipPos = u_clipMatrix * a_position;\\n v_texCoord = a_texCoord;\\n v_texCoord.y = 1.0 - v_texCoord.y;\\n}\\n\"","export default \"/**\\n * Copyright(c) Live2D Inc. All rights reserved.\\n *\\n * Use of this source code is governed by the Live2D Open Software license\\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\\n */\\n\\n\\nattribute vec4 a_position;\\nattribute vec2 a_texCoord;\\nvarying vec2 v_texCoord;\\nvarying vec4 v_myPos;\\nuniform mat4 u_clipMatrix;\\n\\nvoid main()\\n{\\n gl_Position = u_clipMatrix * a_position;\\n v_myPos = u_clipMatrix * a_position;\\n v_texCoord = a_texCoord;\\n v_texCoord.y = 1.0 - v_texCoord.y;\\n}\\n\"","import type { CubismShader_WebGL } from '@cubism/rendering/cubismshader_webgl'\nimport { CubismShaderManager_WebGL, CubismShaderSet } from '@cubism/rendering/cubismshader_webgl'\n\n// R5 moved every shader out of CubismShader_WebGL into loose .vert/.frag files that the\n// framework `fetch()`es from a page-relative directory. A bundled engine has no such\n// directory, so inline the sources and register them ourselves instead — same shader\n// programs the framework would build, minus the network round-trip and the 404s.\nimport fragShaderSrcAlphaBlend from '../../vendor/cubism/Shaders/WebGL/fragshadersrcalphablend.frag?raw'\nimport fragShaderSrcColorBlend from '../../vendor/cubism/Shaders/WebGL/fragshadersrccolorblend.frag?raw'\nimport fragShaderSrcCopy from '../../vendor/cubism/Shaders/WebGL/fragshadersrccopy.frag?raw'\nimport fragShaderSrcMaskInvertedPremultipliedAlpha from '../../vendor/cubism/Shaders/WebGL/fragshadersrcmaskinvertedpremultipliedalpha.frag?raw'\nimport fragShaderSrcMaskPremultipliedAlpha from '../../vendor/cubism/Shaders/WebGL/fragshadersrcmaskpremultipliedalpha.frag?raw'\nimport fragShaderSrcPremultipliedAlpha from '../../vendor/cubism/Shaders/WebGL/fragshadersrcpremultipliedalpha.frag?raw'\nimport fragShaderSrcBlend from '../../vendor/cubism/Shaders/WebGL/fragshadersrcpremultipliedalphablend.frag?raw'\nimport fragShaderSrcSetupMask from '../../vendor/cubism/Shaders/WebGL/fragshadersrcsetupmask.frag?raw'\nimport vertShaderSrc from '../../vendor/cubism/Shaders/WebGL/vertshadersrc.vert?raw'\nimport vertShaderSrcBlend from '../../vendor/cubism/Shaders/WebGL/vertshadersrcblend.vert?raw'\nimport vertShaderSrcCopy from '../../vendor/cubism/Shaders/WebGL/vertshadersrccopy.vert?raw'\nimport vertShaderSrcMasked from '../../vendor/cubism/Shaders/WebGL/vertshadersrcmasked.vert?raw'\nimport vertShaderSrcSetupMask from '../../vendor/cubism/Shaders/WebGL/vertshadersrcsetupmask.vert?raw'\n\n/**\n * Compiles the framework's shader programs from inlined sources for the given context.\n *\n * Idempotent per GL context; the context must already be registered with the shader manager\n * (`CubismRenderer_WebGL.startUp` does that).\n */\nexport function installCubismShaderSources(gl: WebGLRenderingContext): void {\n const shader: CubismShader_WebGL | undefined = CubismShaderManager_WebGL.getInstance().getShader(gl)\n\n if (!shader || shader._isShaderLoaded) {\n return\n }\n\n shader._vertShaderSrc = vertShaderSrc\n shader._vertShaderSrcMasked = vertShaderSrcMasked\n shader._vertShaderSrcSetupMask = vertShaderSrcSetupMask\n shader._fragShaderSrcSetupMask = fragShaderSrcSetupMask\n shader._fragShaderSrcPremultipliedAlpha = fragShaderSrcPremultipliedAlpha\n shader._fragShaderSrcMaskPremultipliedAlpha = fragShaderSrcMaskPremultipliedAlpha\n shader._fragShaderSrcMaskInvertedPremultipliedAlpha = fragShaderSrcMaskInvertedPremultipliedAlpha\n shader._vertShaderSrcCopy = vertShaderSrcCopy\n shader._fragShaderSrcCopy = fragShaderSrcCopy\n shader._fragShaderSrcColorBlend = fragShaderSrcColorBlend\n shader._fragShaderSrcAlphaBlend = fragShaderSrcAlphaBlend\n shader._vertShaderSrcBlend = vertShaderSrcBlend\n shader._fragShaderSrcBlend = fragShaderSrcBlend\n\n shader._shaderSets.length = shader._shaderCount\n\n for (let i = 0; i < shader._shaderCount; i++) {\n shader._shaderSets[i] = new CubismShaderSet()\n }\n\n shader.registerShader()\n shader.registerBlendShader()\n\n shader._isShaderLoading = false\n shader._isShaderLoaded = true\n}\n","import { CubismDefaultParameterId } from '@cubism/cubismdefaultparameterid'\nimport { BreathParameterData, CubismBreath } from '@cubism/effect/cubismbreath'\nimport { CubismEyeBlink } from '@cubism/effect/cubismeyeblink'\nimport type { CubismPose } from '@cubism/effect/cubismpose'\nimport type { CubismIdHandle } from '@cubism/id/cubismid'\nimport type { CubismIdManager } from '@cubism/id/cubismidmanager'\nimport { CubismFramework } from '@cubism/live2dcubismframework'\nimport { CubismMatrix44 } from '@cubism/math/cubismmatrix44'\nimport type { CubismModel } from '@cubism/model/cubismmodel'\nimport type { CubismPhysics } from '@cubism/physics/cubismphysics'\nimport { CubismRenderer_WebGL } from '@cubism/rendering/cubismrenderer_webgl'\nimport { Matrix } from 'pixi.js'\n\nimport type { CubismModelSettings } from '@/cubism/CubismModelSettings'\nimport type { InternalModelOptions } from '@/cubism-common'\nimport type { CommonHitArea, CommonLayout } from '@/cubism-common/InternalModel'\nimport type { Mutable } from '@/types/helpers'\n\nimport { CubismMotionManager } from '@/cubism/CubismMotionManager'\nimport { CubismParallelMotionManager } from '@/cubism/CubismParallelMotionManager'\nimport { detachPooledRenderTargets, releaseOffscreenPool, retainOffscreenPool } from '@/cubism/offscreen-pool'\nimport { installCubismShaderSources } from '@/cubism/shaders'\nimport { InternalModel, normalizeHitAreaDefs } from '@/cubism-common/InternalModel'\nimport { setupCubismLayoutMatrix } from '@/cubism-common/layout'\nimport { clamp } from '@/utils'\n\nconst tempMatrix = new CubismMatrix44()\nconst DEFAULT_MASKS_PER_RENDER_TEXTURE = 36\nconst MASKS_PER_RENDER_TEXTURE = 32\nconst HIGH_PRECISION_MASK_UNIQUE_MASK_SET_THRESHOLD = 16\nconst HIGH_PRECISION_MASK_MASKED_DRAWABLE_THRESHOLD = 64\nconst HIGH_PRECISION_MASK_MAX_MASKS_PER_DRAWABLE_THRESHOLD = 3\nconst HIGH_PRECISION_MASK_MASKED_VERTEX_THRESHOLD = 4096\nconst HIGH_PRECISION_MASK_VERTEX_RATIO_THRESHOLD = 0.5\nconst HIGH_PRECISION_MASK_VERTEX_RATIO_DRAWABLE_THRESHOLD = 24\n\n// `draw()` below is the only writer of the cull-face mode in the whole pipeline (Pixi\n// toggles CULL_FACE and frontFace but never the mode), so the value is shadowed rather\n// than read back: `getParameter(CULL_FACE_MODE)` is one of the pnames Chromium does not\n// cache client-side, and each call is a synchronous round trip to the GPU process —\n// ~0.3-1 ms *per model per frame*, which is most of the frame budget once a scene holds\n// more than a couple of models.\nconst cullFaceModes = new WeakMap<WebGLRenderingContext, GLenum>()\n\nfunction getCullFaceMode(gl: WebGLRenderingContext): GLenum {\n return cullFaceModes.get(gl) ?? gl.BACK // GL's initial value\n}\n\nfunction setCullFaceMode(gl: WebGLRenderingContext, mode: GLenum): void {\n if (getCullFaceMode(gl) === mode) {\n return\n }\n\n gl.cullFace(mode)\n cullFaceModes.set(gl, mode)\n}\n\ntype MaskProfile = {\n maskedDrawableCount: number\n uniqueMaskSetCount: number\n maxMasksPerDrawable: number\n maskedVertexCount: number\n totalVertexCount: number\n}\n\nconst layoutKeyMap: Record<string, keyof CommonLayout> = {\n CenterX: 'centerX',\n centerX: 'centerX',\n center_x: 'centerX',\n CenterY: 'centerY',\n centerY: 'centerY',\n center_y: 'centerY',\n X: 'x',\n x: 'x',\n Y: 'y',\n y: 'y',\n Width: 'width',\n width: 'width',\n Height: 'height',\n height: 'height',\n Top: 'top',\n top: 'top',\n Bottom: 'bottom',\n bottom: 'bottom',\n Left: 'left',\n left: 'left',\n Right: 'right',\n right: 'right',\n}\n\nfunction getRequiredMaskRenderTextureCount(model: CubismModel): number {\n if (!model.isUsingMasking()) {\n return 1\n }\n\n const maskCounts = model.getDrawableMaskCounts()\n const masks = model.getDrawableMasks()\n const uniqueMaskSets = new Set<string>()\n\n for (let i = 0; i < model.getDrawableCount(); i++) {\n const maskCount = maskCounts[i]\n\n if (!maskCount || maskCount <= 0) {\n continue\n }\n\n const maskSet = Array.from(masks[i] ?? [])\n .slice(0, maskCount)\n .sort((a, b) => a - b)\n .join(',')\n\n uniqueMaskSets.add(maskSet)\n }\n\n const clippingContextCount = uniqueMaskSets.size\n\n if (clippingContextCount <= DEFAULT_MASKS_PER_RENDER_TEXTURE) {\n return 1\n }\n\n return Math.ceil(clippingContextCount / MASKS_PER_RENDER_TEXTURE)\n}\n\nfunction getMaskProfile(model: CubismModel): MaskProfile {\n const maskCounts = model.getDrawableMaskCounts()\n const masks = model.getDrawableMasks()\n const uniqueMaskSets = new Set<string>()\n const drawableCount = model.getDrawableCount()\n\n let maskedDrawableCount = 0\n let maxMasksPerDrawable = 0\n let maskedVertexCount = 0\n let totalVertexCount = 0\n\n for (let i = 0; i < drawableCount; i++) {\n const vertexCount = model.getDrawableVertexCount(i)\n const maskCount = maskCounts[i] ?? 0\n\n totalVertexCount += vertexCount\n\n if (maskCount <= 0) {\n continue\n }\n\n maskedDrawableCount++\n maskedVertexCount += vertexCount\n maxMasksPerDrawable = Math.max(maxMasksPerDrawable, maskCount)\n\n const maskSet = Array.from(masks[i] ?? [])\n .slice(0, maskCount)\n .sort((a, b) => a - b)\n .join(',')\n\n uniqueMaskSets.add(maskSet)\n }\n\n return {\n maskedDrawableCount,\n uniqueMaskSetCount: uniqueMaskSets.size,\n maxMasksPerDrawable,\n maskedVertexCount,\n totalVertexCount,\n }\n}\n\nfunction shouldUseHighPrecisionMask(model: CubismModel): boolean {\n if (!model.isUsingMasking()) {\n return false\n }\n\n const profile = getMaskProfile(model)\n const maskedVertexRatio = profile.totalVertexCount > 0 ? profile.maskedVertexCount / profile.totalVertexCount : 0\n\n return (\n profile.uniqueMaskSetCount > HIGH_PRECISION_MASK_UNIQUE_MASK_SET_THRESHOLD ||\n profile.maskedDrawableCount > HIGH_PRECISION_MASK_MASKED_DRAWABLE_THRESHOLD ||\n profile.maxMasksPerDrawable >= HIGH_PRECISION_MASK_MAX_MASKS_PER_DRAWABLE_THRESHOLD ||\n profile.maskedVertexCount > HIGH_PRECISION_MASK_MASKED_VERTEX_THRESHOLD ||\n (maskedVertexRatio >= HIGH_PRECISION_MASK_VERTEX_RATIO_THRESHOLD &&\n profile.maskedDrawableCount > HIGH_PRECISION_MASK_VERTEX_RATIO_DRAWABLE_THRESHOLD)\n )\n}\n\nfunction resolveHighPrecisionMaskOption(\n model: CubismModel,\n option: InternalModelOptions['useHighPrecisionMask']\n): boolean {\n if (typeof option === 'boolean') {\n return option\n }\n\n return shouldUseHighPrecisionMask(model)\n}\n\n// noinspection JSUnusedGlobalSymbols\nexport class CubismInternalModel extends InternalModel {\n settings: CubismModelSettings\n options: InternalModelOptions\n coreModel: CubismModel\n motionManager: CubismMotionManager\n parallelMotionManager: CubismParallelMotionManager[]\n\n lipSync = true\n\n breath = CubismBreath.create()\n eyeBlink?: CubismEyeBlink\n\n declare pose?: CubismPose\n declare physics?: CubismPhysics\n\n // Render-target size is unknown until the first draw; setRenderState() keeps it in sync.\n renderer = new CubismRenderer_WebGL(0, 0)\n\n private readonly idManager: CubismIdManager\n\n /** Context the renderer was last started up against; also the offscreen-pool refcount key. */\n private renderContext?: WebGLRenderingContext | WebGL2RenderingContext\n\n idParamAngleX: CubismIdHandle\n idParamAngleY: CubismIdHandle\n idParamAngleZ: CubismIdHandle\n idParamEyeBallX: CubismIdHandle\n idParamEyeBallY: CubismIdHandle\n idParamBodyAngleX: CubismIdHandle\n idParamBreath: CubismIdHandle\n idParamMouthForm: CubismIdHandle\n\n /**\n * The model's internal scale, defined in the moc3 file.\n */\n readonly pixelsPerUnit: number = 1\n\n /**\n * Matrix that scales by {@link pixelsPerUnit}, and moves the origin from top-left to center.\n */\n protected modelTransform = new Matrix()\n\n constructor(coreModel: CubismModel, settings: CubismModelSettings, options?: InternalModelOptions) {\n super()\n\n this.coreModel = coreModel\n this.settings = settings\n this.options = Object.assign({}, { breathDepth: 1, lipSyncGain: 1.5, lipSyncWeight: 0.4 }, options)\n this.idManager = CubismFramework.getIdManager()\n\n this.idParamAngleX = this.getIdSafe(CubismDefaultParameterId.ParamAngleX)\n this.idParamAngleY = this.getIdSafe(CubismDefaultParameterId.ParamAngleY)\n this.idParamAngleZ = this.getIdSafe(CubismDefaultParameterId.ParamAngleZ)\n this.idParamEyeBallX = this.getIdSafe(CubismDefaultParameterId.ParamEyeBallX)\n this.idParamEyeBallY = this.getIdSafe(CubismDefaultParameterId.ParamEyeBallY)\n this.idParamBodyAngleX = this.getIdSafe(CubismDefaultParameterId.ParamBodyAngleX)\n this.idParamBreath = this.getIdSafe(CubismDefaultParameterId.ParamBreath)\n this.idParamMouthForm = this.getIdSafe(CubismDefaultParameterId.ParamMouthForm)\n this.motionManager = new CubismMotionManager(this)\n this.parallelMotionManager = []\n\n this.init()\n }\n\n protected init() {\n super.init()\n\n const eyeBlinkParameters = this.settings.getEyeBlinkParameters()\n\n if (this.options.eyeBlink !== false && eyeBlinkParameters.length) {\n const parameterIds: CubismIdHandle[] = eyeBlinkParameters.map(parameter => this.idManager.getId(parameter))\n\n const eyeBlink = CubismEyeBlink.create()\n eyeBlink.setParameterIds?.(parameterIds)\n this.eyeBlink = eyeBlink\n }\n\n this.breath.setParameters([\n new BreathParameterData(this.idParamAngleX, 0.0, 15.0 * this.options.breathDepth!, 6.5345, 0.5),\n new BreathParameterData(this.idParamAngleY, 0.0, 8.0 * this.options.breathDepth!, 3.5345, 0.5),\n new BreathParameterData(this.idParamAngleZ, 0.0, 10.0 * this.options.breathDepth!, 5.5345, 0.5),\n new BreathParameterData(this.idParamBodyAngleX, 0.0, 4.0 * this.options.breathDepth!, 15.5345, 0.5),\n new BreathParameterData(this.idParamBreath, 0.0, 0.5, 3.2345, 0.5),\n ])\n\n this.renderer.initialize(this.coreModel, getRequiredMaskRenderTextureCount(this.coreModel))\n // initialize() forces high-precision masks for blend-mode models; never downgrade that.\n this.renderer.useHighPrecisionMask(\n this.renderer.isUsingHighPrecisionMask() ||\n resolveHighPrecisionMaskOption(this.coreModel, this.options.useHighPrecisionMask)\n )\n this.renderer.setIsPremultipliedAlpha(true)\n }\n\n protected getIdSafe(id: string | undefined): CubismIdHandle {\n return this.idManager.getId(id ?? '')\n }\n\n protected getSize(): [number, number] {\n return [this.coreModel.getModel().canvasinfo.CanvasWidth, this.coreModel.getModel().canvasinfo.CanvasHeight]\n }\n\n protected getLayout(): CommonLayout {\n const layout: CommonLayout = {}\n\n const settingsLayout = this.settings.layout\n\n if (settingsLayout) {\n for (const [key, value] of Object.entries(settingsLayout)) {\n const commonKey = layoutKeyMap[key]\n\n if (commonKey && typeof value === 'number') {\n layout[commonKey] = value\n }\n }\n }\n\n return layout\n }\n\n protected setupLayout() {\n const self = this as Mutable<this>\n const size = this.getSize()\n\n self.originalWidth = size[0]\n self.originalHeight = size[1]\n self.pixelsPerUnit = this.coreModel.getModel().canvasinfo.PixelsPerUnit\n\n const bounds = setupCubismLayoutMatrix(\n this.localTransform,\n this.originalWidth,\n this.originalHeight,\n this.getLayout()\n )\n\n self.width = bounds.width\n self.height = bounds.height\n\n // move the origin from top left to center\n this.modelTransform\n .identity()\n .scale(this.pixelsPerUnit, this.pixelsPerUnit)\n .translate(this.originalWidth / 2, this.originalHeight / 2)\n }\n\n updateWebGLContext(gl: WebGLRenderingContext, _glContextID: number): void {\n if (!(gl instanceof WebGL2RenderingContext)) {\n throw new Error('[pixijs-live2d] Cubism 5.3 rendering requires WebGL2; got WebGL1 context')\n }\n\n if (this.renderContext !== gl) {\n if (this.renderContext) {\n releaseOffscreenPool(this.renderContext)\n }\n\n retainOffscreenPool(gl)\n this.renderContext = gl\n }\n\n // startUp() allocates the mask/offscreen render targets for this context, so it must\n // know the target size up front. setRenderState() refines it to the exact viewport.\n this.renderer.setRenderTargetSize(gl.drawingBufferWidth, gl.drawingBufferHeight)\n\n // startUp() leaves the default framebuffer bound; keep Pixi's binding intact.\n const framebuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING) as WebGLFramebuffer | null\n\n // CubismShader_WebGL.setupShaderProgram* lazily fills these and caches them on the\n // renderer, so they belong to the outgoing context — drop them before switching.\n this.renderer._bufferData = {\n vertex: null as unknown as WebGLBuffer,\n uv: null as unknown as WebGLBuffer,\n index: null as unknown as WebGLBuffer,\n }\n\n this.renderer.startUp(gl)\n installCubismShaderSources(gl)\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer)\n }\n\n bindTexture(index: number, texture: WebGLTexture): void {\n this.renderer.bindTexture(index, texture)\n }\n\n protected getHitAreaDefs(): CommonHitArea[] {\n const json = this.settings.json as unknown as Record<string, unknown>\n const hitAreas =\n (this.settings.hitAreas as { Id?: string; Name?: string }[] | undefined) ??\n json.HitAreas ??\n json.hitAreas ??\n json.hit_areas\n\n return normalizeHitAreaDefs(hitAreas, id => this.coreModel.getDrawableIndex(this.idManager.getId(id)))\n }\n\n getDrawableIDs(): string[] {\n const count = this.coreModel.getDrawableCount()\n const ids: string[] = []\n\n for (let i = 0; i < count; i++) {\n ids.push(this.coreModel.getDrawableId(i).getString())\n }\n\n return ids\n }\n\n getDrawableIndex(id: string): number {\n return this.coreModel.getDrawableIndex(this.idManager.getId(id))\n }\n\n getDrawableVertices(drawIndex: number | string): Float32Array {\n if (typeof drawIndex === 'string') {\n const id = drawIndex\n drawIndex = this.getDrawableIndex(id)\n\n if (drawIndex === -1) throw new TypeError(`Unable to find drawable ID: ${id}`)\n }\n\n const arr = this.coreModel.getDrawableVertices(drawIndex).slice()\n\n for (let i = 0; i < arr.length; i += 2) {\n arr[i] = arr[i]! * this.pixelsPerUnit + this.originalWidth / 2\n arr[i + 1] = -arr[i + 1]! * this.pixelsPerUnit + this.originalHeight / 2\n }\n\n return arr\n }\n\n updateTransform(transform: Matrix) {\n this.drawingMatrix.copyFrom(this.modelTransform).prepend(this.localTransform).prepend(transform)\n }\n\n public update(dt: DOMHighResTimeStamp, now: DOMHighResTimeStamp): void {\n super.update(dt, now)\n\n // Cubism motion timelines use seconds\n dt /= 1000\n now /= 1000\n\n const model = this.coreModel\n\n const motionUpdated = this.updateMotions(model, now)\n\n model.saveParameters()\n\n this.motionManager.expressionManager?.update(model, now)\n\n if (!motionUpdated) {\n this.eyeBlink?.updateParameters?.(model, dt)\n }\n\n this.updateFocus()\n\n // revert the timestamps to be milliseconds\n this.updateNaturalMovements(dt * 1000, now * 1000)\n\n if (this.lipSync && this.motionManager.currentAudio) {\n let value = this.motionManager.mouthSync() * this.options.lipSyncGain!\n value = value ** 1.15\n const min_ = value > 0 ? 0.1 : 0\n const max_ = 1\n value = clamp(value, min_, max_)\n this.motionManager.lipSyncIds.forEach(lipSyncId => {\n model.addParameterValueById(this.getIdSafe(lipSyncId), value, this.options.lipSyncWeight)\n })\n }\n\n this.physics?.evaluate(model, dt)\n this.pose?.updateParameters(model, dt)\n\n this.emit('beforeModelUpdate')\n\n model.update()\n model.loadParameters()\n }\n\n updateFocus() {\n this.coreModel.addParameterValueById(this.idParamEyeBallX, this.focusController.x) // -1 ~ 1\n this.coreModel.addParameterValueById(this.idParamEyeBallY, this.focusController.y)\n this.coreModel.addParameterValueById(this.idParamAngleX, this.focusController.x * 30) // -30 ~ 30\n this.coreModel.addParameterValueById(this.idParamAngleY, this.focusController.y * 30)\n this.coreModel.addParameterValueById(this.idParamAngleZ, this.focusController.x * this.focusController.y * -30)\n this.coreModel.addParameterValueById(this.idParamBodyAngleX, this.focusController.x * 10) // -10 ~ 10\n }\n\n updateFacialEmotion(mouthForm: number) {\n this.coreModel.addParameterValueById(this.idParamMouthForm, mouthForm) // -1 ~ 1\n }\n\n updateNaturalMovements(dt: DOMHighResTimeStamp, _now: DOMHighResTimeStamp) {\n this.breath?.updateParameters(this.coreModel, dt / 1000)\n }\n\n draw(gl: WebGLRenderingContext): void {\n const matrix = this.drawingMatrix\n const array = tempMatrix.getArray()\n\n // set given 3x3 matrix into a 4x4 matrix, with Y inverted\n array[0] = matrix.a\n array[1] = matrix.b\n array[4] = -matrix.c\n array[5] = -matrix.d\n array[12] = matrix.tx\n array[13] = matrix.ty\n\n this.renderer.setMvpMatrix(tempMatrix)\n this.renderer.setModelColor(1, 1, 1, this.alpha)\n const framebuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING) as WebGLFramebuffer\n const previousCullFaceMode = getCullFaceMode(gl)\n const determinant = array[0] * array[5] - array[1] * array[4]\n\n // Cubism always treats CCW triangles as front-facing. Keep the visible face consistent\n // when Pixi flips the projection for render textures, filters, or mirrored transforms.\n setCullFaceMode(gl, determinant < 0 ? gl.FRONT : gl.BACK)\n this.renderer.setRenderState(framebuffer, this.viewport)\n\n try {\n this.renderer.drawModel()\n } finally {\n setCullFaceMode(gl, previousCullFaceMode)\n // R5's offscreen/blend passes bind their own framebuffers; make sure Pixi's is back.\n gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer)\n }\n }\n\n extendParallelMotionManager(managerCount: number) {\n while (this.parallelMotionManager.length < managerCount) {\n this.parallelMotionManager.push(new CubismParallelMotionManager(this))\n }\n }\n\n destroy() {\n super.destroy()\n\n const gl = this.renderContext\n this.renderContext = undefined\n\n detachPooledRenderTargets(this.renderer)\n this.renderer.release()\n\n if (gl) {\n releaseOffscreenPool(gl)\n }\n\n this.coreModel.release()\n ;(this as Partial<this>).renderer = undefined\n ;(this as Partial<this>).coreModel = undefined\n }\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport { CubismIdHandle } from './id/cubismid';\n\n/**\n * モデル設定情報を取り扱う関数を宣言した純粋仮想クラス。\n *\n * このクラスを継承することで、モデル設定情報を取り扱うクラスになる。\n */\nexport abstract class ICubismModelSetting {\n /**\n * Mocファイルの名前を取得する\n * @return Mocファイルの名前\n */\n public abstract getModelFileName(): string;\n\n /**\n * モデルが使用するテクスチャの数を取得する\n * テクスチャの数\n */\n public abstract getTextureCount(): number;\n\n /**\n * テクスチャが配置されたディレクトリの名前を取得する\n * @return テクスチャが配置されたディレクトリの名前\n */\n public abstract getTextureDirectory(): string;\n\n /**\n * モデルが使用するテクスチャの名前を取得する\n * @param index 配列のインデックス値\n * @return テクスチャの名前\n */\n public abstract getTextureFileName(index: number): string;\n\n /**\n * モデルに設定された当たり判定の数を取得する\n * @return モデルに設定された当たり判定の数\n */\n public abstract getHitAreasCount(): number;\n\n /**\n * 当たり判定に設定されたIDを取得する\n *\n * @param index 配列のindex\n * @return 当たり判定に設定されたID\n */\n public abstract getHitAreaId(index: number): CubismIdHandle;\n\n /**\n * 当たり判定に設定された名前を取得する\n * @param index 配列のインデックス値\n * @return 当たり判定に設定された名前\n */\n public abstract getHitAreaName(index: number): string;\n\n /**\n * 物理演算設定ファイルの名前を取得する\n * @return 物理演算設定ファイルの名前\n */\n public abstract getPhysicsFileName(): string;\n\n /**\n * パーツ切り替え設定ファイルの名前を取得する\n * @return パーツ切り替え設定ファイルの名前\n */\n public abstract getPoseFileName(): string;\n\n /**\n * 表情設定ファイルの数を取得する\n * @return 表情設定ファイルの数\n */\n public abstract getExpressionCount(): number;\n\n /**\n * 表情設定ファイルを識別する名前(別名)を取得する\n * @param index 配列のインデックス値\n * @return 表情の名前\n */\n public abstract getExpressionName(index: number): string;\n\n /**\n * 表情設定ファイルの名前を取得する\n * @param index 配列のインデックス値\n * @return 表情設定ファイルの名前\n */\n public abstract getExpressionFileName(index: number): string;\n\n /**\n * モーショングループの数を取得する\n * @return モーショングループの数\n */\n public abstract getMotionGroupCount(): number;\n\n /**\n * モーショングループの名前を取得する\n * @param index 配列のインデックス値\n * @return モーショングループの名前\n */\n public abstract getMotionGroupName(index: number): string;\n\n /**\n * モーショングループに含まれるモーションの数を取得する\n * @param groupName モーショングループの名前\n * @return モーショングループの数\n */\n public abstract getMotionCount(groupName: string): number;\n\n /**\n * グループ名とインデックス値からモーションファイル名を取得する\n * @param groupName モーショングループの名前\n * @param index 配列のインデックス値\n * @return モーションファイルの名前\n */\n public abstract getMotionFileName(groupName: string, index: number): string;\n\n /**\n * モーションに対応するサウンドファイルの名前を取得する\n * @param groupName モーショングループの名前\n * @param index 配列のインデックス値\n * @return サウンドファイルの名前\n */\n public abstract getMotionSoundFileName(\n groupName: string,\n index: number\n ): string;\n\n /**\n * モーション開始時のフェードイン処理時間を取得する\n * @param groupName モーショングループの名前\n * @param index 配列のインデックス値\n * @return フェードイン処理時間[秒]\n */\n public abstract getMotionFadeInTimeValue(\n groupName: string,\n index: number\n ): number;\n\n /**\n * モーション終了時のフェードアウト処理時間を取得する\n * @param groupName モーショングループの名前\n * @param index 配列のインデックス値\n * @return フェードアウト処理時間[秒]\n */\n public abstract getMotionFadeOutTimeValue(\n groupName: string,\n index: number\n ): number;\n\n /**\n * ユーザーデータのファイル名を取得する\n * @return ユーザーデータのファイル名\n */\n public abstract getUserDataFile(): string;\n\n /**\n * レイアウト情報を取得する\n * @param outLayoutMap Mapクラスのインスタンス\n * @return true レイアウト情報が存在する\n * @return false レイアウト情報が存在しない\n */\n public abstract getLayoutMap(outLayoutMap: Map<string, number>): boolean;\n\n /**\n * 目パチに関連付けられたパラメータの数を取得する\n * @return 目パチに関連付けられたパラメータの数\n */\n public abstract getEyeBlinkParameterCount(): number;\n\n /**\n * 目パチに関連付けられたパラメータのIDを取得する\n * @param index 配列のインデックス値\n * @return パラメータID\n */\n public abstract getEyeBlinkParameterId(index: number): CubismIdHandle;\n\n /**\n * リップシンクに関連付けられたパラメータの数を取得する\n * @return リップシンクに関連付けられたパラメータの数\n */\n public abstract getLipSyncParameterCount(): number;\n\n /**\n * リップシンクに関連付けられたパラメータの数を取得する\n * @param index 配列のインデックス値\n * @return パラメータID\n */\n public abstract getLipSyncParameterId(index: number): CubismIdHandle;\n}\n\n// Namespace definition for compatibility.\nimport * as $ from './icubismmodelsetting';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const ICubismModelSetting = $.ICubismModelSetting;\n export type ICubismModelSetting = $.ICubismModelSetting;\n}\n","/**\n * Copyright(c) Live2D Inc. All rights reserved.\n *\n * Use of this source code is governed by the Live2D Open Software license\n * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.\n */\n\nimport { ICubismModelSetting } from './icubismmodelsetting';\nimport { CubismIdHandle } from './id/cubismid';\nimport { CubismFramework } from './live2dcubismframework';\nimport { CubismJson, Value } from './utils/cubismjson';\n\nexport enum FrequestNode {\n FrequestNode_Groups, // getRoot().getValueByString(Groups)\n FrequestNode_Moc, // getRoot().getValueByString(FileReferences).getValueByString(Moc)\n FrequestNode_Motions, // getRoot().getValueByString(FileReferences).getValueByString(Motions)\n FrequestNode_Expressions, // getRoot().getValueByString(FileReferences).getValueByString(Expressions)\n FrequestNode_Textures, // getRoot().getValueByString(FileReferences).getValueByString(Textures)\n FrequestNode_Physics, // getRoot().getValueByString(FileReferences).getValueByString(Physics)\n FrequestNode_Pose, // getRoot().getValueByString(FileReferences).getValueByString(Pose)\n FrequestNode_HitAreas // getRoot().getValueByString(HitAreas)\n}\n\n/**\n * Model3Jsonパーサー\n *\n * model3.jsonファイルをパースして値を取得する\n */\nexport class CubismModelSettingJson extends ICubismModelSetting {\n /**\n * 引数付きコンストラクタ\n *\n * @param buffer Model3Jsonをバイト配列として読み込んだデータバッファ\n * @param size Model3Jsonのデータサイズ\n */\n public constructor(buffer: ArrayBuffer, size: number) {\n super();\n this._json = CubismJson.create(buffer, size);\n\n if (this.getJson()) {\n this._jsonValue = [\n // 順番はenum FrequestNodeと一致させる\n this.getJson().getRoot().getValueByString(this.groups),\n this.getJson()\n .getRoot()\n .getValueByString(this.fileReferences)\n .getValueByString(this.moc),\n this.getJson()\n .getRoot()\n .getValueByString(this.fileReferences)\n .getValueByString(this.motions),\n this.getJson()\n .getRoot()\n .getValueByString(this.fileReferences)\n .getValueByString(this.expressions),\n this.getJson()\n .getRoot()\n .getValueByString(this.fileReferences)\n .getValueByString(this.textures),\n this.getJson()\n .getRoot()\n .getValueByString(this.fileReferences)\n .getValueByString(this.physics),\n this.getJson()\n .getRoot()\n .getValueByString(this.fileReferences)\n .getValueByString(this.pose),\n this.getJson().getRoot().getValueByString(this.hitAreas)\n ];\n }\n }\n\n /**\n * デストラクタ相当の処理\n */\n public release(): void {\n CubismJson.delete(this._json);\n\n this._jsonValue = null;\n }\n\n /**\n * CubismJsonオブジェクトを取得する\n *\n * @return CubismJson\n */\n public getJson(): CubismJson {\n return this._json;\n }\n\n /**\n * Mocファイルの名前を取得する\n * @return Mocファイルの名前\n */\n public getModelFileName(): string {\n if (!this.isExistModelFile()) {\n return '';\n }\n return this._jsonValue[FrequestNode.FrequestNode_Moc].getRawString();\n }\n\n /**\n * モデルが使用するテクスチャの数を取得する\n * テクスチャの数\n */\n public getTextureCount(): number {\n if (!this.isExistTextureFiles()) {\n return 0;\n }\n\n return this._jsonValue[FrequestNode.FrequestNode_Textures].getSize();\n }\n\n /**\n * テクスチャが配置されたディレクトリの名前を取得する\n * @return テクスチャが配置されたディレクトリの名前\n */\n public getTextureDirectory(): string {\n const texturePath = this._jsonValue[FrequestNode.FrequestNode_Textures]\n .getValueByIndex(0)\n .getRawString();\n\n const pathArray = texturePath.split('/');\n // 最後の要素はテクスチャ名なので不要\n const arrayLength = pathArray.length - 1;\n let textureDirectoryStr = '';\n\n // 分割したパスを結合\n for (let i = 0; i < arrayLength; i++) {\n textureDirectoryStr += pathArray[i];\n if (i < arrayLength - 1) {\n textureDirectoryStr += '/';\n }\n }\n\n return textureDirectoryStr;\n }\n\n /**\n * モデルが使用するテクスチャの名前を取得する\n * @param index 配列のインデックス値\n * @return テクスチャの名前\n */\n public getTextureFileName(index: number): string {\n return this._jsonValue[FrequestNode.FrequestNode_Textures]\n .getValueByIndex(index)\n .getRawString();\n }\n\n /**\n * モデルに設定された当たり判定の数を取得する\n * @return モデルに設定された当たり判定の数\n */\n public getHitAreasCount(): number {\n if (!this.isExistHitAreas()) {\n return 0;\n }\n\n return this._jsonValue[FrequestNode.FrequestNode_HitAreas].getSize();\n }\n\n /**\n * 当たり判定に設定されたIDを取得する\n *\n * @param index 配列のindex\n * @return 当たり判定に設定されたID\n */\n public getHitAreaId(index: number): CubismIdHandle {\n return CubismFramework.getIdManager().getId(\n this._jsonValue[FrequestNode.FrequestNode_HitAreas]\n .getValueByIndex(index)\n .getValueByString(this.id)\n .getRawString()\n );\n }\n\n /**\n * 当たり判定に設定された名前を取得する\n * @param index 配列のインデックス値\n * @return 当たり判定に設定された名前\n */\n public getHitAreaName(index: number): string {\n return this._jsonValue[FrequestNode.FrequestNode_HitAreas]\n .getValueByIndex(index)\n .getValueByString(this.name)\n .getRawString();\n }\n\n /**\n * 物理演算設定ファイルの名前を取得する\n * @return 物理演算設定ファイルの名前\n */\n public getPhysicsFileName(): string {\n if (!this.isExistPhysicsFile()) {\n return '';\n }\n\n return this._jsonValue[FrequestNode.FrequestNode_Physics].getRawString();\n }\n\n /**\n * パーツ切り替え設定ファイルの名前を取得する\n * @return パーツ切り替え設定ファイルの名前\n */\n public getPoseFileName(): string {\n if (!this.isExistPoseFile()) {\n return '';\n }\n\n return this._jsonValue[FrequestNode.FrequestNode_Pose].getRawString();\n }\n\n /**\n * 表情設定ファイルの数を取得する\n * @return 表情設定ファイルの数\n */\n public getExpressionCount(): number {\n if (!this.isExistExpressionFile()) {\n return 0;\n }\n\n return this._jsonValue[FrequestNode.FrequestNode_Expressions].getSize();\n }\n\n /**\n * 表情設定ファイルを識別する名前(別名)を取得する\n * @param index 配列のインデックス値\n * @return 表情の名前\n */\n public getExpressionName(index: number): string {\n return this._jsonValue[FrequestNode.FrequestNode_Expressions]\n .getValueByIndex(index)\n .getValueByString(this.name)\n .getRawString();\n }\n\n /**\n * 表情設定ファイルの名前を取得する\n * @param index 配列のインデックス値\n * @return 表情設定ファイルの名前\n */\n public getExpressionFileName(index: number): string {\n return this._jsonValue[FrequestNode.FrequestNode_Expressions]\n .getValueByIndex(index)\n .getValueByString(this.filePath)\n .getRawString();\n }\n\n /**\n * モーショングループの数を取得する\n * @return モーショングループの数\n */\n public getMotionGroupCount(): number {\n if (!this.isExistMotionGroups()) {\n return 0;\n }\n\n return this._jsonValue[FrequestNode.FrequestNode_Motions].getKeys().length;\n }\n\n /**\n * モーショングループの名前を取得する\n * @param index 配列のインデックス値\n * @return モーショングループの名前\n */\n public getMotionGroupName(index: number): string {\n if (!this.isExistMotionGroups()) {\n return null;\n }\n\n return this._jsonValue[FrequestNode.FrequestNode_Motions].getKeys()[index];\n }\n\n /**\n * モーショングループに含まれるモーションの数を取得する\n * @param groupName モーショングループの名前\n * @return モーショングループの数\n */\n public getMotionCount(groupName: string): number {\n if (!this.isExistMotionGroupName(groupName)) {\n return 0;\n }\n\n return this._jsonValue[FrequestNode.FrequestNode_Motions]\n .getValueByString(groupName)\n .getSize();\n }\n\n /**\n * グループ名とインデックス値からモーションファイル名を取得する\n * @param groupName モーショングループの名前\n * @param index 配列のインデックス値\n * @return モーションファイルの名前\n */\n public getMotionFileName(groupName: string, index: number): string {\n if (!this.isExistMotionGroupName(groupName)) {\n return '';\n }\n\n return this._jsonValue[FrequestNode.FrequestNode_Motions]\n .getValueByString(groupName)\n .getValueByIndex(index)\n .getValueByString(this.filePath)\n .getRawString();\n }\n\n /**\n * モーションに対応するサウンドファイルの名前を取得する\n * @param groupName モーショングループの名前\n * @param index 配列のインデックス値\n * @return サウンドファイルの名前\n */\n public getMotionSoundFileName(groupName: string, index: number): string {\n if (!this.isExistMotionSoundFile(groupName, index)) {\n return '';\n }\n\n return this._jsonValue[FrequestNode.FrequestNode_Motions]\n .getValueByString(groupName)\n .getValueByIndex(index)\n .getValueByString(this.soundPath)\n .getRawString();\n }\n\n /**\n * モーション開始時のフェードイン処理時間を取得する\n * @param groupName モーショングループの名前\n * @param index 配列のインデックス値\n * @return フェードイン処理時間[秒]\n */\n public getMotionFadeInTimeValue(groupName: string, index: number): number {\n if (!this.isExistMotionFadeIn(groupName, index)) {\n return -1.0;\n }\n\n return this._jsonValue[FrequestNode.FrequestNode_Motions]\n .getValueByString(groupName)\n .getValueByIndex(index)\n .getValueByString(this.fadeInTime)\n .toFloat();\n }\n\n /**\n * モーション終了時のフェードアウト処理時間を取得する\n * @param groupName モーショングループの名前\n * @param index 配列のインデックス値\n * @return フェードアウト処理時間[秒]\n */\n public getMotionFadeOutTimeValue(groupName: string, index: number): number {\n if (!this.isExistMotionFadeOut(groupName, index)) {\n return -1.0;\n }\n\n return this._jsonValue[FrequestNode.FrequestNode_Motions]\n .getValueByString(groupName)\n .getValueByIndex(index)\n .getValueByString(this.fadeOutTime)\n .toFloat();\n }\n\n /**\n * ユーザーデータのファイル名を取得する\n * @return ユーザーデータのファイル名\n */\n public getUserDataFile(): string {\n if (!this.isExistUserDataFile()) {\n return '';\n }\n\n return this.getJson()\n .getRoot()\n .getValueByString(this.fileReferences)\n .getValueByString(this.userData)\n .getRawString();\n }\n\n /**\n * レイアウト情報を取得する\n * @param outLayoutMap Mapクラスのインスタンス\n * @return true レイアウト情報が存在する\n * @return false レイアウト情報が存在しない\n */\n public getLayoutMap(outLayoutMap: Map<string, number>): boolean {\n // 存在しない要素にアクセスするとエラーになるためValueがnullの場合はnullを代入する\n const map: Map<string, Value> = this.getJson()\n .getRoot()\n .getValueByString(this.layout)\n .getMap();\n\n if (map == null) {\n return false;\n }\n\n let ret = false;\n\n for (const element of map) {\n outLayoutMap.set(element[0], element[1].toFloat());\n ret = true;\n }\n\n return ret;\n }\n\n /**\n * 目パチに関連付けられたパラメータの数を取得する\n * @return 目パチに関連付けられたパラメータの数\n */\n public getEyeBlinkParameterCount(): number {\n if (!this.isExistEyeBlinkParameters()) {\n return 0;\n }\n\n let num = 0;\n for (\n let i = 0;\n i < this._jsonValue[FrequestNode.FrequestNode_Groups].getSize();\n i++\n ) {\n const refI: Value =\n this._jsonValue[FrequestNode.FrequestNode_Groups].getValueByIndex(i);\n if (refI.isNull() || refI.isError()) {\n continue;\n }\n\n if (refI.getValueByString(this.name).getRawString() == this.eyeBlink) {\n num = refI.getValueByString(this.ids).getVector().length;\n break;\n }\n }\n\n return num;\n }\n\n /**\n * 目パチに関連付けられたパラメータのIDを取得する\n * @param index 配列のインデックス値\n * @return パラメータID\n */\n public getEyeBlinkParameterId(index: number): CubismIdHandle {\n if (!this.isExistEyeBlinkParameters()) {\n return null;\n }\n\n for (\n let i = 0;\n i < this._jsonValue[FrequestNode.FrequestNode_Groups].getSize();\n i++\n ) {\n const refI: Value =\n this._jsonValue[FrequestNode.FrequestNode_Groups].getValueByIndex(i);\n if (refI.isNull() || refI.isError()) {\n continue;\n }\n\n if (refI.getValueByString(this.name).getRawString() == this.eyeBlink) {\n return CubismFramework.getIdManager().getId(\n refI.getValueByString(this.ids).getValueByIndex(index).getRawString()\n );\n }\n }\n return null;\n }\n\n /**\n * リップシンクに関連付けられたパラメータの数を取得する\n * @return リップシンクに関連付けられたパラメータの数\n */\n public getLipSyncParameterCount(): number {\n if (!this.isExistLipSyncParameters()) {\n return 0;\n }\n\n let num = 0;\n for (\n let i = 0;\n i < this._jsonValue[FrequestNode.FrequestNode_Groups].getSize();\n i++\n ) {\n const refI: Value =\n this._jsonValue[FrequestNode.FrequestNode_Groups].getValueByIndex(i);\n if (refI.isNull() || refI.isError()) {\n continue;\n }\n\n if (refI.getValueByString(this.name).getRawString() == this.lipSync) {\n num = refI.getValueByString(this.ids).getVector().length;\n break;\n }\n }\n\n return num;\n }\n\n /**\n * リップシンクに関連付けられたパラメータの数を取得する\n * @param index 配列のインデックス値\n * @return パラメータID\n */\n public getLipSyncParameterId(index: number): CubismIdHandle {\n if (!this.isExistLipSyncParameters()) {\n return null;\n }\n\n for (\n let i = 0;\n i < this._jsonValue[FrequestNode.FrequestNode_Groups].getSize();\n i++\n ) {\n const refI: Value =\n this._jsonValue[FrequestNode.FrequestNode_Groups].getValueByIndex(i);\n if (refI.isNull() || refI.isError()) {\n continue;\n }\n\n if (refI.getValueByString(this.name).getRawString() == this.lipSync) {\n return CubismFramework.getIdManager().getId(\n refI.getValueByString(this.ids).getValueByIndex(index).getRawString()\n );\n }\n }\n return null;\n }\n\n /**\n * モデルファイルのキーが存在するかどうかを確認する\n * @return true キーが存在する\n * @return false キーが存在しない\n */\n protected isExistModelFile(): boolean {\n const node: Value = this._jsonValue[FrequestNode.FrequestNode_Moc];\n return !node.isNull() && !node.isError();\n }\n\n /**\n * テクスチャファイルのキーが存在するかどうかを確認する\n * @return true キーが存在する\n * @return false キーが存在しない\n */\n protected isExistTextureFiles(): boolean {\n const node: Value = this._jsonValue[FrequestNode.FrequestNode_Textures];\n return !node.isNull() && !node.isError();\n }\n\n /**\n * 当たり判定のキーが存在するかどうかを確認する\n * @return true キーが存在する\n * @return false キーが存在しない\n */\n protected isExistHitAreas(): boolean {\n const node: Value = this._jsonValue[FrequestNode.FrequestNode_HitAreas];\n return !node.isNull() && !node.isError();\n }\n\n /**\n * 物理演算ファイルのキーが存在するかどうかを確認する\n * @return true キーが存在する\n * @return false キーが存在しない\n */\n protected isExistPhysicsFile(): boolean {\n const node: Value = this._jsonValue[FrequestNode.FrequestNode_Physics];\n return !node.isNull() && !node.isError();\n }\n\n /**\n * ポーズ設定ファイルのキーが存在するかどうかを確認する\n * @return true キーが存在する\n * @return false キーが存在しない\n */\n protected isExistPoseFile(): boolean {\n const node: Value = this._jsonValue[FrequestNode.FrequestNode_Pose];\n return !node.isNull() && !node.isError();\n }\n\n /**\n * 表情設定ファイルのキーが存在するかどうかを確認する\n * @return true キーが存在する\n * @return false キーが存在しない\n */\n protected isExistExpressionFile(): boolean {\n const node: Value = this._jsonValue[FrequestNode.FrequestNode_Expressions];\n return !node.isNull() && !node.isError();\n }\n\n /**\n * モーショングループのキーが存在するかどうかを確認する\n * @return true キーが存在する\n * @return false キーが存在しない\n */\n protected isExistMotionGroups(): boolean {\n const node: Value = this._jsonValue[FrequestNode.FrequestNode_Motions];\n return !node.isNull() && !node.isError();\n }\n\n /**\n * 引数で指定したモーショングループのキーが存在するかどうかを確認する\n * @param groupName グループ名\n * @return true キーが存在する\n * @return false キーが存在しない\n */\n protected isExistMotionGroupName(groupName: string): boolean {\n const node: Value =\n this._jsonValue[FrequestNode.FrequestNode_Motions].getValueByString(\n groupName\n );\n return !node.isNull() && !node.isError();\n }\n\n /**\n * 引数で指定したモーションに対応するサウンドファイルのキーが存在するかどうかを確認する\n * @param groupName グループ名\n * @param index 配列のインデックス値\n * @return true キーが存在する\n * @return false キーが存在しない\n */\n protected isExistMotionSoundFile(groupName: string, index: number): boolean {\n const node: Value = this._jsonValue[FrequestNode.FrequestNode_Motions]\n .getValueByString(groupName)\n .getValueByIndex(index)\n .getValueByString(this.soundPath);\n return !node.isNull() && !node.isError();\n }\n\n /**\n * 引数で指定したモーションに対応するフェードイン時間のキーが存在するかどうかを確認する\n * @param groupName グループ名\n * @param index 配列のインデックス値\n * @return true キーが存在する\n * @return false キーが存在しない\n */\n protected isExistMotionFadeIn(groupName: string, index: number): boolean {\n const node: Value = this._jsonValue[FrequestNode.FrequestNode_Motions]\n .getValueByString(groupName)\n .getValueByIndex(index)\n .getValueByString(this.fadeInTime);\n return !node.isNull() && !node.isError();\n }\n\n /**\n * 引数で指定したモーションに対応するフェードアウト時間のキーが存在するかどうかを確認する\n * @param groupName グループ名\n * @param index 配列のインデックス値\n * @return true キーが存在する\n * @return false キーが存在しない\n */\n protected isExistMotionFadeOut(groupName: string, index: number): boolean {\n const node: Value = this._jsonValue[FrequestNode.FrequestNode_Motions]\n .getValueByString(groupName)\n .getValueByIndex(index)\n .getValueByString(this.fadeOutTime);\n return !node.isNull() && !node.isError();\n }\n\n /**\n * UserDataのファイル名が存在するかどうかを確認する\n * @return true キーが存在する\n * @return false キーが存在しない\n */\n protected isExistUserDataFile(): boolean {\n const node: Value = this.getJson()\n .getRoot()\n .getValueByString(this.fileReferences)\n .getValueByString(this.userData);\n return !node.isNull() && !node.isError();\n }\n\n /**\n * 目ぱちに対応付けられたパラメータが存在するかどうかを確認する\n * @return true キーが存在する\n * @return false キーが存在しない\n */\n protected isExistEyeBlinkParameters(): boolean {\n if (\n this._jsonValue[FrequestNode.FrequestNode_Groups].isNull() ||\n this._jsonValue[FrequestNode.FrequestNode_Groups].isError()\n ) {\n return false;\n }\n\n for (\n let i = 0;\n i < this._jsonValue[FrequestNode.FrequestNode_Groups].getSize();\n ++i\n ) {\n if (\n this._jsonValue[FrequestNode.FrequestNode_Groups]\n .getValueByIndex(i)\n .getValueByString(this.name)\n .getRawString() == this.eyeBlink\n ) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * リップシンクに対応付けられたパラメータが存在するかどうかを確認する\n * @return true キーが存在する\n * @return false キーが存在しない\n */\n protected isExistLipSyncParameters(): boolean {\n if (\n this._jsonValue[FrequestNode.FrequestNode_Groups].isNull() ||\n this._jsonValue[FrequestNode.FrequestNode_Groups].isError()\n ) {\n return false;\n }\n for (\n let i = 0;\n i < this._jsonValue[FrequestNode.FrequestNode_Groups].getSize();\n ++i\n ) {\n if (\n this._jsonValue[FrequestNode.FrequestNode_Groups]\n .getValueByIndex(i)\n .getValueByString(this.name)\n .getRawString() == this.lipSync\n ) {\n return true;\n }\n }\n return false;\n }\n\n protected _json: CubismJson;\n protected _jsonValue: Array<Value>;\n\n /**\n * Model3Jsonのキー文字列\n */\n protected readonly version = 'Version';\n protected readonly fileReferences = 'FileReferences';\n\n protected readonly groups = 'Groups';\n protected readonly layout = 'Layout';\n protected readonly hitAreas = 'HitAreas';\n\n protected readonly moc = 'Moc';\n protected readonly textures = 'Textures';\n protected readonly physics = 'Physics';\n protected readonly pose = 'Pose';\n protected readonly expressions = 'Expressions';\n protected readonly motions = 'Motions';\n\n protected readonly userData = 'UserData';\n protected readonly name = 'Name';\n protected readonly filePath = 'File';\n protected readonly id = 'Id';\n protected readonly ids = 'Ids';\n protected readonly target = 'Target';\n\n // Motions\n protected readonly idle = 'Idle';\n protected readonly tapBody = 'TapBody';\n protected readonly pinchIn = 'PinchIn';\n protected readonly pinchOut = 'PinchOut';\n protected readonly shake = 'Shake';\n protected readonly flickHead = 'FlickHead';\n protected readonly parameter = 'Parameter';\n\n protected readonly soundPath = 'Sound';\n protected readonly fadeInTime = 'FadeInTime';\n protected readonly fadeOutTime = 'FadeOutTime';\n\n // Layout\n protected readonly centerX = 'CenterX';\n protected readonly centerY = 'CenterY';\n protected readonly x = 'X';\n protected readonly y = 'Y';\n protected readonly width = 'Width';\n protected readonly height = 'Height';\n\n protected readonly lipSync = 'LipSync';\n protected readonly eyeBlink = 'EyeBlink';\n\n protected readonly initParameter = 'init_param';\n protected readonly initPartsVisible = 'init_parts_visible';\n protected readonly val = 'val';\n}\n\n// Namespace definition for compatibility.\nimport * as $ from './cubismmodelsettingjson';\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Live2DCubismFramework {\n export const CubismModelSettingJson = $.CubismModelSettingJson;\n export type CubismModelSettingJson = $.CubismModelSettingJson;\n export const FrequestNode = $.FrequestNode;\n export type FrequestNode = $.FrequestNode;\n}\n","// biome-ignore-all lint/suspicious/noUnsafeDeclarationMerging: mixin pattern — settings-JSON methods are grafted on by applyMixins\nimport type * as CubismSpec from '@cubism/CubismSpec'\nimport { CubismDefaultParameterId } from '@cubism/cubismdefaultparameterid'\nimport { CubismModelSettingJson } from '@cubism/cubismmodelsettingjson'\nimport type { CubismIdHandle } from '@cubism/id/cubismid'\n\nimport { ModelSettings } from '@/cubism-common/ModelSettings'\nimport { applyMixins } from '@/utils'\n\ntype CubismModelSettingJsonMixin = Omit<CubismModelSettingJson, 'name'>\n\nconst defaultEyeBlinkParameters = [CubismDefaultParameterId.ParamEyeLOpen!, CubismDefaultParameterId.ParamEyeROpen!]\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging, @typescript-eslint/no-empty-object-type\nexport interface CubismModelSettings extends CubismModelSettingJsonMixin {}\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging\nexport class CubismModelSettings extends ModelSettings {\n declare json: CubismSpec.ModelJSON\n\n moc!: string\n textures!: string[]\n layout?: Record<string, number>\n hitAreas?: { Id: string; Name: string }[]\n expressions?: CubismSpec.Expression[]\n motions?: Record<string, CubismSpec.Motion[]>\n\n // methods mixed in from CubismModelSettingJson (stubs for type checking)\n declare getEyeBlinkParameterCount: () => number\n declare getEyeBlinkParameterId: (index: number) => CubismIdHandle\n declare getLipSyncParameterCount: () => number\n declare getLipSyncParameterId: (index: number) => CubismIdHandle\n\n static isValidJSON(json: unknown): json is CubismSpec.ModelJSON {\n if (!json || typeof json !== 'object') {\n return false\n }\n\n const references = (json as { FileReferences?: unknown }).FileReferences\n\n if (!references || typeof references !== 'object' || typeof (references as { Moc?: unknown }).Moc !== 'string') {\n return false\n }\n\n const textures = (references as { Textures?: unknown }).Textures\n\n if (!Array.isArray(textures) || textures.length === 0) {\n return false\n }\n\n const textureNamesAreStrings = textures.every(item => typeof item === 'string')\n\n if (!textureNamesAreStrings) {\n return false\n }\n\n const expressions = (references as { Expressions?: unknown }).Expressions\n\n const isValidExpression = (expression: unknown): expression is { File: string } => {\n return !!expression && typeof (expression as { File?: unknown }).File === 'string'\n }\n\n const hasInvalidExpressions =\n expressions !== undefined &&\n (!Array.isArray(expressions) || expressions.some(expression => !isValidExpression(expression)))\n\n return !hasInvalidExpressions\n }\n\n constructor(json: CubismSpec.ModelJSON & { url: string }) {\n super(json)\n\n if (!CubismModelSettings.isValidJSON(json)) {\n throw new TypeError('Invalid JSON.')\n }\n\n // this doesn't seem to be allowed in ES6 and above, calling it will cause an error:\n // \"Class constructor CubismModelSettingsJson cannot be invoked without 'new'\"\n //\n // CubismModelSettingsJson.call(this, json);\n\n const buffer = new TextEncoder().encode(JSON.stringify(json)).buffer\n\n Object.assign(this, new CubismModelSettingJson(buffer, buffer.byteLength))\n\n // populate plain fields expected by ModelSettings consumers\n this.moc = json.FileReferences.Moc\n this.textures = [...json.FileReferences.Textures]\n this.pose = json.FileReferences.Pose\n this.physics = json.FileReferences.Physics\n this.expressions = json.FileReferences.Expressions?.filter(\n (expression): expression is CubismSpec.Expression => !!expression && typeof expression.File === 'string'\n )\n this.motions = json.FileReferences.Motions ?? json.Motions\n this.layout = json.Layout\n this.hitAreas = json.HitAreas\n\n const mocStem = this.getFileStem(this.moc)\n this.setModelName(mocStem, this.name)\n }\n\n replaceFiles(replace: (file: string, path: string) => string) {\n super.replaceFiles(replace)\n\n if (this.motions) {\n for (const [group, motions] of Object.entries(this.motions)) {\n for (let i = 0; i < motions.length; i++) {\n const motion = motions[i]\n\n if (!motion?.File) {\n continue\n }\n\n motion.File = replace(motion.File, `motions.${group}[${i}].File`)\n\n if (motion.Sound) {\n motion.Sound = replace(motion.Sound, `motions.${group}[${i}].Sound`)\n }\n }\n }\n }\n\n if (this.expressions) {\n for (let i = 0; i < this.expressions.length; i++) {\n const expression = this.expressions[i]\n if (!expression?.File) continue\n\n expression.File = replace(expression.File, `expressions[${i}].File`)\n }\n }\n }\n\n getEyeBlinkParameters(): string[] {\n const parameters: string[] = []\n const count = this.getEyeBlinkParameterCount?.() ?? 0\n\n if (count > 0) {\n for (let i = 0; i < count; i++) {\n const id = this.getEyeBlinkParameterId?.(i)\n if (id?.getString) {\n parameters.push(id.getString())\n }\n }\n } else {\n let hasEyeBlinkGroup = false\n const groups = this.json.Groups\n\n if (Array.isArray(groups)) {\n for (const group of groups) {\n if (group?.Name !== 'EyeBlink') continue\n\n hasEyeBlinkGroup = true\n\n if (!Array.isArray(group.Ids)) continue\n\n for (const entry of group.Ids) {\n if (typeof entry === 'string') {\n parameters.push(entry)\n } else if (entry?.Id) {\n parameters.push(entry.Id)\n }\n }\n }\n }\n\n if (hasEyeBlinkGroup) {\n return parameters\n }\n }\n\n return parameters.length ? parameters : [...defaultEyeBlinkParameters]\n }\n\n getLipSyncParameters(): string[] {\n const parameters: string[] = []\n const count = this.getLipSyncParameterCount?.() ?? 0\n\n if (count > 0) {\n for (let i = 0; i < count; i++) {\n const id = this.getLipSyncParameterId?.(i)\n if (id?.getString) {\n parameters.push(id.getString())\n }\n }\n } else if (Array.isArray(this.json.Groups)) {\n const groups = this.json.Groups\n\n for (const group of groups) {\n if (group?.Name !== 'LipSync' || !Array.isArray(group.Ids)) continue\n\n for (const entry of group.Ids) {\n if (typeof entry === 'string') {\n parameters.push(entry)\n } else if (entry?.Id) {\n parameters.push(entry.Id)\n }\n }\n }\n }\n\n return parameters\n }\n}\n\napplyMixins(CubismModelSettings, [CubismModelSettingJson])\n","import './factory'\nimport type { Option } from '@cubism/live2dcubismframework'\nimport { CubismFramework, LogLevel } from '@cubism/live2dcubismframework'\n\nimport { logger, MBToByte } from '@/utils'\n\nlet startupPromise: Promise<void>\nlet startupRetries = 20\n\n// Cubism Core caches typed-array views over the emscripten heap when a model is\n// built, and never re-acquires them; a later model that grows the heap detaches\n// every earlier model's views, freezing it (writes land in the orphaned buffer).\n// Pre-allocating past the point of growth is Live2D's own remedy — but the API\n// ignores anything <= 16 MB, so the old 16 default silently did nothing.\nlet cubismMemory = 128\n\ninterface CubismConfig {\n /**\n * Memory size in megabytes for Cubism's internal heap.\n */\n memorySizeMB?: number\n}\n\n/**\n * Configures global Cubism startup settings.\n */\nexport function configureCubismSDK(config: CubismConfig = {}): void {\n if (config.memorySizeMB != null) {\n cubismMemory = config.memorySizeMB\n }\n}\n\n/**\n * Promises that the Cubism framework is ready to work.\n * @return Promise that resolves if the startup has succeeded, rejects if failed.\n */\nexport function cubismReady(): Promise<void> {\n if (CubismFramework.isStarted()) {\n return Promise.resolve()\n }\n\n startupPromise ??= new Promise<void>((resolve, reject) => {\n function startUpWithRetry() {\n try {\n startUpCubism()\n resolve()\n } catch (e) {\n startupRetries--\n\n if (startupRetries < 0) {\n reject(new Error('Failed to start up Cubism framework.', { cause: e }))\n return\n }\n\n logger.log('Cubism', 'Startup failed, retrying 10ms later...')\n\n setTimeout(startUpWithRetry, 10)\n }\n }\n\n startUpWithRetry()\n })\n\n return startupPromise\n}\n\n/**\n * Starts up the Cubism framework.\n */\nexport function startUpCubism(options?: Option, memorySizeMB?: number) {\n const startupOptions: Option = {\n logFunction: console.log,\n loggingLevel: LogLevel.LogLevel_Verbose,\n ...options,\n }\n\n const memory = memorySizeMB ?? cubismMemory\n\n CubismFramework.startUp(startupOptions)\n CubismFramework.initialize(MBToByte(memory))\n}\n\n/**\n * Reconfigures Cubism settings and restarts the framework so they take effect.\n */\nexport function reconfigureCubismSDK(config: CubismConfig = {}): void {\n configureCubismSDK(config)\n\n if (CubismFramework.isInitialized()) {\n CubismFramework.dispose()\n }\n\n if (CubismFramework.isStarted()) {\n CubismFramework.cleanUp()\n }\n\n startUpCubism(undefined, config.memorySizeMB)\n}\n","import type * as CubismSpec from '@cubism/CubismSpec'\nimport { CubismPose } from '@cubism/effect/cubismpose'\nimport { CubismMoc } from '@cubism/model/cubismmoc'\nimport type { CubismModel } from '@cubism/model/cubismmodel'\nimport { CubismPhysics } from '@cubism/physics/cubismphysics'\n\nimport type { Live2DFactoryOptions } from '@/factory/Live2DFactory'\n\nimport { CubismInternalModel } from '@/cubism/CubismInternalModel'\nimport { CubismModelSettings } from '@/cubism/CubismModelSettings'\nimport { cubismReady } from '@/cubism/setup'\nimport { Live2DFactory } from '@/factory/Live2DFactory'\nimport { logger } from '@/utils'\n\ntype ModelWithMoc = { __moc?: CubismMoc }\n\nLive2DFactory.registerRuntime({\n version: 4,\n\n ready: cubismReady,\n\n test(source: unknown): boolean {\n return source instanceof CubismModelSettings || CubismModelSettings.isValidJSON(source)\n },\n\n isValidMoc(modelData: ArrayBuffer): boolean {\n if (modelData.byteLength < 4) {\n return false\n }\n\n const view = new Int8Array(modelData, 0, 4)\n\n return String.fromCharCode(...view) === 'MOC3'\n },\n\n createModelSettings(json: CubismSpec.ModelJSON & { url: string }): CubismModelSettings {\n return new CubismModelSettings(json)\n },\n\n createCoreModel(data: ArrayBuffer, options?: Live2DFactoryOptions): CubismModel {\n const moc = CubismMoc.create(data, !!options?.checkMocConsistency)\n\n try {\n const model = moc.createModel()\n\n // store the moc instance so we can reference it later\n ;(model as ModelWithMoc).__moc = moc\n\n return model\n } catch (e) {\n try {\n moc.release()\n } catch (releaseError) {\n logger.warn('CubismFactory', 'Failed to release moc after core model creation failed.', releaseError)\n }\n\n throw e\n }\n },\n\n createInternalModel(\n coreModel: CubismModel,\n settings: CubismModelSettings,\n options?: Live2DFactoryOptions\n ): CubismInternalModel {\n const model = new CubismInternalModel(coreModel, settings, options)\n\n const coreModelWithMoc = coreModel as CubismModel & ModelWithMoc\n\n if (coreModelWithMoc.__moc) {\n // transfer the moc to InternalModel, because the coreModel will\n // probably have been set to undefined when we receive the \"destroy\" event\n ;(model as CubismInternalModel & ModelWithMoc).__moc = coreModelWithMoc.__moc\n\n delete coreModelWithMoc.__moc\n\n // release the moc when destroying\n model.once('destroy', releaseMoc)\n }\n\n return model\n },\n\n createPhysics(_coreModel: CubismModel, data: unknown): CubismPhysics {\n if (!(data instanceof ArrayBuffer)) {\n throw new TypeError('Cubism physics data must be an ArrayBuffer.')\n }\n\n return CubismPhysics.create(data, data.byteLength)\n },\n\n createPose(_coreModel: CubismModel, data: unknown): CubismPose {\n if (!(data instanceof ArrayBuffer)) {\n throw new TypeError('Cubism pose data must be an ArrayBuffer.')\n }\n\n return CubismPose.create(data, data.byteLength)\n },\n})\n\nfunction releaseMoc(this: CubismInternalModel) {\n ;(this as CubismInternalModel & ModelWithMoc).__moc?.release()\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAeA,IAAa,WAAb,MAAa,SAAS;;;;;;;;;CASpB,OAAc,iBAAiB,IAAY;EACzC,OAAO,IAAI,SAAS,EAAE;CACxB;;;;CAKA,YAAmB;EACjB,OAAO,KAAK;CACd;;;;;;CAOA,QAAe,GAA+B;EAC5C,IAAI,OAAO,MAAM,UACf,OAAO,KAAK,OAAO;OACd,IAAI,aAAa,UACtB,OAAO,KAAK,OAAO,EAAE;EAEvB,OAAO;CACT;;;;;;CAOA,WAAkB,GAA+B;EAC/C,IAAI,OAAO,KAAK,UACd,OAAO,EAAE,KAAK,OAAO;OAChB,IAAI,aAAa,UACtB,OAAO,EAAE,KAAK,OAAO,EAAE;EAEzB,OAAO;CACT;;;;;;CAOA,YAAoB,IAAY;EAC9B,KAAK,MAAM;CACb;CAEA;AACF;AAOO,IAAUA;CAAV,SAAA,wBAAA;CACmBC,uBAAAA,WAAAA;AAGzB,EAAA,CAAA,6BAAA,2BAAA,CAAA,EAAD;;;;;;;;;;;;;;ACtEA,IAAa,kBAAb,MAA6B;;;;CAI3B,cAAqB;EACnB,KAAK,OAAO,IAAI,MAAgB;CAClC;;;;CAKA,UAAuB;EACrB,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,KAAK,QAAQ,EAAE,GACtC,KAAK,KAAK,KAAK,KAAK;EAEtB,KAAK,OAAO;CACd;;;;;;;CAQA,YAAmB,KAAqB;EACtC,KAAK,IAAI,IAAI,GAAG,IAAI,IAAI,QAAQ,KAC9B,KAAK,WAAW,IAAI,EAAE;CAE1B;;;;;;CAOA,WAAkB,IAAsB;EACtC,IAAI,SAAmB;EAEvB,IAAI,YAAY,OAAO,IAAI;GACzB,KAAK,SAAS,KAAK,OAAO,EAAE,MAAM,MACh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