Change to compatible syntax without namaspace

master
Jun Koyama 2020-10-05 23:45:01 +09:00
parent 572cb01ec8
commit 6a61a4c349
No known key found for this signature in database
GPG Key ID: 7E7F553174548698
41 changed files with 13528 additions and 13418 deletions

View File

@ -10,56 +10,109 @@
* <br> * <br>
* https://docs.live2d.com/cubism-editor-manual/standard-parametor-list/ * https://docs.live2d.com/cubism-editor-manual/standard-parametor-list/
*/ */
export namespace Live2DCubismFramework { export const CubismDefaultParameterId = Object.freeze({
// パーツID // パーツID
export const HitAreaPrefix = 'HitArea'; HitAreaPrefix: 'HitArea',
export const HitAreaHead = 'Head'; HitAreaHead: 'Head',
export const HitAreaBody = 'Body'; HitAreaBody: 'Body',
export const PartsIdCore = 'Parts01Core'; PartsIdCore: 'Parts01Core',
export const PartsArmPrefix = 'Parts01Arm_'; PartsArmPrefix: 'Parts01Arm_',
export const PartsArmLPrefix = 'Parts01ArmL_'; PartsArmLPrefix: 'Parts01ArmL_',
export const PartsArmRPrefix = 'Parts01ArmR_'; PartsArmRPrefix: 'Parts01ArmR_',
// パラメータID // パラメータID
export const ParamAngleX = 'ParamAngleX'; ParamAngleX: 'ParamAngleX',
export const ParamAngleY = 'ParamAngleY'; ParamAngleY: 'ParamAngleY',
export const ParamAngleZ = 'ParamAngleZ'; ParamAngleZ: 'ParamAngleZ',
export const ParamEyeLOpen = 'ParamEyeLOpen'; ParamEyeLOpen: 'ParamEyeLOpen',
export const ParamEyeLSmile = 'ParamEyeLSmile'; ParamEyeLSmile: 'ParamEyeLSmile',
export const ParamEyeROpen = 'ParamEyeROpen'; ParamEyeROpen: 'ParamEyeROpen',
export const ParamEyeRSmile = 'ParamEyeRSmile'; ParamEyeRSmile: 'ParamEyeRSmile',
export const ParamEyeBallX = 'ParamEyeBallX'; ParamEyeBallX: 'ParamEyeBallX',
export const ParamEyeBallY = 'ParamEyeBallY'; ParamEyeBallY: 'ParamEyeBallY',
export const ParamEyeBallForm = 'ParamEyeBallForm'; ParamEyeBallForm: 'ParamEyeBallForm',
export const ParamBrowLY = 'ParamBrowLY'; ParamBrowLY: 'ParamBrowLY',
export const ParamBrowRY = 'ParamBrowRY'; ParamBrowRY: 'ParamBrowRY',
export const ParamBrowLX = 'ParamBrowLX'; ParamBrowLX: 'ParamBrowLX',
export const ParamBrowRX = 'ParamBrowRX'; ParamBrowRX: 'ParamBrowRX',
export const ParamBrowLAngle = 'ParamBrowLAngle'; ParamBrowLAngle: 'ParamBrowLAngle',
export const ParamBrowRAngle = 'ParamBrowRAngle'; ParamBrowRAngle: 'ParamBrowRAngle',
export const ParamBrowLForm = 'ParamBrowLForm'; ParamBrowLForm: 'ParamBrowLForm',
export const ParamBrowRForm = 'ParamBrowRForm'; ParamBrowRForm: 'ParamBrowRForm',
export const ParamMouthForm = 'ParamMouthForm'; ParamMouthForm: 'ParamMouthForm',
export const ParamMouthOpenY = 'ParamMouthOpenY'; ParamMouthOpenY: 'ParamMouthOpenY',
export const ParamCheek = 'ParamCheek'; ParamCheek: 'ParamCheek',
export const ParamBodyAngleX = 'ParamBodyAngleX'; ParamBodyAngleX: 'ParamBodyAngleX',
export const ParamBodyAngleY = 'ParamBodyAngleY'; ParamBodyAngleY: 'ParamBodyAngleY',
export const ParamBodyAngleZ = 'ParamBodyAngleZ'; ParamBodyAngleZ: 'ParamBodyAngleZ',
export const ParamBreath = 'ParamBreath'; ParamBreath: 'ParamBreath',
export const ParamArmLA = 'ParamArmLA'; ParamArmLA: 'ParamArmLA',
export const ParamArmRA = 'ParamArmRA'; ParamArmRA: 'ParamArmRA',
export const ParamArmLB = 'ParamArmLB'; ParamArmLB: 'ParamArmLB',
export const ParamArmRB = 'ParamArmRB'; ParamArmRB: 'ParamArmRB',
export const ParamHandL = 'ParamHandL'; ParamHandL: 'ParamHandL',
export const ParamHandR = 'ParamHandR'; ParamHandR: 'ParamHandR',
export const ParamHairFront = 'ParamHairFront'; ParamHairFront: 'ParamHairFront',
export const ParamHairSide = 'ParamHairSide'; ParamHairSide: 'ParamHairSide',
export const ParamHairBack = 'ParamHairBack'; ParamHairBack: 'ParamHairBack',
export const ParamHairFluffy = 'ParamHairFluffy'; ParamHairFluffy: 'ParamHairFluffy',
export const ParamShoulderY = 'ParamShoulderY'; ParamShoulderY: 'ParamShoulderY',
export const ParamBustX = 'ParamBustX'; ParamBustX: 'ParamBustX',
export const ParamBustY = 'ParamBustY'; ParamBustY: 'ParamBustY',
export const ParamBaseX = 'ParamBaseX'; ParamBaseX: 'ParamBaseX',
export const ParamBaseY = 'ParamBaseY'; ParamBaseY: 'ParamBaseY',
export const ParamNONE = 'NONE:'; 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;
} }

View File

@ -5,22 +5,13 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import { Live2DCubismFramework as cubismframework } from './live2dcubismframework'; import { ICubismModelSetting } from './icubismmodelsetting';
import { Live2DCubismFramework as icubismmodelsetting } from './icubismmodelsetting'; import { CubismIdHandle } from './id/cubismid';
import { Live2DCubismFramework as cubismid } from './id/cubismid'; import { CubismFramework } from './live2dcubismframework';
import { Live2DCubismFramework as cubismjson } from './utils/cubismjson'; import { csmMap, iterator } from './type/csmmap';
import { Live2DCubismFramework as csmmap } from './type/csmmap'; import { csmVector } from './type/csmvector';
import { Live2DCubismFramework as csmvector } from './type/csmvector'; import { CubismJson, Value } from './utils/cubismjson';
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;
export namespace Live2DCubismFramework {
/** /**
* Model3Json * Model3Json
*/ */
@ -142,9 +133,7 @@ export namespace Live2DCubismFramework {
.getValueByString(FileReferences) .getValueByString(FileReferences)
.getValueByString(Pose) .getValueByString(Pose)
); );
this._jsonValue.pushBack( this._jsonValue.pushBack(this._json.getRoot().getValueByString(HitAreas));
this._json.getRoot().getValueByString(HitAreas)
);
} }
} }
@ -261,9 +250,7 @@ export namespace Live2DCubismFramework {
return ''; return '';
} }
return this._jsonValue return this._jsonValue.at(FrequestNode.FrequestNode_Physics).getRawString();
.at(FrequestNode.FrequestNode_Physics)
.getRawString();
} }
/** /**
@ -287,9 +274,7 @@ export namespace Live2DCubismFramework {
return 0; return 0;
} }
return this._jsonValue return this._jsonValue.at(FrequestNode.FrequestNode_Expressions).getSize();
.at(FrequestNode.FrequestNode_Expressions)
.getSize();
} }
/** /**
@ -640,9 +625,7 @@ export namespace Live2DCubismFramework {
* @return false * @return false
*/ */
private isExistTextureFiles(): boolean { private isExistTextureFiles(): boolean {
const node: Value = this._jsonValue.at( const node: Value = this._jsonValue.at(FrequestNode.FrequestNode_Textures);
FrequestNode.FrequestNode_Textures
);
return !node.isNull() && !node.isError(); return !node.isNull() && !node.isError();
} }
@ -652,9 +635,7 @@ export namespace Live2DCubismFramework {
* @return false * @return false
*/ */
private isExistHitAreas(): boolean { private isExistHitAreas(): boolean {
const node: Value = this._jsonValue.at( const node: Value = this._jsonValue.at(FrequestNode.FrequestNode_HitAreas);
FrequestNode.FrequestNode_HitAreas
);
return !node.isNull() && !node.isError(); return !node.isNull() && !node.isError();
} }
@ -839,4 +820,11 @@ export namespace Live2DCubismFramework {
private _json: CubismJson; private _json: CubismJson;
private _jsonValue: csmVector<Value>; 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;
} }

View File

@ -5,14 +5,10 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * 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 { CubismIdHandle } from '../id/cubismid';
import { Live2DCubismFramework as cubismmodel } from '../model/cubismmodel'; import { CubismModel } from '../model/cubismmodel';
import { Live2DCubismFramework as cubismid } from '../id/cubismid'; import { csmVector } from '../type/csmvector';
import CubismIdHandle = cubismid.CubismIdHandle;
import CubismModel = cubismmodel.CubismModel;
import csmVector = csmvector.csmVector;
export namespace Live2DCubismFramework {
/** /**
* *
* *
@ -40,9 +36,7 @@ export namespace Live2DCubismFramework {
* *
* @param breathParameters * @param breathParameters
*/ */
public setParameters( public setParameters(breathParameters: csmVector<BreathParameterData>): void {
breathParameters: csmVector<BreathParameterData>
): void {
this._breathParameters = breathParameters; this._breathParameters = breathParameters;
} }
@ -59,10 +53,7 @@ export namespace Live2DCubismFramework {
* @param model * @param model
* @param deltaTimeSeconds [] * @param deltaTimeSeconds []
*/ */
public updateParameters( public updateParameters(model: CubismModel, deltaTimeSeconds: number): void {
model: CubismModel,
deltaTimeSeconds: number
): void {
this._currentTime += deltaTimeSeconds; this._currentTime += deltaTimeSeconds;
const t: number = this._currentTime * 2.0 * 3.14159; const t: number = this._currentTime * 2.0 * 3.14159;
@ -121,4 +112,13 @@ export namespace Live2DCubismFramework {
cycle: number; // 呼吸を正弦波としたときの、波の周期 cycle: number; // 呼吸を正弦波としたときの、波の周期
weight: 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;
} }

View File

@ -5,16 +5,11 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * 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 { ICubismModelSetting } from '../icubismmodelsetting';
import { Live2DCubismFramework as icubismmodelsetting } from '../icubismmodelsetting'; import { CubismIdHandle } from '../id/cubismid';
import { Live2DCubismFramework as cubismid } from '../id/cubismid'; import { CubismModel } from '../model/cubismmodel';
import { Live2DCubismFramework as cubismmodel } from '../model/cubismmodel'; import { csmVector } from '../type/csmvector';
import CubismModel = cubismmodel.CubismModel;
import CubismIdHandle = cubismid.CubismIdHandle;
import ICubismModelSetting = icubismmodelsetting.ICubismModelSetting;
import csmVector = csmvector.csmVector;
export namespace Live2DCubismFramework {
/** /**
* *
* *
@ -88,10 +83,7 @@ export namespace Live2DCubismFramework {
* @param model * @param model
* @param deltaTimeSeconds [] * @param deltaTimeSeconds []
*/ */
public updateParameters( public updateParameters(model: CubismModel, deltaTimeSeconds: number): void {
model: CubismModel,
deltaTimeSeconds: number
): void {
this._userTimeSeconds += deltaTimeSeconds; this._userTimeSeconds += deltaTimeSeconds;
let parameterValue: number; let parameterValue: number;
let t = 0.0; let t = 0.0;
@ -229,4 +221,13 @@ export namespace Live2DCubismFramework {
EyeState_Closed, // まぶたが閉じている状態 EyeState_Closed, // まぶたが閉じている状態
EyeState_Opening // まぶたが開いていく途中の状態 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;
} }

View File

@ -5,20 +5,12 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * 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 { CubismIdHandle } from '../id/cubismid';
import { Live2DCubismFramework as csmvector } from '../type/csmvector'; import { CubismFramework } from '../live2dcubismframework';
import { Live2DCubismFramework as cubismmodel } from '../model/cubismmodel'; import { CubismModel } from '../model/cubismmodel';
import { Live2DCubismFramework as cubismframework } from '../live2dcubismframework'; import { csmVector, iterator } from '../type/csmvector';
import { Live2DCubismFramework as cubismjson } from '../utils/cubismjson'; import { CubismJson, Value } 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;
export namespace Live2DCubismFramework {
const Epsilon = 0.001; const Epsilon = 0.001;
const DefaultFadeInSeconds = 0.5; const DefaultFadeInSeconds = 0.5;
@ -119,10 +111,7 @@ export namespace Live2DCubismFramework {
* @param model * @param model
* @param deltaTimeSeconds [] * @param deltaTimeSeconds []
*/ */
public updateParameters( public updateParameters(model: CubismModel, deltaTimeSeconds: number): void {
model: CubismModel,
deltaTimeSeconds: number
): void {
// 前回のモデルと同じでない場合は初期化が必要 // 前回のモデルと同じでない場合は初期化が必要
if (model != this._lastModel) { if (model != this._lastModel) {
// パラメータインデックスの初期化 // パラメータインデックスの初期化
@ -171,10 +160,7 @@ export namespace Live2DCubismFramework {
} }
model.setPartOpacityByIndex(partsIndex, j == beginIndex ? 1.0 : 0.0); model.setPartOpacityByIndex(partsIndex, j == beginIndex ? 1.0 : 0.0);
model.setParameterValueByIndex( model.setParameterValueByIndex(paramIndex, j == beginIndex ? 1.0 : 0.0);
paramIndex,
j == beginIndex ? 1.0 : 0.0
);
for (let k = 0; k < this._partGroups.at(j).link.getSize(); ++k) { for (let k = 0; k < this._partGroups.at(j).link.getSize(); ++k) {
this._partGroups this._partGroups
@ -402,4 +388,13 @@ export namespace Live2DCubismFramework {
partIndex: number; // パーツのインデックス partIndex: number; // パーツのインデックス
link: csmVector<PartData>; // 連動するパラメータ 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;
} }

View File

@ -5,7 +5,6 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
export namespace Live2DCubismFramework {
/** /**
* *
* *
@ -42,4 +41,11 @@ export namespace Live2DCubismFramework {
*/ */
public abstract deallocateAligned(alignedMemory: any): void; 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;
} }

View File

@ -5,12 +5,9 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * 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 { CubismIdHandle } from './id/cubismid';
import { Live2DCubismFramework as csmmap } from './type/csmmap'; import { csmMap } from './type/csmmap';
import csmMap = csmmap.csmMap;
import CubismIdHandle = cubismid.CubismIdHandle;
export namespace Live2DCubismFramework {
/** /**
* *
* *
@ -196,4 +193,11 @@ export namespace Live2DCubismFramework {
*/ */
public abstract getLipSyncParameterId(index: number): CubismIdHandle; 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;
} }

View File

@ -5,10 +5,8 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * 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 } from '../type/csmstring';
import csmString = csmstring.csmString;
export namespace Live2DCubismFramework {
/** /**
* Drawable * Drawable
* *
@ -70,4 +68,12 @@ export namespace Live2DCubismFramework {
} }
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;
} }

View File

@ -5,14 +5,10 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * 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 { csmString } from '../type/csmstring';
import { Live2DCubismFramework as cubismid } from './cubismid'; import { csmVector } from '../type/csmvector';
import { Live2DCubismFramework as csmstring } from '../type/csmstring'; import { CubismId } from './cubismid';
import csmString = csmstring.csmString;
import CubismId = cubismid.CubismId;
import csmVector = csmvector.csmVector;
export namespace Live2DCubismFramework {
/** /**
* ID * ID
* *
@ -115,4 +111,11 @@ export namespace Live2DCubismFramework {
private _ids: csmVector<CubismId>; // 登録されているIDのリスト 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;
} }

View File

@ -5,17 +5,14 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * 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 { CubismIdManager } from './id/cubismidmanager';
import { Live2DCubismFramework as cubismidmanager } from './id/cubismidmanager'; import { CubismRenderer } from './rendering/cubismrenderer';
import { Live2DCubismFramework as cubismrenderer } from './rendering/cubismrenderer';
import { import {
CSM_ASSERT,
CubismLogInfo, CubismLogInfo,
CubismLogWarning, CubismLogWarning
CSM_ASSERT
} from './utils/cubismdebug'; } from './utils/cubismdebug';
import Value = cubismjson.Value; import { Value } from './utils/cubismjson';
import CubismIdManager = cubismidmanager.CubismIdManager;
import CubismRenderer = cubismrenderer.CubismRenderer;
export function strtod(s: string, endPtr: string[]): number { export function strtod(s: string, endPtr: string[]): number {
let index = 0; let index = 0;
@ -47,7 +44,6 @@ export function strtod(s: string, endPtr: string[]): number {
return d; return d;
} }
export namespace Live2DCubismFramework {
// ファイルスコープの変数を初期化 // ファイルスコープの変数を初期化
let s_isStarted = false; let s_isStarted = false;
@ -58,10 +54,10 @@ export namespace Live2DCubismFramework {
/** /**
* Framework使 * Framework使
*/ */
export namespace Constant { export const Constant = Object.freeze({
export const vertexOffset = 0; // メッシュ頂点のオフセット値 vertexOffset: 0, // メッシュ頂点のオフセット値
export const vertexStep = 2; // メッシュ頂点のステップ値 vertexStep: 2 // メッシュ頂点のステップ値
} });
export function csmDelete<T>(address: T): void { export function csmDelete<T>(address: T): void {
if (!address) { if (!address) {
@ -252,7 +248,6 @@ export namespace Live2DCubismFramework {
*/ */
private constructor() {} private constructor() {}
} }
}
export class Option { export class Option {
logFunction: Live2DCubismCore.csmLogFunction; // ログ出力の関数オブジェクト logFunction: Live2DCubismCore.csmLogFunction; // ログ出力の関数オブジェクト
@ -270,3 +265,13 @@ export enum LogLevel {
LogLevel_Error, // エラーログ LogLevel_Error, // エラーログ
LogLevel_Off // ログ出力無効 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;
}

View File

@ -5,10 +5,8 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * 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 } from './cubismvector2';
import CubismVector2 = cubismvector2.CubismVector2;
export namespace Live2DCubismFramework {
/** /**
* 使 * 使
*/ */
@ -192,4 +190,11 @@ export namespace Live2DCubismFramework {
*/ */
private constructor() {} 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;
} }

View File

@ -5,7 +5,6 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
export namespace Live2DCubismFramework {
/** /**
* 4x4 * 4x4
* *
@ -305,4 +304,11 @@ export namespace Live2DCubismFramework {
protected _tr: Float32Array; // 4x4行列データ 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;
} }

View File

@ -5,13 +5,9 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * 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 { csmMap, iterator } from '../type/csmmap';
import { Live2DCubismFramework as cubismmatrix44 } from './cubismmatrix44'; import { CubismMatrix44 } from './cubismmatrix44';
import csmMap = csmmap.csmMap;
import iterator = csmmap.iterator;
import CubismMatrix44 = cubismmatrix44.CubismMatrix44;
export namespace Live2DCubismFramework {
/** /**
* 4x4 * 4x4
* *
@ -220,4 +216,11 @@ export namespace Live2DCubismFramework {
private _width: number; // 横幅 private _width: number; // 横幅
private _height: 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;
} }

View File

@ -5,10 +5,8 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * 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 } from './cubismmath';
import CubismMath = cubismmath.CubismMath;
export namespace Live2DCubismFramework {
const FrameRate = 30; const FrameRate = 30;
const Epsilon = 0.01; const Epsilon = 0.01;
@ -161,4 +159,11 @@ export namespace Live2DCubismFramework {
private _lastTimeSeconds: number; // 最後の実行時間[秒] private _lastTimeSeconds: number; // 最後の実行時間[秒]
private _userTimeSeconds: 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;
} }

View File

@ -5,7 +5,6 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
export namespace Live2DCubismFramework {
/** /**
* 2 * 2
* *
@ -160,4 +159,11 @@ export namespace Live2DCubismFramework {
return !this.isEqual(rhs); 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;
} }

View File

@ -5,10 +5,8 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * 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 } from './cubismmatrix44';
import CubismMatrix44 = cubismmatrix44.CubismMatrix44;
export namespace Live2DCubismFramework {
/** /**
* 使便4x4 * 使便4x4
* *
@ -43,10 +41,7 @@ export namespace Live2DCubismFramework {
x = this._screenLeft - this._tr[0] * this._maxLeft - this._tr[12]; x = this._screenLeft - this._tr[0] * this._maxLeft - this._tr[12];
} }
if ( if (this._tr[0] * this._maxRight + (this._tr[12] + x) < this._screenRight) {
this._tr[0] * this._maxRight + (this._tr[12] + x) <
this._screenRight
) {
x = this._screenRight - this._tr[0] * this._maxRight - this._tr[12]; x = this._screenRight - this._tr[0] * this._maxRight - this._tr[12];
} }
@ -334,4 +329,11 @@ export namespace Live2DCubismFramework {
private _maxScale: number; // 拡大率の最大値 private _maxScale: number; // 拡大率の最大値
private _minScale: 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;
} }

View File

@ -5,11 +5,9 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * 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 { CSM_ASSERT } from '../utils/cubismdebug';
import { CubismModel } from './cubismmodel';
export namespace Live2DCubismFramework {
/** /**
* Moc * Moc
* *
@ -97,4 +95,11 @@ export namespace Live2DCubismFramework {
_moc: Live2DCubismCore.Moc; // Mocデータ _moc: Live2DCubismCore.Moc; // Mocデータ
_modelCount: number; // 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;
} }

View File

@ -5,19 +5,13 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * 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 { CubismIdHandle } from '../id/cubismid';
import { Live2DCubismFramework as cubismid } from '../id/cubismid'; import { CubismFramework } from '../live2dcubismframework';
import { Live2DCubismFramework as cubismframework } from '../live2dcubismframework'; import { CubismBlendMode } from '../rendering/cubismrenderer';
import { Live2DCubismFramework as csmmap } from '../type/csmmap'; import { csmMap } from '../type/csmmap';
import { Live2DCubismFramework as csmvector } from '../type/csmvector'; import { csmVector } from '../type/csmvector';
import { CSM_ASSERT } from '../utils/cubismdebug'; 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 {
/** /**
* *
* *
@ -43,8 +37,7 @@ export namespace Live2DCubismFramework {
} }
return ( return (
this._model.canvasinfo.CanvasWidth / this._model.canvasinfo.CanvasWidth / this._model.canvasinfo.PixelsPerUnit
this._model.canvasinfo.PixelsPerUnit
); );
} }
@ -57,8 +50,7 @@ export namespace Live2DCubismFramework {
} }
return ( return (
this._model.canvasinfo.CanvasHeight / this._model.canvasinfo.CanvasHeight / this._model.canvasinfo.PixelsPerUnit
this._model.canvasinfo.PixelsPerUnit
); );
} }
@ -530,8 +522,7 @@ export namespace Live2DCubismFramework {
* @return drawable * @return drawable
*/ */
public getDrawableVertexPositions(drawableIndex: number): Float32Array { public getDrawableVertexPositions(drawableIndex: number): Float32Array {
const verticesArray: Float32Array[] = this._model.drawables const verticesArray: Float32Array[] = this._model.drawables.vertexPositions;
.vertexPositions;
return verticesArray[drawableIndex]; return verticesArray[drawableIndex];
} }
@ -647,9 +638,7 @@ export namespace Live2DCubismFramework {
*/ */
public getDrawableDynamicFlagIsVisible(drawableIndex: number): boolean { public getDrawableDynamicFlagIsVisible(drawableIndex: number): boolean {
const dynamicFlags: Uint8Array = this._model.drawables.dynamicFlags; const dynamicFlags: Uint8Array = this._model.drawables.dynamicFlags;
return Live2DCubismCore.Utils.hasIsVisibleBit( return Live2DCubismCore.Utils.hasIsVisibleBit(dynamicFlags[drawableIndex]);
dynamicFlags[drawableIndex]
);
} }
/** /**
@ -819,4 +808,11 @@ export namespace Live2DCubismFramework {
private _partIds: csmVector<CubismIdHandle>; private _partIds: csmVector<CubismIdHandle>;
private _drawableIds: 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;
} }

View File

@ -5,18 +5,12 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import { Live2DCubismFramework as cubismmodeluserdatajson } from './cubismmodeluserdatajson'; import { CubismIdHandle } from '../id/cubismid';
import { Live2DCubismFramework as cubismid } from '../id/cubismid'; import { CubismFramework } from '../live2dcubismframework';
import { Live2DCubismFramework as csmstring } from '../type/csmstring'; import { csmString } from '../type/csmstring';
import { Live2DCubismFramework as csmvector } from '../type/csmvector'; import { csmVector } from '../type/csmvector';
import { Live2DCubismFramework as cubismframework } from '../live2dcubismframework'; import { CubismModelUserDataJson } from './cubismmodeluserdatajson';
import CubismFramework = cubismframework.CubismFramework;
import csmVector = csmvector.csmVector;
import csmString = csmstring.csmString;
import CubismIdHandle = cubismid.CubismIdHandle;
import CubismModelUserDataJson = cubismmodeluserdatajson.CubismModelUserDataJson;
export namespace Live2DCubismFramework {
const ArtMesh = 'ArtMesh'; const ArtMesh = 'ArtMesh';
/** /**
@ -43,10 +37,7 @@ export namespace Live2DCubismFramework {
* @param size * @param size
* @return * @return
*/ */
public static create( public static create(buffer: ArrayBuffer, size: number): CubismModelUserData {
buffer: ArrayBuffer,
size: number
): CubismModelUserData {
const ret: CubismModelUserData = new CubismModelUserData(); const ret: CubismModelUserData = new CubismModelUserData();
ret.parseUserData(buffer, size); ret.parseUserData(buffer, size);
@ -133,4 +124,13 @@ export namespace Live2DCubismFramework {
private _userDataNodes: csmVector<CubismModelUserDataNode>; // ユーザーデータ構造体配列 private _userDataNodes: csmVector<CubismModelUserDataNode>; // ユーザーデータ構造体配列
private _artMeshUserDataNode: 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;
} }

View File

@ -5,14 +5,10 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * 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 { CubismIdHandle } from '../id/cubismid';
import { Live2DCubismFramework as cubismid } from '../id/cubismid'; import { CubismFramework } from '../live2dcubismframework';
import { Live2DCubismFramework as cubismframework } from '../live2dcubismframework'; import { CubismJson } from '../utils/cubismjson';
import CubismFramework = cubismframework.CubismFramework;
import CubismIdHandle = cubismid.CubismIdHandle;
import CubismJson = cubismjson.CubismJson;
export namespace Live2DCubismFramework {
const Meta = 'Meta'; const Meta = 'Meta';
const UserDataCount = 'UserDataCount'; const UserDataCount = 'UserDataCount';
const TotalUserDataSize = 'TotalUserDataSize'; const TotalUserDataSize = 'TotalUserDataSize';
@ -111,4 +107,11 @@ export namespace Live2DCubismFramework {
private _json: CubismJson; 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;
} }

View File

@ -5,46 +5,26 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import { Live2DCubismFramework as cubismframework } from '../live2dcubismframework'; import { CubismBreath } from '../effect/cubismbreath';
import { Live2DCubismFramework as cubismmotionmanager } from '../motion/cubismmotionmanager'; import { CubismEyeBlink } from '../effect/cubismeyeblink';
import { Live2DCubismFramework as cubismtargetpoint } from '../math/cubismtargetpoint'; import { CubismPose } from '../effect/cubismpose';
import { Live2DCubismFramework as cubismmodelmatrix } from '../math/cubismmodelmatrix'; import { CubismIdHandle } from '../id/cubismid';
import { Live2DCubismFramework as cubismmoc } from './cubismmoc'; import { Constant } from '../live2dcubismframework';
import { Live2DCubismFramework as cubismmodel } from './cubismmodel'; import { CubismModelMatrix } from '../math/cubismmodelmatrix';
import { Live2DCubismFramework as acubismmotion } from '../motion/acubismmotion'; import { CubismTargetPoint } from '../math/cubismtargetpoint';
import { Live2DCubismFramework as cubismmotion } from '../motion/cubismmotion'; import { ACubismMotion, FinishedMotionCallback } from '../motion/acubismmotion';
import { Live2DCubismFramework as cubismexpressionmotion } from '../motion/cubismexpressionmotion'; import { CubismExpressionMotion } from '../motion/cubismexpressionmotion';
import { Live2DCubismFramework as cubismpose } from '../effect/cubismpose'; import { CubismMotion } from '../motion/cubismmotion';
import { Live2DCubismFramework as cubismmodeluserdata } from './cubismmodeluserdata'; import { CubismMotionManager } from '../motion/cubismmotionmanager';
import { Live2DCubismFramework as cubismphysics } from '../physics/cubismphysics'; import { CubismMotionQueueManager } from '../motion/cubismmotionqueuemanager';
import { Live2DCubismFramework as cubismid } from '../id/cubismid'; import { CubismPhysics } from '../physics/cubismphysics';
import { Live2DCubismFramework as csmstring } from '../type/csmstring'; import { CubismRenderer_WebGL } from '../rendering/cubismrenderer_webgl';
import { Live2DCubismFramework as cubismmotionqueuemanager } from '../motion/cubismmotionqueuemanager'; import { csmString } from '../type/csmstring';
import { Live2DCubismFramework as cubismbreath } from '../effect/cubismbreath';
import { Live2DCubismFramework as cubismeyeblink } from '../effect/cubismeyeblink';
import { Live2DCubismFramework as cubismrenderer_webgl } from '../rendering/cubismrenderer_webgl';
import { CubismLogError, CubismLogInfo } from '../utils/cubismdebug'; import { CubismLogError, CubismLogInfo } from '../utils/cubismdebug';
import CubismRenderer_WebGL = cubismrenderer_webgl.CubismRenderer_WebGL; import { CubismMoc } from './cubismmoc';
import CubismEyeBlink = cubismeyeblink.CubismEyeBlink; import { CubismModel } from './cubismmodel';
import CubismBreath = cubismbreath.CubismBreath; import { CubismModelUserData } from './cubismmodeluserdata';
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;
export namespace Live2DCubismFramework {
/** /**
* 使 * 使
* *
@ -450,4 +430,11 @@ export namespace Live2DCubismFramework {
private _renderer: CubismRenderer_WebGL; // レンダラ 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;
} }

View File

@ -5,19 +5,13 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * 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 { CubismMath } from '../math/cubismmath';
import { Live2DCubismFramework as cubismmodel } from '../model/cubismmodel'; import { CubismModel } from '../model/cubismmodel';
import { Live2DCubismFramework as cubismmotionqueueentry } from './cubismmotionqueueentry'; import { csmString } from '../type/csmstring';
import { Live2DCubismFramework as csmstring } from '../type/csmstring'; import { csmVector } from '../type/csmvector';
import { Live2DCubismFramework as csmvector } from '../type/csmvector';
import { CSM_ASSERT } from '../utils/cubismdebug'; import { CSM_ASSERT } from '../utils/cubismdebug';
import csmVector = csmvector.csmVector; import { CubismMotionQueueEntry } from './cubismmotionqueueentry';
import csmString = csmstring.csmString;
import CubismMotionQueueEntry = cubismmotionqueueentry.CubismMotionQueueEntry;
import CubismModel = cubismmodel.CubismModel;
import CubismMath = cubismmath.CubismMath;
export namespace Live2DCubismFramework {
/** モーション再生終了コールバック関数定義 */ /** モーション再生終了コールバック関数定義 */
export type FinishedMotionCallback = (self: ACubismMotion) => void; export type FinishedMotionCallback = (self: ACubismMotion) => void;
@ -275,4 +269,12 @@ export namespace Live2DCubismFramework {
// モーション再生終了コールバック関数 // モーション再生終了コールバック関数
public _onFinishedMotion?: FinishedMotionCallback; 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;
} }

View File

@ -5,24 +5,14 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import { Live2DCubismFramework as acubismmotion } from './acubismmotion'; import { CubismIdHandle } from '../id/cubismid';
import { Live2DCubismFramework as cubismjson } from '../utils/cubismjson'; import { CubismFramework } from '../live2dcubismframework';
import { Live2DCubismFramework as cubismid } from '../id/cubismid'; import { CubismModel } from '../model/cubismmodel';
import { Live2DCubismFramework as cubismframework } from '../live2dcubismframework'; import { csmVector } from '../type/csmvector';
import { Live2DCubismFramework as cubismmodel } from '../model/cubismmodel'; import { CubismJson, Value } from '../utils/cubismjson';
import { Live2DCubismFramework as cubismmotionqueueentry } from './cubismmotionqueueentry'; import { ACubismMotion } from './acubismmotion';
import { Live2DCubismFramework as csmvector } from '../type/csmvector'; import { CubismMotionQueueEntry } from './cubismmotionqueueentry';
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;
export namespace Live2DCubismFramework {
// exp3.jsonのキーとデフォルト // exp3.jsonのキーとデフォルト
const ExpressionKeyFadeIn = 'FadeInTime'; const ExpressionKeyFadeIn = 'FadeInTime';
const ExpressionKeyFadeOut = 'FadeOutTime'; const ExpressionKeyFadeOut = 'FadeOutTime';
@ -86,8 +76,7 @@ export namespace Live2DCubismFramework {
if ( if (
param.getValueByString(ExpressionKeyBlend).isNull() || param.getValueByString(ExpressionKeyBlend).isNull() ||
param.getValueByString(ExpressionKeyBlend).getString() == param.getValueByString(ExpressionKeyBlend).getString() == BlendValueAdd
BlendValueAdd
) { ) {
blendType = ExpressionBlendType.ExpressionBlendType_Add; blendType = ExpressionBlendType.ExpressionBlendType_Add;
} else if ( } else if (
@ -196,4 +185,15 @@ export namespace Live2DCubismFramework {
blendType: ExpressionBlendType; // パラメータの演算種類 blendType: ExpressionBlendType; // パラメータの演算種類
value: number; // 値 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;
} }

View File

@ -5,36 +5,26 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import { Live2DCubismFramework as cubismmotionjson } from './cubismmotionjson'; import { CubismIdHandle } from '../id/cubismid';
import { Live2DCubismFramework as cubismmotioninternal } from './cubismmotioninternal'; import { CubismFramework } from '../live2dcubismframework';
import { Live2DCubismFramework as acubismmotion } from './acubismmotion'; import { CubismMath } from '../math/cubismmath';
import { Live2DCubismFramework as cubismmodel } from '../model/cubismmodel'; import { CubismModel } from '../model/cubismmodel';
import { Live2DCubismFramework as cubismframework } from '../live2dcubismframework'; import { csmString } from '../type/csmstring';
import { Live2DCubismFramework as cubismmotionqueueentry } from './cubismmotionqueueentry'; import { csmVector } from '../type/csmvector';
import { Live2DCubismFramework as cubismmath } from '../math/cubismmath'; import { CSM_ASSERT, CubismLogDebug } from '../utils/cubismdebug';
import { Live2DCubismFramework as csmvector } from '../type/csmvector'; import { ACubismMotion, FinishedMotionCallback } from './acubismmotion';
import { Live2DCubismFramework as cubismid } from '../id/cubismid'; import {
import { Live2DCubismFramework as csmstring } from '../type/csmstring'; CubismMotionCurve,
import { CubismLogDebug, CSM_ASSERT } from '../utils/cubismdebug'; CubismMotionCurveTarget,
import csmString = csmstring.csmString; CubismMotionData,
import CubismMotionData = cubismmotioninternal.CubismMotionData; CubismMotionEvent,
import CubismMotionSegment = cubismmotioninternal.CubismMotionSegment; CubismMotionPoint,
import CubismMotionPoint = cubismmotioninternal.CubismMotionPoint; CubismMotionSegment,
import CubismMotionEvent = cubismmotioninternal.CubismMotionEvent; CubismMotionSegmentType
import CubismMotionSegmentType = cubismmotioninternal.CubismMotionSegmentType; } from './cubismmotioninternal';
import CubismIdHandle = cubismid.CubismIdHandle; import { CubismMotionJson } from './cubismmotionjson';
import CubismMotionCurve = cubismmotioninternal.CubismMotionCurve; import { CubismMotionQueueEntry } from './cubismmotionqueueentry';
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;
export namespace Live2DCubismFramework {
const EffectNameEyeBlink = 'EyeBlink'; const EffectNameEyeBlink = 'EyeBlink';
const EffectNameLipSync = 'LipSync'; const EffectNameLipSync = 'LipSync';
const TargetNameModel = 'Model'; const TargetNameModel = 'Model';
@ -101,8 +91,7 @@ export namespace Live2DCubismFramework {
const curve: CubismMotionCurve = motionData.curves.at(index); const curve: CubismMotionCurve = motionData.curves.at(index);
let target = -1; let target = -1;
const totalSegmentCount: number = const totalSegmentCount: number = curve.baseSegmentIndex + curve.segmentCount;
curve.baseSegmentIndex + curve.segmentCount;
let pointPosition = 0; let pointPosition = 0;
for (let i: number = curve.baseSegmentIndex; i < totalSegmentCount; ++i) { for (let i: number = curve.baseSegmentIndex; i < totalSegmentCount; ++i) {
// Get first point of next segment. // Get first point of next segment.
@ -126,10 +115,7 @@ export namespace Live2DCubismFramework {
const segment: CubismMotionSegment = motionData.segments.at(target); const segment: CubismMotionSegment = motionData.segments.at(target);
return segment.evaluate( return segment.evaluate(motionData.points.get(segment.basePointIndex), time);
motionData.points.get(segment.basePointIndex),
time
);
} }
/** /**
@ -677,9 +663,7 @@ export namespace Live2DCubismFramework {
if (json.getMotionCurveTarget(curveCount) == TargetNameModel) { if (json.getMotionCurveTarget(curveCount) == TargetNameModel) {
this._motionData.curves.at(curveCount).type = this._motionData.curves.at(curveCount).type =
CubismMotionCurveTarget.CubismMotionCurveTarget_Model; CubismMotionCurveTarget.CubismMotionCurveTarget_Model;
} else if ( } else if (json.getMotionCurveTarget(curveCount) == TargetNameParameter) {
json.getMotionCurveTarget(curveCount) == TargetNameParameter
) {
this._motionData.curves.at(curveCount).type = this._motionData.curves.at(curveCount).type =
CubismMotionCurveTarget.CubismMotionCurveTarget_Parameter; CubismMotionCurveTarget.CubismMotionCurveTarget_Parameter;
} else if ( } else if (
@ -724,10 +708,7 @@ export namespace Live2DCubismFramework {
).time = json.getMotionCurveSegment(curveCount, segmentPosition); ).time = json.getMotionCurveSegment(curveCount, segmentPosition);
this._motionData.points.at( this._motionData.points.at(
totalPointCount totalPointCount
).value = json.getMotionCurveSegment( ).value = json.getMotionCurveSegment(curveCount, segmentPosition + 1);
curveCount,
segmentPosition + 1
);
totalPointCount += 1; totalPointCount += 1;
segmentPosition += 2; segmentPosition += 2;
@ -942,4 +923,11 @@ export namespace Live2DCubismFramework {
public _modelCurveIdEyeBlink: CubismIdHandle; // モデルが持つ自動まばたき用パラメータIDのハンドル。 モデルとモーションを対応付ける。 public _modelCurveIdEyeBlink: CubismIdHandle; // モデルが持つ自動まばたき用パラメータIDのハンドル。 モデルとモーションを対応付ける。
public _modelCurveIdLipSync: 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;
} }

View File

@ -5,14 +5,10 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * 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 { CubismIdHandle } from '../id/cubismid';
import { Live2DCubismFramework as csmstring } from '../type/csmstring'; import { csmString } from '../type/csmstring';
import { Live2DCubismFramework as csmvector } from '../type/csmvector'; import { csmVector } from '../type/csmvector';
import csmVector = csmvector.csmVector;
import csmString = csmstring.csmString;
import CubismIdHandle = cubismid.CubismIdHandle;
export namespace Live2DCubismFramework {
/** /**
* @brief * @brief
* *
@ -137,4 +133,24 @@ export namespace Live2DCubismFramework {
points: csmVector<CubismMotionPoint>; // ポイントのリスト points: csmVector<CubismMotionPoint>; // ポイントのリスト
events: csmVector<CubismMotionEvent>; // イベントのリスト 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;
} }

View File

@ -5,16 +5,11 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * 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 { CubismIdHandle } from '../id/cubismid';
import { Live2DCubismFramework as cubismid } from '../id/cubismid'; import { CubismFramework } from '../live2dcubismframework';
import { Live2DCubismFramework as cubismframework } from '../live2dcubismframework'; import { csmString } from '../type/csmstring';
import { Live2DCubismFramework as csmstring } from '../type/csmstring'; import { CubismJson } from '../utils/cubismjson';
import csmString = csmstring.csmString;
import CubismFramework = cubismframework.CubismFramework;
import CubismIdHandle = cubismid.CubismIdHandle;
import CubismJson = cubismjson.CubismJson;
export namespace Live2DCubismFramework {
// JSON keys // JSON keys
const Meta = 'Meta'; const Meta = 'Meta';
const Duration = 'Duration'; const Duration = 'Duration';
@ -356,4 +351,11 @@ export namespace Live2DCubismFramework {
_json: CubismJson; // motion3.jsonのデータ _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;
} }

View File

@ -5,15 +5,13 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import { Live2DCubismFramework as cubismmotionqueuemanager } from './cubismmotionqueuemanager'; import { CubismModel } from '../model/cubismmodel';
import { Live2DCubismFramework as acubismmotion } from './acubismmotion'; import { ACubismMotion } from './acubismmotion';
import { Live2DCubismFramework as cubismmodel } from '../model/cubismmodel'; import {
import CubismMotionQueueEntryHandle = cubismmotionqueuemanager.CubismMotionQueueEntryHandle; CubismMotionQueueEntryHandle,
import CubismModel = cubismmodel.CubismModel; CubismMotionQueueManager
import ACubismMotion = acubismmotion.ACubismMotion; } from './cubismmotionqueuemanager';
import CubismMotionQueueManager = cubismmotionqueuemanager.CubismMotionQueueManager;
export namespace Live2DCubismFramework {
/** /**
* *
* *
@ -86,10 +84,7 @@ export namespace Live2DCubismFramework {
public updateMotion(model: CubismModel, deltaTimeSeconds: number): boolean { public updateMotion(model: CubismModel, deltaTimeSeconds: number): boolean {
this._userTimeSeconds += deltaTimeSeconds; this._userTimeSeconds += deltaTimeSeconds;
const updated: boolean = super.doUpdateMotion( const updated: boolean = super.doUpdateMotion(model, this._userTimeSeconds);
model,
this._userTimeSeconds
);
if (this.isFinished()) { if (this.isFinished()) {
this._currentPriority = 0; // 再生中のモーションの優先度を解除 this._currentPriority = 0; // 再生中のモーションの優先度を解除
@ -121,4 +116,11 @@ export namespace Live2DCubismFramework {
_currentPriority: number; // 現在再生中のモーションの優先度 _currentPriority: number; // 現在再生中のモーションの優先度
_reservePriority: number; // 再生予定のモーションの優先度。再生中は0になる。モーションファイルを別スレッドで読み込むときの機能。 _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;
} }

View File

@ -5,12 +5,9 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import { Live2DCubismFramework as acubismmotion } from './acubismmotion'; import { ACubismMotion } from './acubismmotion';
import { Live2DCubismFramework as cubismmotionqueuemanager } from './cubismmotionqueuemanager'; import { CubismMotionQueueEntryHandle } from './cubismmotionqueuemanager';
import CubismMotionQueueEntryHandle = cubismmotionqueuemanager.CubismMotionQueueEntryHandle;
import ACubismMotion = acubismmotion.ACubismMotion;
export namespace Live2DCubismFramework {
/** /**
* CubismMotionQueueManager * CubismMotionQueueManager
*/ */
@ -246,4 +243,11 @@ export namespace Live2DCubismFramework {
_motionQueueEntryHandle: CubismMotionQueueEntryHandle; // インスタンスごとに一意の値を持つ識別番号 _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;
} }

View File

@ -5,19 +5,12 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import { Live2DCubismFramework as acubismmotion } from './acubismmotion'; import { ACubismMotion } from './acubismmotion';
import { Live2DCubismFramework as cubismmotionqueueentry } from './cubismmotionqueueentry'; import { CubismMotionQueueEntry } from './cubismmotionqueueentry';
import { Live2DCubismFramework as csmvector } from '../type/csmvector'; import { csmVector, iterator } from '../type/csmvector';
import { Live2DCubismFramework as cubismmodel } from '../model/cubismmodel'; import { CubismModel } from '../model/cubismmodel';
import { Live2DCubismFramework as csmstring } from '../type/csmstring'; import { 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;
export namespace Live2DCubismFramework {
/** /**
* *
* *
@ -217,9 +210,7 @@ export namespace Live2DCubismFramework {
continue; continue;
} }
if ( if (motionQueueEntry._motionQueueEntryHandle == motionQueueEntryNumber) {
motionQueueEntry._motionQueueEntryHandle == motionQueueEntryNumber
) {
return motionQueueEntry; return motionQueueEntry;
} }
} }
@ -249,10 +240,7 @@ export namespace Live2DCubismFramework {
* @return true * @return true
* @return false () * @return false ()
*/ */
public doUpdateMotion( public doUpdateMotion(model: CubismModel, userTimeSeconds: number): boolean {
model: CubismModel,
userTimeSeconds: number
): boolean {
let updated = false; let updated = false;
// ------- 処理を行う -------- // ------- 処理を行う --------
@ -347,4 +335,15 @@ export namespace Live2DCubismFramework {
*/ */
export declare type CubismMotionQueueEntryHandle = any; export declare type CubismMotionQueueEntryHandle = any;
export const InvalidMotionQueueEntryHandleValue: CubismMotionQueueEntryHandle = -1; 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;
} }

View File

@ -5,25 +5,21 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import { Live2DCubismFramework as cubismphysicsinternal } from './cubismphysicsinternal'; import { CubismMath } from '../math/cubismmath';
import { Live2DCubismFramework as cubismmodel } from '../model/cubismmodel'; import { CubismVector2 } from '../math/cubismvector2';
import { Live2DCubismFramework as cubismvector2 } from '../math/cubismvector2'; import { CubismModel } from '../model/cubismmodel';
import { Live2DCubismFramework as cubismmath } from '../math/cubismmath'; import {
import { Live2DCubismFramework as cubismphysicsjson } from './cubismphysicsjson'; CubismPhysicsInput,
import CubismPhysicsJson = cubismphysicsjson.CubismPhysicsJson; CubismPhysicsNormalization,
import CubismMath = cubismmath.CubismMath; CubismPhysicsOutput,
import CubismPhysicsRig = cubismphysicsinternal.CubismPhysicsRig; CubismPhysicsParticle,
import CubismPhysicsSubRig = cubismphysicsinternal.CubismPhysicsSubRig; CubismPhysicsRig,
import CubismPhysicsInput = cubismphysicsinternal.CubismPhysicsInput; CubismPhysicsSource,
import CubismPhysicsOutput = cubismphysicsinternal.CubismPhysicsOutput; CubismPhysicsSubRig,
import CubismPhysicsParticle = cubismphysicsinternal.CubismPhysicsParticle; CubismPhysicsTargetType
import CubismPhysicsSource = cubismphysicsinternal.CubismPhysicsSource; } from './cubismphysicsinternal';
import CubismPhysicsTargetType = cubismphysicsinternal.CubismPhysicsTargetType; import { CubismPhysicsJson } from './cubismphysicsjson';
import CubismPhysicsNormalization = cubismphysicsinternal.CubismPhysicsNormalization;
import CubismVector2 = cubismvector2.CubismVector2;
import CubismModel = cubismmodel.CubismModel;
export namespace Live2DCubismFramework {
// physics types tags. // physics types tags.
const PhysicsTypeTagX = 'X'; const PhysicsTypeTagX = 'X';
const PhysicsTypeTagY = 'Y'; const PhysicsTypeTagY = 'Y';
@ -103,9 +99,7 @@ export namespace Live2DCubismFramework {
totalTranslation.x = 0.0; totalTranslation.x = 0.0;
totalTranslation.y = 0.0; totalTranslation.y = 0.0;
currentSetting = this._physicsRig.settings.at(settingIndex); currentSetting = this._physicsRig.settings.at(settingIndex);
currentInput = this._physicsRig.inputs.get( currentInput = this._physicsRig.inputs.get(currentSetting.baseInputIndex);
currentSetting.baseInputIndex
);
currentOutput = this._physicsRig.outputs.get( currentOutput = this._physicsRig.outputs.get(
currentSetting.baseOutputIndex currentSetting.baseOutputIndex
); );
@ -170,9 +164,7 @@ export namespace Live2DCubismFramework {
} }
if (currentOutput[i].destinationParameterIndex == -1) { if (currentOutput[i].destinationParameterIndex == -1) {
currentOutput[ currentOutput[i].destinationParameterIndex = model.getParameterIndex(
i
].destinationParameterIndex = model.getParameterIndex(
currentOutput[i].destination.id currentOutput[i].destination.id
); );
} }
@ -196,8 +188,7 @@ export namespace Live2DCubismFramework {
const destinationParameterIndex: number = const destinationParameterIndex: number =
currentOutput[i].destinationParameterIndex; currentOutput[i].destinationParameterIndex;
const outParameterValue: Float32Array = const outParameterValue: Float32Array =
!Float32Array.prototype.slice && !Float32Array.prototype.slice && 'subarray' in Float32Array.prototype
'subarray' in Float32Array.prototype
? JSON.parse( ? JSON.parse(
JSON.stringify( JSON.stringify(
parameterValue.subarray(destinationParameterIndex) parameterValue.subarray(destinationParameterIndex)
@ -321,19 +312,13 @@ export namespace Live2DCubismFramework {
this._physicsRig.settings.at( this._physicsRig.settings.at(
i i
).normalizationAngle.minimum = json.getNormalizationAngleMinimumValue( ).normalizationAngle.minimum = json.getNormalizationAngleMinimumValue(i);
i
);
this._physicsRig.settings.at( this._physicsRig.settings.at(
i i
).normalizationAngle.maximum = json.getNormalizationAngleMaximumValue( ).normalizationAngle.maximum = json.getNormalizationAngleMaximumValue(i);
i
);
this._physicsRig.settings.at( this._physicsRig.settings.at(
i i
).normalizationAngle.defalut = json.getNormalizationAngleDefaultValue( ).normalizationAngle.defalut = json.getNormalizationAngleDefaultValue(i);
i
);
// Input // Input
this._physicsRig.settings.at(i).inputCount = json.getInputCount(i); 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) { 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).sourceParameterIndex = -1;
this._physicsRig.inputs.at( this._physicsRig.inputs.at(inputIndex + j).weight = json.getInputWeight(
inputIndex + j i,
).weight = json.getInputWeight(i, j); j
);
this._physicsRig.inputs.at( this._physicsRig.inputs.at(
inputIndex + j inputIndex + j
).reflect = json.getInputReflect(i, j); ).reflect = json.getInputReflect(i, j);
@ -436,16 +422,10 @@ export namespace Live2DCubismFramework {
outputIndex += this._physicsRig.settings.at(i).outputCount; outputIndex += this._physicsRig.settings.at(i).outputCount;
// Particle // Particle
this._physicsRig.settings.at(i).particleCount = json.getParticleCount( this._physicsRig.settings.at(i).particleCount = json.getParticleCount(i);
i
);
this._physicsRig.settings.at(i).baseParticleIndex = particleIndex; this._physicsRig.settings.at(i).baseParticleIndex = particleIndex;
for ( for (let j = 0; j < this._physicsRig.settings.at(i).particleCount; ++j) {
let j = 0;
j < this._physicsRig.settings.at(i).particleCount;
++j
) {
this._physicsRig.particles.at( this._physicsRig.particles.at(
particleIndex + j particleIndex + j
).mobility = json.getParticleMobility(i, j); ).mobility = json.getParticleMobility(i, j);
@ -487,9 +467,7 @@ export namespace Live2DCubismFramework {
++settingIndex ++settingIndex
) { ) {
currentSetting = this._physicsRig.settings.at(settingIndex); currentSetting = this._physicsRig.settings.at(settingIndex);
strand = this._physicsRig.particles.get( strand = this._physicsRig.particles.get(currentSetting.baseParticleIndex);
currentSetting.baseParticleIndex
);
// Initialize the top of particle. // Initialize the top of particle.
strand[0].initialPosition = new CubismVector2(0.0, 0.0); strand[0].initialPosition = new CubismVector2(0.0, 0.0);
@ -811,9 +789,7 @@ export namespace Live2DCubismFramework {
} }
if (delay != 0.0) { if (delay != 0.0) {
strand[i].velocity = strand[i].position.substract( strand[i].velocity = strand[i].position.substract(strand[i].lastPosition);
strand[i].lastPosition
);
strand[i].velocity = strand[i].velocity.divisionByScalar(delay); strand[i].velocity = strand[i].velocity.divisionByScalar(delay);
strand[i].velocity = strand[i].velocity.multiplyByScaler( strand[i].velocity = strand[i].velocity.multiplyByScaler(
strand[i].mobility strand[i].mobility
@ -946,4 +922,13 @@ export namespace Live2DCubismFramework {
return isInverted ? result : result * -1.0; 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;
} }

View File

@ -5,14 +5,10 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * 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 { CubismIdHandle } from '../id/cubismid';
import { Live2DCubismFramework as cubismid } from '../id/cubismid'; import { CubismVector2 } from '../math/cubismvector2';
import { Live2DCubismFramework as csmvector } from '../type/csmvector'; import { csmVector } from '../type/csmvector';
import csmVector = csmvector.csmVector;
import CubismIdHandle = cubismid.CubismIdHandle;
import CubismVector2 = cubismvector2.CubismVector2;
export namespace Live2DCubismFramework {
/** /**
* *
*/ */
@ -222,4 +218,32 @@ export namespace Live2DCubismFramework {
gravity: CubismVector2; // 重力 gravity: CubismVector2; // 重力
wind: 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;
} }

View File

@ -5,16 +5,11 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * 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 { CubismIdHandle } from '../id/cubismid';
import { Live2DCubismFramework as cubismvector2 } from '../math/cubismvector2'; import { CubismFramework } from '../live2dcubismframework';
import { Live2DCubismFramework as cubismid } from '../id/cubismid'; import { CubismVector2 } from '../math/cubismvector2';
import { Live2DCubismFramework as cubismframework } from '../live2dcubismframework'; import { CubismJson } from '../utils/cubismjson';
import CubismFramework = cubismframework.CubismFramework;
import CubismIdHandle = cubismid.CubismIdHandle;
import CubismVector2 = cubismvector2.CubismVector2;
import CubismJson = cubismjson.CubismJson;
export namespace Live2DCubismFramework {
// JSON keys // JSON keys
const Position = 'Position'; const Position = 'Position';
const X = 'X'; const X = 'X';
@ -342,10 +337,7 @@ export namespace Live2DCubismFramework {
* @param inputIndex * @param inputIndex
* @return * @return
*/ */
public getInputType( public getInputType(physicsSettingIndex: number, inputIndex: number): string {
physicsSettingIndex: number,
inputIndex: number
): string {
return this._json return this._json
.getRoot() .getRoot()
.getValueByString(PhysicsSettings) .getValueByString(PhysicsSettings)
@ -646,4 +638,11 @@ export namespace Live2DCubismFramework {
_json: CubismJson; // physics3.jsonデータ _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;
} }

View File

@ -5,12 +5,9 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * 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 { CubismMatrix44 } from '../math/cubismmatrix44';
import { Live2DCubismFramework as cubismmodel } from '../model/cubismmodel'; import { CubismModel } from '../model/cubismmodel';
import CubismModel = cubismmodel.CubismModel;
import CubismMatrix44 = cubismmatrix44.CubismMatrix44;
export namespace Live2DCubismFramework {
/** /**
* *
* *
@ -264,4 +261,15 @@ export namespace Live2DCubismFramework {
B: number; // 青チャンネル B: number; // 青チャンネル
A: 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;
} }

View File

@ -5,25 +5,19 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import { Live2DCubismFramework as cubismframework } from '../live2dcubismframework'; import { Constant } from '../live2dcubismframework';
import { Live2DCubismFramework as csmrect } from '../type/csmrectf'; import { CubismMatrix44 } from '../math/cubismmatrix44';
import { Live2DCubismFramework as cubismrenderer } from './cubismrenderer'; import { CubismModel } from '../model/cubismmodel';
import { Live2DCubismFramework as cubismmodel } from '../model/cubismmodel'; import { csmMap } from '../type/csmmap';
import { Live2DCubismFramework as cubsimmatrix44 } from '../math/cubismmatrix44'; import { csmRect } from '../type/csmrectf';
import { Live2DCubismFramework as csmmap } from '../type/csmmap'; import { csmVector } from '../type/csmvector';
import { Live2DCubismFramework as csmvector } from '../type/csmvector';
import { CubismLogError } from '../utils/cubismdebug'; import { CubismLogError } from '../utils/cubismdebug';
import Constant = cubismframework.Constant; import {
import CubismMatrix44 = cubsimmatrix44.CubismMatrix44; CubismBlendMode,
import csmRect = csmrect.csmRect; CubismRenderer,
import csmMap = csmmap.csmMap; CubismTextureColor
import csmVector = csmvector.csmVector; } from './cubismrenderer';
import CubismModel = cubismmodel.CubismModel;
import CubismRenderer = cubismrenderer.CubismRenderer;
import CubismBlendMode = cubismrenderer.CubismBlendMode;
import CubismTextureColor = cubismrenderer.CubismTextureColor;
export namespace Live2DCubismFramework {
const ColorChannelCount = 4; // 実験時に1チャンネルの場合は1、RGBだけの場合は3、アルファも含める場合は4 const ColorChannelCount = 4; // 実験時に1チャンネルの場合は1、RGBだけの場合は3、アルファも含める場合は4
const shaderCount = 10; // シェーダーの数 = マスク生成用 + (通常用 + 加算 + 乗算) * (マスク無の乗算済アルファ対応版 + マスク有の乗算済アルファ対応版 + マスク有反転の乗算済アルファ対応版) const shaderCount = 10; // シェーダーの数 = マスク生成用 + (通常用 + 加算 + 乗算) * (マスク無の乗算済アルファ対応版 + マスク有の乗算済アルファ対応版 + マスク有反転の乗算済アルファ対応版)
@ -490,12 +484,8 @@ export namespace Live2DCubismFramework {
} }
this._tmpMatrixForDraw.setMatrix(this._tmpMatrix.getArray()); this._tmpMatrixForDraw.setMatrix(this._tmpMatrix.getArray());
} }
clipContext._matrixForMask.setMatrix( clipContext._matrixForMask.setMatrix(this._tmpMatrixForMask.getArray());
this._tmpMatrixForMask.getArray() clipContext._matrixForDraw.setMatrix(this._tmpMatrixForDraw.getArray());
);
clipContext._matrixForDraw.setMatrix(
this._tmpMatrixForDraw.getArray()
);
const clipDrawCount: number = clipContext._clippingIdCount; const clipDrawCount: number = clipContext._clippingIdCount;
for (let i = 0; i < clipDrawCount; i++) { for (let i = 0; i < clipDrawCount; i++) {
@ -503,9 +493,7 @@ export namespace Live2DCubismFramework {
// 頂点情報が更新されておらず、信頼性がない場合は描画をパスする // 頂点情報が更新されておらず、信頼性がない場合は描画をパスする
if ( if (
!model.getDrawableDynamicFlagVertexPositionsDidChange( !model.getDrawableDynamicFlagVertexPositionsDidChange(clipDrawIndex)
clipDrawIndex
)
) { ) {
continue; continue;
} }
@ -1200,26 +1188,14 @@ export namespace Live2DCubismFramework {
); );
// 加算も通常と同じシェーダーを利用する // 加算も通常と同じシェーダーを利用する
this._shaderSets.at(4).shaderProgram = this._shaderSets.at( this._shaderSets.at(4).shaderProgram = this._shaderSets.at(1).shaderProgram;
1 this._shaderSets.at(5).shaderProgram = this._shaderSets.at(2).shaderProgram;
).shaderProgram; this._shaderSets.at(6).shaderProgram = this._shaderSets.at(3).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( this._shaderSets.at(7).shaderProgram = this._shaderSets.at(1).shaderProgram;
1 this._shaderSets.at(8).shaderProgram = this._shaderSets.at(2).shaderProgram;
).shaderProgram; this._shaderSets.at(9).shaderProgram = this._shaderSets.at(3).shaderProgram;
this._shaderSets.at(8).shaderProgram = this._shaderSets.at(
2
).shaderProgram;
this._shaderSets.at(9).shaderProgram = this._shaderSets.at(
3
).shaderProgram;
// SetupMask // SetupMask
this._shaderSets.at( this._shaderSets.at(
@ -1234,9 +1210,7 @@ export namespace Live2DCubismFramework {
this._shaderSets.at(0).shaderProgram, this._shaderSets.at(0).shaderProgram,
'a_texCoord' 'a_texCoord'
); );
this._shaderSets.at( this._shaderSets.at(0).samplerTexture0Location = this.gl.getUniformLocation(
0
).samplerTexture0Location = this.gl.getUniformLocation(
this._shaderSets.at(0).shaderProgram, this._shaderSets.at(0).shaderProgram,
's_texture0' 's_texture0'
); );
@ -1272,9 +1246,7 @@ export namespace Live2DCubismFramework {
this._shaderSets.at(1).shaderProgram, this._shaderSets.at(1).shaderProgram,
'a_texCoord' 'a_texCoord'
); );
this._shaderSets.at( this._shaderSets.at(1).samplerTexture0Location = this.gl.getUniformLocation(
1
).samplerTexture0Location = this.gl.getUniformLocation(
this._shaderSets.at(1).shaderProgram, this._shaderSets.at(1).shaderProgram,
's_texture0' 's_texture0'
); );
@ -1302,15 +1274,11 @@ export namespace Live2DCubismFramework {
this._shaderSets.at(2).shaderProgram, this._shaderSets.at(2).shaderProgram,
'a_texCoord' 'a_texCoord'
); );
this._shaderSets.at( this._shaderSets.at(2).samplerTexture0Location = this.gl.getUniformLocation(
2
).samplerTexture0Location = this.gl.getUniformLocation(
this._shaderSets.at(2).shaderProgram, this._shaderSets.at(2).shaderProgram,
's_texture0' 's_texture0'
); );
this._shaderSets.at( this._shaderSets.at(2).samplerTexture1Location = this.gl.getUniformLocation(
2
).samplerTexture1Location = this.gl.getUniformLocation(
this._shaderSets.at(2).shaderProgram, this._shaderSets.at(2).shaderProgram,
's_texture1' 's_texture1'
); );
@ -1350,15 +1318,11 @@ export namespace Live2DCubismFramework {
this._shaderSets.at(3).shaderProgram, this._shaderSets.at(3).shaderProgram,
'a_texCoord' 'a_texCoord'
); );
this._shaderSets.at( this._shaderSets.at(3).samplerTexture0Location = this.gl.getUniformLocation(
3
).samplerTexture0Location = this.gl.getUniformLocation(
this._shaderSets.at(3).shaderProgram, this._shaderSets.at(3).shaderProgram,
's_texture0' 's_texture0'
); );
this._shaderSets.at( this._shaderSets.at(3).samplerTexture1Location = this.gl.getUniformLocation(
3
).samplerTexture1Location = this.gl.getUniformLocation(
this._shaderSets.at(3).shaderProgram, this._shaderSets.at(3).shaderProgram,
's_texture1' 's_texture1'
); );
@ -1398,9 +1362,7 @@ export namespace Live2DCubismFramework {
this._shaderSets.at(4).shaderProgram, this._shaderSets.at(4).shaderProgram,
'a_texCoord' 'a_texCoord'
); );
this._shaderSets.at( this._shaderSets.at(4).samplerTexture0Location = this.gl.getUniformLocation(
4
).samplerTexture0Location = this.gl.getUniformLocation(
this._shaderSets.at(4).shaderProgram, this._shaderSets.at(4).shaderProgram,
's_texture0' 's_texture0'
); );
@ -1428,15 +1390,11 @@ export namespace Live2DCubismFramework {
this._shaderSets.at(5).shaderProgram, this._shaderSets.at(5).shaderProgram,
'a_texCoord' 'a_texCoord'
); );
this._shaderSets.at( this._shaderSets.at(5).samplerTexture0Location = this.gl.getUniformLocation(
5
).samplerTexture0Location = this.gl.getUniformLocation(
this._shaderSets.at(5).shaderProgram, this._shaderSets.at(5).shaderProgram,
's_texture0' 's_texture0'
); );
this._shaderSets.at( this._shaderSets.at(5).samplerTexture1Location = this.gl.getUniformLocation(
5
).samplerTexture1Location = this.gl.getUniformLocation(
this._shaderSets.at(5).shaderProgram, this._shaderSets.at(5).shaderProgram,
's_texture1' 's_texture1'
); );
@ -1476,15 +1434,11 @@ export namespace Live2DCubismFramework {
this._shaderSets.at(6).shaderProgram, this._shaderSets.at(6).shaderProgram,
'a_texCoord' 'a_texCoord'
); );
this._shaderSets.at( this._shaderSets.at(6).samplerTexture0Location = this.gl.getUniformLocation(
6
).samplerTexture0Location = this.gl.getUniformLocation(
this._shaderSets.at(6).shaderProgram, this._shaderSets.at(6).shaderProgram,
's_texture0' 's_texture0'
); );
this._shaderSets.at( this._shaderSets.at(6).samplerTexture1Location = this.gl.getUniformLocation(
6
).samplerTexture1Location = this.gl.getUniformLocation(
this._shaderSets.at(6).shaderProgram, this._shaderSets.at(6).shaderProgram,
's_texture1' 's_texture1'
); );
@ -1524,9 +1478,7 @@ export namespace Live2DCubismFramework {
this._shaderSets.at(7).shaderProgram, this._shaderSets.at(7).shaderProgram,
'a_texCoord' 'a_texCoord'
); );
this._shaderSets.at( this._shaderSets.at(7).samplerTexture0Location = this.gl.getUniformLocation(
7
).samplerTexture0Location = this.gl.getUniformLocation(
this._shaderSets.at(7).shaderProgram, this._shaderSets.at(7).shaderProgram,
's_texture0' 's_texture0'
); );
@ -1554,15 +1506,11 @@ export namespace Live2DCubismFramework {
this._shaderSets.at(8).shaderProgram, this._shaderSets.at(8).shaderProgram,
'a_texCoord' 'a_texCoord'
); );
this._shaderSets.at( this._shaderSets.at(8).samplerTexture0Location = this.gl.getUniformLocation(
8
).samplerTexture0Location = this.gl.getUniformLocation(
this._shaderSets.at(8).shaderProgram, this._shaderSets.at(8).shaderProgram,
's_texture0' 's_texture0'
); );
this._shaderSets.at( this._shaderSets.at(8).samplerTexture1Location = this.gl.getUniformLocation(
8
).samplerTexture1Location = this.gl.getUniformLocation(
this._shaderSets.at(8).shaderProgram, this._shaderSets.at(8).shaderProgram,
's_texture1' 's_texture1'
); );
@ -1602,15 +1550,11 @@ export namespace Live2DCubismFramework {
this._shaderSets.at(9).shaderProgram, this._shaderSets.at(9).shaderProgram,
'a_texCoord' 'a_texCoord'
); );
this._shaderSets.at( this._shaderSets.at(9).samplerTexture0Location = this.gl.getUniformLocation(
9
).samplerTexture0Location = this.gl.getUniformLocation(
this._shaderSets.at(9).shaderProgram, this._shaderSets.at(9).shaderProgram,
's_texture0' 's_texture0'
); );
this._shaderSets.at( this._shaderSets.at(9).samplerTexture1Location = this.gl.getUniformLocation(
9
).samplerTexture1Location = this.gl.getUniformLocation(
this._shaderSets.at(9).shaderProgram, this._shaderSets.at(9).shaderProgram,
's_texture1' 's_texture1'
); );
@ -2256,4 +2200,23 @@ export namespace Live2DCubismFramework {
CubismRenderer.staticRelease = (): void => { CubismRenderer.staticRelease = (): void => {
CubismRenderer_WebGL.doStaticRelease(); 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;
} }

View File

@ -7,7 +7,6 @@
import { CubismLogDebug } from '../utils/cubismdebug'; import { CubismLogDebug } from '../utils/cubismdebug';
export namespace Live2DCubismFramework {
/** /**
* Key-Value * Key-Value
* csmMap使 * csmMap使
@ -302,4 +301,15 @@ export namespace Live2DCubismFramework {
_index: number; // コンテナのインデックス値 _index: number; // コンテナのインデックス値
_map: csmMap<_KeyT, _ValT>; // コンテナ _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>;
} }

View File

@ -5,7 +5,6 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
export namespace Live2DCubismFramework {
/** /**
* float * float
*/ */
@ -80,4 +79,11 @@ export namespace Live2DCubismFramework {
public width: number; // 幅 public width: number; // 幅
public height: 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;
} }

View File

@ -5,7 +5,6 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
export namespace Live2DCubismFramework {
/** /**
* *
*/ */
@ -98,4 +97,11 @@ export namespace Live2DCubismFramework {
s: string; 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;
} }

View File

@ -5,7 +5,6 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
export namespace Live2DCubismFramework {
/** /**
* *
*/ */
@ -341,4 +340,13 @@ export namespace Live2DCubismFramework {
_index: number; // コンテナのインデックス値 _index: number; // コンテナのインデックス値
_vector: csmVector<T>; // コンテナ _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>;
} }

View File

@ -5,21 +5,18 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * 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 { import {
CSM_LOG_LEVEL, CSM_LOG_LEVEL,
CSM_LOG_LEVEL_VERBOSE,
CSM_LOG_LEVEL_DEBUG, CSM_LOG_LEVEL_DEBUG,
CSM_LOG_LEVEL_ERROR,
CSM_LOG_LEVEL_INFO, CSM_LOG_LEVEL_INFO,
CSM_LOG_LEVEL_WARNING, CSM_LOG_LEVEL_VERBOSE,
CSM_LOG_LEVEL_ERROR CSM_LOG_LEVEL_WARNING
} from '../cubismframeworkconfig'; } from '../cubismframeworkconfig';
import { CubismFramework, LogLevel } from '../live2dcubismframework';
export const CubismLogPrint = (level: LogLevel, fmt: string, args: any[]) => { 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[]) => { export const CubismLogPrintIn = (level: LogLevel, fmt: string, args: any[]) => {
@ -98,8 +95,6 @@ if (CSM_LOG_LEVEL <= CSM_LOG_LEVEL_VERBOSE) {
}; };
} }
//------------ LIVE2D NAMESPACE ------------
export namespace Live2DCubismFramework {
/** /**
* *
* *
@ -113,18 +108,14 @@ export namespace Live2DCubismFramework {
* @param format * @param format
* @param args * @param args
*/ */
public static print( public static print(logLevel: LogLevel, format: string, args?: any[]): void {
logLevel: LogLevel,
format: string,
args?: any[]
): void {
// オプションで設定されたログ出力レベルを下回る場合はログに出さない // オプションで設定されたログ出力レベルを下回る場合はログに出さない
if (logLevel < cubismframework.CubismFramework.getLoggingLevel()) { if (logLevel < CubismFramework.getLoggingLevel()) {
return; return;
} }
const logPrint: Live2DCubismCore.csmLogFunction = const logPrint: Live2DCubismCore.csmLogFunction =
cubismframework.CubismFramework.coreLogFunction; CubismFramework.coreLogFunction;
if (!logPrint) return; if (!logPrint) return;
@ -161,6 +152,11 @@ export namespace Live2DCubismFramework {
*/ */
private constructor() {} 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;
}

View File

@ -5,18 +5,12 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * 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 { strtod } from '../live2dcubismframework';
import csmVector = csmvector.csmVector; import { csmMap, iterator as csmMap_iterator } from '../type/csmmap';
import csmVector_iterator = csmvector.iterator; import { csmString } from '../type/csmstring';
import csmMap = csmmap.csmMap; import { csmVector, iterator as csmVector_iterator } from '../type/csmvector';
import csmMap_iterator = csmmap.iterator; import { CubismLogInfo } from './cubismdebug';
import csmString = csmstring.csmString;
export namespace Live2DCubismFramework {
// StaticInitializeNotForClientCall()で初期化する // StaticInitializeNotForClientCall()で初期化する
const CSM_JSON_ERROR_TYPE_MISMATCH = 'Error: type mismatch'; const CSM_JSON_ERROR_TYPE_MISMATCH = 'Error: type mismatch';
const CSM_JSON_ERROR_INDEX_OF_BOUNDS = 'Error: index out of bounds'; const CSM_JSON_ERROR_INDEX_OF_BOUNDS = 'Error: index out of bounds';
@ -624,12 +618,7 @@ export namespace Live2DCubismFramework {
} }
// 値をチェック // 値をチェック
const value: Value = this.parseValue( const value: Value = this.parseValue(buffer, length, i, localRetEndPos2);
buffer,
length,
i,
localRetEndPos2
);
if (this._error) { if (this._error) {
return null; return null;
} }
@ -685,12 +674,7 @@ export namespace Live2DCubismFramework {
// , が続く限りループ // , が続く限りループ
for (; i < length; i++) { for (; i < length; i++) {
// : をチェック // : をチェック
const value: Value = this.parseValue( const value: Value = this.parseValue(buffer, length, i, localRetEndpos2);
buffer,
length,
i,
localRetEndpos2
);
if (this._error) { if (this._error) {
return null; return null;
@ -1243,4 +1227,27 @@ export namespace Live2DCubismFramework {
private _map: csmMap<string, Value>; // JSON要素の値 private _map: csmMap<string, Value>; // JSON要素の値
private _keys: csmVector<string>; // 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;
} }

View File

@ -5,7 +5,6 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. * 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 {
/** /**
* *
@ -120,4 +119,11 @@ export namespace Live2DCubismFramework {
*/ */
private constructor() {} 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;
} }