forked from sunyu/CubismFramework
Merge pull request #3 from cocor-au-lait/feature/avoid-namespace
Avoiding needless namespace syntax to simplify importshfjnulyz-patch-1
commit
c80e158a66
|
@ -23,7 +23,6 @@ rules:
|
|||
- error
|
||||
- allow:
|
||||
- constructors
|
||||
'@typescript-eslint/no-namespace': warn
|
||||
'no-fallthrough': warn
|
||||
'@typescript-eslint/unbound-method': off
|
||||
'no-inner-declarations': off
|
||||
|
|
|
@ -10,4 +10,5 @@ dist/
|
|||
# Exclude some VSCode setting files.
|
||||
.vscode/*
|
||||
!/.vscode/extensions.json
|
||||
!/.vscode/settings.json
|
||||
!/.vscode/tasks.json
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"typescript.tsdk": "./node_modules/typescript/lib"
|
||||
}
|
|
@ -3,8 +3,8 @@
|
|||
"scripts": {
|
||||
"build": "tsc",
|
||||
"test": "tsc --noEmit",
|
||||
"lint": "eslint src -f codeframe --ext .ts",
|
||||
"lint:fix": "eslint src -f codeframe --ext .ts --fix",
|
||||
"lint": "eslint src --ext .ts",
|
||||
"lint:fix": "eslint src --ext .ts --fix",
|
||||
"clean": "rimraf dist"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -10,56 +10,109 @@
|
|||
* デフォルト値の仕様は以下のマニュアルに基づく<br>
|
||||
* https://docs.live2d.com/cubism-editor-manual/standard-parametor-list/
|
||||
*/
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismDefaultParameterId = Object.freeze<Record<string, string>>({
|
||||
// パーツID
|
||||
export const HitAreaPrefix = 'HitArea';
|
||||
export const HitAreaHead = 'Head';
|
||||
export const HitAreaBody = 'Body';
|
||||
export const PartsIdCore = 'Parts01Core';
|
||||
export const PartsArmPrefix = 'Parts01Arm_';
|
||||
export const PartsArmLPrefix = 'Parts01ArmL_';
|
||||
export const PartsArmRPrefix = 'Parts01ArmR_';
|
||||
|
||||
HitAreaPrefix: 'HitArea',
|
||||
HitAreaHead: 'Head',
|
||||
HitAreaBody: 'Body',
|
||||
PartsIdCore: 'Parts01Core',
|
||||
PartsArmPrefix: 'Parts01Arm_',
|
||||
PartsArmLPrefix: 'Parts01ArmL_',
|
||||
PartsArmRPrefix: 'Parts01ArmR_',
|
||||
// パラメータID
|
||||
export const ParamAngleX = 'ParamAngleX';
|
||||
export const ParamAngleY = 'ParamAngleY';
|
||||
export const ParamAngleZ = 'ParamAngleZ';
|
||||
export const ParamEyeLOpen = 'ParamEyeLOpen';
|
||||
export const ParamEyeLSmile = 'ParamEyeLSmile';
|
||||
export const ParamEyeROpen = 'ParamEyeROpen';
|
||||
export const ParamEyeRSmile = 'ParamEyeRSmile';
|
||||
export const ParamEyeBallX = 'ParamEyeBallX';
|
||||
export const ParamEyeBallY = 'ParamEyeBallY';
|
||||
export const ParamEyeBallForm = 'ParamEyeBallForm';
|
||||
export const ParamBrowLY = 'ParamBrowLY';
|
||||
export const ParamBrowRY = 'ParamBrowRY';
|
||||
export const ParamBrowLX = 'ParamBrowLX';
|
||||
export const ParamBrowRX = 'ParamBrowRX';
|
||||
export const ParamBrowLAngle = 'ParamBrowLAngle';
|
||||
export const ParamBrowRAngle = 'ParamBrowRAngle';
|
||||
export const ParamBrowLForm = 'ParamBrowLForm';
|
||||
export const ParamBrowRForm = 'ParamBrowRForm';
|
||||
export const ParamMouthForm = 'ParamMouthForm';
|
||||
export const ParamMouthOpenY = 'ParamMouthOpenY';
|
||||
export const ParamCheek = 'ParamCheek';
|
||||
export const ParamBodyAngleX = 'ParamBodyAngleX';
|
||||
export const ParamBodyAngleY = 'ParamBodyAngleY';
|
||||
export const ParamBodyAngleZ = 'ParamBodyAngleZ';
|
||||
export const ParamBreath = 'ParamBreath';
|
||||
export const ParamArmLA = 'ParamArmLA';
|
||||
export const ParamArmRA = 'ParamArmRA';
|
||||
export const ParamArmLB = 'ParamArmLB';
|
||||
export const ParamArmRB = 'ParamArmRB';
|
||||
export const ParamHandL = 'ParamHandL';
|
||||
export const ParamHandR = 'ParamHandR';
|
||||
export const ParamHairFront = 'ParamHairFront';
|
||||
export const ParamHairSide = 'ParamHairSide';
|
||||
export const ParamHairBack = 'ParamHairBack';
|
||||
export const ParamHairFluffy = 'ParamHairFluffy';
|
||||
export const ParamShoulderY = 'ParamShoulderY';
|
||||
export const ParamBustX = 'ParamBustX';
|
||||
export const ParamBustY = 'ParamBustY';
|
||||
export const ParamBaseX = 'ParamBaseX';
|
||||
export const ParamBaseY = 'ParamBaseY';
|
||||
export const ParamNONE = 'NONE:';
|
||||
ParamAngleX: 'ParamAngleX',
|
||||
ParamAngleY: 'ParamAngleY',
|
||||
ParamAngleZ: 'ParamAngleZ',
|
||||
ParamEyeLOpen: 'ParamEyeLOpen',
|
||||
ParamEyeLSmile: 'ParamEyeLSmile',
|
||||
ParamEyeROpen: 'ParamEyeROpen',
|
||||
ParamEyeRSmile: 'ParamEyeRSmile',
|
||||
ParamEyeBallX: 'ParamEyeBallX',
|
||||
ParamEyeBallY: 'ParamEyeBallY',
|
||||
ParamEyeBallForm: 'ParamEyeBallForm',
|
||||
ParamBrowLY: 'ParamBrowLY',
|
||||
ParamBrowRY: 'ParamBrowRY',
|
||||
ParamBrowLX: 'ParamBrowLX',
|
||||
ParamBrowRX: 'ParamBrowRX',
|
||||
ParamBrowLAngle: 'ParamBrowLAngle',
|
||||
ParamBrowRAngle: 'ParamBrowRAngle',
|
||||
ParamBrowLForm: 'ParamBrowLForm',
|
||||
ParamBrowRForm: 'ParamBrowRForm',
|
||||
ParamMouthForm: 'ParamMouthForm',
|
||||
ParamMouthOpenY: 'ParamMouthOpenY',
|
||||
ParamCheek: 'ParamCheek',
|
||||
ParamBodyAngleX: 'ParamBodyAngleX',
|
||||
ParamBodyAngleY: 'ParamBodyAngleY',
|
||||
ParamBodyAngleZ: 'ParamBodyAngleZ',
|
||||
ParamBreath: 'ParamBreath',
|
||||
ParamArmLA: 'ParamArmLA',
|
||||
ParamArmRA: 'ParamArmRA',
|
||||
ParamArmLB: 'ParamArmLB',
|
||||
ParamArmRB: 'ParamArmRB',
|
||||
ParamHandL: 'ParamHandL',
|
||||
ParamHandR: 'ParamHandR',
|
||||
ParamHairFront: 'ParamHairFront',
|
||||
ParamHairSide: 'ParamHairSide',
|
||||
ParamHairBack: 'ParamHairBack',
|
||||
ParamHairFluffy: 'ParamHairFluffy',
|
||||
ParamShoulderY: 'ParamShoulderY',
|
||||
ParamBustX: 'ParamBustX',
|
||||
ParamBustY: 'ParamBustY',
|
||||
ParamBaseX: 'ParamBaseX',
|
||||
ParamBaseY: 'ParamBaseY',
|
||||
ParamNONE: 'NONE:'
|
||||
});
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismdefaultparameterid';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const HitAreaBody = $.CubismDefaultParameterId.HitAreaBody;
|
||||
export const HitAreaHead = $.CubismDefaultParameterId.HitAreaHead;
|
||||
export const HitAreaPrefix = $.CubismDefaultParameterId.HitAreaPrefix;
|
||||
export const ParamAngleX = $.CubismDefaultParameterId.ParamAngleX;
|
||||
export const ParamAngleY = $.CubismDefaultParameterId.ParamAngleY;
|
||||
export const ParamAngleZ = $.CubismDefaultParameterId.ParamAngleZ;
|
||||
export const ParamArmLA = $.CubismDefaultParameterId.ParamArmLA;
|
||||
export const ParamArmLB = $.CubismDefaultParameterId.ParamArmLB;
|
||||
export const ParamArmRA = $.CubismDefaultParameterId.ParamArmRA;
|
||||
export const ParamArmRB = $.CubismDefaultParameterId.ParamArmRB;
|
||||
export const ParamBaseX = $.CubismDefaultParameterId.ParamBaseX;
|
||||
export const ParamBaseY = $.CubismDefaultParameterId.ParamBaseY;
|
||||
export const ParamBodyAngleX = $.CubismDefaultParameterId.ParamBodyAngleX;
|
||||
export const ParamBodyAngleY = $.CubismDefaultParameterId.ParamBodyAngleY;
|
||||
export const ParamBodyAngleZ = $.CubismDefaultParameterId.ParamBodyAngleZ;
|
||||
export const ParamBreath = $.CubismDefaultParameterId.ParamBreath;
|
||||
export const ParamBrowLAngle = $.CubismDefaultParameterId.ParamBrowLAngle;
|
||||
export const ParamBrowLForm = $.CubismDefaultParameterId.ParamBrowLForm;
|
||||
export const ParamBrowLX = $.CubismDefaultParameterId.ParamBrowLX;
|
||||
export const ParamBrowLY = $.CubismDefaultParameterId.ParamBrowLY;
|
||||
export const ParamBrowRAngle = $.CubismDefaultParameterId.ParamBrowRAngle;
|
||||
export const ParamBrowRForm = $.CubismDefaultParameterId.ParamBrowRForm;
|
||||
export const ParamBrowRX = $.CubismDefaultParameterId.ParamBrowRX;
|
||||
export const ParamBrowRY = $.CubismDefaultParameterId.ParamBrowRY;
|
||||
export const ParamBustX = $.CubismDefaultParameterId.ParamBustX;
|
||||
export const ParamBustY = $.CubismDefaultParameterId.ParamBustY;
|
||||
export const ParamCheek = $.CubismDefaultParameterId.ParamCheek;
|
||||
export const ParamEyeBallForm = $.CubismDefaultParameterId.ParamEyeBallForm;
|
||||
export const ParamEyeBallX = $.CubismDefaultParameterId.ParamEyeBallX;
|
||||
export const ParamEyeBallY = $.CubismDefaultParameterId.ParamEyeBallY;
|
||||
export const ParamEyeLOpen = $.CubismDefaultParameterId.ParamEyeLOpen;
|
||||
export const ParamEyeLSmile = $.CubismDefaultParameterId.ParamEyeLSmile;
|
||||
export const ParamEyeROpen = $.CubismDefaultParameterId.ParamEyeROpen;
|
||||
export const ParamEyeRSmile = $.CubismDefaultParameterId.ParamEyeRSmile;
|
||||
export const ParamHairBack = $.CubismDefaultParameterId.ParamHairBack;
|
||||
export const ParamHairFluffy = $.CubismDefaultParameterId.ParamHairFluffy;
|
||||
export const ParamHairFront = $.CubismDefaultParameterId.ParamHairFront;
|
||||
export const ParamHairSide = $.CubismDefaultParameterId.ParamHairSide;
|
||||
export const ParamHandL = $.CubismDefaultParameterId.ParamHandL;
|
||||
export const ParamHandR = $.CubismDefaultParameterId.ParamHandR;
|
||||
export const ParamMouthForm = $.CubismDefaultParameterId.ParamMouthForm;
|
||||
export const ParamMouthOpenY = $.CubismDefaultParameterId.ParamMouthOpenY;
|
||||
export const ParamNONE = $.CubismDefaultParameterId.ParamNONE;
|
||||
export const ParamShoulderY = $.CubismDefaultParameterId.ParamShoulderY;
|
||||
export const PartsArmLPrefix = $.CubismDefaultParameterId.PartsArmLPrefix;
|
||||
export const PartsArmPrefix = $.CubismDefaultParameterId.PartsArmPrefix;
|
||||
export const PartsArmRPrefix = $.CubismDefaultParameterId.PartsArmRPrefix;
|
||||
export const PartsIdCore = $.CubismDefaultParameterId.PartsIdCore;
|
||||
}
|
||||
|
|
|
@ -5,76 +5,67 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as cubismframework } from './live2dcubismframework';
|
||||
import { Live2DCubismFramework as icubismmodelsetting } from './icubismmodelsetting';
|
||||
import { Live2DCubismFramework as cubismid } from './id/cubismid';
|
||||
import { Live2DCubismFramework as cubismjson } from './utils/cubismjson';
|
||||
import { Live2DCubismFramework as csmmap } from './type/csmmap';
|
||||
import { Live2DCubismFramework as csmvector } from './type/csmvector';
|
||||
import csmVector = csmvector.csmVector;
|
||||
import csmMap = csmmap.csmMap;
|
||||
import iterator = csmmap.iterator;
|
||||
import CubismFramework = cubismframework.CubismFramework;
|
||||
import CubismIdHandle = cubismid.CubismIdHandle;
|
||||
import CubismJson = cubismjson.CubismJson;
|
||||
import Value = cubismjson.Value;
|
||||
import ICubismModelSetting = icubismmodelsetting.ICubismModelSetting;
|
||||
import { ICubismModelSetting } from './icubismmodelsetting';
|
||||
import { CubismIdHandle } from './id/cubismid';
|
||||
import { CubismFramework } from './live2dcubismframework';
|
||||
import { csmMap, iterator } from './type/csmmap';
|
||||
import { csmVector } from './type/csmvector';
|
||||
import { CubismJson, Value } from './utils/cubismjson';
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
/**
|
||||
/**
|
||||
* Model3Jsonのキー文字列
|
||||
*/
|
||||
|
||||
// JSON Keys
|
||||
const Version = 'Version';
|
||||
const FileReferences = 'FileReferences';
|
||||
const Groups = 'Groups';
|
||||
const Layout = 'Layout';
|
||||
const HitAreas = 'HitAreas';
|
||||
// JSON Keys
|
||||
const Version = 'Version';
|
||||
const FileReferences = 'FileReferences';
|
||||
const Groups = 'Groups';
|
||||
const Layout = 'Layout';
|
||||
const HitAreas = 'HitAreas';
|
||||
|
||||
const Moc = 'Moc';
|
||||
const Textures = 'Textures';
|
||||
const Physics = 'Physics';
|
||||
const Pose = 'Pose';
|
||||
const Expressions = 'Expressions';
|
||||
const Motions = 'Motions';
|
||||
const Moc = 'Moc';
|
||||
const Textures = 'Textures';
|
||||
const Physics = 'Physics';
|
||||
const Pose = 'Pose';
|
||||
const Expressions = 'Expressions';
|
||||
const Motions = 'Motions';
|
||||
|
||||
const UserData = 'UserData';
|
||||
const Name = 'Name';
|
||||
const FilePath = 'File';
|
||||
const Id = 'Id';
|
||||
const Ids = 'Ids';
|
||||
const Target = 'Target';
|
||||
const UserData = 'UserData';
|
||||
const Name = 'Name';
|
||||
const FilePath = 'File';
|
||||
const Id = 'Id';
|
||||
const Ids = 'Ids';
|
||||
const Target = 'Target';
|
||||
|
||||
// Motions
|
||||
const Idle = 'Idle';
|
||||
const TapBody = 'TapBody';
|
||||
const PinchIn = 'PinchIn';
|
||||
const PinchOut = 'PinchOut';
|
||||
const Shake = 'Shake';
|
||||
const FlickHead = 'FlickHead';
|
||||
const Parameter = 'Parameter';
|
||||
// Motions
|
||||
const Idle = 'Idle';
|
||||
const TapBody = 'TapBody';
|
||||
const PinchIn = 'PinchIn';
|
||||
const PinchOut = 'PinchOut';
|
||||
const Shake = 'Shake';
|
||||
const FlickHead = 'FlickHead';
|
||||
const Parameter = 'Parameter';
|
||||
|
||||
const SoundPath = 'Sound';
|
||||
const FadeInTime = 'FadeInTime';
|
||||
const FadeOutTime = 'FadeOutTime';
|
||||
const SoundPath = 'Sound';
|
||||
const FadeInTime = 'FadeInTime';
|
||||
const FadeOutTime = 'FadeOutTime';
|
||||
|
||||
// Layout
|
||||
const CenterX = 'CenterX';
|
||||
const CenterY = 'CenterY';
|
||||
const X = 'X';
|
||||
const Y = 'Y';
|
||||
const Width = 'Width';
|
||||
const Height = 'Height';
|
||||
// Layout
|
||||
const CenterX = 'CenterX';
|
||||
const CenterY = 'CenterY';
|
||||
const X = 'X';
|
||||
const Y = 'Y';
|
||||
const Width = 'Width';
|
||||
const Height = 'Height';
|
||||
|
||||
const LipSync = 'LipSync';
|
||||
const EyeBlink = 'EyeBlink';
|
||||
const LipSync = 'LipSync';
|
||||
const EyeBlink = 'EyeBlink';
|
||||
|
||||
const InitParameter = 'init_param';
|
||||
const InitPartsVisible = 'init_parts_visible';
|
||||
const Val = 'val';
|
||||
const InitParameter = 'init_param';
|
||||
const InitPartsVisible = 'init_parts_visible';
|
||||
const Val = 'val';
|
||||
|
||||
enum FrequestNode {
|
||||
enum FrequestNode {
|
||||
FrequestNode_Groups, // getRoot().getValueByString(Groups)
|
||||
FrequestNode_Moc, // getRoot().getValueByString(FileReferences).getValueByString(Moc)
|
||||
FrequestNode_Motions, // getRoot().getValueByString(FileReferences).getValueByString(Motions)
|
||||
|
@ -83,14 +74,14 @@ export namespace Live2DCubismFramework {
|
|||
FrequestNode_Physics, // getRoot().getValueByString(FileReferences).getValueByString(Physics)
|
||||
FrequestNode_Pose, // getRoot().getValueByString(FileReferences).getValueByString(Pose)
|
||||
FrequestNode_HitAreas // getRoot().getValueByString(HitAreas)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Model3Jsonパーサー
|
||||
*
|
||||
* model3.jsonファイルをパースして値を取得する
|
||||
*/
|
||||
export class CubismModelSettingJson extends ICubismModelSetting {
|
||||
export class CubismModelSettingJson extends ICubismModelSetting {
|
||||
/**
|
||||
* 引数付きコンストラクタ
|
||||
*
|
||||
|
@ -142,9 +133,7 @@ export namespace Live2DCubismFramework {
|
|||
.getValueByString(FileReferences)
|
||||
.getValueByString(Pose)
|
||||
);
|
||||
this._jsonValue.pushBack(
|
||||
this._json.getRoot().getValueByString(HitAreas)
|
||||
);
|
||||
this._jsonValue.pushBack(this._json.getRoot().getValueByString(HitAreas));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -261,9 +250,7 @@ export namespace Live2DCubismFramework {
|
|||
return '';
|
||||
}
|
||||
|
||||
return this._jsonValue
|
||||
.at(FrequestNode.FrequestNode_Physics)
|
||||
.getRawString();
|
||||
return this._jsonValue.at(FrequestNode.FrequestNode_Physics).getRawString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -287,9 +274,7 @@ export namespace Live2DCubismFramework {
|
|||
return 0;
|
||||
}
|
||||
|
||||
return this._jsonValue
|
||||
.at(FrequestNode.FrequestNode_Expressions)
|
||||
.getSize();
|
||||
return this._jsonValue.at(FrequestNode.FrequestNode_Expressions).getSize();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -640,9 +625,7 @@ export namespace Live2DCubismFramework {
|
|||
* @return false キーが存在しない
|
||||
*/
|
||||
private isExistTextureFiles(): boolean {
|
||||
const node: Value = this._jsonValue.at(
|
||||
FrequestNode.FrequestNode_Textures
|
||||
);
|
||||
const node: Value = this._jsonValue.at(FrequestNode.FrequestNode_Textures);
|
||||
return !node.isNull() && !node.isError();
|
||||
}
|
||||
|
||||
|
@ -652,9 +635,7 @@ export namespace Live2DCubismFramework {
|
|||
* @return false キーが存在しない
|
||||
*/
|
||||
private isExistHitAreas(): boolean {
|
||||
const node: Value = this._jsonValue.at(
|
||||
FrequestNode.FrequestNode_HitAreas
|
||||
);
|
||||
const node: Value = this._jsonValue.at(FrequestNode.FrequestNode_HitAreas);
|
||||
return !node.isNull() && !node.isError();
|
||||
}
|
||||
|
||||
|
@ -838,5 +819,12 @@ export namespace Live2DCubismFramework {
|
|||
|
||||
private _json: CubismJson;
|
||||
private _jsonValue: csmVector<Value>;
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismmodelsettingjson';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismModelSettingJson = $.CubismModelSettingJson;
|
||||
export type CubismModelSettingJson = $.CubismModelSettingJson;
|
||||
}
|
||||
|
|
|
@ -5,20 +5,16 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as csmvector } from '../type/csmvector';
|
||||
import { Live2DCubismFramework as cubismmodel } from '../model/cubismmodel';
|
||||
import { Live2DCubismFramework as cubismid } from '../id/cubismid';
|
||||
import CubismIdHandle = cubismid.CubismIdHandle;
|
||||
import CubismModel = cubismmodel.CubismModel;
|
||||
import csmVector = csmvector.csmVector;
|
||||
import { CubismIdHandle } from '../id/cubismid';
|
||||
import { CubismModel } from '../model/cubismmodel';
|
||||
import { csmVector } from '../type/csmvector';
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
/**
|
||||
/**
|
||||
* 呼吸機能
|
||||
*
|
||||
* 呼吸機能を提供する。
|
||||
*/
|
||||
export class CubismBreath {
|
||||
export class CubismBreath {
|
||||
/**
|
||||
* インスタンスの作成
|
||||
*/
|
||||
|
@ -40,9 +36,7 @@ export namespace Live2DCubismFramework {
|
|||
* 呼吸のパラメータの紐づけ
|
||||
* @param breathParameters 呼吸を紐づけたいパラメータのリスト
|
||||
*/
|
||||
public setParameters(
|
||||
breathParameters: csmVector<BreathParameterData>
|
||||
): void {
|
||||
public setParameters(breathParameters: csmVector<BreathParameterData>): void {
|
||||
this._breathParameters = breathParameters;
|
||||
}
|
||||
|
||||
|
@ -59,10 +53,7 @@ export namespace Live2DCubismFramework {
|
|||
* @param model 対象のモデル
|
||||
* @param deltaTimeSeconds デルタ時間[秒]
|
||||
*/
|
||||
public updateParameters(
|
||||
model: CubismModel,
|
||||
deltaTimeSeconds: number
|
||||
): void {
|
||||
public updateParameters(model: CubismModel, deltaTimeSeconds: number): void {
|
||||
this._currentTime += deltaTimeSeconds;
|
||||
|
||||
const t: number = this._currentTime * 2.0 * 3.14159;
|
||||
|
@ -87,12 +78,12 @@ export namespace Live2DCubismFramework {
|
|||
|
||||
_breathParameters: csmVector<BreathParameterData>; // 呼吸にひもづいているパラメータのリスト
|
||||
_currentTime: number; // 積算時間[秒]
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 呼吸のパラメータ情報
|
||||
*/
|
||||
export class BreathParameterData {
|
||||
export class BreathParameterData {
|
||||
/**
|
||||
* コンストラクタ
|
||||
* @param parameterId 呼吸をひもづけるパラメータID
|
||||
|
@ -120,5 +111,14 @@ export namespace Live2DCubismFramework {
|
|||
peak: number; // 呼吸を正弦波としたときの、波の高さ
|
||||
cycle: number; // 呼吸を正弦波としたときの、波の周期
|
||||
weight: number; // パラメータへの重み
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismbreath';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const BreathParameterData = $.BreathParameterData;
|
||||
export type BreathParameterData = $.BreathParameterData;
|
||||
export const CubismBreath = $.CubismBreath;
|
||||
export type CubismBreath = $.CubismBreath;
|
||||
}
|
||||
|
|
|
@ -5,22 +5,17 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as csmvector } from '../type/csmvector';
|
||||
import { Live2DCubismFramework as icubismmodelsetting } from '../icubismmodelsetting';
|
||||
import { Live2DCubismFramework as cubismid } from '../id/cubismid';
|
||||
import { Live2DCubismFramework as cubismmodel } from '../model/cubismmodel';
|
||||
import CubismModel = cubismmodel.CubismModel;
|
||||
import CubismIdHandle = cubismid.CubismIdHandle;
|
||||
import ICubismModelSetting = icubismmodelsetting.ICubismModelSetting;
|
||||
import csmVector = csmvector.csmVector;
|
||||
import { ICubismModelSetting } from '../icubismmodelsetting';
|
||||
import { CubismIdHandle } from '../id/cubismid';
|
||||
import { CubismModel } from '../model/cubismmodel';
|
||||
import { csmVector } from '../type/csmvector';
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
/**
|
||||
/**
|
||||
* 自動まばたき機能
|
||||
*
|
||||
* 自動まばたき機能を提供する。
|
||||
*/
|
||||
export class CubismEyeBlink {
|
||||
export class CubismEyeBlink {
|
||||
/**
|
||||
* インスタンスを作成する
|
||||
* @param modelSetting モデルの設定情報
|
||||
|
@ -88,10 +83,7 @@ export namespace Live2DCubismFramework {
|
|||
* @param model 対象のモデル
|
||||
* @param deltaTimeSeconds デルタ時間[秒]
|
||||
*/
|
||||
public updateParameters(
|
||||
model: CubismModel,
|
||||
deltaTimeSeconds: number
|
||||
): void {
|
||||
public updateParameters(model: CubismModel, deltaTimeSeconds: number): void {
|
||||
this._userTimeSeconds += deltaTimeSeconds;
|
||||
let parameterValue: number;
|
||||
let t = 0.0;
|
||||
|
@ -215,18 +207,27 @@ export namespace Live2DCubismFramework {
|
|||
* IDで指定された目のパラメータが、0のときに閉じるなら true 、1の時に閉じるなら false 。
|
||||
*/
|
||||
static readonly CloseIfZero: boolean = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* まばたきの状態
|
||||
*
|
||||
* まばたきの状態を表す列挙型
|
||||
*/
|
||||
export enum EyeState {
|
||||
export enum EyeState {
|
||||
EyeState_First = 0, // 初期状態
|
||||
EyeState_Interval, // まばたきしていない状態
|
||||
EyeState_Closing, // まぶたが閉じていく途中の状態
|
||||
EyeState_Closed, // まぶたが閉じている状態
|
||||
EyeState_Opening // まぶたが開いていく途中の状態
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismeyeblink';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismEyeBlink = $.CubismEyeBlink;
|
||||
export type CubismEyeBlink = $.CubismEyeBlink;
|
||||
export const EyeState = $.EyeState;
|
||||
export type EyeState = $.EyeState;
|
||||
}
|
||||
|
|
|
@ -5,35 +5,27 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as cubismid } from '../id/cubismid';
|
||||
import { Live2DCubismFramework as csmvector } from '../type/csmvector';
|
||||
import { Live2DCubismFramework as cubismmodel } from '../model/cubismmodel';
|
||||
import { Live2DCubismFramework as cubismframework } from '../live2dcubismframework';
|
||||
import { Live2DCubismFramework as cubismjson } from '../utils/cubismjson';
|
||||
import CubismIdHandle = cubismid.CubismIdHandle;
|
||||
import csmVector = csmvector.csmVector;
|
||||
import iterator = csmvector.iterator;
|
||||
import CubismModel = cubismmodel.CubismModel;
|
||||
import CubismFramework = cubismframework.CubismFramework;
|
||||
import CubismJson = cubismjson.CubismJson;
|
||||
import Value = cubismjson.Value;
|
||||
import { CubismIdHandle } from '../id/cubismid';
|
||||
import { CubismFramework } from '../live2dcubismframework';
|
||||
import { CubismModel } from '../model/cubismmodel';
|
||||
import { csmVector, iterator } from '../type/csmvector';
|
||||
import { CubismJson, Value } from '../utils/cubismjson';
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
const Epsilon = 0.001;
|
||||
const DefaultFadeInSeconds = 0.5;
|
||||
const Epsilon = 0.001;
|
||||
const DefaultFadeInSeconds = 0.5;
|
||||
|
||||
// Pose.jsonのタグ
|
||||
const FadeIn = 'FadeInTime';
|
||||
const Link = 'Link';
|
||||
const Groups = 'Groups';
|
||||
const Id = 'Id';
|
||||
// Pose.jsonのタグ
|
||||
const FadeIn = 'FadeInTime';
|
||||
const Link = 'Link';
|
||||
const Groups = 'Groups';
|
||||
const Id = 'Id';
|
||||
|
||||
/**
|
||||
/**
|
||||
* パーツの不透明度の設定
|
||||
*
|
||||
* パーツの不透明度の管理と設定を行う。
|
||||
*/
|
||||
export class CubismPose {
|
||||
export class CubismPose {
|
||||
/**
|
||||
* インスタンスの作成
|
||||
* @param pose3json pose3.jsonのデータ
|
||||
|
@ -119,10 +111,7 @@ export namespace Live2DCubismFramework {
|
|||
* @param model 対象のモデル
|
||||
* @param deltaTimeSeconds デルタ時間[秒]
|
||||
*/
|
||||
public updateParameters(
|
||||
model: CubismModel,
|
||||
deltaTimeSeconds: number
|
||||
): void {
|
||||
public updateParameters(model: CubismModel, deltaTimeSeconds: number): void {
|
||||
// 前回のモデルと同じでない場合は初期化が必要
|
||||
if (model != this._lastModel) {
|
||||
// パラメータインデックスの初期化
|
||||
|
@ -171,10 +160,7 @@ export namespace Live2DCubismFramework {
|
|||
}
|
||||
|
||||
model.setPartOpacityByIndex(partsIndex, j == beginIndex ? 1.0 : 0.0);
|
||||
model.setParameterValueByIndex(
|
||||
paramIndex,
|
||||
j == beginIndex ? 1.0 : 0.0
|
||||
);
|
||||
model.setParameterValueByIndex(paramIndex, j == beginIndex ? 1.0 : 0.0);
|
||||
|
||||
for (let k = 0; k < this._partGroups.at(j).link.getSize(); ++k) {
|
||||
this._partGroups
|
||||
|
@ -320,12 +306,12 @@ export namespace Live2DCubismFramework {
|
|||
_partGroupCounts: csmVector<number>; // それぞれのパーツグループの個数
|
||||
_fadeTimeSeconds: number; // フェード時間[秒]
|
||||
_lastModel: CubismModel; // 前回操作したモデル
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* パーツにまつわるデータを管理
|
||||
*/
|
||||
export class PartData {
|
||||
export class PartData {
|
||||
/**
|
||||
* コンストラクタ
|
||||
*/
|
||||
|
@ -401,5 +387,14 @@ export namespace Live2DCubismFramework {
|
|||
parameterIndex: number; // パラメータのインデックス
|
||||
partIndex: number; // パーツのインデックス
|
||||
link: csmVector<PartData>; // 連動するパラメータ
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismpose';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismPose = $.CubismPose;
|
||||
export type CubismPose = $.CubismPose;
|
||||
export const PartData = $.PartData;
|
||||
export type PartData = $.PartData;
|
||||
}
|
||||
|
|
|
@ -5,14 +5,13 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
/**
|
||||
/**
|
||||
* メモリアロケーションを抽象化したクラス
|
||||
*
|
||||
* メモリ確保・解放処理をプラットフォーム側で実装して
|
||||
* フレームワークから呼び出すためのインターフェース
|
||||
*/
|
||||
export abstract class ICubismAllocator {
|
||||
export abstract class ICubismAllocator {
|
||||
/**
|
||||
* アラインメント制約なしのヒープ・メモリーを確保します
|
||||
*
|
||||
|
@ -41,5 +40,12 @@ export namespace Live2DCubismFramework {
|
|||
* @param alignedMemory 解放するメモリのアドレス
|
||||
*/
|
||||
public abstract deallocateAligned(alignedMemory: any): void;
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './icubismallcator';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const ICubismAllocator = $.ICubismAllocator;
|
||||
export type ICubismAllocator = $.ICubismAllocator;
|
||||
}
|
||||
|
|
|
@ -5,18 +5,15 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as cubismid } from './id/cubismid';
|
||||
import { Live2DCubismFramework as csmmap } from './type/csmmap';
|
||||
import csmMap = csmmap.csmMap;
|
||||
import CubismIdHandle = cubismid.CubismIdHandle;
|
||||
import { CubismIdHandle } from './id/cubismid';
|
||||
import { csmMap } from './type/csmmap';
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
/**
|
||||
/**
|
||||
* モデル設定情報を取り扱う関数を宣言した純粋仮想クラス。
|
||||
*
|
||||
* このクラスを継承することで、モデル設定情報を取り扱うクラスになる。
|
||||
*/
|
||||
export abstract class ICubismModelSetting {
|
||||
export abstract class ICubismModelSetting {
|
||||
/**
|
||||
* Mocファイルの名前を取得する
|
||||
* @return Mocファイルの名前
|
||||
|
@ -195,5 +192,12 @@ export namespace Live2DCubismFramework {
|
|||
* @return パラメータID
|
||||
*/
|
||||
public abstract getLipSyncParameterId(index: number): CubismIdHandle;
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './icubismmodelsetting';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const ICubismModelSetting = $.ICubismModelSetting;
|
||||
export type ICubismModelSetting = $.ICubismModelSetting;
|
||||
}
|
||||
|
|
|
@ -5,16 +5,14 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as csmstring } from '../type/csmstring';
|
||||
import csmString = csmstring.csmString;
|
||||
import { csmString } from '../type/csmstring';
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
/**
|
||||
/**
|
||||
* パラメータ名・パーツ名・Drawable名を保持
|
||||
*
|
||||
* パラメータ名・パーツ名・Drawable名を保持するクラス。
|
||||
*/
|
||||
export class CubismId {
|
||||
export class CubismId {
|
||||
/**
|
||||
* ID名を取得する
|
||||
*/
|
||||
|
@ -67,7 +65,15 @@ export namespace Live2DCubismFramework {
|
|||
}
|
||||
|
||||
private _id: csmString; // ID名
|
||||
}
|
||||
|
||||
export declare type CubismIdHandle = CubismId;
|
||||
}
|
||||
|
||||
export declare type CubismIdHandle = CubismId;
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismid';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismId = $.CubismId;
|
||||
export type CubismId = $.CubismId;
|
||||
export type CubismIdHandle = $.CubismIdHandle;
|
||||
}
|
||||
|
|
|
@ -5,20 +5,16 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as csmvector } from '../type/csmvector';
|
||||
import { Live2DCubismFramework as cubismid } from './cubismid';
|
||||
import { Live2DCubismFramework as csmstring } from '../type/csmstring';
|
||||
import csmString = csmstring.csmString;
|
||||
import CubismId = cubismid.CubismId;
|
||||
import csmVector = csmvector.csmVector;
|
||||
import { csmString } from '../type/csmstring';
|
||||
import { csmVector } from '../type/csmvector';
|
||||
import { CubismId } from './cubismid';
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
/**
|
||||
/**
|
||||
* ID名の管理
|
||||
*
|
||||
* ID名を管理する。
|
||||
*/
|
||||
export class CubismIdManager {
|
||||
export class CubismIdManager {
|
||||
/**
|
||||
* コンストラクタ
|
||||
*/
|
||||
|
@ -114,5 +110,12 @@ export namespace Live2DCubismFramework {
|
|||
}
|
||||
|
||||
private _ids: csmVector<CubismId>; // 登録されているIDのリスト
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismidmanager';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismIdManager = $.CubismIdManager;
|
||||
export type CubismIdManager = $.CubismIdManager;
|
||||
}
|
||||
|
|
|
@ -5,17 +5,14 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as cubismjson } from './utils/cubismjson';
|
||||
import { Live2DCubismFramework as cubismidmanager } from './id/cubismidmanager';
|
||||
import { Live2DCubismFramework as cubismrenderer } from './rendering/cubismrenderer';
|
||||
import { CubismIdManager } from './id/cubismidmanager';
|
||||
import { CubismRenderer } from './rendering/cubismrenderer';
|
||||
import {
|
||||
CSM_ASSERT,
|
||||
CubismLogInfo,
|
||||
CubismLogWarning,
|
||||
CSM_ASSERT
|
||||
CubismLogWarning
|
||||
} from './utils/cubismdebug';
|
||||
import Value = cubismjson.Value;
|
||||
import CubismIdManager = cubismidmanager.CubismIdManager;
|
||||
import CubismRenderer = cubismrenderer.CubismRenderer;
|
||||
import { Value } from './utils/cubismjson';
|
||||
|
||||
export function strtod(s: string, endPtr: string[]): number {
|
||||
let index = 0;
|
||||
|
@ -47,35 +44,34 @@ export function strtod(s: string, endPtr: string[]): number {
|
|||
return d;
|
||||
}
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
// ファイルスコープの変数を初期化
|
||||
// ファイルスコープの変数を初期化
|
||||
|
||||
let s_isStarted = false;
|
||||
let s_isInitialized = false;
|
||||
let s_option: Option = null;
|
||||
let s_cubismIdManager: CubismIdManager = null;
|
||||
let s_isStarted = false;
|
||||
let s_isInitialized = false;
|
||||
let s_option: Option = null;
|
||||
let s_cubismIdManager: CubismIdManager = null;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Framework内で使う定数の宣言
|
||||
*/
|
||||
export namespace Constant {
|
||||
export const vertexOffset = 0; // メッシュ頂点のオフセット値
|
||||
export const vertexStep = 2; // メッシュ頂点のステップ値
|
||||
}
|
||||
export const Constant = Object.freeze<Record<string, number>>({
|
||||
vertexOffset: 0, // メッシュ頂点のオフセット値
|
||||
vertexStep: 2 // メッシュ頂点のステップ値
|
||||
});
|
||||
|
||||
export function csmDelete<T>(address: T): void {
|
||||
export function csmDelete<T>(address: T): void {
|
||||
if (!address) {
|
||||
return;
|
||||
}
|
||||
|
||||
address = void 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Live2D Cubism SDK Original Workflow SDKのエントリポイント
|
||||
* 利用開始時はCubismFramework.initialize()を呼び、CubismFramework.dispose()で終了する。
|
||||
*/
|
||||
export class CubismFramework {
|
||||
export class CubismFramework {
|
||||
/**
|
||||
* Cubism FrameworkのAPIを使用可能にする。
|
||||
* APIを実行する前に必ずこの関数を実行すること。
|
||||
|
@ -251,7 +247,6 @@ export namespace Live2DCubismFramework {
|
|||
* インスタンス化させない
|
||||
*/
|
||||
private constructor() {}
|
||||
}
|
||||
}
|
||||
|
||||
export class Option {
|
||||
|
@ -270,3 +265,13 @@ export enum LogLevel {
|
|||
LogLevel_Error, // エラーログ
|
||||
LogLevel_Off // ログ出力無効
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './live2dcubismframework';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const Constant = $.Constant;
|
||||
export const csmDelete = $.csmDelete;
|
||||
export const CubismFramework = $.CubismFramework;
|
||||
export type CubismFramework = $.CubismFramework;
|
||||
}
|
||||
|
|
|
@ -5,14 +5,12 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as cubismvector2 } from './cubismvector2';
|
||||
import CubismVector2 = cubismvector2.CubismVector2;
|
||||
import { CubismVector2 } from './cubismvector2';
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
/**
|
||||
/**
|
||||
* 数値計算などに使用するユーティリティクラス
|
||||
*/
|
||||
export class CubismMath {
|
||||
export class CubismMath {
|
||||
/**
|
||||
* 第一引数の値を最小値と最大値の範囲に収めた値を返す
|
||||
*
|
||||
|
@ -191,5 +189,12 @@ export namespace Live2DCubismFramework {
|
|||
* コンストラクタ
|
||||
*/
|
||||
private constructor() {}
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismmath';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismMath = $.CubismMath;
|
||||
export type CubismMath = $.CubismMath;
|
||||
}
|
||||
|
|
|
@ -5,13 +5,12 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
/**
|
||||
/**
|
||||
* 4x4の行列
|
||||
*
|
||||
* 4x4行列の便利クラス。
|
||||
*/
|
||||
export class CubismMatrix44 {
|
||||
export class CubismMatrix44 {
|
||||
/**
|
||||
* コンストラクタ
|
||||
*/
|
||||
|
@ -304,5 +303,12 @@ export namespace Live2DCubismFramework {
|
|||
}
|
||||
|
||||
protected _tr: Float32Array; // 4x4行列データ
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismmatrix44';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismMatrix44 = $.CubismMatrix44;
|
||||
export type CubismMatrix44 = $.CubismMatrix44;
|
||||
}
|
||||
|
|
|
@ -5,19 +5,15 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as csmmap } from '../type/csmmap';
|
||||
import { Live2DCubismFramework as cubismmatrix44 } from './cubismmatrix44';
|
||||
import csmMap = csmmap.csmMap;
|
||||
import iterator = csmmap.iterator;
|
||||
import CubismMatrix44 = cubismmatrix44.CubismMatrix44;
|
||||
import { csmMap, iterator } from '../type/csmmap';
|
||||
import { CubismMatrix44 } from './cubismmatrix44';
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
/**
|
||||
/**
|
||||
* モデル座標設定用の4x4行列
|
||||
*
|
||||
* モデル座標設定用の4x4行列クラス
|
||||
*/
|
||||
export class CubismModelMatrix extends CubismMatrix44 {
|
||||
export class CubismModelMatrix extends CubismMatrix44 {
|
||||
/**
|
||||
* コンストラクタ
|
||||
*
|
||||
|
@ -219,5 +215,12 @@ export namespace Live2DCubismFramework {
|
|||
|
||||
private _width: number; // 横幅
|
||||
private _height: number; // 縦幅
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismmodelmatrix';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismModelMatrix = $.CubismModelMatrix;
|
||||
export type CubismModelMatrix = $.CubismModelMatrix;
|
||||
}
|
||||
|
|
|
@ -5,19 +5,17 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as cubismmath } from './cubismmath';
|
||||
import CubismMath = cubismmath.CubismMath;
|
||||
import { CubismMath } from './cubismmath';
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
const FrameRate = 30;
|
||||
const Epsilon = 0.01;
|
||||
const FrameRate = 30;
|
||||
const Epsilon = 0.01;
|
||||
|
||||
/**
|
||||
/**
|
||||
* 顔の向きの制御機能
|
||||
*
|
||||
* 顔の向きの制御機能を提供するクラス。
|
||||
*/
|
||||
export class CubismTargetPoint {
|
||||
export class CubismTargetPoint {
|
||||
/**
|
||||
* コンストラクタ
|
||||
*/
|
||||
|
@ -160,5 +158,12 @@ export namespace Live2DCubismFramework {
|
|||
private _faceVY: number; // 顔の向きの変化速度Y
|
||||
private _lastTimeSeconds: number; // 最後の実行時間[秒]
|
||||
private _userTimeSeconds: number; // デルタ時間の積算値[秒]
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismtargetpoint';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismTargetPoint = $.CubismTargetPoint;
|
||||
export type CubismTargetPoint = $.CubismTargetPoint;
|
||||
}
|
||||
|
|
|
@ -5,13 +5,12 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
/**
|
||||
/**
|
||||
* 2次元ベクトル型
|
||||
*
|
||||
* 2次元ベクトル型の機能を提供する。
|
||||
*/
|
||||
export class CubismVector2 {
|
||||
export class CubismVector2 {
|
||||
/**
|
||||
* コンストラクタ
|
||||
*/
|
||||
|
@ -159,5 +158,12 @@ export namespace Live2DCubismFramework {
|
|||
public isNotEqual(rhs: CubismVector2): boolean {
|
||||
return !this.isEqual(rhs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismvector2';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismVector2 = $.CubismVector2;
|
||||
export type CubismVector2 = $.CubismVector2;
|
||||
}
|
||||
|
|
|
@ -5,16 +5,14 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as cubismmatrix44 } from './cubismmatrix44';
|
||||
import CubismMatrix44 = cubismmatrix44.CubismMatrix44;
|
||||
import { CubismMatrix44 } from './cubismmatrix44';
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
/**
|
||||
/**
|
||||
* カメラの位置変更に使うと便利な4x4行列
|
||||
*
|
||||
* カメラの位置変更に使うと便利な4x4行列のクラス。
|
||||
*/
|
||||
export class CubismViewMatrix extends CubismMatrix44 {
|
||||
export class CubismViewMatrix extends CubismMatrix44 {
|
||||
/**
|
||||
* コンストラクタ
|
||||
*/
|
||||
|
@ -43,10 +41,7 @@ export namespace Live2DCubismFramework {
|
|||
x = this._screenLeft - this._tr[0] * this._maxLeft - this._tr[12];
|
||||
}
|
||||
|
||||
if (
|
||||
this._tr[0] * this._maxRight + (this._tr[12] + x) <
|
||||
this._screenRight
|
||||
) {
|
||||
if (this._tr[0] * this._maxRight + (this._tr[12] + x) < this._screenRight) {
|
||||
x = this._screenRight - this._tr[0] * this._maxRight - this._tr[12];
|
||||
}
|
||||
|
||||
|
@ -333,5 +328,12 @@ export namespace Live2DCubismFramework {
|
|||
private _maxBottom: number; // 論理座標上の移動可能範囲(下辺Y軸位置)
|
||||
private _maxScale: number; // 拡大率の最大値
|
||||
private _minScale: number; // 拡大率の最小値
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismviewmatrix';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismViewMatrix = $.CubismViewMatrix;
|
||||
export type CubismViewMatrix = $.CubismViewMatrix;
|
||||
}
|
||||
|
|
|
@ -5,17 +5,15 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as cubismmodel } from './cubismmodel';
|
||||
import CubismModel = cubismmodel.CubismModel;
|
||||
import { CSM_ASSERT } from '../utils/cubismdebug';
|
||||
import { CubismModel } from './cubismmodel';
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
/**
|
||||
/**
|
||||
* Mocデータの管理
|
||||
*
|
||||
* Mocデータの管理を行うクラス。
|
||||
*/
|
||||
export class CubismMoc {
|
||||
export class CubismMoc {
|
||||
/**
|
||||
* Mocデータの作成
|
||||
*/
|
||||
|
@ -96,5 +94,12 @@ export namespace Live2DCubismFramework {
|
|||
|
||||
_moc: Live2DCubismCore.Moc; // Mocデータ
|
||||
_modelCount: number; // Mocデータから作られたモデルの個数
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismmoc';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismMoc = $.CubismMoc;
|
||||
export type CubismMoc = $.CubismMoc;
|
||||
}
|
||||
|
|
|
@ -5,25 +5,19 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as cubismrenderer } from '../rendering/cubismrenderer';
|
||||
import { Live2DCubismFramework as cubismid } from '../id/cubismid';
|
||||
import { Live2DCubismFramework as cubismframework } from '../live2dcubismframework';
|
||||
import { Live2DCubismFramework as csmmap } from '../type/csmmap';
|
||||
import { Live2DCubismFramework as csmvector } from '../type/csmvector';
|
||||
import { CubismIdHandle } from '../id/cubismid';
|
||||
import { CubismFramework } from '../live2dcubismframework';
|
||||
import { CubismBlendMode } from '../rendering/cubismrenderer';
|
||||
import { csmMap } from '../type/csmmap';
|
||||
import { csmVector } from '../type/csmvector';
|
||||
import { CSM_ASSERT } from '../utils/cubismdebug';
|
||||
import CubismFramework = cubismframework.CubismFramework;
|
||||
import CubismBlendMode = cubismrenderer.CubismBlendMode;
|
||||
import csmVector = csmvector.csmVector;
|
||||
import csmMap = csmmap.csmMap;
|
||||
import CubismIdHandle = cubismid.CubismIdHandle;
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
/**
|
||||
/**
|
||||
* モデル
|
||||
*
|
||||
* Mocデータから生成されるモデルのクラス。
|
||||
*/
|
||||
export class CubismModel {
|
||||
export class CubismModel {
|
||||
/**
|
||||
* モデルのパラメータの更新
|
||||
*/
|
||||
|
@ -43,8 +37,7 @@ export namespace Live2DCubismFramework {
|
|||
}
|
||||
|
||||
return (
|
||||
this._model.canvasinfo.CanvasWidth /
|
||||
this._model.canvasinfo.PixelsPerUnit
|
||||
this._model.canvasinfo.CanvasWidth / this._model.canvasinfo.PixelsPerUnit
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -57,8 +50,7 @@ export namespace Live2DCubismFramework {
|
|||
}
|
||||
|
||||
return (
|
||||
this._model.canvasinfo.CanvasHeight /
|
||||
this._model.canvasinfo.PixelsPerUnit
|
||||
this._model.canvasinfo.CanvasHeight / this._model.canvasinfo.PixelsPerUnit
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -530,8 +522,7 @@ export namespace Live2DCubismFramework {
|
|||
* @return drawableの頂点リスト
|
||||
*/
|
||||
public getDrawableVertexPositions(drawableIndex: number): Float32Array {
|
||||
const verticesArray: Float32Array[] = this._model.drawables
|
||||
.vertexPositions;
|
||||
const verticesArray: Float32Array[] = this._model.drawables.vertexPositions;
|
||||
return verticesArray[drawableIndex];
|
||||
}
|
||||
|
||||
|
@ -647,9 +638,7 @@ export namespace Live2DCubismFramework {
|
|||
*/
|
||||
public getDrawableDynamicFlagIsVisible(drawableIndex: number): boolean {
|
||||
const dynamicFlags: Uint8Array = this._model.drawables.dynamicFlags;
|
||||
return Live2DCubismCore.Utils.hasIsVisibleBit(
|
||||
dynamicFlags[drawableIndex]
|
||||
);
|
||||
return Live2DCubismCore.Utils.hasIsVisibleBit(dynamicFlags[drawableIndex]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -818,5 +807,12 @@ export namespace Live2DCubismFramework {
|
|||
private _parameterIds: csmVector<CubismIdHandle>;
|
||||
private _partIds: csmVector<CubismIdHandle>;
|
||||
private _drawableIds: csmVector<CubismIdHandle>;
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismmodel';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismModel = $.CubismModel;
|
||||
export type CubismModel = $.CubismModel;
|
||||
}
|
||||
|
|
|
@ -5,37 +5,31 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as cubismmodeluserdatajson } from './cubismmodeluserdatajson';
|
||||
import { Live2DCubismFramework as cubismid } from '../id/cubismid';
|
||||
import { Live2DCubismFramework as csmstring } from '../type/csmstring';
|
||||
import { Live2DCubismFramework as csmvector } from '../type/csmvector';
|
||||
import { Live2DCubismFramework as cubismframework } from '../live2dcubismframework';
|
||||
import CubismFramework = cubismframework.CubismFramework;
|
||||
import csmVector = csmvector.csmVector;
|
||||
import csmString = csmstring.csmString;
|
||||
import CubismIdHandle = cubismid.CubismIdHandle;
|
||||
import CubismModelUserDataJson = cubismmodeluserdatajson.CubismModelUserDataJson;
|
||||
import { CubismIdHandle } from '../id/cubismid';
|
||||
import { CubismFramework } from '../live2dcubismframework';
|
||||
import { csmString } from '../type/csmstring';
|
||||
import { csmVector } from '../type/csmvector';
|
||||
import { CubismModelUserDataJson } from './cubismmodeluserdatajson';
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
const ArtMesh = 'ArtMesh';
|
||||
const ArtMesh = 'ArtMesh';
|
||||
|
||||
/**
|
||||
/**
|
||||
* ユーザーデータインターフェース
|
||||
*
|
||||
* Jsonから読み込んだユーザーデータを記録しておくための構造体
|
||||
*/
|
||||
export class CubismModelUserDataNode {
|
||||
export class CubismModelUserDataNode {
|
||||
targetType: CubismIdHandle; // ユーザーデータターゲットタイプ
|
||||
targetId: CubismIdHandle; // ユーザーデータターゲットのID
|
||||
value: csmString; // ユーザーデータ
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* ユーザデータの管理クラス
|
||||
*
|
||||
* ユーザデータをロード、管理、検索インターフェイス、解放までを行う。
|
||||
*/
|
||||
export class CubismModelUserData {
|
||||
export class CubismModelUserData {
|
||||
/**
|
||||
* インスタンスの作成
|
||||
*
|
||||
|
@ -43,10 +37,7 @@ export namespace Live2DCubismFramework {
|
|||
* @param size バッファのサイズ
|
||||
* @return 作成されたインスタンス
|
||||
*/
|
||||
public static create(
|
||||
buffer: ArrayBuffer,
|
||||
size: number
|
||||
): CubismModelUserData {
|
||||
public static create(buffer: ArrayBuffer, size: number): CubismModelUserData {
|
||||
const ret: CubismModelUserData = new CubismModelUserData();
|
||||
|
||||
ret.parseUserData(buffer, size);
|
||||
|
@ -132,5 +123,14 @@ export namespace Live2DCubismFramework {
|
|||
|
||||
private _userDataNodes: csmVector<CubismModelUserDataNode>; // ユーザーデータ構造体配列
|
||||
private _artMeshUserDataNode: csmVector<CubismModelUserDataNode>; // 閲覧リストの保持
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismmodeluserdata';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismModelUserData = $.CubismModelUserData;
|
||||
export type CubismModelUserData = $.CubismModelUserData;
|
||||
export const CubismModelUserDataNode = $.CubismModelUserDataNode;
|
||||
export type CubismModelUserDataNode = $.CubismModelUserDataNode;
|
||||
}
|
||||
|
|
|
@ -5,23 +5,19 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as cubismjson } from '../utils/cubismjson';
|
||||
import { Live2DCubismFramework as cubismid } from '../id/cubismid';
|
||||
import { Live2DCubismFramework as cubismframework } from '../live2dcubismframework';
|
||||
import CubismFramework = cubismframework.CubismFramework;
|
||||
import CubismIdHandle = cubismid.CubismIdHandle;
|
||||
import CubismJson = cubismjson.CubismJson;
|
||||
import { CubismIdHandle } from '../id/cubismid';
|
||||
import { CubismFramework } from '../live2dcubismframework';
|
||||
import { CubismJson } from '../utils/cubismjson';
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
const Meta = 'Meta';
|
||||
const UserDataCount = 'UserDataCount';
|
||||
const TotalUserDataSize = 'TotalUserDataSize';
|
||||
const UserData = 'UserData';
|
||||
const Target = 'Target';
|
||||
const Id = 'Id';
|
||||
const Value = 'Value';
|
||||
const Meta = 'Meta';
|
||||
const UserDataCount = 'UserDataCount';
|
||||
const TotalUserDataSize = 'TotalUserDataSize';
|
||||
const UserData = 'UserData';
|
||||
const Target = 'Target';
|
||||
const Id = 'Id';
|
||||
const Value = 'Value';
|
||||
|
||||
export class CubismModelUserDataJson {
|
||||
export class CubismModelUserDataJson {
|
||||
/**
|
||||
* コンストラクタ
|
||||
* @param buffer userdata3.jsonが読み込まれているバッファ
|
||||
|
@ -110,5 +106,12 @@ export namespace Live2DCubismFramework {
|
|||
}
|
||||
|
||||
private _json: CubismJson;
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismmodeluserdatajson';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismModelUserDataJson = $.CubismModelUserDataJson;
|
||||
export type CubismModelUserDataJson = $.CubismModelUserDataJson;
|
||||
}
|
||||
|
|
|
@ -5,52 +5,32 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as cubismframework } from '../live2dcubismframework';
|
||||
import { Live2DCubismFramework as cubismmotionmanager } from '../motion/cubismmotionmanager';
|
||||
import { Live2DCubismFramework as cubismtargetpoint } from '../math/cubismtargetpoint';
|
||||
import { Live2DCubismFramework as cubismmodelmatrix } from '../math/cubismmodelmatrix';
|
||||
import { Live2DCubismFramework as cubismmoc } from './cubismmoc';
|
||||
import { Live2DCubismFramework as cubismmodel } from './cubismmodel';
|
||||
import { Live2DCubismFramework as acubismmotion } from '../motion/acubismmotion';
|
||||
import { Live2DCubismFramework as cubismmotion } from '../motion/cubismmotion';
|
||||
import { Live2DCubismFramework as cubismexpressionmotion } from '../motion/cubismexpressionmotion';
|
||||
import { Live2DCubismFramework as cubismpose } from '../effect/cubismpose';
|
||||
import { Live2DCubismFramework as cubismmodeluserdata } from './cubismmodeluserdata';
|
||||
import { Live2DCubismFramework as cubismphysics } from '../physics/cubismphysics';
|
||||
import { Live2DCubismFramework as cubismid } from '../id/cubismid';
|
||||
import { Live2DCubismFramework as csmstring } from '../type/csmstring';
|
||||
import { Live2DCubismFramework as cubismmotionqueuemanager } from '../motion/cubismmotionqueuemanager';
|
||||
import { Live2DCubismFramework as cubismbreath } from '../effect/cubismbreath';
|
||||
import { Live2DCubismFramework as cubismeyeblink } from '../effect/cubismeyeblink';
|
||||
import { Live2DCubismFramework as cubismrenderer_webgl } from '../rendering/cubismrenderer_webgl';
|
||||
import { CubismBreath } from '../effect/cubismbreath';
|
||||
import { CubismEyeBlink } from '../effect/cubismeyeblink';
|
||||
import { CubismPose } from '../effect/cubismpose';
|
||||
import { CubismIdHandle } from '../id/cubismid';
|
||||
import { Constant } from '../live2dcubismframework';
|
||||
import { CubismModelMatrix } from '../math/cubismmodelmatrix';
|
||||
import { CubismTargetPoint } from '../math/cubismtargetpoint';
|
||||
import { ACubismMotion, FinishedMotionCallback } from '../motion/acubismmotion';
|
||||
import { CubismExpressionMotion } from '../motion/cubismexpressionmotion';
|
||||
import { CubismMotion } from '../motion/cubismmotion';
|
||||
import { CubismMotionManager } from '../motion/cubismmotionmanager';
|
||||
import { CubismMotionQueueManager } from '../motion/cubismmotionqueuemanager';
|
||||
import { CubismPhysics } from '../physics/cubismphysics';
|
||||
import { CubismRenderer_WebGL } from '../rendering/cubismrenderer_webgl';
|
||||
import { csmString } from '../type/csmstring';
|
||||
import { CubismLogError, CubismLogInfo } from '../utils/cubismdebug';
|
||||
import CubismRenderer_WebGL = cubismrenderer_webgl.CubismRenderer_WebGL;
|
||||
import CubismEyeBlink = cubismeyeblink.CubismEyeBlink;
|
||||
import CubismBreath = cubismbreath.CubismBreath;
|
||||
import CubismMotionQueueManager = cubismmotionqueuemanager.CubismMotionQueueManager;
|
||||
import csmString = csmstring.csmString;
|
||||
import Constant = cubismframework.Constant;
|
||||
import CubismIdHandle = cubismid.CubismIdHandle;
|
||||
import CubismPhysics = cubismphysics.CubismPhysics;
|
||||
import CubismModelUserData = cubismmodeluserdata.CubismModelUserData;
|
||||
import CubismPose = cubismpose.CubismPose;
|
||||
import CubismExpressionMotion = cubismexpressionmotion.CubismExpressionMotion;
|
||||
import CubismMotion = cubismmotion.CubismMotion;
|
||||
import ACubismMotion = acubismmotion.ACubismMotion;
|
||||
import FinishedMotionCallback = acubismmotion.FinishedMotionCallback;
|
||||
import CubismModel = cubismmodel.CubismModel;
|
||||
import CubismMoc = cubismmoc.CubismMoc;
|
||||
import CubismModelMatrix = cubismmodelmatrix.CubismModelMatrix;
|
||||
import CubismTargetPoint = cubismtargetpoint.CubismTargetPoint;
|
||||
import CubismMotionManager = cubismmotionmanager.CubismMotionManager;
|
||||
import { CubismMoc } from './cubismmoc';
|
||||
import { CubismModel } from './cubismmodel';
|
||||
import { CubismModelUserData } from './cubismmodeluserdata';
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
/**
|
||||
/**
|
||||
* ユーザーが実際に使用するモデル
|
||||
*
|
||||
* ユーザーが実際に使用するモデルの基底クラス。これを継承してユーザーが実装する。
|
||||
*/
|
||||
export class CubismUserModel {
|
||||
export class CubismUserModel {
|
||||
/**
|
||||
* 初期化状態の取得
|
||||
*
|
||||
|
@ -449,5 +429,12 @@ export namespace Live2DCubismFramework {
|
|||
protected _debugMode: boolean; // デバッグモードかどうか
|
||||
|
||||
private _renderer: CubismRenderer_WebGL; // レンダラ
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismusermodel';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismUserModel = $.CubismUserModel;
|
||||
export type CubismUserModel = $.CubismUserModel;
|
||||
}
|
||||
|
|
|
@ -5,28 +5,22 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as cubismmath } from '../math/cubismmath';
|
||||
import { Live2DCubismFramework as cubismmodel } from '../model/cubismmodel';
|
||||
import { Live2DCubismFramework as cubismmotionqueueentry } from './cubismmotionqueueentry';
|
||||
import { Live2DCubismFramework as csmstring } from '../type/csmstring';
|
||||
import { Live2DCubismFramework as csmvector } from '../type/csmvector';
|
||||
import { CubismMath } from '../math/cubismmath';
|
||||
import { CubismModel } from '../model/cubismmodel';
|
||||
import { csmString } from '../type/csmstring';
|
||||
import { csmVector } from '../type/csmvector';
|
||||
import { CSM_ASSERT } from '../utils/cubismdebug';
|
||||
import csmVector = csmvector.csmVector;
|
||||
import csmString = csmstring.csmString;
|
||||
import CubismMotionQueueEntry = cubismmotionqueueentry.CubismMotionQueueEntry;
|
||||
import CubismModel = cubismmodel.CubismModel;
|
||||
import CubismMath = cubismmath.CubismMath;
|
||||
import { CubismMotionQueueEntry } from './cubismmotionqueueentry';
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
/** モーション再生終了コールバック関数定義 */
|
||||
export type FinishedMotionCallback = (self: ACubismMotion) => void;
|
||||
/** モーション再生終了コールバック関数定義 */
|
||||
export type FinishedMotionCallback = (self: ACubismMotion) => void;
|
||||
|
||||
/**
|
||||
/**
|
||||
* モーションの抽象基底クラス
|
||||
*
|
||||
* モーションの抽象基底クラス。MotionQueueManagerによってモーションの再生を管理する。
|
||||
*/
|
||||
export abstract class ACubismMotion {
|
||||
export abstract class ACubismMotion {
|
||||
/**
|
||||
* インスタンスの破棄
|
||||
*/
|
||||
|
@ -274,5 +268,13 @@ export namespace Live2DCubismFramework {
|
|||
|
||||
// モーション再生終了コールバック関数
|
||||
public _onFinishedMotion?: FinishedMotionCallback;
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './acubismmotion';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const ACubismMotion = $.ACubismMotion;
|
||||
export type ACubismMotion = $.ACubismMotion;
|
||||
export type FinishedMotionCallback = $.FinishedMotionCallback;
|
||||
}
|
||||
|
|
|
@ -5,42 +5,32 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as acubismmotion } from './acubismmotion';
|
||||
import { Live2DCubismFramework as cubismjson } from '../utils/cubismjson';
|
||||
import { Live2DCubismFramework as cubismid } from '../id/cubismid';
|
||||
import { Live2DCubismFramework as cubismframework } from '../live2dcubismframework';
|
||||
import { Live2DCubismFramework as cubismmodel } from '../model/cubismmodel';
|
||||
import { Live2DCubismFramework as cubismmotionqueueentry } from './cubismmotionqueueentry';
|
||||
import { Live2DCubismFramework as csmvector } from '../type/csmvector';
|
||||
import JsonFloat = cubismjson.JsonFloat;
|
||||
import csmVector = csmvector.csmVector;
|
||||
import CubismMotionQueueEntry = cubismmotionqueueentry.CubismMotionQueueEntry;
|
||||
import CubismModel = cubismmodel.CubismModel;
|
||||
import CubismFramework = cubismframework.CubismFramework;
|
||||
import CubismIdHandle = cubismid.CubismIdHandle;
|
||||
import CubismJson = cubismjson.CubismJson;
|
||||
import Value = cubismjson.Value;
|
||||
import ACubismMotion = acubismmotion.ACubismMotion;
|
||||
import { CubismIdHandle } from '../id/cubismid';
|
||||
import { CubismFramework } from '../live2dcubismframework';
|
||||
import { CubismModel } from '../model/cubismmodel';
|
||||
import { csmVector } from '../type/csmvector';
|
||||
import { CubismJson, Value } from '../utils/cubismjson';
|
||||
import { ACubismMotion } from './acubismmotion';
|
||||
import { CubismMotionQueueEntry } from './cubismmotionqueueentry';
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
// exp3.jsonのキーとデフォルト
|
||||
const ExpressionKeyFadeIn = 'FadeInTime';
|
||||
const ExpressionKeyFadeOut = 'FadeOutTime';
|
||||
const ExpressionKeyParameters = 'Parameters';
|
||||
const ExpressionKeyId = 'Id';
|
||||
const ExpressionKeyValue = 'Value';
|
||||
const ExpressionKeyBlend = 'Blend';
|
||||
const BlendValueAdd = 'Add';
|
||||
const BlendValueMultiply = 'Multiply';
|
||||
const BlendValueOverwrite = 'Overwrite';
|
||||
const DefaultFadeTime = 1.0;
|
||||
// exp3.jsonのキーとデフォルト
|
||||
const ExpressionKeyFadeIn = 'FadeInTime';
|
||||
const ExpressionKeyFadeOut = 'FadeOutTime';
|
||||
const ExpressionKeyParameters = 'Parameters';
|
||||
const ExpressionKeyId = 'Id';
|
||||
const ExpressionKeyValue = 'Value';
|
||||
const ExpressionKeyBlend = 'Blend';
|
||||
const BlendValueAdd = 'Add';
|
||||
const BlendValueMultiply = 'Multiply';
|
||||
const BlendValueOverwrite = 'Overwrite';
|
||||
const DefaultFadeTime = 1.0;
|
||||
|
||||
/**
|
||||
/**
|
||||
* 表情のモーション
|
||||
*
|
||||
* 表情のモーションクラス。
|
||||
*/
|
||||
export class CubismExpressionMotion extends ACubismMotion {
|
||||
export class CubismExpressionMotion extends ACubismMotion {
|
||||
/**
|
||||
* インスタンスを作成する。
|
||||
* @param buffer expファイルが読み込まれているバッファ
|
||||
|
@ -86,8 +76,7 @@ export namespace Live2DCubismFramework {
|
|||
|
||||
if (
|
||||
param.getValueByString(ExpressionKeyBlend).isNull() ||
|
||||
param.getValueByString(ExpressionKeyBlend).getString() ==
|
||||
BlendValueAdd
|
||||
param.getValueByString(ExpressionKeyBlend).getString() == BlendValueAdd
|
||||
) {
|
||||
blendType = ExpressionBlendType.ExpressionBlendType_Add;
|
||||
} else if (
|
||||
|
@ -177,23 +166,34 @@ export namespace Live2DCubismFramework {
|
|||
}
|
||||
|
||||
_parameters: csmVector<ExpressionParameter>; // 表情のパラメータ情報リスト
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 表情パラメータ値の計算方式
|
||||
*/
|
||||
export enum ExpressionBlendType {
|
||||
export enum ExpressionBlendType {
|
||||
ExpressionBlendType_Add = 0, // 加算
|
||||
ExpressionBlendType_Multiply = 1, // 乗算
|
||||
ExpressionBlendType_Overwrite = 2 // 上書き
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 表情のパラメータ情報
|
||||
*/
|
||||
export class ExpressionParameter {
|
||||
export class ExpressionParameter {
|
||||
parameterId: CubismIdHandle; // パラメータID
|
||||
blendType: ExpressionBlendType; // パラメータの演算種類
|
||||
value: number; // 値
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismexpressionmotion';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismExpressionMotion = $.CubismExpressionMotion;
|
||||
export type CubismExpressionMotion = $.CubismExpressionMotion;
|
||||
export const ExpressionBlendType = $.ExpressionBlendType;
|
||||
export type ExpressionBlendType = $.ExpressionBlendType;
|
||||
export const ExpressionParameter = $.ExpressionParameter;
|
||||
export type ExpressionParameter = $.ExpressionParameter;
|
||||
}
|
||||
|
|
|
@ -5,56 +5,46 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as cubismmotionjson } from './cubismmotionjson';
|
||||
import { Live2DCubismFramework as cubismmotioninternal } from './cubismmotioninternal';
|
||||
import { Live2DCubismFramework as acubismmotion } from './acubismmotion';
|
||||
import { Live2DCubismFramework as cubismmodel } from '../model/cubismmodel';
|
||||
import { Live2DCubismFramework as cubismframework } from '../live2dcubismframework';
|
||||
import { Live2DCubismFramework as cubismmotionqueueentry } from './cubismmotionqueueentry';
|
||||
import { Live2DCubismFramework as cubismmath } from '../math/cubismmath';
|
||||
import { Live2DCubismFramework as csmvector } from '../type/csmvector';
|
||||
import { Live2DCubismFramework as cubismid } from '../id/cubismid';
|
||||
import { Live2DCubismFramework as csmstring } from '../type/csmstring';
|
||||
import { CubismLogDebug, CSM_ASSERT } from '../utils/cubismdebug';
|
||||
import csmString = csmstring.csmString;
|
||||
import CubismMotionData = cubismmotioninternal.CubismMotionData;
|
||||
import CubismMotionSegment = cubismmotioninternal.CubismMotionSegment;
|
||||
import CubismMotionPoint = cubismmotioninternal.CubismMotionPoint;
|
||||
import CubismMotionEvent = cubismmotioninternal.CubismMotionEvent;
|
||||
import CubismMotionSegmentType = cubismmotioninternal.CubismMotionSegmentType;
|
||||
import CubismIdHandle = cubismid.CubismIdHandle;
|
||||
import CubismMotionCurve = cubismmotioninternal.CubismMotionCurve;
|
||||
import CubismMotionCurveTarget = cubismmotioninternal.CubismMotionCurveTarget;
|
||||
import csmVector = csmvector.csmVector;
|
||||
import CubismMath = cubismmath.CubismMath;
|
||||
import CubismMotionQueueEntry = cubismmotionqueueentry.CubismMotionQueueEntry;
|
||||
import CubismFramework = cubismframework.CubismFramework;
|
||||
import CubismModel = cubismmodel.CubismModel;
|
||||
import ACubismMotion = acubismmotion.ACubismMotion;
|
||||
import FinishedMotionCallback = acubismmotion.FinishedMotionCallback;
|
||||
import CubismMotionJson = cubismmotionjson.CubismMotionJson;
|
||||
import { CubismIdHandle } from '../id/cubismid';
|
||||
import { CubismFramework } from '../live2dcubismframework';
|
||||
import { CubismMath } from '../math/cubismmath';
|
||||
import { CubismModel } from '../model/cubismmodel';
|
||||
import { csmString } from '../type/csmstring';
|
||||
import { csmVector } from '../type/csmvector';
|
||||
import { CSM_ASSERT, CubismLogDebug } from '../utils/cubismdebug';
|
||||
import { ACubismMotion, FinishedMotionCallback } from './acubismmotion';
|
||||
import {
|
||||
CubismMotionCurve,
|
||||
CubismMotionCurveTarget,
|
||||
CubismMotionData,
|
||||
CubismMotionEvent,
|
||||
CubismMotionPoint,
|
||||
CubismMotionSegment,
|
||||
CubismMotionSegmentType
|
||||
} from './cubismmotioninternal';
|
||||
import { CubismMotionJson } from './cubismmotionjson';
|
||||
import { CubismMotionQueueEntry } from './cubismmotionqueueentry';
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
const EffectNameEyeBlink = 'EyeBlink';
|
||||
const EffectNameLipSync = 'LipSync';
|
||||
const TargetNameModel = 'Model';
|
||||
const TargetNameParameter = 'Parameter';
|
||||
const TargetNamePartOpacity = 'PartOpacity';
|
||||
const EffectNameEyeBlink = 'EyeBlink';
|
||||
const EffectNameLipSync = 'LipSync';
|
||||
const TargetNameModel = 'Model';
|
||||
const TargetNameParameter = 'Parameter';
|
||||
const TargetNamePartOpacity = 'PartOpacity';
|
||||
|
||||
function lerpPoints(
|
||||
function lerpPoints(
|
||||
a: CubismMotionPoint,
|
||||
b: CubismMotionPoint,
|
||||
t: number
|
||||
): CubismMotionPoint {
|
||||
): CubismMotionPoint {
|
||||
const result: CubismMotionPoint = new CubismMotionPoint();
|
||||
|
||||
result.time = a.time + (b.time - a.time) * t;
|
||||
result.value = a.value + (b.value - a.value) * t;
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
function linearEvaluate(points: CubismMotionPoint[], time: number): number {
|
||||
function linearEvaluate(points: CubismMotionPoint[], time: number): number {
|
||||
let t: number = (time - points[0].time) / (points[1].time - points[0].time);
|
||||
|
||||
if (t < 0.0) {
|
||||
|
@ -62,9 +52,9 @@ export namespace Live2DCubismFramework {
|
|||
}
|
||||
|
||||
return points[0].value + (points[1].value - points[0].value) * t;
|
||||
}
|
||||
}
|
||||
|
||||
function bezierEvaluate(points: CubismMotionPoint[], time: number): number {
|
||||
function bezierEvaluate(points: CubismMotionPoint[], time: number): number {
|
||||
let t: number = (time - points[0].time) / (points[3].time - points[0].time);
|
||||
|
||||
if (t < 0.0) {
|
||||
|
@ -79,30 +69,29 @@ export namespace Live2DCubismFramework {
|
|||
const p123: CubismMotionPoint = lerpPoints(p12, p23, t);
|
||||
|
||||
return lerpPoints(p012, p123, t).value;
|
||||
}
|
||||
}
|
||||
|
||||
function steppedEvaluate(points: CubismMotionPoint[], time: number): number {
|
||||
function steppedEvaluate(points: CubismMotionPoint[], time: number): number {
|
||||
return points[0].value;
|
||||
}
|
||||
}
|
||||
|
||||
function inverseSteppedEvaluate(
|
||||
function inverseSteppedEvaluate(
|
||||
points: CubismMotionPoint[],
|
||||
time: number
|
||||
): number {
|
||||
): number {
|
||||
return points[1].value;
|
||||
}
|
||||
}
|
||||
|
||||
function evaluateCurve(
|
||||
function evaluateCurve(
|
||||
motionData: CubismMotionData,
|
||||
index: number,
|
||||
time: number
|
||||
): number {
|
||||
): number {
|
||||
// Find segment to evaluate.
|
||||
const curve: CubismMotionCurve = motionData.curves.at(index);
|
||||
|
||||
let target = -1;
|
||||
const totalSegmentCount: number =
|
||||
curve.baseSegmentIndex + curve.segmentCount;
|
||||
const totalSegmentCount: number = curve.baseSegmentIndex + curve.segmentCount;
|
||||
let pointPosition = 0;
|
||||
for (let i: number = curve.baseSegmentIndex; i < totalSegmentCount; ++i) {
|
||||
// Get first point of next segment.
|
||||
|
@ -126,18 +115,15 @@ export namespace Live2DCubismFramework {
|
|||
|
||||
const segment: CubismMotionSegment = motionData.segments.at(target);
|
||||
|
||||
return segment.evaluate(
|
||||
motionData.points.get(segment.basePointIndex),
|
||||
time
|
||||
);
|
||||
}
|
||||
return segment.evaluate(motionData.points.get(segment.basePointIndex), time);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* モーションクラス
|
||||
*
|
||||
* モーションのクラス。
|
||||
*/
|
||||
export class CubismMotion extends ACubismMotion {
|
||||
export class CubismMotion extends ACubismMotion {
|
||||
/**
|
||||
* インスタンスを作成する
|
||||
*
|
||||
|
@ -677,9 +663,7 @@ export namespace Live2DCubismFramework {
|
|||
if (json.getMotionCurveTarget(curveCount) == TargetNameModel) {
|
||||
this._motionData.curves.at(curveCount).type =
|
||||
CubismMotionCurveTarget.CubismMotionCurveTarget_Model;
|
||||
} else if (
|
||||
json.getMotionCurveTarget(curveCount) == TargetNameParameter
|
||||
) {
|
||||
} else if (json.getMotionCurveTarget(curveCount) == TargetNameParameter) {
|
||||
this._motionData.curves.at(curveCount).type =
|
||||
CubismMotionCurveTarget.CubismMotionCurveTarget_Parameter;
|
||||
} else if (
|
||||
|
@ -724,10 +708,7 @@ export namespace Live2DCubismFramework {
|
|||
).time = json.getMotionCurveSegment(curveCount, segmentPosition);
|
||||
this._motionData.points.at(
|
||||
totalPointCount
|
||||
).value = json.getMotionCurveSegment(
|
||||
curveCount,
|
||||
segmentPosition + 1
|
||||
);
|
||||
).value = json.getMotionCurveSegment(curveCount, segmentPosition + 1);
|
||||
|
||||
totalPointCount += 1;
|
||||
segmentPosition += 2;
|
||||
|
@ -941,5 +922,12 @@ export namespace Live2DCubismFramework {
|
|||
|
||||
public _modelCurveIdEyeBlink: CubismIdHandle; // モデルが持つ自動まばたき用パラメータIDのハンドル。 モデルとモーションを対応付ける。
|
||||
public _modelCurveIdLipSync: CubismIdHandle; // モデルが持つリップシンク用パラメータIDのハンドル。 モデルとモーションを対応付ける。
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismmotion';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismMotion = $.CubismMotion;
|
||||
export type CubismMotion = $.CubismMotion;
|
||||
}
|
||||
|
|
|
@ -5,63 +5,59 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as cubismid } from '../id/cubismid';
|
||||
import { Live2DCubismFramework as csmstring } from '../type/csmstring';
|
||||
import { Live2DCubismFramework as csmvector } from '../type/csmvector';
|
||||
import csmVector = csmvector.csmVector;
|
||||
import csmString = csmstring.csmString;
|
||||
import CubismIdHandle = cubismid.CubismIdHandle;
|
||||
import { CubismIdHandle } from '../id/cubismid';
|
||||
import { csmString } from '../type/csmstring';
|
||||
import { csmVector } from '../type/csmvector';
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
/**
|
||||
/**
|
||||
* @brief モーションカーブの種類
|
||||
*
|
||||
* モーションカーブの種類。
|
||||
*/
|
||||
export enum CubismMotionCurveTarget {
|
||||
export enum CubismMotionCurveTarget {
|
||||
CubismMotionCurveTarget_Model, // モデルに対して
|
||||
CubismMotionCurveTarget_Parameter, // パラメータに対して
|
||||
CubismMotionCurveTarget_PartOpacity // パーツの不透明度に対して
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief モーションカーブのセグメントの種類
|
||||
*
|
||||
* モーションカーブのセグメントの種類。
|
||||
*/
|
||||
export enum CubismMotionSegmentType {
|
||||
export enum CubismMotionSegmentType {
|
||||
CubismMotionSegmentType_Linear = 0, // リニア
|
||||
CubismMotionSegmentType_Bezier = 1, // ベジェ曲線
|
||||
CubismMotionSegmentType_Stepped = 2, // ステップ
|
||||
CubismMotionSegmentType_InverseStepped = 3 // インバースステップ
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief モーションカーブの制御点
|
||||
*
|
||||
* モーションカーブの制御点。
|
||||
*/
|
||||
export class CubismMotionPoint {
|
||||
export class CubismMotionPoint {
|
||||
time = 0.0; // 時間[秒]
|
||||
value = 0.0; // 値
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* モーションカーブのセグメントの評価関数
|
||||
*
|
||||
* @param points モーションカーブの制御点リスト
|
||||
* @param time 評価する時間[秒]
|
||||
*/
|
||||
export interface csmMotionSegmentEvaluationFunction {
|
||||
export interface csmMotionSegmentEvaluationFunction {
|
||||
(points: CubismMotionPoint[], time: number): number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief モーションカーブのセグメント
|
||||
*
|
||||
* モーションカーブのセグメント。
|
||||
*/
|
||||
export class CubismMotionSegment {
|
||||
export class CubismMotionSegment {
|
||||
/**
|
||||
* @brief コンストラクタ
|
||||
*
|
||||
|
@ -76,14 +72,14 @@ export namespace Live2DCubismFramework {
|
|||
evaluate: csmMotionSegmentEvaluationFunction; // 使用する評価関数
|
||||
basePointIndex: number; // 最初のセグメントへのインデックス
|
||||
segmentType: number; // セグメントの種類
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief モーションカーブ
|
||||
*
|
||||
* モーションカーブ。
|
||||
*/
|
||||
export class CubismMotionCurve {
|
||||
export class CubismMotionCurve {
|
||||
public constructor() {
|
||||
this.type = CubismMotionCurveTarget.CubismMotionCurveTarget_Model;
|
||||
this.segmentCount = 0;
|
||||
|
@ -98,22 +94,22 @@ export namespace Live2DCubismFramework {
|
|||
baseSegmentIndex: number; // 最初のセグメントのインデックス
|
||||
fadeInTime: number; // フェードインにかかる時間[秒]
|
||||
fadeOutTime: number; // フェードアウトにかかる時間[秒]
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* イベント。
|
||||
*/
|
||||
export class CubismMotionEvent {
|
||||
export class CubismMotionEvent {
|
||||
fireTime = 0.0;
|
||||
value: csmString;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief モーションデータ
|
||||
*
|
||||
* モーションデータ。
|
||||
*/
|
||||
export class CubismMotionData {
|
||||
export class CubismMotionData {
|
||||
public constructor() {
|
||||
this.duration = 0.0;
|
||||
this.loop = false;
|
||||
|
@ -136,5 +132,25 @@ export namespace Live2DCubismFramework {
|
|||
segments: csmVector<CubismMotionSegment>; // セグメントのリスト
|
||||
points: csmVector<CubismMotionPoint>; // ポイントのリスト
|
||||
events: csmVector<CubismMotionEvent>; // イベントのリスト
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismmotioninternal';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismMotionCurve = $.CubismMotionCurve;
|
||||
export type CubismMotionCurve = $.CubismMotionCurve;
|
||||
export const CubismMotionCurveTarget = $.CubismMotionCurveTarget;
|
||||
export type CubismMotionCurveTarget = $.CubismMotionCurveTarget;
|
||||
export const CubismMotionData = $.CubismMotionData;
|
||||
export type CubismMotionData = $.CubismMotionData;
|
||||
export const CubismMotionEvent = $.CubismMotionEvent;
|
||||
export type CubismMotionEvent = $.CubismMotionEvent;
|
||||
export const CubismMotionPoint = $.CubismMotionPoint;
|
||||
export type CubismMotionPoint = $.CubismMotionPoint;
|
||||
export const CubismMotionSegment = $.CubismMotionSegment;
|
||||
export type CubismMotionSegment = $.CubismMotionSegment;
|
||||
export const CubismMotionSegmentType = $.CubismMotionSegmentType;
|
||||
export type CubismMotionSegmentType = $.CubismMotionSegmentType;
|
||||
export type csmMotionSegmentEvaluationFunction = $.csmMotionSegmentEvaluationFunction;
|
||||
}
|
||||
|
|
|
@ -5,40 +5,35 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as cubismjson } from '../utils/cubismjson';
|
||||
import { Live2DCubismFramework as cubismid } from '../id/cubismid';
|
||||
import { Live2DCubismFramework as cubismframework } from '../live2dcubismframework';
|
||||
import { Live2DCubismFramework as csmstring } from '../type/csmstring';
|
||||
import csmString = csmstring.csmString;
|
||||
import CubismFramework = cubismframework.CubismFramework;
|
||||
import CubismIdHandle = cubismid.CubismIdHandle;
|
||||
import CubismJson = cubismjson.CubismJson;
|
||||
import { CubismIdHandle } from '../id/cubismid';
|
||||
import { CubismFramework } from '../live2dcubismframework';
|
||||
import { csmString } from '../type/csmstring';
|
||||
import { CubismJson } from '../utils/cubismjson';
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
// JSON keys
|
||||
const Meta = 'Meta';
|
||||
const Duration = 'Duration';
|
||||
const Loop = 'Loop';
|
||||
const CurveCount = 'CurveCount';
|
||||
const Fps = 'Fps';
|
||||
const TotalSegmentCount = 'TotalSegmentCount';
|
||||
const TotalPointCount = 'TotalPointCount';
|
||||
const Curves = 'Curves';
|
||||
const Target = 'Target';
|
||||
const Id = 'Id';
|
||||
const FadeInTime = 'FadeInTime';
|
||||
const FadeOutTime = 'FadeOutTime';
|
||||
const Segments = 'Segments';
|
||||
const UserData = 'UserData';
|
||||
const UserDataCount = 'UserDataCount';
|
||||
const TotalUserDataSize = 'TotalUserDataSize';
|
||||
const Time = 'Time';
|
||||
const Value = 'Value';
|
||||
// JSON keys
|
||||
const Meta = 'Meta';
|
||||
const Duration = 'Duration';
|
||||
const Loop = 'Loop';
|
||||
const CurveCount = 'CurveCount';
|
||||
const Fps = 'Fps';
|
||||
const TotalSegmentCount = 'TotalSegmentCount';
|
||||
const TotalPointCount = 'TotalPointCount';
|
||||
const Curves = 'Curves';
|
||||
const Target = 'Target';
|
||||
const Id = 'Id';
|
||||
const FadeInTime = 'FadeInTime';
|
||||
const FadeOutTime = 'FadeOutTime';
|
||||
const Segments = 'Segments';
|
||||
const UserData = 'UserData';
|
||||
const UserDataCount = 'UserDataCount';
|
||||
const TotalUserDataSize = 'TotalUserDataSize';
|
||||
const Time = 'Time';
|
||||
const Value = 'Value';
|
||||
|
||||
/**
|
||||
/**
|
||||
* motion3.jsonのコンテナ。
|
||||
*/
|
||||
export class CubismMotionJson {
|
||||
export class CubismMotionJson {
|
||||
/**
|
||||
* コンストラクタ
|
||||
* @param buffer motion3.jsonが読み込まれているバッファ
|
||||
|
@ -355,5 +350,12 @@ export namespace Live2DCubismFramework {
|
|||
}
|
||||
|
||||
_json: CubismJson; // motion3.jsonのデータ
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismmotionjson';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismMotionJson = $.CubismMotionJson;
|
||||
export type CubismMotionJson = $.CubismMotionJson;
|
||||
}
|
||||
|
|
|
@ -5,21 +5,19 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as cubismmotionqueuemanager } from './cubismmotionqueuemanager';
|
||||
import { Live2DCubismFramework as acubismmotion } from './acubismmotion';
|
||||
import { Live2DCubismFramework as cubismmodel } from '../model/cubismmodel';
|
||||
import CubismMotionQueueEntryHandle = cubismmotionqueuemanager.CubismMotionQueueEntryHandle;
|
||||
import CubismModel = cubismmodel.CubismModel;
|
||||
import ACubismMotion = acubismmotion.ACubismMotion;
|
||||
import CubismMotionQueueManager = cubismmotionqueuemanager.CubismMotionQueueManager;
|
||||
import { CubismModel } from '../model/cubismmodel';
|
||||
import { ACubismMotion } from './acubismmotion';
|
||||
import {
|
||||
CubismMotionQueueEntryHandle,
|
||||
CubismMotionQueueManager
|
||||
} from './cubismmotionqueuemanager';
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
/**
|
||||
/**
|
||||
* モーションの管理
|
||||
*
|
||||
* モーションの管理を行うクラス
|
||||
*/
|
||||
export class CubismMotionManager extends CubismMotionQueueManager {
|
||||
export class CubismMotionManager extends CubismMotionQueueManager {
|
||||
/**
|
||||
* コンストラクタ
|
||||
*/
|
||||
|
@ -86,10 +84,7 @@ export namespace Live2DCubismFramework {
|
|||
public updateMotion(model: CubismModel, deltaTimeSeconds: number): boolean {
|
||||
this._userTimeSeconds += deltaTimeSeconds;
|
||||
|
||||
const updated: boolean = super.doUpdateMotion(
|
||||
model,
|
||||
this._userTimeSeconds
|
||||
);
|
||||
const updated: boolean = super.doUpdateMotion(model, this._userTimeSeconds);
|
||||
|
||||
if (this.isFinished()) {
|
||||
this._currentPriority = 0; // 再生中のモーションの優先度を解除
|
||||
|
@ -120,5 +115,12 @@ export namespace Live2DCubismFramework {
|
|||
|
||||
_currentPriority: number; // 現在再生中のモーションの優先度
|
||||
_reservePriority: number; // 再生予定のモーションの優先度。再生中は0になる。モーションファイルを別スレッドで読み込むときの機能。
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismmotionmanager';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismMotionManager = $.CubismMotionManager;
|
||||
export type CubismMotionManager = $.CubismMotionManager;
|
||||
}
|
||||
|
|
|
@ -5,16 +5,13 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as acubismmotion } from './acubismmotion';
|
||||
import { Live2DCubismFramework as cubismmotionqueuemanager } from './cubismmotionqueuemanager';
|
||||
import CubismMotionQueueEntryHandle = cubismmotionqueuemanager.CubismMotionQueueEntryHandle;
|
||||
import ACubismMotion = acubismmotion.ACubismMotion;
|
||||
import { ACubismMotion } from './acubismmotion';
|
||||
import { CubismMotionQueueEntryHandle } from './cubismmotionqueuemanager';
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
/**
|
||||
/**
|
||||
* CubismMotionQueueManagerで再生している各モーションの管理クラス。
|
||||
*/
|
||||
export class CubismMotionQueueEntry {
|
||||
export class CubismMotionQueueEntry {
|
||||
/**
|
||||
* コンストラクタ
|
||||
*/
|
||||
|
@ -245,5 +242,12 @@ export namespace Live2DCubismFramework {
|
|||
private _isTriggeredFadeOut: boolean; // フェードアウト開始フラグ
|
||||
|
||||
_motionQueueEntryHandle: CubismMotionQueueEntryHandle; // インスタンスごとに一意の値を持つ識別番号
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismmotionqueueentry';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismMotionQueueEntry = $.CubismMotionQueueEntry;
|
||||
export type CubismMotionQueueEntry = $.CubismMotionQueueEntry;
|
||||
}
|
||||
|
|
|
@ -5,20 +5,13 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as acubismmotion } from './acubismmotion';
|
||||
import { Live2DCubismFramework as cubismmotionqueueentry } from './cubismmotionqueueentry';
|
||||
import { Live2DCubismFramework as csmvector } from '../type/csmvector';
|
||||
import { Live2DCubismFramework as cubismmodel } from '../model/cubismmodel';
|
||||
import { Live2DCubismFramework as csmstring } from '../type/csmstring';
|
||||
import csmString = csmstring.csmString;
|
||||
import CubismModel = cubismmodel.CubismModel;
|
||||
import csmVector = csmvector.csmVector;
|
||||
import iterator = csmvector.iterator;
|
||||
import CubismMotionQueueEntry = cubismmotionqueueentry.CubismMotionQueueEntry;
|
||||
import ACubismMotion = acubismmotion.ACubismMotion;
|
||||
import { ACubismMotion } from './acubismmotion';
|
||||
import { CubismMotionQueueEntry } from './cubismmotionqueueentry';
|
||||
import { csmVector, iterator } from '../type/csmvector';
|
||||
import { CubismModel } from '../model/cubismmodel';
|
||||
import { csmString } from '../type/csmstring';
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
/**
|
||||
/**
|
||||
* モーション再生の管理
|
||||
*
|
||||
* モーション再生の管理用クラス。CubismMotionモーションなどACubismMotionのサブクラスを再生するために使用する。
|
||||
|
@ -27,7 +20,7 @@ export namespace Live2DCubismFramework {
|
|||
* 表情用モーション、体用モーションなどを分けてモーション化した場合など、
|
||||
* 複数のモーションを同時に再生させる場合は、複数のCubismMotionQueueManagerインスタンスを使用する。
|
||||
*/
|
||||
export class CubismMotionQueueManager {
|
||||
export class CubismMotionQueueManager {
|
||||
/**
|
||||
* コンストラクタ
|
||||
*/
|
||||
|
@ -217,9 +210,7 @@ export namespace Live2DCubismFramework {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (
|
||||
motionQueueEntry._motionQueueEntryHandle == motionQueueEntryNumber
|
||||
) {
|
||||
if (motionQueueEntry._motionQueueEntryHandle == motionQueueEntryNumber) {
|
||||
return motionQueueEntry;
|
||||
}
|
||||
}
|
||||
|
@ -249,10 +240,7 @@ export namespace Live2DCubismFramework {
|
|||
* @return true モデルへパラメータ値の反映あり
|
||||
* @return false モデルへパラメータ値の反映なし(モーションの変化なし)
|
||||
*/
|
||||
public doUpdateMotion(
|
||||
model: CubismModel,
|
||||
userTimeSeconds: number
|
||||
): boolean {
|
||||
public doUpdateMotion(model: CubismModel, userTimeSeconds: number): boolean {
|
||||
let updated = false;
|
||||
|
||||
// ------- 処理を行う --------
|
||||
|
@ -322,9 +310,9 @@ export namespace Live2DCubismFramework {
|
|||
_motions: csmVector<CubismMotionQueueEntry>; // モーション
|
||||
_eventCallBack: CubismMotionEventFunction; // コールバック関数
|
||||
_eventCustomData: any; // コールバックに戻されるデータ
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* イベントのコールバック関数を定義
|
||||
*
|
||||
* イベントのコールバックに登録できる関数の型情報
|
||||
|
@ -332,19 +320,30 @@ export namespace Live2DCubismFramework {
|
|||
* @param eventValue 発火したイベントの文字列データ
|
||||
* @param customData コールバックに返される登録時に指定されたデータ
|
||||
*/
|
||||
export interface CubismMotionEventFunction {
|
||||
export interface CubismMotionEventFunction {
|
||||
(
|
||||
caller: CubismMotionQueueManager,
|
||||
eventValue: csmString,
|
||||
customData: any
|
||||
): void;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* モーションの識別番号
|
||||
*
|
||||
* モーションの識別番号の定義
|
||||
*/
|
||||
export declare type CubismMotionQueueEntryHandle = any;
|
||||
export const InvalidMotionQueueEntryHandleValue: CubismMotionQueueEntryHandle = -1;
|
||||
export declare type CubismMotionQueueEntryHandle = any;
|
||||
export const InvalidMotionQueueEntryHandleValue: CubismMotionQueueEntryHandle = -1;
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismmotionqueuemanager';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismMotionQueueManager = $.CubismMotionQueueManager;
|
||||
export type CubismMotionQueueManager = $.CubismMotionQueueManager;
|
||||
export const InvalidMotionQueueEntryHandleValue =
|
||||
$.InvalidMotionQueueEntryHandleValue;
|
||||
export type CubismMotionQueueEntryHandle = $.CubismMotionQueueEntryHandle;
|
||||
export type CubismMotionEventFunction = $.CubismMotionEventFunction;
|
||||
}
|
||||
|
|
|
@ -5,43 +5,39 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as cubismphysicsinternal } from './cubismphysicsinternal';
|
||||
import { Live2DCubismFramework as cubismmodel } from '../model/cubismmodel';
|
||||
import { Live2DCubismFramework as cubismvector2 } from '../math/cubismvector2';
|
||||
import { Live2DCubismFramework as cubismmath } from '../math/cubismmath';
|
||||
import { Live2DCubismFramework as cubismphysicsjson } from './cubismphysicsjson';
|
||||
import CubismPhysicsJson = cubismphysicsjson.CubismPhysicsJson;
|
||||
import CubismMath = cubismmath.CubismMath;
|
||||
import CubismPhysicsRig = cubismphysicsinternal.CubismPhysicsRig;
|
||||
import CubismPhysicsSubRig = cubismphysicsinternal.CubismPhysicsSubRig;
|
||||
import CubismPhysicsInput = cubismphysicsinternal.CubismPhysicsInput;
|
||||
import CubismPhysicsOutput = cubismphysicsinternal.CubismPhysicsOutput;
|
||||
import CubismPhysicsParticle = cubismphysicsinternal.CubismPhysicsParticle;
|
||||
import CubismPhysicsSource = cubismphysicsinternal.CubismPhysicsSource;
|
||||
import CubismPhysicsTargetType = cubismphysicsinternal.CubismPhysicsTargetType;
|
||||
import CubismPhysicsNormalization = cubismphysicsinternal.CubismPhysicsNormalization;
|
||||
import CubismVector2 = cubismvector2.CubismVector2;
|
||||
import CubismModel = cubismmodel.CubismModel;
|
||||
import { CubismMath } from '../math/cubismmath';
|
||||
import { CubismVector2 } from '../math/cubismvector2';
|
||||
import { CubismModel } from '../model/cubismmodel';
|
||||
import {
|
||||
CubismPhysicsInput,
|
||||
CubismPhysicsNormalization,
|
||||
CubismPhysicsOutput,
|
||||
CubismPhysicsParticle,
|
||||
CubismPhysicsRig,
|
||||
CubismPhysicsSource,
|
||||
CubismPhysicsSubRig,
|
||||
CubismPhysicsTargetType
|
||||
} from './cubismphysicsinternal';
|
||||
import { CubismPhysicsJson } from './cubismphysicsjson';
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
// physics types tags.
|
||||
const PhysicsTypeTagX = 'X';
|
||||
const PhysicsTypeTagY = 'Y';
|
||||
const PhysicsTypeTagAngle = 'Angle';
|
||||
// physics types tags.
|
||||
const PhysicsTypeTagX = 'X';
|
||||
const PhysicsTypeTagY = 'Y';
|
||||
const PhysicsTypeTagAngle = 'Angle';
|
||||
|
||||
// Constant of air resistance.
|
||||
const AirResistance = 5.0;
|
||||
// Constant of air resistance.
|
||||
const AirResistance = 5.0;
|
||||
|
||||
// Constant of maximum weight of input and output ratio.
|
||||
const MaximumWeight = 100.0;
|
||||
// Constant of maximum weight of input and output ratio.
|
||||
const MaximumWeight = 100.0;
|
||||
|
||||
// Constant of threshold of movement.
|
||||
const MovementThreshold = 0.001;
|
||||
// Constant of threshold of movement.
|
||||
const MovementThreshold = 0.001;
|
||||
|
||||
/**
|
||||
/**
|
||||
* 物理演算クラス
|
||||
*/
|
||||
export class CubismPhysics {
|
||||
export class CubismPhysics {
|
||||
/**
|
||||
* インスタンスの作成
|
||||
* @param buffer physics3.jsonが読み込まれているバッファ
|
||||
|
@ -103,9 +99,7 @@ export namespace Live2DCubismFramework {
|
|||
totalTranslation.x = 0.0;
|
||||
totalTranslation.y = 0.0;
|
||||
currentSetting = this._physicsRig.settings.at(settingIndex);
|
||||
currentInput = this._physicsRig.inputs.get(
|
||||
currentSetting.baseInputIndex
|
||||
);
|
||||
currentInput = this._physicsRig.inputs.get(currentSetting.baseInputIndex);
|
||||
currentOutput = this._physicsRig.outputs.get(
|
||||
currentSetting.baseOutputIndex
|
||||
);
|
||||
|
@ -170,9 +164,7 @@ export namespace Live2DCubismFramework {
|
|||
}
|
||||
|
||||
if (currentOutput[i].destinationParameterIndex == -1) {
|
||||
currentOutput[
|
||||
i
|
||||
].destinationParameterIndex = model.getParameterIndex(
|
||||
currentOutput[i].destinationParameterIndex = model.getParameterIndex(
|
||||
currentOutput[i].destination.id
|
||||
);
|
||||
}
|
||||
|
@ -196,8 +188,7 @@ export namespace Live2DCubismFramework {
|
|||
const destinationParameterIndex: number =
|
||||
currentOutput[i].destinationParameterIndex;
|
||||
const outParameterValue: Float32Array =
|
||||
!Float32Array.prototype.slice &&
|
||||
'subarray' in Float32Array.prototype
|
||||
!Float32Array.prototype.slice && 'subarray' in Float32Array.prototype
|
||||
? JSON.parse(
|
||||
JSON.stringify(
|
||||
parameterValue.subarray(destinationParameterIndex)
|
||||
|
@ -321,19 +312,13 @@ export namespace Live2DCubismFramework {
|
|||
|
||||
this._physicsRig.settings.at(
|
||||
i
|
||||
).normalizationAngle.minimum = json.getNormalizationAngleMinimumValue(
|
||||
i
|
||||
);
|
||||
).normalizationAngle.minimum = json.getNormalizationAngleMinimumValue(i);
|
||||
this._physicsRig.settings.at(
|
||||
i
|
||||
).normalizationAngle.maximum = json.getNormalizationAngleMaximumValue(
|
||||
i
|
||||
);
|
||||
).normalizationAngle.maximum = json.getNormalizationAngleMaximumValue(i);
|
||||
this._physicsRig.settings.at(
|
||||
i
|
||||
).normalizationAngle.defalut = json.getNormalizationAngleDefaultValue(
|
||||
i
|
||||
);
|
||||
).normalizationAngle.defalut = json.getNormalizationAngleDefaultValue(i);
|
||||
|
||||
// Input
|
||||
this._physicsRig.settings.at(i).inputCount = json.getInputCount(i);
|
||||
|
@ -341,9 +326,10 @@ export namespace Live2DCubismFramework {
|
|||
|
||||
for (let j = 0; j < this._physicsRig.settings.at(i).inputCount; ++j) {
|
||||
this._physicsRig.inputs.at(inputIndex + j).sourceParameterIndex = -1;
|
||||
this._physicsRig.inputs.at(
|
||||
inputIndex + j
|
||||
).weight = json.getInputWeight(i, j);
|
||||
this._physicsRig.inputs.at(inputIndex + j).weight = json.getInputWeight(
|
||||
i,
|
||||
j
|
||||
);
|
||||
this._physicsRig.inputs.at(
|
||||
inputIndex + j
|
||||
).reflect = json.getInputReflect(i, j);
|
||||
|
@ -436,16 +422,10 @@ export namespace Live2DCubismFramework {
|
|||
outputIndex += this._physicsRig.settings.at(i).outputCount;
|
||||
|
||||
// Particle
|
||||
this._physicsRig.settings.at(i).particleCount = json.getParticleCount(
|
||||
i
|
||||
);
|
||||
this._physicsRig.settings.at(i).particleCount = json.getParticleCount(i);
|
||||
this._physicsRig.settings.at(i).baseParticleIndex = particleIndex;
|
||||
|
||||
for (
|
||||
let j = 0;
|
||||
j < this._physicsRig.settings.at(i).particleCount;
|
||||
++j
|
||||
) {
|
||||
for (let j = 0; j < this._physicsRig.settings.at(i).particleCount; ++j) {
|
||||
this._physicsRig.particles.at(
|
||||
particleIndex + j
|
||||
).mobility = json.getParticleMobility(i, j);
|
||||
|
@ -487,9 +467,7 @@ export namespace Live2DCubismFramework {
|
|||
++settingIndex
|
||||
) {
|
||||
currentSetting = this._physicsRig.settings.at(settingIndex);
|
||||
strand = this._physicsRig.particles.get(
|
||||
currentSetting.baseParticleIndex
|
||||
);
|
||||
strand = this._physicsRig.particles.get(currentSetting.baseParticleIndex);
|
||||
|
||||
// Initialize the top of particle.
|
||||
strand[0].initialPosition = new CubismVector2(0.0, 0.0);
|
||||
|
@ -528,12 +506,12 @@ export namespace Live2DCubismFramework {
|
|||
|
||||
_physicsRig: CubismPhysicsRig; // 物理演算のデータ
|
||||
_options: Options; // オプション
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 物理演算のオプション
|
||||
*/
|
||||
export class Options {
|
||||
export class Options {
|
||||
constructor() {
|
||||
this.gravity = new CubismVector2(0, 0);
|
||||
this.wind = new CubismVector2(0, 0);
|
||||
|
@ -541,16 +519,16 @@ export namespace Live2DCubismFramework {
|
|||
|
||||
gravity: CubismVector2; // 重力方向
|
||||
wind: CubismVector2; // 風の方向
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Gets sign.
|
||||
*
|
||||
* @param value Evaluation target value.
|
||||
*
|
||||
* @return Sign of value.
|
||||
*/
|
||||
function sign(value: number): number {
|
||||
function sign(value: number): number {
|
||||
let ret = 0;
|
||||
|
||||
if (value > 0.0) {
|
||||
|
@ -560,9 +538,9 @@ export namespace Live2DCubismFramework {
|
|||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
function getInputTranslationXFromNormalizedParameterValue(
|
||||
function getInputTranslationXFromNormalizedParameterValue(
|
||||
targetTranslation: CubismVector2,
|
||||
targetAngle: { angle: number },
|
||||
value: number,
|
||||
|
@ -573,7 +551,7 @@ export namespace Live2DCubismFramework {
|
|||
normalizationAngle: CubismPhysicsNormalization,
|
||||
isInverted: boolean,
|
||||
weight: number
|
||||
): void {
|
||||
): void {
|
||||
targetTranslation.x +=
|
||||
normalizeParameterValue(
|
||||
value,
|
||||
|
@ -585,9 +563,9 @@ export namespace Live2DCubismFramework {
|
|||
normalizationPosition.defalut,
|
||||
isInverted
|
||||
) * weight;
|
||||
}
|
||||
}
|
||||
|
||||
function getInputTranslationYFromNormalizedParamterValue(
|
||||
function getInputTranslationYFromNormalizedParamterValue(
|
||||
targetTranslation: CubismVector2,
|
||||
targetAngle: { angle: number },
|
||||
value: number,
|
||||
|
@ -598,7 +576,7 @@ export namespace Live2DCubismFramework {
|
|||
normalizationAngle: CubismPhysicsNormalization,
|
||||
isInverted: boolean,
|
||||
weight: number
|
||||
): void {
|
||||
): void {
|
||||
targetTranslation.y +=
|
||||
normalizeParameterValue(
|
||||
value,
|
||||
|
@ -610,9 +588,9 @@ export namespace Live2DCubismFramework {
|
|||
normalizationPosition.defalut,
|
||||
isInverted
|
||||
) * weight;
|
||||
}
|
||||
}
|
||||
|
||||
function getInputAngleFromNormalizedParameterValue(
|
||||
function getInputAngleFromNormalizedParameterValue(
|
||||
targetTranslation: CubismVector2,
|
||||
targetAngle: { angle: number },
|
||||
value: number,
|
||||
|
@ -623,7 +601,7 @@ export namespace Live2DCubismFramework {
|
|||
normalizationAngle: CubismPhysicsNormalization,
|
||||
isInverted: boolean,
|
||||
weight: number
|
||||
): void {
|
||||
): void {
|
||||
targetAngle.angle +=
|
||||
normalizeParameterValue(
|
||||
value,
|
||||
|
@ -635,15 +613,15 @@ export namespace Live2DCubismFramework {
|
|||
normalizationAngle.defalut,
|
||||
isInverted
|
||||
) * weight;
|
||||
}
|
||||
}
|
||||
|
||||
function getOutputTranslationX(
|
||||
function getOutputTranslationX(
|
||||
translation: CubismVector2,
|
||||
particles: CubismPhysicsParticle[],
|
||||
particleIndex: number,
|
||||
isInverted: boolean,
|
||||
parentGravity: CubismVector2
|
||||
): number {
|
||||
): number {
|
||||
let outputValue: number = translation.x;
|
||||
|
||||
if (isInverted) {
|
||||
|
@ -651,30 +629,30 @@ export namespace Live2DCubismFramework {
|
|||
}
|
||||
|
||||
return outputValue;
|
||||
}
|
||||
}
|
||||
|
||||
function getOutputTranslationY(
|
||||
function getOutputTranslationY(
|
||||
translation: CubismVector2,
|
||||
particles: CubismPhysicsParticle[],
|
||||
particleIndex: number,
|
||||
isInverted: boolean,
|
||||
parentGravity: CubismVector2
|
||||
): number {
|
||||
): number {
|
||||
let outputValue: number = translation.y;
|
||||
|
||||
if (isInverted) {
|
||||
outputValue *= -1.0;
|
||||
}
|
||||
return outputValue;
|
||||
}
|
||||
}
|
||||
|
||||
function getOutputAngle(
|
||||
function getOutputAngle(
|
||||
translation: CubismVector2,
|
||||
particles: CubismPhysicsParticle[],
|
||||
particleIndex: number,
|
||||
isInverted: boolean,
|
||||
parentGravity: CubismVector2
|
||||
): number {
|
||||
): number {
|
||||
let outputValue: number;
|
||||
|
||||
if (particleIndex >= 2) {
|
||||
|
@ -692,42 +670,42 @@ export namespace Live2DCubismFramework {
|
|||
}
|
||||
|
||||
return outputValue;
|
||||
}
|
||||
}
|
||||
|
||||
function getRangeValue(min: number, max: number): number {
|
||||
function getRangeValue(min: number, max: number): number {
|
||||
const maxValue: number = CubismMath.max(min, max);
|
||||
const minValue: number = CubismMath.min(min, max);
|
||||
|
||||
return CubismMath.abs(maxValue - minValue);
|
||||
}
|
||||
}
|
||||
|
||||
function getDefaultValue(min: number, max: number): number {
|
||||
function getDefaultValue(min: number, max: number): number {
|
||||
const minValue: number = CubismMath.min(min, max);
|
||||
return minValue + getRangeValue(min, max) / 2.0;
|
||||
}
|
||||
}
|
||||
|
||||
function getOutputScaleTranslationX(
|
||||
function getOutputScaleTranslationX(
|
||||
translationScale: CubismVector2,
|
||||
angleScale: number
|
||||
): number {
|
||||
): number {
|
||||
return JSON.parse(JSON.stringify(translationScale.x));
|
||||
}
|
||||
}
|
||||
|
||||
function getOutputScaleTranslationY(
|
||||
function getOutputScaleTranslationY(
|
||||
translationScale: CubismVector2,
|
||||
angleScale: number
|
||||
): number {
|
||||
): number {
|
||||
return JSON.parse(JSON.stringify(translationScale.y));
|
||||
}
|
||||
}
|
||||
|
||||
function getOutputScaleAngle(
|
||||
function getOutputScaleAngle(
|
||||
translationScale: CubismVector2,
|
||||
angleScale: number
|
||||
): number {
|
||||
): number {
|
||||
return JSON.parse(JSON.stringify(angleScale));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Updates particles.
|
||||
*
|
||||
* @param strand Target array of particle.
|
||||
|
@ -739,7 +717,7 @@ export namespace Live2DCubismFramework {
|
|||
* @param deltaTimeSeconds Delta time.
|
||||
* @param airResistance Air resistance.
|
||||
*/
|
||||
function updateParticles(
|
||||
function updateParticles(
|
||||
strand: CubismPhysicsParticle[],
|
||||
strandCount: number,
|
||||
totalTranslation: CubismVector2,
|
||||
|
@ -748,7 +726,7 @@ export namespace Live2DCubismFramework {
|
|||
thresholdValue: number,
|
||||
deltaTimeSeconds: number,
|
||||
airResistance: number
|
||||
) {
|
||||
) {
|
||||
let totalRadian: number;
|
||||
let delay: number;
|
||||
let radian: number;
|
||||
|
@ -811,9 +789,7 @@ export namespace Live2DCubismFramework {
|
|||
}
|
||||
|
||||
if (delay != 0.0) {
|
||||
strand[i].velocity = strand[i].position.substract(
|
||||
strand[i].lastPosition
|
||||
);
|
||||
strand[i].velocity = strand[i].position.substract(strand[i].lastPosition);
|
||||
strand[i].velocity = strand[i].velocity.divisionByScalar(delay);
|
||||
strand[i].velocity = strand[i].velocity.multiplyByScaler(
|
||||
strand[i].mobility
|
||||
|
@ -826,22 +802,22 @@ export namespace Live2DCubismFramework {
|
|||
currentGravity.y
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Updates output parameter value.
|
||||
* @param parameterValue Target parameter value.
|
||||
* @param parameterValueMinimum Minimum of parameter value.
|
||||
* @param parameterValueMaximum Maximum of parameter value.
|
||||
* @param translation Translation value.
|
||||
*/
|
||||
function updateOutputParameterValue(
|
||||
function updateOutputParameterValue(
|
||||
parameterValue: Float32Array,
|
||||
parameterValueMinimum: number,
|
||||
parameterValueMaximum: number,
|
||||
translation: number,
|
||||
output: CubismPhysicsOutput
|
||||
): void {
|
||||
): void {
|
||||
let outputScale: number;
|
||||
let value: number;
|
||||
let weight: number;
|
||||
|
@ -872,9 +848,9 @@ export namespace Live2DCubismFramework {
|
|||
value = parameterValue[0] * (1.0 - weight) + value * weight;
|
||||
parameterValue[0] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function normalizeParameterValue(
|
||||
function normalizeParameterValue(
|
||||
value: number,
|
||||
parameterMinimum: number,
|
||||
parameterMaximum: number,
|
||||
|
@ -883,7 +859,7 @@ export namespace Live2DCubismFramework {
|
|||
normalizedMaximum: number,
|
||||
normalizedDefault: number,
|
||||
isInverted: boolean
|
||||
) {
|
||||
) {
|
||||
let result = 0.0;
|
||||
|
||||
const maxValue: number = CubismMath.max(parameterMaximum, parameterMinimum);
|
||||
|
@ -945,5 +921,14 @@ export namespace Live2DCubismFramework {
|
|||
}
|
||||
|
||||
return isInverted ? result : result * -1.0;
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismphysics';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismPhysics = $.CubismPhysics;
|
||||
export type CubismPhysics = $.CubismPhysics;
|
||||
export const Options = $.Options;
|
||||
export type Options = $.Options;
|
||||
}
|
||||
|
|
|
@ -5,65 +5,61 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as cubismvector2 } from '../math/cubismvector2';
|
||||
import { Live2DCubismFramework as cubismid } from '../id/cubismid';
|
||||
import { Live2DCubismFramework as csmvector } from '../type/csmvector';
|
||||
import csmVector = csmvector.csmVector;
|
||||
import CubismIdHandle = cubismid.CubismIdHandle;
|
||||
import CubismVector2 = cubismvector2.CubismVector2;
|
||||
import { CubismIdHandle } from '../id/cubismid';
|
||||
import { CubismVector2 } from '../math/cubismvector2';
|
||||
import { csmVector } from '../type/csmvector';
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
/**
|
||||
/**
|
||||
* 物理演算の適用先の種類
|
||||
*/
|
||||
export enum CubismPhysicsTargetType {
|
||||
export enum CubismPhysicsTargetType {
|
||||
CubismPhysicsTargetType_Parameter // パラメータに対して適用
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 物理演算の入力の種類
|
||||
*/
|
||||
export enum CubismPhysicsSource {
|
||||
export enum CubismPhysicsSource {
|
||||
CubismPhysicsSource_X, // X軸の位置から
|
||||
CubismPhysicsSource_Y, // Y軸の位置から
|
||||
CubismPhysicsSource_Angle // 角度から
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief 物理演算で使用する外部の力
|
||||
*
|
||||
* 物理演算で使用する外部の力。
|
||||
*/
|
||||
export class PhysicsJsonEffectiveForces {
|
||||
export class PhysicsJsonEffectiveForces {
|
||||
constructor() {
|
||||
this.gravity = new CubismVector2(0, 0);
|
||||
this.wind = new CubismVector2(0, 0);
|
||||
}
|
||||
gravity: CubismVector2; // 重力
|
||||
wind: CubismVector2; // 風
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 物理演算のパラメータ情報
|
||||
*/
|
||||
export class CubismPhysicsParameter {
|
||||
export class CubismPhysicsParameter {
|
||||
id: CubismIdHandle; // パラメータ
|
||||
targetType: CubismPhysicsTargetType; // 適用先の種類
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 物理演算の正規化情報
|
||||
*/
|
||||
export class CubismPhysicsNormalization {
|
||||
export class CubismPhysicsNormalization {
|
||||
minimum: number; // 最大値
|
||||
maximum: number; // 最小値
|
||||
defalut: number; // デフォルト値
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 物理演算の演算委使用する物理点の情報
|
||||
*/
|
||||
export class CubismPhysicsParticle {
|
||||
export class CubismPhysicsParticle {
|
||||
constructor() {
|
||||
this.initialPosition = new CubismVector2(0, 0);
|
||||
this.position = new CubismVector2(0, 0);
|
||||
|
@ -83,12 +79,12 @@ export namespace Live2DCubismFramework {
|
|||
lastGravity: CubismVector2; // 最後の重力
|
||||
force: CubismVector2; // 現在かかっている力
|
||||
velocity: CubismVector2; // 現在の速度
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 物理演算の物理点の管理
|
||||
*/
|
||||
export class CubismPhysicsSubRig {
|
||||
export class CubismPhysicsSubRig {
|
||||
constructor() {
|
||||
this.normalizationPosition = new CubismPhysicsNormalization();
|
||||
this.normalizationAngle = new CubismPhysicsNormalization();
|
||||
|
@ -101,9 +97,9 @@ export namespace Live2DCubismFramework {
|
|||
baseParticleIndex: number; // 物理点の最初のインデックス
|
||||
normalizationPosition: CubismPhysicsNormalization; // 正規化された位置
|
||||
normalizationAngle: CubismPhysicsNormalization; // 正規化された角度
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 正規化されたパラメータの取得関数の宣言
|
||||
* @param targetTranslation // 演算結果の移動値
|
||||
* @param targetAngle // 演算結果の角度
|
||||
|
@ -116,7 +112,7 @@ export namespace Live2DCubismFramework {
|
|||
* @param isInverted // 値が反転されているか?
|
||||
* @param weight // 重み
|
||||
*/
|
||||
export interface normalizedPhysicsParameterValueGetter {
|
||||
export interface normalizedPhysicsParameterValueGetter {
|
||||
(
|
||||
targetTranslation: CubismVector2,
|
||||
targetAngle: { angle: number },
|
||||
|
@ -129,9 +125,9 @@ export namespace Live2DCubismFramework {
|
|||
isInverted: boolean,
|
||||
weight: number
|
||||
): void;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 物理演算の値の取得関数の宣言
|
||||
* @param translation 移動値
|
||||
* @param particles 物理点のリスト
|
||||
|
@ -139,7 +135,7 @@ export namespace Live2DCubismFramework {
|
|||
* @param parentGravity 重力
|
||||
* @return 値
|
||||
*/
|
||||
export interface physicsValueGetter {
|
||||
export interface physicsValueGetter {
|
||||
(
|
||||
translation: CubismVector2,
|
||||
particles: CubismPhysicsParticle[],
|
||||
|
@ -147,22 +143,22 @@ export namespace Live2DCubismFramework {
|
|||
isInverted: boolean,
|
||||
parentGravity: CubismVector2
|
||||
): number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 物理演算のスケールの取得関数の宣言
|
||||
* @param translationScale 移動値のスケール
|
||||
* @param angleScale 角度のスケール
|
||||
* @return スケール値
|
||||
*/
|
||||
export interface physicsScaleGetter {
|
||||
export interface physicsScaleGetter {
|
||||
(translationScale: CubismVector2, angleScale: number): number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 物理演算の入力情報
|
||||
*/
|
||||
export class CubismPhysicsInput {
|
||||
export class CubismPhysicsInput {
|
||||
constructor() {
|
||||
this.source = new CubismPhysicsParameter();
|
||||
}
|
||||
|
@ -172,14 +168,14 @@ export namespace Live2DCubismFramework {
|
|||
type: number; // 入力の種類
|
||||
reflect: boolean; // 値が反転されているかどうか
|
||||
getNormalizedParameterValue: normalizedPhysicsParameterValueGetter; // 正規化されたパラメータ値の取得関数
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief 物理演算の出力情報
|
||||
*
|
||||
* 物理演算の出力情報。
|
||||
*/
|
||||
export class CubismPhysicsOutput {
|
||||
export class CubismPhysicsOutput {
|
||||
constructor() {
|
||||
this.destination = new CubismPhysicsParameter();
|
||||
this.translationScale = new CubismVector2(0, 0);
|
||||
|
@ -197,14 +193,14 @@ export namespace Live2DCubismFramework {
|
|||
valueExceededMaximum: number; // 最大値をこえた時の値
|
||||
getValue: physicsValueGetter; // 物理演算の値の取得関数
|
||||
getScale: physicsScaleGetter; // 物理演算のスケール値の取得関数
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief 物理演算のデータ
|
||||
*
|
||||
* 物理演算のデータ。
|
||||
*/
|
||||
export class CubismPhysicsRig {
|
||||
export class CubismPhysicsRig {
|
||||
constructor() {
|
||||
this.settings = new csmVector<CubismPhysicsSubRig>();
|
||||
this.inputs = new csmVector<CubismPhysicsInput>();
|
||||
|
@ -221,5 +217,33 @@ export namespace Live2DCubismFramework {
|
|||
particles: csmVector<CubismPhysicsParticle>; // 物理演算の物理点のリスト
|
||||
gravity: CubismVector2; // 重力
|
||||
wind: CubismVector2; // 風
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismphysicsinternal';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismPhysicsInput = $.CubismPhysicsInput;
|
||||
export type CubismPhysicsInput = $.CubismPhysicsInput;
|
||||
export const CubismPhysicsNormalization = $.CubismPhysicsNormalization;
|
||||
export type CubismPhysicsNormalization = $.CubismPhysicsNormalization;
|
||||
export const CubismPhysicsOutput = $.CubismPhysicsOutput;
|
||||
export type CubismPhysicsOutput = $.CubismPhysicsOutput;
|
||||
export const CubismPhysicsParameter = $.CubismPhysicsParameter;
|
||||
export type CubismPhysicsParameter = $.CubismPhysicsParameter;
|
||||
export const CubismPhysicsParticle = $.CubismPhysicsParticle;
|
||||
export type CubismPhysicsParticle = $.CubismPhysicsParticle;
|
||||
export const CubismPhysicsRig = $.CubismPhysicsRig;
|
||||
export type CubismPhysicsRig = $.CubismPhysicsRig;
|
||||
export const CubismPhysicsSource = $.CubismPhysicsSource;
|
||||
export type CubismPhysicsSource = $.CubismPhysicsSource;
|
||||
export const CubismPhysicsSubRig = $.CubismPhysicsSubRig;
|
||||
export type CubismPhysicsSubRig = $.CubismPhysicsSubRig;
|
||||
export const CubismPhysicsTargetType = $.CubismPhysicsTargetType;
|
||||
export type CubismPhysicsTargetType = $.CubismPhysicsTargetType;
|
||||
export const PhysicsJsonEffectiveForces = $.PhysicsJsonEffectiveForces;
|
||||
export type PhysicsJsonEffectiveForces = $.PhysicsJsonEffectiveForces;
|
||||
export type normalizedPhysicsParameterValueGetter = $.normalizedPhysicsParameterValueGetter;
|
||||
export type physicsScaleGetter = $.physicsScaleGetter;
|
||||
export type physicsValueGetter = $.physicsValueGetter;
|
||||
}
|
||||
|
|
|
@ -5,64 +5,59 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as cubismjson } from '../utils/cubismjson';
|
||||
import { Live2DCubismFramework as cubismvector2 } from '../math/cubismvector2';
|
||||
import { Live2DCubismFramework as cubismid } from '../id/cubismid';
|
||||
import { Live2DCubismFramework as cubismframework } from '../live2dcubismframework';
|
||||
import CubismFramework = cubismframework.CubismFramework;
|
||||
import CubismIdHandle = cubismid.CubismIdHandle;
|
||||
import CubismVector2 = cubismvector2.CubismVector2;
|
||||
import CubismJson = cubismjson.CubismJson;
|
||||
import { CubismIdHandle } from '../id/cubismid';
|
||||
import { CubismFramework } from '../live2dcubismframework';
|
||||
import { CubismVector2 } from '../math/cubismvector2';
|
||||
import { CubismJson } from '../utils/cubismjson';
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
// JSON keys
|
||||
const Position = 'Position';
|
||||
const X = 'X';
|
||||
const Y = 'Y';
|
||||
const Angle = 'Angle';
|
||||
const Type = 'Type';
|
||||
const Id = 'Id';
|
||||
// JSON keys
|
||||
const Position = 'Position';
|
||||
const X = 'X';
|
||||
const Y = 'Y';
|
||||
const Angle = 'Angle';
|
||||
const Type = 'Type';
|
||||
const Id = 'Id';
|
||||
|
||||
// Meta
|
||||
const Meta = 'Meta';
|
||||
const EffectiveForces = 'EffectiveForces';
|
||||
const TotalInputCount = 'TotalInputCount';
|
||||
const TotalOutputCount = 'TotalOutputCount';
|
||||
const PhysicsSettingCount = 'PhysicsSettingCount';
|
||||
const Gravity = 'Gravity';
|
||||
const Wind = 'Wind';
|
||||
const VertexCount = 'VertexCount';
|
||||
// Meta
|
||||
const Meta = 'Meta';
|
||||
const EffectiveForces = 'EffectiveForces';
|
||||
const TotalInputCount = 'TotalInputCount';
|
||||
const TotalOutputCount = 'TotalOutputCount';
|
||||
const PhysicsSettingCount = 'PhysicsSettingCount';
|
||||
const Gravity = 'Gravity';
|
||||
const Wind = 'Wind';
|
||||
const VertexCount = 'VertexCount';
|
||||
|
||||
// PhysicsSettings
|
||||
const PhysicsSettings = 'PhysicsSettings';
|
||||
const Normalization = 'Normalization';
|
||||
const Minimum = 'Minimum';
|
||||
const Maximum = 'Maximum';
|
||||
const Default = 'Default';
|
||||
const Reflect = 'Reflect';
|
||||
const Weight = 'Weight';
|
||||
// PhysicsSettings
|
||||
const PhysicsSettings = 'PhysicsSettings';
|
||||
const Normalization = 'Normalization';
|
||||
const Minimum = 'Minimum';
|
||||
const Maximum = 'Maximum';
|
||||
const Default = 'Default';
|
||||
const Reflect = 'Reflect';
|
||||
const Weight = 'Weight';
|
||||
|
||||
// Input
|
||||
const Input = 'Input';
|
||||
const Source = 'Source';
|
||||
// Input
|
||||
const Input = 'Input';
|
||||
const Source = 'Source';
|
||||
|
||||
// Output
|
||||
const Output = 'Output';
|
||||
const Scale = 'Scale';
|
||||
const VertexIndex = 'VertexIndex';
|
||||
const Destination = 'Destination';
|
||||
// Output
|
||||
const Output = 'Output';
|
||||
const Scale = 'Scale';
|
||||
const VertexIndex = 'VertexIndex';
|
||||
const Destination = 'Destination';
|
||||
|
||||
// Particle
|
||||
const Vertices = 'Vertices';
|
||||
const Mobility = 'Mobility';
|
||||
const Delay = 'Delay';
|
||||
const Radius = 'Radius';
|
||||
const Acceleration = 'Acceleration';
|
||||
// Particle
|
||||
const Vertices = 'Vertices';
|
||||
const Mobility = 'Mobility';
|
||||
const Delay = 'Delay';
|
||||
const Radius = 'Radius';
|
||||
const Acceleration = 'Acceleration';
|
||||
|
||||
/**
|
||||
/**
|
||||
* physics3.jsonのコンテナ。
|
||||
*/
|
||||
export class CubismPhysicsJson {
|
||||
export class CubismPhysicsJson {
|
||||
/**
|
||||
* コンストラクタ
|
||||
* @param buffer physics3.jsonが読み込まれているバッファ
|
||||
|
@ -342,10 +337,7 @@ export namespace Live2DCubismFramework {
|
|||
* @param inputIndex 入力のインデックス
|
||||
* @return 入力の種類
|
||||
*/
|
||||
public getInputType(
|
||||
physicsSettingIndex: number,
|
||||
inputIndex: number
|
||||
): string {
|
||||
public getInputType(physicsSettingIndex: number, inputIndex: number): string {
|
||||
return this._json
|
||||
.getRoot()
|
||||
.getValueByString(PhysicsSettings)
|
||||
|
@ -645,5 +637,12 @@ export namespace Live2DCubismFramework {
|
|||
}
|
||||
|
||||
_json: CubismJson; // physics3.jsonデータ
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismphysicsjson';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismPhysicsJson = $.CubismPhysicsJson;
|
||||
export type CubismPhysicsJson = $.CubismPhysicsJson;
|
||||
}
|
||||
|
|
|
@ -5,18 +5,15 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as cubismmatrix44 } from '../math/cubismmatrix44';
|
||||
import { Live2DCubismFramework as cubismmodel } from '../model/cubismmodel';
|
||||
import CubismModel = cubismmodel.CubismModel;
|
||||
import CubismMatrix44 = cubismmatrix44.CubismMatrix44;
|
||||
import { CubismMatrix44 } from '../math/cubismmatrix44';
|
||||
import { CubismModel } from '../model/cubismmodel';
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
/**
|
||||
/**
|
||||
* モデル描画を処理するレンダラ
|
||||
*
|
||||
* サブクラスに環境依存の描画命令を記述する。
|
||||
*/
|
||||
export abstract class CubismRenderer {
|
||||
export abstract class CubismRenderer {
|
||||
/**
|
||||
* レンダラのインスタンスを生成して取得する
|
||||
*
|
||||
|
@ -237,18 +234,18 @@ export namespace Live2DCubismFramework {
|
|||
protected _isPremultipliedAlpha: boolean; // 乗算済みαならtrue
|
||||
protected _anisortopy: any; // テクスチャの異方性フィルタリングのパラメータ
|
||||
protected _model: CubismModel; // レンダリング対象のモデル
|
||||
}
|
||||
}
|
||||
|
||||
export enum CubismBlendMode {
|
||||
export enum CubismBlendMode {
|
||||
CubismBlendMode_Normal = 0, // 通常
|
||||
CubismBlendMode_Additive = 1, // 加算
|
||||
CubismBlendMode_Multiplicative = 2 // 乗算
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* テクスチャの色をRGBAで扱うためのクラス
|
||||
*/
|
||||
export class CubismTextureColor {
|
||||
export class CubismTextureColor {
|
||||
/**
|
||||
* コンストラクタ
|
||||
*/
|
||||
|
@ -263,5 +260,16 @@ export namespace Live2DCubismFramework {
|
|||
G: number; // 緑チャンネル
|
||||
B: number; // 青チャンネル
|
||||
A: number; // αチャンネル
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismrenderer';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismBlendMode = $.CubismBlendMode;
|
||||
export type CubismBlendMode = $.CubismBlendMode;
|
||||
export const CubismRenderer = $.CubismRenderer;
|
||||
export type CubismRenderer = $.CubismRenderer;
|
||||
export const CubismTextureColor = $.CubismTextureColor;
|
||||
export type CubismTextureColor = $.CubismTextureColor;
|
||||
}
|
||||
|
|
|
@ -5,36 +5,30 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as cubismframework } from '../live2dcubismframework';
|
||||
import { Live2DCubismFramework as csmrect } from '../type/csmrectf';
|
||||
import { Live2DCubismFramework as cubismrenderer } from './cubismrenderer';
|
||||
import { Live2DCubismFramework as cubismmodel } from '../model/cubismmodel';
|
||||
import { Live2DCubismFramework as cubsimmatrix44 } from '../math/cubismmatrix44';
|
||||
import { Live2DCubismFramework as csmmap } from '../type/csmmap';
|
||||
import { Live2DCubismFramework as csmvector } from '../type/csmvector';
|
||||
import { Constant } from '../live2dcubismframework';
|
||||
import { CubismMatrix44 } from '../math/cubismmatrix44';
|
||||
import { CubismModel } from '../model/cubismmodel';
|
||||
import { csmMap } from '../type/csmmap';
|
||||
import { csmRect } from '../type/csmrectf';
|
||||
import { csmVector } from '../type/csmvector';
|
||||
import { CubismLogError } from '../utils/cubismdebug';
|
||||
import Constant = cubismframework.Constant;
|
||||
import CubismMatrix44 = cubsimmatrix44.CubismMatrix44;
|
||||
import csmRect = csmrect.csmRect;
|
||||
import csmMap = csmmap.csmMap;
|
||||
import csmVector = csmvector.csmVector;
|
||||
import CubismModel = cubismmodel.CubismModel;
|
||||
import CubismRenderer = cubismrenderer.CubismRenderer;
|
||||
import CubismBlendMode = cubismrenderer.CubismBlendMode;
|
||||
import CubismTextureColor = cubismrenderer.CubismTextureColor;
|
||||
import {
|
||||
CubismBlendMode,
|
||||
CubismRenderer,
|
||||
CubismTextureColor
|
||||
} from './cubismrenderer';
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
const ColorChannelCount = 4; // 実験時に1チャンネルの場合は1、RGBだけの場合は3、アルファも含める場合は4
|
||||
const ColorChannelCount = 4; // 実験時に1チャンネルの場合は1、RGBだけの場合は3、アルファも含める場合は4
|
||||
|
||||
const shaderCount = 10; // シェーダーの数 = マスク生成用 + (通常用 + 加算 + 乗算) * (マスク無の乗算済アルファ対応版 + マスク有の乗算済アルファ対応版 + マスク有反転の乗算済アルファ対応版)
|
||||
let s_instance: CubismShader_WebGL;
|
||||
let s_viewport: number[];
|
||||
let s_fbo: WebGLFramebuffer;
|
||||
const shaderCount = 10; // シェーダーの数 = マスク生成用 + (通常用 + 加算 + 乗算) * (マスク無の乗算済アルファ対応版 + マスク有の乗算済アルファ対応版 + マスク有反転の乗算済アルファ対応版)
|
||||
let s_instance: CubismShader_WebGL;
|
||||
let s_viewport: number[];
|
||||
let s_fbo: WebGLFramebuffer;
|
||||
|
||||
/**
|
||||
/**
|
||||
* クリッピングマスクの処理を実行するクラス
|
||||
*/
|
||||
export class CubismClippingManager_WebGL {
|
||||
export class CubismClippingManager_WebGL {
|
||||
/**
|
||||
* カラーチャンネル(RGBA)のフラグを取得する
|
||||
* @param channelNo カラーチャンネル(RGBA)の番号(0:R, 1:G, 2:B, 3:A)
|
||||
|
@ -490,12 +484,8 @@ export namespace Live2DCubismFramework {
|
|||
}
|
||||
this._tmpMatrixForDraw.setMatrix(this._tmpMatrix.getArray());
|
||||
}
|
||||
clipContext._matrixForMask.setMatrix(
|
||||
this._tmpMatrixForMask.getArray()
|
||||
);
|
||||
clipContext._matrixForDraw.setMatrix(
|
||||
this._tmpMatrixForDraw.getArray()
|
||||
);
|
||||
clipContext._matrixForMask.setMatrix(this._tmpMatrixForMask.getArray());
|
||||
clipContext._matrixForDraw.setMatrix(this._tmpMatrixForDraw.getArray());
|
||||
|
||||
const clipDrawCount: number = clipContext._clippingIdCount;
|
||||
for (let i = 0; i < clipDrawCount; i++) {
|
||||
|
@ -503,9 +493,7 @@ export namespace Live2DCubismFramework {
|
|||
|
||||
// 頂点情報が更新されておらず、信頼性がない場合は描画をパスする
|
||||
if (
|
||||
!model.getDrawableDynamicFlagVertexPositionsDidChange(
|
||||
clipDrawIndex
|
||||
)
|
||||
!model.getDrawableDynamicFlagVertexPositionsDidChange(clipDrawIndex)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
@ -739,13 +727,13 @@ export namespace Live2DCubismFramework {
|
|||
private _tmpBoundsOnModel: csmRect; // マスク配置計算用の矩形
|
||||
|
||||
gl: WebGLRenderingContext; // WebGLレンダリングコンテキスト
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* レンダーテクスチャのリソースを定義する構造体
|
||||
* クリッピングマスクで使用する
|
||||
*/
|
||||
export class CubismRenderTextureResource {
|
||||
export class CubismRenderTextureResource {
|
||||
/**
|
||||
* 引数付きコンストラクタ
|
||||
* @param frameNo レンダラーのフレーム番号
|
||||
|
@ -758,12 +746,12 @@ export namespace Live2DCubismFramework {
|
|||
|
||||
public frameNo: number; // レンダラのフレーム番号
|
||||
public texture: WebGLFramebuffer; // テクスチャのアドレス
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* クリッピングマスクのコンテキスト
|
||||
*/
|
||||
export class CubismClippingContext {
|
||||
export class CubismClippingContext {
|
||||
/**
|
||||
* 引数付きコンストラクタ
|
||||
*/
|
||||
|
@ -838,13 +826,13 @@ export namespace Live2DCubismFramework {
|
|||
public _clippedDrawableIndexList: number[]; // このマスクにクリップされる描画オブジェクトのリスト
|
||||
|
||||
private _owner: CubismClippingManager_WebGL; // このマスクを管理しているマネージャのインスタンス
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* WebGL用のシェーダープログラムを生成・破棄するクラス
|
||||
* シングルトンなクラスであり、CubismShader_WebGL.getInstanceからアクセスする。
|
||||
*/
|
||||
export class CubismShader_WebGL {
|
||||
export class CubismShader_WebGL {
|
||||
/**
|
||||
* インスタンスを取得する(シングルトン)
|
||||
* @return インスタンス
|
||||
|
@ -1200,26 +1188,14 @@ export namespace Live2DCubismFramework {
|
|||
);
|
||||
|
||||
// 加算も通常と同じシェーダーを利用する
|
||||
this._shaderSets.at(4).shaderProgram = this._shaderSets.at(
|
||||
1
|
||||
).shaderProgram;
|
||||
this._shaderSets.at(5).shaderProgram = this._shaderSets.at(
|
||||
2
|
||||
).shaderProgram;
|
||||
this._shaderSets.at(6).shaderProgram = this._shaderSets.at(
|
||||
3
|
||||
).shaderProgram;
|
||||
this._shaderSets.at(4).shaderProgram = this._shaderSets.at(1).shaderProgram;
|
||||
this._shaderSets.at(5).shaderProgram = this._shaderSets.at(2).shaderProgram;
|
||||
this._shaderSets.at(6).shaderProgram = this._shaderSets.at(3).shaderProgram;
|
||||
|
||||
// 乗算も通常と同じシェーダーを利用する
|
||||
this._shaderSets.at(7).shaderProgram = this._shaderSets.at(
|
||||
1
|
||||
).shaderProgram;
|
||||
this._shaderSets.at(8).shaderProgram = this._shaderSets.at(
|
||||
2
|
||||
).shaderProgram;
|
||||
this._shaderSets.at(9).shaderProgram = this._shaderSets.at(
|
||||
3
|
||||
).shaderProgram;
|
||||
this._shaderSets.at(7).shaderProgram = this._shaderSets.at(1).shaderProgram;
|
||||
this._shaderSets.at(8).shaderProgram = this._shaderSets.at(2).shaderProgram;
|
||||
this._shaderSets.at(9).shaderProgram = this._shaderSets.at(3).shaderProgram;
|
||||
|
||||
// SetupMask
|
||||
this._shaderSets.at(
|
||||
|
@ -1234,9 +1210,7 @@ export namespace Live2DCubismFramework {
|
|||
this._shaderSets.at(0).shaderProgram,
|
||||
'a_texCoord'
|
||||
);
|
||||
this._shaderSets.at(
|
||||
0
|
||||
).samplerTexture0Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(0).samplerTexture0Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(0).shaderProgram,
|
||||
's_texture0'
|
||||
);
|
||||
|
@ -1272,9 +1246,7 @@ export namespace Live2DCubismFramework {
|
|||
this._shaderSets.at(1).shaderProgram,
|
||||
'a_texCoord'
|
||||
);
|
||||
this._shaderSets.at(
|
||||
1
|
||||
).samplerTexture0Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(1).samplerTexture0Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(1).shaderProgram,
|
||||
's_texture0'
|
||||
);
|
||||
|
@ -1302,15 +1274,11 @@ export namespace Live2DCubismFramework {
|
|||
this._shaderSets.at(2).shaderProgram,
|
||||
'a_texCoord'
|
||||
);
|
||||
this._shaderSets.at(
|
||||
2
|
||||
).samplerTexture0Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(2).samplerTexture0Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(2).shaderProgram,
|
||||
's_texture0'
|
||||
);
|
||||
this._shaderSets.at(
|
||||
2
|
||||
).samplerTexture1Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(2).samplerTexture1Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(2).shaderProgram,
|
||||
's_texture1'
|
||||
);
|
||||
|
@ -1350,15 +1318,11 @@ export namespace Live2DCubismFramework {
|
|||
this._shaderSets.at(3).shaderProgram,
|
||||
'a_texCoord'
|
||||
);
|
||||
this._shaderSets.at(
|
||||
3
|
||||
).samplerTexture0Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(3).samplerTexture0Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(3).shaderProgram,
|
||||
's_texture0'
|
||||
);
|
||||
this._shaderSets.at(
|
||||
3
|
||||
).samplerTexture1Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(3).samplerTexture1Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(3).shaderProgram,
|
||||
's_texture1'
|
||||
);
|
||||
|
@ -1398,9 +1362,7 @@ export namespace Live2DCubismFramework {
|
|||
this._shaderSets.at(4).shaderProgram,
|
||||
'a_texCoord'
|
||||
);
|
||||
this._shaderSets.at(
|
||||
4
|
||||
).samplerTexture0Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(4).samplerTexture0Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(4).shaderProgram,
|
||||
's_texture0'
|
||||
);
|
||||
|
@ -1428,15 +1390,11 @@ export namespace Live2DCubismFramework {
|
|||
this._shaderSets.at(5).shaderProgram,
|
||||
'a_texCoord'
|
||||
);
|
||||
this._shaderSets.at(
|
||||
5
|
||||
).samplerTexture0Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(5).samplerTexture0Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(5).shaderProgram,
|
||||
's_texture0'
|
||||
);
|
||||
this._shaderSets.at(
|
||||
5
|
||||
).samplerTexture1Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(5).samplerTexture1Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(5).shaderProgram,
|
||||
's_texture1'
|
||||
);
|
||||
|
@ -1476,15 +1434,11 @@ export namespace Live2DCubismFramework {
|
|||
this._shaderSets.at(6).shaderProgram,
|
||||
'a_texCoord'
|
||||
);
|
||||
this._shaderSets.at(
|
||||
6
|
||||
).samplerTexture0Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(6).samplerTexture0Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(6).shaderProgram,
|
||||
's_texture0'
|
||||
);
|
||||
this._shaderSets.at(
|
||||
6
|
||||
).samplerTexture1Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(6).samplerTexture1Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(6).shaderProgram,
|
||||
's_texture1'
|
||||
);
|
||||
|
@ -1524,9 +1478,7 @@ export namespace Live2DCubismFramework {
|
|||
this._shaderSets.at(7).shaderProgram,
|
||||
'a_texCoord'
|
||||
);
|
||||
this._shaderSets.at(
|
||||
7
|
||||
).samplerTexture0Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(7).samplerTexture0Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(7).shaderProgram,
|
||||
's_texture0'
|
||||
);
|
||||
|
@ -1554,15 +1506,11 @@ export namespace Live2DCubismFramework {
|
|||
this._shaderSets.at(8).shaderProgram,
|
||||
'a_texCoord'
|
||||
);
|
||||
this._shaderSets.at(
|
||||
8
|
||||
).samplerTexture0Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(8).samplerTexture0Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(8).shaderProgram,
|
||||
's_texture0'
|
||||
);
|
||||
this._shaderSets.at(
|
||||
8
|
||||
).samplerTexture1Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(8).samplerTexture1Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(8).shaderProgram,
|
||||
's_texture1'
|
||||
);
|
||||
|
@ -1602,15 +1550,11 @@ export namespace Live2DCubismFramework {
|
|||
this._shaderSets.at(9).shaderProgram,
|
||||
'a_texCoord'
|
||||
);
|
||||
this._shaderSets.at(
|
||||
9
|
||||
).samplerTexture0Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(9).samplerTexture0Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(9).shaderProgram,
|
||||
's_texture0'
|
||||
);
|
||||
this._shaderSets.at(
|
||||
9
|
||||
).samplerTexture1Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(9).samplerTexture1Location = this.gl.getUniformLocation(
|
||||
this._shaderSets.at(9).shaderProgram,
|
||||
's_texture1'
|
||||
);
|
||||
|
@ -1748,12 +1692,12 @@ export namespace Live2DCubismFramework {
|
|||
|
||||
_shaderSets: csmVector<CubismShaderSet>; // ロードしたシェーダープログラムを保持する変数
|
||||
gl: WebGLRenderingContext; // webglコンテキスト
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* CubismShader_WebGLのインナークラス
|
||||
*/
|
||||
export class CubismShaderSet {
|
||||
export class CubismShaderSet {
|
||||
shaderProgram: WebGLProgram; // シェーダープログラムのアドレス
|
||||
attributePositionLocation: GLuint; // シェーダープログラムに渡す変数のアドレス(Position)
|
||||
attributeTexCoordLocation: GLuint; // シェーダープログラムに渡す変数のアドレス(TexCoord)
|
||||
|
@ -1763,9 +1707,9 @@ export namespace Live2DCubismFramework {
|
|||
samplerTexture1Location: WebGLUniformLocation; // シェーダープログラムに渡す変数のアドレス(Texture1)
|
||||
uniformBaseColorLocation: WebGLUniformLocation; // シェーダープログラムに渡す変数のアドレス(BaseColor)
|
||||
uniformChannelFlagLocation: WebGLUniformLocation; // シェーダープログラムに渡す変数のアドレス(ChannelFlag)
|
||||
}
|
||||
}
|
||||
|
||||
export enum ShaderNames {
|
||||
export enum ShaderNames {
|
||||
// SetupMask
|
||||
ShaderNames_SetupMask,
|
||||
|
||||
|
@ -1783,9 +1727,9 @@ export namespace Live2DCubismFramework {
|
|||
ShaderNames_MultPremultipliedAlpha,
|
||||
ShaderNames_MultMaskedPremultipliedAlpha,
|
||||
ShaderNames_MultMaskedPremultipliedAlphaInverted
|
||||
}
|
||||
}
|
||||
|
||||
export const vertexShaderSrcSetupMask =
|
||||
export const vertexShaderSrcSetupMask =
|
||||
'attribute vec4 a_position;' +
|
||||
'attribute vec2 a_texCoord;' +
|
||||
'varying vec2 v_texCoord;' +
|
||||
|
@ -1798,7 +1742,7 @@ export namespace Live2DCubismFramework {
|
|||
' v_texCoord = a_texCoord;' +
|
||||
' v_texCoord.y = 1.0 - v_texCoord.y;' +
|
||||
'}';
|
||||
export const fragmentShaderSrcsetupMask =
|
||||
export const fragmentShaderSrcsetupMask =
|
||||
'precision mediump float;' +
|
||||
'varying vec2 v_texCoord;' +
|
||||
'varying vec4 v_myPos;' +
|
||||
|
@ -1815,9 +1759,9 @@ export namespace Live2DCubismFramework {
|
|||
' gl_FragColor = u_channelFlag * texture2D(s_texture0, v_texCoord).a * isInside;' +
|
||||
'}';
|
||||
|
||||
//----- バーテックスシェーダプログラム -----
|
||||
// Normal & Add & Mult 共通
|
||||
export const vertexShaderSrc =
|
||||
//----- バーテックスシェーダプログラム -----
|
||||
// Normal & Add & Mult 共通
|
||||
export const vertexShaderSrc =
|
||||
'attribute vec4 a_position;' + //v.vertex
|
||||
'attribute vec2 a_texCoord;' + //v.texcoord
|
||||
'varying vec2 v_texCoord;' + //v2f.texcoord
|
||||
|
@ -1829,8 +1773,8 @@ export namespace Live2DCubismFramework {
|
|||
' v_texCoord.y = 1.0 - v_texCoord.y;' +
|
||||
'}';
|
||||
|
||||
// Normal & Add & Mult 共通(クリッピングされたものの描画用)
|
||||
export const vertexShaderSrcMasked =
|
||||
// Normal & Add & Mult 共通(クリッピングされたものの描画用)
|
||||
export const vertexShaderSrcMasked =
|
||||
'attribute vec4 a_position;' +
|
||||
'attribute vec2 a_texCoord;' +
|
||||
'varying vec2 v_texCoord;' +
|
||||
|
@ -1845,9 +1789,9 @@ export namespace Live2DCubismFramework {
|
|||
' v_texCoord.y = 1.0 - v_texCoord.y;' +
|
||||
'}';
|
||||
|
||||
//----- フラグメントシェーダプログラム -----
|
||||
// Normal & Add & Mult 共通 (PremultipliedAlpha)
|
||||
export const fragmentShaderSrcPremultipliedAlpha =
|
||||
//----- フラグメントシェーダプログラム -----
|
||||
// Normal & Add & Mult 共通 (PremultipliedAlpha)
|
||||
export const fragmentShaderSrcPremultipliedAlpha =
|
||||
'precision mediump float;' +
|
||||
'varying vec2 v_texCoord;' + //v2f.texcoord
|
||||
'uniform vec4 u_baseColor;' +
|
||||
|
@ -1857,8 +1801,8 @@ export namespace Live2DCubismFramework {
|
|||
' gl_FragColor = texture2D(s_texture0 , v_texCoord) * u_baseColor;' +
|
||||
'}';
|
||||
|
||||
// Normal (クリッピングされたものの描画用、PremultipliedAlpha兼用)
|
||||
export const fragmentShaderSrcMaskPremultipliedAlpha =
|
||||
// Normal (クリッピングされたものの描画用、PremultipliedAlpha兼用)
|
||||
export const fragmentShaderSrcMaskPremultipliedAlpha =
|
||||
'precision mediump float;' +
|
||||
'varying vec2 v_texCoord;' +
|
||||
'varying vec4 v_clipPos;' +
|
||||
|
@ -1875,8 +1819,8 @@ export namespace Live2DCubismFramework {
|
|||
' gl_FragColor = col_formask;' +
|
||||
'}';
|
||||
|
||||
// Normal & Add & Mult 共通(クリッピングされて反転使用の描画用、PremultipliedAlphaの場合)
|
||||
export const fragmentShaderSrcMaskInvertedPremultipliedAlpha =
|
||||
// Normal & Add & Mult 共通(クリッピングされて反転使用の描画用、PremultipliedAlphaの場合)
|
||||
export const fragmentShaderSrcMaskInvertedPremultipliedAlpha =
|
||||
'precision mediump float;' +
|
||||
'varying vec2 v_texCoord;' +
|
||||
'varying vec4 v_clipPos;' +
|
||||
|
@ -1893,10 +1837,10 @@ export namespace Live2DCubismFramework {
|
|||
'gl_FragColor = col_formask;' +
|
||||
'}';
|
||||
|
||||
/**
|
||||
/**
|
||||
* WebGL用の描画命令を実装したクラス
|
||||
*/
|
||||
export class CubismRenderer_WebGL extends CubismRenderer {
|
||||
export class CubismRenderer_WebGL extends CubismRenderer {
|
||||
/**
|
||||
* レンダラの初期化処理を実行する
|
||||
* 引数に渡したモデルからレンダラの初期化処理に必要な情報を取り出すことができる
|
||||
|
@ -2248,12 +2192,31 @@ export namespace Live2DCubismFramework {
|
|||
index: WebGLBuffer;
|
||||
}; // 頂点バッファデータ
|
||||
gl: WebGLRenderingContext; // webglコンテキスト
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* レンダラが保持する静的なリソースを開放する
|
||||
*/
|
||||
CubismRenderer.staticRelease = (): void => {
|
||||
CubismRenderer.staticRelease = (): void => {
|
||||
CubismRenderer_WebGL.doStaticRelease();
|
||||
};
|
||||
};
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismrenderer_webgl';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismClippingContext = $.CubismClippingContext;
|
||||
export type CubismClippingContext = $.CubismClippingContext;
|
||||
export const CubismClippingManager_WebGL = $.CubismClippingManager_WebGL;
|
||||
export type CubismClippingManager_WebGL = $.CubismClippingManager_WebGL;
|
||||
export const CubismRenderTextureResource = $.CubismRenderTextureResource;
|
||||
export type CubismRenderTextureResource = $.CubismRenderTextureResource;
|
||||
export const CubismRenderer_WebGL = $.CubismRenderer_WebGL;
|
||||
export type CubismRenderer_WebGL = $.CubismRenderer_WebGL;
|
||||
export const CubismShaderSet = $.CubismShaderSet;
|
||||
export type CubismShaderSet = $.CubismShaderSet;
|
||||
export const CubismShader_WebGL = $.CubismShader_WebGL;
|
||||
export type CubismShader_WebGL = $.CubismShader_WebGL;
|
||||
export const ShaderNames = $.ShaderNames;
|
||||
export type ShaderNames = $.ShaderNames;
|
||||
}
|
||||
|
|
|
@ -7,12 +7,11 @@
|
|||
|
||||
import { CubismLogDebug } from '../utils/cubismdebug';
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
/**
|
||||
/**
|
||||
* Key-Valueのペアを定義するクラス
|
||||
* csmMapクラスの内部データで使用する。
|
||||
*/
|
||||
export class csmPair<_KeyT, _ValT> {
|
||||
export class csmPair<_KeyT, _ValT> {
|
||||
/**
|
||||
* コンストラクタ
|
||||
* @param key Keyとしてセットする値
|
||||
|
@ -26,12 +25,12 @@ export namespace Live2DCubismFramework {
|
|||
|
||||
public first: _KeyT; // keyとして用いる変数
|
||||
public second: _ValT; // valueとして用いる変数
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* マップ型
|
||||
*/
|
||||
export class csmMap<_KeyT, _ValT> {
|
||||
export class csmMap<_KeyT, _ValT> {
|
||||
/**
|
||||
* 引数付きコンストラクタ
|
||||
* @param size 初期化時点で確保するサイズ
|
||||
|
@ -227,12 +226,12 @@ export namespace Live2DCubismFramework {
|
|||
public _keyValues: csmPair<_KeyT, _ValT>[]; // key-valueペアの配列
|
||||
public _dummyValue: _ValT; // 空の値を返す為のダミー
|
||||
public _size: number; // コンテナの要素数
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* csmMap<T>のイテレータ
|
||||
*/
|
||||
export class iterator<_KeyT, _ValT> {
|
||||
export class iterator<_KeyT, _ValT> {
|
||||
/**
|
||||
* コンストラクタ
|
||||
*/
|
||||
|
@ -301,5 +300,16 @@ export namespace Live2DCubismFramework {
|
|||
|
||||
_index: number; // コンテナのインデックス値
|
||||
_map: csmMap<_KeyT, _ValT>; // コンテナ
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './csmmap';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const csmMap = $.csmMap;
|
||||
export type csmMap<K, V> = $.csmMap<K, V>;
|
||||
export const csmPair = $.csmPair;
|
||||
export type csmPair<K, V> = $.csmPair<K, V>;
|
||||
export const iterator = $.iterator;
|
||||
export type iterator<K, V> = $.iterator<K, V>;
|
||||
}
|
||||
|
|
|
@ -5,11 +5,10 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
/**
|
||||
/**
|
||||
* 矩形形状(座標・長さはfloat値)を定義するクラス
|
||||
*/
|
||||
export class csmRect {
|
||||
export class csmRect {
|
||||
/**
|
||||
* コンストラクタ
|
||||
* @param x 左端X座標
|
||||
|
@ -79,5 +78,12 @@ export namespace Live2DCubismFramework {
|
|||
public y: number; // 上端Y座標
|
||||
public width: number; // 幅
|
||||
public height: number; // 高さ
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './csmrectf';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const csmRect = $.csmRect;
|
||||
export type csmRect = $.csmRect;
|
||||
}
|
||||
|
|
|
@ -5,11 +5,10 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
/**
|
||||
/**
|
||||
* 文字列クラス。
|
||||
*/
|
||||
export class csmString {
|
||||
export class csmString {
|
||||
/**
|
||||
* 文字列を後方に追加する
|
||||
*
|
||||
|
@ -97,5 +96,12 @@ export namespace Live2DCubismFramework {
|
|||
}
|
||||
|
||||
s: string;
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './csmstring';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const csmString = $.csmString;
|
||||
export type csmString = $.csmString;
|
||||
}
|
||||
|
|
|
@ -5,11 +5,10 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
/**
|
||||
/**
|
||||
* ベクター型(可変配列型)
|
||||
*/
|
||||
export class csmVector<T> {
|
||||
export class csmVector<T> {
|
||||
/**
|
||||
* 引数付きコンストラクタ
|
||||
* @param iniitalCapacity 初期化後のキャパシティ。データサイズは_capacity * sizeof(T)
|
||||
|
@ -263,9 +262,9 @@ export namespace Live2DCubismFramework {
|
|||
_capacity: number; // コンテナのキャパシティ
|
||||
|
||||
static readonly s_defaultSize = 10; // コンテナ初期化のデフォルトサイズ
|
||||
}
|
||||
}
|
||||
|
||||
export class iterator<T> {
|
||||
export class iterator<T> {
|
||||
/**
|
||||
* コンストラクタ
|
||||
*/
|
||||
|
@ -340,5 +339,14 @@ export namespace Live2DCubismFramework {
|
|||
|
||||
_index: number; // コンテナのインデックス値
|
||||
_vector: csmVector<T>; // コンテナ
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './csmvector';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const csmVector = $.csmVector;
|
||||
export type csmVector<T> = $.csmVector<T>;
|
||||
export const iterator = $.iterator;
|
||||
export type iterator<T> = $.iterator<T>;
|
||||
}
|
||||
|
|
|
@ -5,21 +5,18 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import {
|
||||
Live2DCubismFramework as cubismframework,
|
||||
LogLevel
|
||||
} from '../live2dcubismframework';
|
||||
import {
|
||||
CSM_LOG_LEVEL,
|
||||
CSM_LOG_LEVEL_VERBOSE,
|
||||
CSM_LOG_LEVEL_DEBUG,
|
||||
CSM_LOG_LEVEL_ERROR,
|
||||
CSM_LOG_LEVEL_INFO,
|
||||
CSM_LOG_LEVEL_WARNING,
|
||||
CSM_LOG_LEVEL_ERROR
|
||||
CSM_LOG_LEVEL_VERBOSE,
|
||||
CSM_LOG_LEVEL_WARNING
|
||||
} from '../cubismframeworkconfig';
|
||||
import { CubismFramework, LogLevel } from '../live2dcubismframework';
|
||||
|
||||
export const CubismLogPrint = (level: LogLevel, fmt: string, args: any[]) => {
|
||||
Live2DCubismFramework.CubismDebug.print(level, '[CSM]' + fmt, args);
|
||||
CubismDebug.print(level, '[CSM]' + fmt, args);
|
||||
};
|
||||
|
||||
export const CubismLogPrintIn = (level: LogLevel, fmt: string, args: any[]) => {
|
||||
|
@ -98,13 +95,11 @@ if (CSM_LOG_LEVEL <= CSM_LOG_LEVEL_VERBOSE) {
|
|||
};
|
||||
}
|
||||
|
||||
//------------ LIVE2D NAMESPACE ------------
|
||||
export namespace Live2DCubismFramework {
|
||||
/**
|
||||
/**
|
||||
* デバッグ用のユーティリティクラス。
|
||||
* ログの出力、バイトのダンプなど
|
||||
*/
|
||||
export class CubismDebug {
|
||||
export class CubismDebug {
|
||||
/**
|
||||
* ログを出力する。第一引数にログレベルを設定する。
|
||||
* CubismFramework.initialize()時にオプションで設定されたログ出力レベルを下回る場合はログに出さない。
|
||||
|
@ -113,18 +108,14 @@ export namespace Live2DCubismFramework {
|
|||
* @param format 書式付き文字列
|
||||
* @param args 可変長引数
|
||||
*/
|
||||
public static print(
|
||||
logLevel: LogLevel,
|
||||
format: string,
|
||||
args?: any[]
|
||||
): void {
|
||||
public static print(logLevel: LogLevel, format: string, args?: any[]): void {
|
||||
// オプションで設定されたログ出力レベルを下回る場合はログに出さない
|
||||
if (logLevel < cubismframework.CubismFramework.getLoggingLevel()) {
|
||||
if (logLevel < CubismFramework.getLoggingLevel()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const logPrint: Live2DCubismCore.csmLogFunction =
|
||||
cubismframework.CubismFramework.coreLogFunction;
|
||||
CubismFramework.coreLogFunction;
|
||||
|
||||
if (!logPrint) return;
|
||||
|
||||
|
@ -160,7 +151,12 @@ export namespace Live2DCubismFramework {
|
|||
* private コンストラクタ
|
||||
*/
|
||||
private constructor() {}
|
||||
}
|
||||
}
|
||||
|
||||
//------------ LIVE2D NAMESPACE ------------
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismdebug';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismDebug = $.CubismDebug;
|
||||
export type CubismDebug = $.CubismDebug;
|
||||
}
|
||||
|
|
|
@ -5,26 +5,20 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import { Live2DCubismFramework as csmstring } from '../type/csmstring';
|
||||
import { Live2DCubismFramework as csmmap } from '../type/csmmap';
|
||||
import { Live2DCubismFramework as csmvector } from '../type/csmvector';
|
||||
import { CubismLogInfo } from './cubismdebug';
|
||||
import { strtod } from '../live2dcubismframework';
|
||||
import csmVector = csmvector.csmVector;
|
||||
import csmVector_iterator = csmvector.iterator;
|
||||
import csmMap = csmmap.csmMap;
|
||||
import csmMap_iterator = csmmap.iterator;
|
||||
import csmString = csmstring.csmString;
|
||||
import { csmMap, iterator as csmMap_iterator } from '../type/csmmap';
|
||||
import { csmString } from '../type/csmstring';
|
||||
import { csmVector, iterator as csmVector_iterator } from '../type/csmvector';
|
||||
import { CubismLogInfo } from './cubismdebug';
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
// StaticInitializeNotForClientCall()で初期化する
|
||||
const CSM_JSON_ERROR_TYPE_MISMATCH = 'Error: type mismatch';
|
||||
const CSM_JSON_ERROR_INDEX_OF_BOUNDS = 'Error: index out of bounds';
|
||||
// StaticInitializeNotForClientCall()で初期化する
|
||||
const CSM_JSON_ERROR_TYPE_MISMATCH = 'Error: type mismatch';
|
||||
const CSM_JSON_ERROR_INDEX_OF_BOUNDS = 'Error: index out of bounds';
|
||||
|
||||
/**
|
||||
/**
|
||||
* パースしたJSONエレメントの要素の基底クラス。
|
||||
*/
|
||||
export abstract class Value {
|
||||
export abstract class Value {
|
||||
/**
|
||||
* コンストラクタ
|
||||
*/
|
||||
|
@ -228,9 +222,9 @@ export namespace Live2DCubismFramework {
|
|||
|
||||
public static errorValue: Value; // 一時的な返り値として返すエラー。 CubismFramework::Disposeするまではdeleteしない
|
||||
public static nullValue: Value; // 一時的な返り値として返すNULL。 CubismFramework::Disposeするまではdeleteしない
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Ascii文字のみ対応した最小限の軽量JSONパーサ。
|
||||
* 仕様はJSONのサブセットとなる。
|
||||
* 設定ファイル(model3.json)などのロード用
|
||||
|
@ -239,7 +233,7 @@ export namespace Live2DCubismFramework {
|
|||
* ・日本語などの非ASCII文字
|
||||
* ・eによる指数表現
|
||||
*/
|
||||
export class CubismJson {
|
||||
export class CubismJson {
|
||||
/**
|
||||
* コンストラクタ
|
||||
*/
|
||||
|
@ -624,12 +618,7 @@ export namespace Live2DCubismFramework {
|
|||
}
|
||||
|
||||
// 値をチェック
|
||||
const value: Value = this.parseValue(
|
||||
buffer,
|
||||
length,
|
||||
i,
|
||||
localRetEndPos2
|
||||
);
|
||||
const value: Value = this.parseValue(buffer, length, i, localRetEndPos2);
|
||||
if (this._error) {
|
||||
return null;
|
||||
}
|
||||
|
@ -685,12 +674,7 @@ export namespace Live2DCubismFramework {
|
|||
// , が続く限りループ
|
||||
for (; i < length; i++) {
|
||||
// : をチェック
|
||||
const value: Value = this.parseValue(
|
||||
buffer,
|
||||
length,
|
||||
i,
|
||||
localRetEndpos2
|
||||
);
|
||||
const value: Value = this.parseValue(buffer, length, i, localRetEndpos2);
|
||||
|
||||
if (this._error) {
|
||||
return null;
|
||||
|
@ -731,12 +715,12 @@ export namespace Live2DCubismFramework {
|
|||
_error: string; // パース時のエラー
|
||||
_lineCount: number; // エラー報告に用いる行数カウント
|
||||
_root: Value; // パースされたルート要素
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* パースしたJSONの要素をfloat値として扱う
|
||||
*/
|
||||
export class JsonFloat extends Value {
|
||||
export class JsonFloat extends Value {
|
||||
/**
|
||||
* コンストラクタ
|
||||
*/
|
||||
|
@ -800,12 +784,12 @@ export namespace Live2DCubismFramework {
|
|||
}
|
||||
|
||||
private _value: number; // JSON要素の値
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* パースしたJSONの要素を真偽値として扱う
|
||||
*/
|
||||
export class JsonBoolean extends Value {
|
||||
export class JsonBoolean extends Value {
|
||||
/**
|
||||
* Valueの種類が真偽値ならtrue
|
||||
*/
|
||||
|
@ -863,12 +847,12 @@ export namespace Live2DCubismFramework {
|
|||
static falseValue: JsonBoolean; // false
|
||||
|
||||
private _boolValue: boolean; // JSON要素の値
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* パースしたJSONの要素を文字列として扱う
|
||||
*/
|
||||
export class JsonString extends Value {
|
||||
export class JsonString extends Value {
|
||||
/**
|
||||
* 引数付きコンストラクタ
|
||||
*/
|
||||
|
@ -918,12 +902,12 @@ export namespace Live2DCubismFramework {
|
|||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* JSONパース時のエラー結果。文字列型のようにふるまう
|
||||
*/
|
||||
export class JsonError extends JsonString {
|
||||
export class JsonError extends JsonString {
|
||||
/**
|
||||
* Valueの値が静的ならtrue、静的なら解放しない
|
||||
*/
|
||||
|
@ -959,12 +943,12 @@ export namespace Live2DCubismFramework {
|
|||
}
|
||||
|
||||
protected _isStatic: boolean; // 静的なValueかどうか
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* パースしたJSONの要素をNULL値として持つ
|
||||
*/
|
||||
export class JsonNullvalue extends Value {
|
||||
export class JsonNullvalue extends Value {
|
||||
/**
|
||||
* Valueの種類がNULL値ならtrue
|
||||
*/
|
||||
|
@ -994,12 +978,12 @@ export namespace Live2DCubismFramework {
|
|||
|
||||
this._stringBuffer = 'NullValue';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* パースしたJSONの要素を配列として持つ
|
||||
*/
|
||||
export class JsonArray extends Value {
|
||||
export class JsonArray extends Value {
|
||||
/**
|
||||
* コンストラクタ
|
||||
*/
|
||||
|
@ -1104,12 +1088,12 @@ export namespace Live2DCubismFramework {
|
|||
}
|
||||
|
||||
private _array: csmVector<Value>; // JSON要素の値
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* パースしたJSONの要素をマップとして持つ
|
||||
*/
|
||||
export class JsonMap extends Value {
|
||||
export class JsonMap extends Value {
|
||||
/**
|
||||
* コンストラクタ
|
||||
*/
|
||||
|
@ -1242,5 +1226,28 @@ export namespace Live2DCubismFramework {
|
|||
|
||||
private _map: csmMap<string, Value>; // JSON要素の値
|
||||
private _keys: csmVector<string>; // JSON要素の値
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismjson';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismJson = $.CubismJson;
|
||||
export type CubismJson = $.CubismJson;
|
||||
export const JsonArray = $.JsonArray;
|
||||
export type JsonArray = $.JsonArray;
|
||||
export const JsonBoolean = $.JsonBoolean;
|
||||
export type JsonBoolean = $.JsonBoolean;
|
||||
export const JsonError = $.JsonError;
|
||||
export type JsonError = $.JsonError;
|
||||
export const JsonFloat = $.JsonFloat;
|
||||
export type JsonFloat = $.JsonFloat;
|
||||
export const JsonMap = $.JsonMap;
|
||||
export type JsonMap = $.JsonMap;
|
||||
export const JsonNullvalue = $.JsonNullvalue;
|
||||
export type JsonNullvalue = $.JsonNullvalue;
|
||||
export const JsonString = $.JsonString;
|
||||
export type JsonString = $.JsonString;
|
||||
export const Value = $.Value;
|
||||
export type Value = $.Value;
|
||||
}
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
export namespace Live2DCubismFramework {
|
||||
export class CubismString {
|
||||
export class CubismString {
|
||||
/**
|
||||
* 標準出力の書式を適用した文字列を取得する。
|
||||
* @param format 標準出力の書式指定文字列
|
||||
|
@ -119,5 +118,12 @@ export namespace Live2DCubismFramework {
|
|||
* コンストラクタ呼び出し不可な静的クラスにする。
|
||||
*/
|
||||
private constructor() {}
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace definition for compatibility.
|
||||
import * as $ from './cubismstring';
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
export namespace Live2DCubismFramework {
|
||||
export const CubismString = $.CubismString;
|
||||
export type CubismString = $.CubismString;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue