commit
bc9f30a86b
|
@ -0,0 +1,5 @@
|
|||
*.ts text
|
||||
*.js text
|
||||
*.json text
|
||||
*.html text
|
||||
*.md text
|
|
@ -1,6 +1,4 @@
|
|||
.idea/
|
||||
|
||||
node_modules/
|
||||
|
||||
/Core/*
|
||||
!Please copy cubism core for web
|
||||
Sample/TypeScript/Demo/dist/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
@ -11,6 +11,7 @@ import {Live2DCubismFramework as cubismid} from "./id/cubismid";
|
|||
import {Live2DCubismFramework as cubismjson} from "./utils/cubismjson";
|
||||
import {Live2DCubismFramework as csmmap} from"./type/csmmap";
|
||||
import csmMap = csmmap.csmMap;
|
||||
import iterator = csmmap.iterator;
|
||||
import CubismFramework = cubismframework.CubismFramework;
|
||||
import CubismIdHandle = cubismid.CubismIdHandle;
|
||||
import CubismJson = cubismjson.CubismJson;
|
||||
|
@ -396,7 +397,7 @@ export namespace Live2DCubismFramework
|
|||
|
||||
let ret: boolean = false;
|
||||
|
||||
for(const ite: csmMap.iterator<string, Value> = map.begin(); ite.notEqual(map.end()); ite.preIncrement())
|
||||
for(const ite: iterator<string, Value> = map.begin(); ite.notEqual(map.end()); ite.preIncrement())
|
||||
{
|
||||
outLayoutMap.setValue(ite.ptr().first, ite.ptr().second.toFloat());
|
||||
ret = true;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
@ -37,15 +37,17 @@ export namespace Live2DCubismFramework
|
|||
*/
|
||||
public static delete(instance: CubismBreath): void
|
||||
{
|
||||
instance = void 0;
|
||||
instance = null;
|
||||
if(instance != null)
|
||||
{
|
||||
instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 呼吸のパラメータの紐づけ
|
||||
* @param breathParameters 呼吸を紐づけたいパラメータのリスト
|
||||
*/
|
||||
public setParameters(breathParameters: csmVector<CubismBreath.BreathParameterData>): void
|
||||
public setParameters(breathParameters: csmVector<BreathParameterData>): void
|
||||
{
|
||||
this._breathParameters = breathParameters;
|
||||
}
|
||||
|
@ -54,7 +56,7 @@ export namespace Live2DCubismFramework
|
|||
* 呼吸に紐づいているパラメータの取得
|
||||
* @return 呼吸に紐づいているパラメータのリスト
|
||||
*/
|
||||
public getParameters(): csmVector<CubismBreath.BreathParameterData>
|
||||
public getParameters(): csmVector<BreathParameterData>
|
||||
{
|
||||
return this._breathParameters;
|
||||
}
|
||||
|
@ -72,7 +74,7 @@ export namespace Live2DCubismFramework
|
|||
|
||||
for(let i: number = 0; i < this._breathParameters.getSize(); ++i)
|
||||
{
|
||||
let data: CubismBreath.BreathParameterData = this._breathParameters.at(i);
|
||||
let data: BreathParameterData = this._breathParameters.at(i);
|
||||
|
||||
model.addParameterValueById(
|
||||
data.parameterId,
|
||||
|
@ -91,50 +93,46 @@ export namespace Live2DCubismFramework
|
|||
this._currentTime = 0.0;
|
||||
}
|
||||
|
||||
_breathParameters: csmVector<CubismBreath.BreathParameterData>; // 呼吸にひもづいているパラメータのリスト
|
||||
_breathParameters: csmVector<BreathParameterData>; // 呼吸にひもづいているパラメータのリスト
|
||||
_currentTime: number; // 積算時間[秒]
|
||||
}
|
||||
|
||||
export namespace CubismBreath
|
||||
/**
|
||||
* 呼吸のパラメータ情報
|
||||
*/
|
||||
export class BreathParameterData
|
||||
{
|
||||
/**
|
||||
* 呼吸のパラメータ情報
|
||||
* コンストラクタ
|
||||
* @param parameterId 呼吸をひもづけるパラメータID
|
||||
* @param offset 呼吸を正弦波としたときの、波のオフセット
|
||||
* @param peak 呼吸を正弦波としたときの、波の高さ
|
||||
* @param cycle 呼吸を正弦波としたときの、波の周期
|
||||
* @param weight パラメータへの重み
|
||||
*/
|
||||
export class BreathParameterData
|
||||
constructor(parameterId?: CubismIdHandle, offset?: number, peak?: number, cycle?: number, weight?: number)
|
||||
{
|
||||
/**
|
||||
* コンストラクタ
|
||||
* @param parameterId 呼吸をひもづけるパラメータID
|
||||
* @param offset 呼吸を正弦波としたときの、波のオフセット
|
||||
* @param peak 呼吸を正弦波としたときの、波の高さ
|
||||
* @param cycle 呼吸を正弦波としたときの、波の周期
|
||||
* @param weight パラメータへの重み
|
||||
*/
|
||||
constructor(parameterId?: CubismIdHandle, offset?: number, peak?: number, cycle?: number, weight?: number)
|
||||
{
|
||||
this.parameterId = (parameterId == undefined)
|
||||
? null
|
||||
: parameterId;
|
||||
this.offset = (offset == undefined)
|
||||
? 0.0
|
||||
: offset;
|
||||
this.peak = (peak == undefined)
|
||||
? 0.0
|
||||
: peak;
|
||||
this.cycle = (cycle == undefined)
|
||||
? 0.0
|
||||
: cycle;
|
||||
this.weight = (weight == undefined)
|
||||
? 0.0
|
||||
: weight;
|
||||
}
|
||||
|
||||
parameterId: CubismIdHandle; // 呼吸をひもづけるパラメータID\
|
||||
offset: number; // 呼吸を正弦波としたときの、波のオフセット
|
||||
peak: number; // 呼吸を正弦波としたときの、波の高さ
|
||||
cycle: number; // 呼吸を正弦波としたときの、波の周期
|
||||
weight: number; // パラメータへの重み
|
||||
this.parameterId = (parameterId == undefined)
|
||||
? null
|
||||
: parameterId;
|
||||
this.offset = (offset == undefined)
|
||||
? 0.0
|
||||
: offset;
|
||||
this.peak = (peak == undefined)
|
||||
? 0.0
|
||||
: peak;
|
||||
this.cycle = (cycle == undefined)
|
||||
? 0.0
|
||||
: cycle;
|
||||
this.weight = (weight == undefined)
|
||||
? 0.0
|
||||
: weight;
|
||||
}
|
||||
|
||||
|
||||
parameterId: CubismIdHandle; // 呼吸をひもづけるパラメータID\
|
||||
offset: number; // 呼吸を正弦波としたときの、波のオフセット
|
||||
peak: number; // 呼吸を正弦波としたときの、波の高さ
|
||||
cycle: number; // 呼吸を正弦波としたときの、波の周期
|
||||
weight: number; // パラメータへの重み
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
@ -40,8 +40,10 @@ export namespace Live2DCubismFramework
|
|||
*/
|
||||
public static delete(eyeBlink: CubismEyeBlink): void
|
||||
{
|
||||
eyeBlink = void 0;
|
||||
eyeBlink = null;
|
||||
if(eyeBlink != null)
|
||||
{
|
||||
eyeBlink = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -97,57 +99,57 @@ export namespace Live2DCubismFramework
|
|||
|
||||
switch(this._blinkingState)
|
||||
{
|
||||
case CubismEyeBlink.EyeState.EyeState_Closing:
|
||||
case EyeState.EyeState_Closing:
|
||||
t = ((this._userTimeSeconds - this._stateStartTimeSeconds) / this._closingSeconds);
|
||||
|
||||
if(t >= 1.0)
|
||||
{
|
||||
t = 1.0;
|
||||
this._blinkingState = CubismEyeBlink.EyeState.EyeState_Closed;
|
||||
this._blinkingState = EyeState.EyeState_Closed;
|
||||
this._stateStartTimeSeconds = this._userTimeSeconds;
|
||||
}
|
||||
|
||||
parameterValue = 1.0 - t;
|
||||
|
||||
break;
|
||||
case CubismEyeBlink.EyeState.EyeState_Closed:
|
||||
case EyeState.EyeState_Closed:
|
||||
t = ((this._userTimeSeconds - this._stateStartTimeSeconds) / this._closedSeconds);
|
||||
|
||||
if(t >= 1.0)
|
||||
{
|
||||
this._blinkingState = CubismEyeBlink.EyeState.EyeState_Opening;
|
||||
this._blinkingState = EyeState.EyeState_Opening;
|
||||
this._stateStartTimeSeconds = this._userTimeSeconds;
|
||||
}
|
||||
|
||||
parameterValue = 0.0;
|
||||
|
||||
break;
|
||||
case CubismEyeBlink.EyeState.EyeState_Opening:
|
||||
case EyeState.EyeState_Opening:
|
||||
t = ((this._userTimeSeconds - this._stateStartTimeSeconds) / this._openingSeconds);
|
||||
|
||||
if(t >= 1.0)
|
||||
{
|
||||
t = 1.0;
|
||||
this._blinkingState = CubismEyeBlink.EyeState.EyeState_Interval;
|
||||
this._blinkingState = EyeState.EyeState_Interval;
|
||||
this._nextBlinkingTime = this.determinNextBlinkingTiming();
|
||||
}
|
||||
|
||||
parameterValue = t;
|
||||
|
||||
break;
|
||||
case CubismEyeBlink.EyeState.EyeState_Interval:
|
||||
case EyeState.EyeState_Interval:
|
||||
if(this._nextBlinkingTime < this._userTimeSeconds)
|
||||
{
|
||||
this._blinkingState = CubismEyeBlink.EyeState.EyeState_Closing;
|
||||
this._blinkingState = EyeState.EyeState_Closing;
|
||||
this._stateStartTimeSeconds = this._userTimeSeconds;
|
||||
}
|
||||
|
||||
parameterValue = 1.0;
|
||||
|
||||
break;
|
||||
case CubismEyeBlink.EyeState.EyeState_First:
|
||||
case EyeState.EyeState_First:
|
||||
default:
|
||||
this._blinkingState = CubismEyeBlink.EyeState.EyeState_Interval;
|
||||
this._blinkingState = EyeState.EyeState_Interval;
|
||||
this._nextBlinkingTime = this.determinNextBlinkingTiming();
|
||||
|
||||
parameterValue = 1.0;
|
||||
|
@ -171,7 +173,7 @@ export namespace Live2DCubismFramework
|
|||
*/
|
||||
public constructor(modelSetting: ICubismModelSetting)
|
||||
{
|
||||
this._blinkingState = CubismEyeBlink.EyeState.EyeState_First;
|
||||
this._blinkingState = EyeState.EyeState_First;
|
||||
this._nextBlinkingTime = 0.0;
|
||||
this._stateStartTimeSeconds = 0.0;
|
||||
this._blinkingIntervalSeconds = 4.0;
|
||||
|
@ -212,27 +214,24 @@ export namespace Live2DCubismFramework
|
|||
_closedSeconds: number; // まぶたを閉じている動作の所要時間[秒]
|
||||
_openingSeconds: number; // まぶたを開く動作の所要時間[秒]
|
||||
_userTimeSeconds: number; // デルタ時間の積算値[秒]
|
||||
}
|
||||
|
||||
export namespace CubismEyeBlink
|
||||
{
|
||||
/**
|
||||
* まばたきの状態
|
||||
*
|
||||
* まばたきの状態を表す列挙型
|
||||
*/
|
||||
export enum EyeState
|
||||
{
|
||||
EyeState_First = 0, // 初期状態
|
||||
EyeState_Interval, // まばたきしていない状態
|
||||
EyeState_Closing, // まぶたが閉じていく途中の状態
|
||||
EyeState_Closed, // まぶたが閉じている状態
|
||||
EyeState_Opening // まぶたが開いていく途中の状態
|
||||
}
|
||||
|
||||
/**
|
||||
* IDで指定された目のパラメータが、0のときに閉じるなら true 、1の時に閉じるなら false 。
|
||||
*/
|
||||
export const CloseIfZero = true;
|
||||
static readonly CloseIfZero: boolean = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* まばたきの状態
|
||||
*
|
||||
* まばたきの状態を表す列挙型
|
||||
*/
|
||||
export enum EyeState
|
||||
{
|
||||
EyeState_First = 0, // 初期状態
|
||||
EyeState_Interval, // まばたきしていない状態
|
||||
EyeState_Closing, // まぶたが閉じていく途中の状態
|
||||
EyeState_Closed, // まぶたが閉じている状態
|
||||
EyeState_Opening // まぶたが開いていく途中の状態
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
@ -12,6 +12,7 @@ import {Live2DCubismFramework as cubismframework} from "../live2dcubismframework
|
|||
import {Live2DCubismFramework as cubismjson} from "../utils/cubismjson";
|
||||
import CubismIdHandle = cubismid.CubismIdHandle;
|
||||
import csmVector = csmvector.csmVector;
|
||||
import iterator = csmvector.iterator;
|
||||
import CubismModel = cubismmodel.CubismModel;
|
||||
import CubismFramework = cubismframework.CubismFramework;
|
||||
import CubismJson = cubismjson.CubismJson;
|
||||
|
@ -73,7 +74,7 @@ export namespace Live2DCubismFramework
|
|||
for(let groupIndex: number = 0; groupIndex < idCount; ++groupIndex)
|
||||
{
|
||||
let partInfo: Value = idListInfo.getVector().at(groupIndex);
|
||||
let partData: CubismPose.PartData = new CubismPose.PartData();
|
||||
let partData: PartData = new PartData();
|
||||
const parameterId: CubismIdHandle = CubismFramework.getIdManager().getId(partInfo.getMap().getValue(Id).getRawString());
|
||||
|
||||
partData.partId = parameterId;
|
||||
|
@ -86,7 +87,7 @@ export namespace Live2DCubismFramework
|
|||
|
||||
for(let linkIndex: number = 0; linkIndex < linkCount; ++linkIndex)
|
||||
{
|
||||
let linkPart: CubismPose.PartData = new CubismPose.PartData();
|
||||
let linkPart: PartData = new PartData();
|
||||
const linkId: CubismIdHandle = CubismFramework.getIdManager().getId(linkListInfo.getVector().at(linkIndex).getString());
|
||||
|
||||
linkPart.partId = linkId;
|
||||
|
@ -114,8 +115,10 @@ export namespace Live2DCubismFramework
|
|||
*/
|
||||
public static delete(pose: CubismPose): void
|
||||
{
|
||||
pose = void 0;
|
||||
pose = null;
|
||||
if(pose != null)
|
||||
{
|
||||
pose = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -201,7 +204,7 @@ export namespace Live2DCubismFramework
|
|||
{
|
||||
for(let groupIndex: number = 0; groupIndex < this._partGroups.getSize(); ++groupIndex)
|
||||
{
|
||||
let partData: CubismPose.PartData = this._partGroups.at(groupIndex);
|
||||
let partData: PartData = this._partGroups.at(groupIndex);
|
||||
|
||||
if(partData.link.getSize() == 0)
|
||||
{
|
||||
|
@ -213,7 +216,7 @@ export namespace Live2DCubismFramework
|
|||
|
||||
for(let linkIndex: number = 0; linkIndex < partData.link.getSize(); ++linkIndex)
|
||||
{
|
||||
let linkPart: CubismPose.PartData = partData.link.at(linkIndex);
|
||||
let linkPart: PartData = partData.link.at(linkIndex);
|
||||
const linkPartIndex: number = linkPart.partIndex;
|
||||
|
||||
if(linkPartIndex < 0)
|
||||
|
@ -323,94 +326,91 @@ export namespace Live2DCubismFramework
|
|||
{
|
||||
this._fadeTimeSeconds = DefaultFadeInSeconds;
|
||||
this._lastModel = null;
|
||||
this._partGroups = new csmVector<CubismPose.PartData>();
|
||||
this._partGroups = new csmVector<PartData>();
|
||||
this._partGroupCounts = new csmVector<number>();
|
||||
}
|
||||
|
||||
_partGroups: csmVector<CubismPose.PartData>; // パーツグループ
|
||||
_partGroups: csmVector<PartData>; // パーツグループ
|
||||
_partGroupCounts: csmVector<number>; // それぞれのパーツグループの個数
|
||||
_fadeTimeSeconds: number; // フェード時間[秒]
|
||||
_lastModel: CubismModel; // 前回操作したモデル
|
||||
}
|
||||
|
||||
export namespace CubismPose
|
||||
/**
|
||||
* パーツにまつわるデータを管理
|
||||
*/
|
||||
export class PartData
|
||||
{
|
||||
/**
|
||||
* パーツにまつわるデータを管理
|
||||
* コンストラクタ
|
||||
*/
|
||||
export class PartData
|
||||
constructor(v?: PartData)
|
||||
{
|
||||
/**
|
||||
* コンストラクタ
|
||||
*/
|
||||
constructor(v?: PartData)
|
||||
{
|
||||
this.parameterIndex = 0;
|
||||
this.partIndex = 0;
|
||||
this.link = new csmVector<PartData>();
|
||||
|
||||
if(v != undefined)
|
||||
{
|
||||
this.partId = v.partId;
|
||||
|
||||
for(const ite: csmVector.iterator<PartData> = v.link.begin(); ite.notEqual(v.link.end()); ite.preIncrement())
|
||||
{
|
||||
this.link.pushBack(ite.ptr().clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* =演算子のオーバーロード
|
||||
*/
|
||||
public assignment(v: PartData): PartData
|
||||
this.parameterIndex = 0;
|
||||
this.partIndex = 0;
|
||||
this.link = new csmVector<PartData>();
|
||||
|
||||
if(v != undefined)
|
||||
{
|
||||
this.partId = v.partId;
|
||||
|
||||
for(const ite: csmVector.iterator<PartData> = v.link.begin(); ite.notEqual(v.link.end()); ite.preIncrement())
|
||||
for(const ite: iterator<PartData> = v.link.begin(); ite.notEqual(v.link.end()); ite.preIncrement())
|
||||
{
|
||||
this.link.pushBack(ite.ptr().clone());
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初期化
|
||||
* @param model 初期化に使用するモデル
|
||||
*/
|
||||
public initialize(model: CubismModel): void
|
||||
{
|
||||
this.parameterIndex = model.getParameterIndex(this.partId);
|
||||
this.partIndex = model.getPartIndex(this.partId);
|
||||
|
||||
model.setParameterValueByIndex(this.parameterIndex, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* オブジェクトのコピーを生成する
|
||||
*/
|
||||
public clone(): PartData
|
||||
{
|
||||
let clonePartData: PartData = new PartData();
|
||||
|
||||
clonePartData.partId = this.partId;
|
||||
clonePartData.parameterIndex = this.parameterIndex;
|
||||
clonePartData.partIndex = this.partIndex;
|
||||
clonePartData.link = new csmVector<PartData>();
|
||||
|
||||
for(let ite: csmVector.iterator<PartData> = this.link.begin(); ite.notEqual(this.link.end()); ite.increment())
|
||||
{
|
||||
clonePartData.link.pushBack(ite.ptr().clone());
|
||||
}
|
||||
|
||||
return clonePartData;
|
||||
}
|
||||
|
||||
partId: CubismIdHandle; // パーツID
|
||||
parameterIndex: number; // パラメータのインデックス
|
||||
partIndex: number; // パーツのインデックス
|
||||
link: csmVector<PartData>; // 連動するパラメータ
|
||||
}
|
||||
|
||||
/**
|
||||
* =演算子のオーバーロード
|
||||
*/
|
||||
public assignment(v: PartData): PartData
|
||||
{
|
||||
this.partId = v.partId;
|
||||
|
||||
for(const ite: iterator<PartData> = v.link.begin(); ite.notEqual(v.link.end()); ite.preIncrement())
|
||||
{
|
||||
this.link.pushBack(ite.ptr().clone());
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初期化
|
||||
* @param model 初期化に使用するモデル
|
||||
*/
|
||||
public initialize(model: CubismModel): void
|
||||
{
|
||||
this.parameterIndex = model.getParameterIndex(this.partId);
|
||||
this.partIndex = model.getPartIndex(this.partId);
|
||||
|
||||
model.setParameterValueByIndex(this.parameterIndex, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* オブジェクトのコピーを生成する
|
||||
*/
|
||||
public clone(): PartData
|
||||
{
|
||||
let clonePartData: PartData = new PartData();
|
||||
|
||||
clonePartData.partId = this.partId;
|
||||
clonePartData.parameterIndex = this.parameterIndex;
|
||||
clonePartData.partIndex = this.partIndex;
|
||||
clonePartData.link = new csmVector<PartData>();
|
||||
|
||||
for(let ite: iterator<PartData> = this.link.begin(); ite.notEqual(this.link.end()); ite.increment())
|
||||
{
|
||||
clonePartData.link.pushBack(ite.ptr().clone());
|
||||
}
|
||||
|
||||
return clonePartData;
|
||||
}
|
||||
|
||||
partId: CubismIdHandle; // パーツID
|
||||
parameterIndex: number; // パラメータのインデックス
|
||||
partIndex: number; // パーツのインデックス
|
||||
link: csmVector<PartData>; // 連動するパラメータ
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
|
|
@ -1,283 +1,280 @@
|
|||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
* that can be found at http://live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import {Live2DCubismFramework as cubismjson} from "./utils/cubismjson";
|
||||
import {Live2DCubismFramework as cubismidmanager} from "./id/cubismidmanager";
|
||||
import {Live2DCubismFramework as cubismrenderer} from "./rendering/cubismrenderer";
|
||||
import {CubismLogInfo, CubismLogWarning, CSM_ASSERT} from "./utils/cubismdebug";
|
||||
import Value = cubismjson.Value;
|
||||
import CubismIdManager = cubismidmanager.CubismIdManager;
|
||||
import CubismRenderer = cubismrenderer.CubismRenderer;
|
||||
|
||||
export function strtod(s: string, endPtr: string[]): number
|
||||
{
|
||||
let index: number = 0;
|
||||
for(let i: number = 1; ; i++)
|
||||
{
|
||||
let testC: string = s.slice(i - 1, i);
|
||||
|
||||
// 指数・マイナスの可能性があるのでスキップする
|
||||
if(testC=='e' || testC=='-' || testC == 'E')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// 文字列の範囲を広げていく
|
||||
let test: string = s.substring(0, i);
|
||||
let number: number = Number(test);
|
||||
if(isNaN(number))
|
||||
{
|
||||
// 数値として認識できなくなったので終了
|
||||
break;
|
||||
}
|
||||
|
||||
// 最後に数値としてできたindexを格納しておく
|
||||
index = i;
|
||||
}
|
||||
let d = parseFloat(s); // パースした数値
|
||||
|
||||
if(isNaN(d))
|
||||
{
|
||||
// 数値として認識できなくなったので終了
|
||||
d = NaN;
|
||||
}
|
||||
|
||||
endPtr[0] = s.slice(index); // 後続の文字列
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
export namespace Live2DCubismFramework
|
||||
{
|
||||
// ファイルスコープの変数を初期化
|
||||
|
||||
let s_isStarted: boolean = false;
|
||||
let s_isInitialized: boolean = false;
|
||||
let s_option: Option = null;
|
||||
let s_cubismIdManager: CubismIdManager = null;
|
||||
|
||||
/**
|
||||
* Framework内で使う定数の宣言
|
||||
*/
|
||||
export namespace Constant
|
||||
{
|
||||
export const vertexOffset: number = 0; // メッシュ頂点のオフセット値
|
||||
export const vertexStep: number = 2; // メッシュ頂点のステップ値
|
||||
}
|
||||
|
||||
export function csmDelete<T>(address: T): void
|
||||
{
|
||||
if(!address)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
address = void 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Live2D Cubism3 Original Workflow SDKのエントリポイント
|
||||
* 利用開始時はCubismFramework.initialize()を呼び、CubismFramework.dispose()で終了する。
|
||||
*/
|
||||
export class CubismFramework
|
||||
{
|
||||
/**
|
||||
* @brief Cubism FrameworkのAPIを使用可能にする。<br>
|
||||
* APIを実行する前に必ずこの関数を実行すること。<br>
|
||||
* 引数に必ずメモリアロケータを渡してください。<br>
|
||||
* 一度準備が完了して以降は、再び実行しても内部処理がスキップされます。
|
||||
*
|
||||
* @param allocator ICubismAllocatorクラスのインスタンス
|
||||
* @param option Optionクラスのインスタンス
|
||||
*
|
||||
* @return 準備処理が完了したらtrueが返ります。
|
||||
*/
|
||||
public static startUp(option: Option = null): boolean
|
||||
{
|
||||
if(s_isStarted)
|
||||
{
|
||||
CubismLogInfo("CubismFramework::StartUp() is already done.");
|
||||
return s_isStarted;
|
||||
}
|
||||
|
||||
s_option = option;
|
||||
|
||||
if(s_option != null)
|
||||
{
|
||||
// TODO Core::csmSetLogFunction(s_option->LogFunction);
|
||||
}
|
||||
|
||||
s_isStarted = true;
|
||||
|
||||
// Live2D Cubism Coreバージョン情報を表示
|
||||
if(s_isStarted)
|
||||
{
|
||||
const version: number = 1; // TODO Core::csmGetVersion()
|
||||
const major: number = ((version & 0xFF000000) >> 24);
|
||||
const minor: number = ((version & 0x00FF0000) >> 16);
|
||||
const patch: number = ((version & 0x0000FFFF));
|
||||
const versionNumber: number = version;
|
||||
|
||||
CubismLogInfo("Live2D Cubism Core version: %02d.%02d.%04d (%d)", major, minor, patch, versionNumber);
|
||||
}
|
||||
|
||||
CubismLogInfo("CubismFramework::StartUp() is complete.");
|
||||
|
||||
return s_isStarted;
|
||||
}
|
||||
|
||||
/**
|
||||
* StartUp()で初期化したCubismFrameworkの各パラメータをクリアします。
|
||||
* Dispose()したCubismFrameworkを再利用する際に利用してください。
|
||||
*/
|
||||
public static cleanUp(): void
|
||||
{
|
||||
s_isStarted = false;
|
||||
s_isInitialized = false;
|
||||
s_option = null;
|
||||
s_cubismIdManager = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cubism Framework内のリソースを初期化してモデルを表示可能な状態にします。<br>
|
||||
* 再度Initialize()するには先にDispose()を実行する必要があります。
|
||||
*/
|
||||
public static initialize(): void
|
||||
{
|
||||
CSM_ASSERT(s_isStarted);
|
||||
if(!s_isStarted)
|
||||
{
|
||||
CubismLogWarning("CubismFramework is not started.");
|
||||
return;
|
||||
}
|
||||
|
||||
// --- s_isInitializedによる連続初期化ガード ---
|
||||
// 連続してリソース確保が行われないようにする。
|
||||
// 再度Initialize()するには先にDispose()を実行する必要がある。
|
||||
if (s_isInitialized)
|
||||
{
|
||||
CubismLogWarning("CubismFramework::Initialize() skipped, already initialized.");
|
||||
return;
|
||||
}
|
||||
|
||||
//---- static 初期化 ----
|
||||
Value.staticInitializeNotForClientCall();
|
||||
|
||||
s_cubismIdManager = new CubismIdManager();
|
||||
|
||||
s_isInitialized = true;
|
||||
|
||||
CubismLogInfo("CubismFramework::Initialize() is complete.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Cubism Framework内の全てのリソースを解放します。
|
||||
* ただし、外部で確保されたリソースについては解放しません。
|
||||
* 外部で適切に破棄する必要があります。
|
||||
*/
|
||||
public static dispose(): void
|
||||
{
|
||||
CSM_ASSERT(s_isStarted);
|
||||
if(!s_isStarted)
|
||||
{
|
||||
CubismLogWarning("CubismFramework is not started.");
|
||||
return;
|
||||
}
|
||||
|
||||
// --- s_isInitializedによる未初期化解放ガード ---
|
||||
// dispose()するには先にinitialize()を実行する必要がある。
|
||||
if(!s_isInitialized) // false...リソース未確保の場合
|
||||
{
|
||||
CubismLogWarning("CubismFramework::Dispose() skipped, not initialized.");
|
||||
return;
|
||||
}
|
||||
|
||||
Value.staticReleaseNotForClientCall();
|
||||
|
||||
s_cubismIdManager.release();
|
||||
s_cubismIdManager = void 0;
|
||||
|
||||
// レンダラの静的リソース(シェーダプログラム他)を解放する
|
||||
CubismRenderer.StaticRelease();
|
||||
|
||||
s_isInitialized = false;
|
||||
|
||||
CubismLogInfo("CubismFramework::Dispose() is complete.");
|
||||
}
|
||||
|
||||
/**
|
||||
* 現在のログ出力レベル設定の値を返す。
|
||||
*
|
||||
* @return 現在のログ出力レベル設定の値
|
||||
*/
|
||||
public static getLoggingLevel(): Option.LogLevel
|
||||
{
|
||||
if (s_option != null)
|
||||
{
|
||||
return s_option.loggingLevel;
|
||||
}
|
||||
return Option.LogLevel.LogLevel_Off;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cubism FrameworkのAPIを使用する準備が完了したかどうか
|
||||
* @return APIを使用する準備が完了していればtrueが返ります。
|
||||
*/
|
||||
public static isStarted(): boolean
|
||||
{
|
||||
return s_isStarted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cubism Frameworkのリソース初期化がすでに行われているかどうか
|
||||
* @return リソース確保が完了していればtrueが返ります
|
||||
*/
|
||||
public static isInitialized(): boolean
|
||||
{
|
||||
return s_isInitialized;
|
||||
}
|
||||
|
||||
/**
|
||||
* IDマネージャのインスタンスを取得する
|
||||
* @return CubismManagerクラスのインスタンス
|
||||
*/
|
||||
public static getIdManager(): CubismIdManager
|
||||
{
|
||||
return s_cubismIdManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* 静的クラスとして使用する
|
||||
* インスタンス化させない
|
||||
*/
|
||||
private constructor()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class Option
|
||||
{
|
||||
loggingLevel: Option.LogLevel; // ログ出力レベルの設定
|
||||
}
|
||||
|
||||
/**
|
||||
* ログ出力のレベル
|
||||
*/
|
||||
export namespace Option
|
||||
{
|
||||
export enum LogLevel
|
||||
{
|
||||
LogLevel_Verbose = 0, // 詳細ログ
|
||||
LogLevel_Debug, // デバッグログ
|
||||
LogLevel_Info, // Infoログ
|
||||
LogLevel_Warning, // 警告ログ
|
||||
LogLevel_Error, // エラーログ
|
||||
LogLevel_Off // ログ出力無効
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
* that can be found at http://live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import {Live2DCubismFramework as cubismjson} from "./utils/cubismjson";
|
||||
import {Live2DCubismFramework as cubismidmanager} from "./id/cubismidmanager";
|
||||
import {Live2DCubismFramework as cubismrenderer} from "./rendering/cubismrenderer";
|
||||
import {CubismLogInfo, CubismLogWarning, CSM_ASSERT} from "./utils/cubismdebug";
|
||||
import Value = cubismjson.Value;
|
||||
import CubismIdManager = cubismidmanager.CubismIdManager;
|
||||
import CubismRenderer = cubismrenderer.CubismRenderer;
|
||||
|
||||
export function strtod(s: string, endPtr: string[]): number
|
||||
{
|
||||
let index: number = 0;
|
||||
for(let i: number = 1; ; i++)
|
||||
{
|
||||
let testC: string = s.slice(i - 1, i);
|
||||
|
||||
// 指数・マイナスの可能性があるのでスキップする
|
||||
if(testC=='e' || testC=='-' || testC == 'E')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// 文字列の範囲を広げていく
|
||||
let test: string = s.substring(0, i);
|
||||
let number: number = Number(test);
|
||||
if(isNaN(number))
|
||||
{
|
||||
// 数値として認識できなくなったので終了
|
||||
break;
|
||||
}
|
||||
|
||||
// 最後に数値としてできたindexを格納しておく
|
||||
index = i;
|
||||
}
|
||||
let d = parseFloat(s); // パースした数値
|
||||
|
||||
if(isNaN(d))
|
||||
{
|
||||
// 数値として認識できなくなったので終了
|
||||
d = NaN;
|
||||
}
|
||||
|
||||
endPtr[0] = s.slice(index); // 後続の文字列
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
export namespace Live2DCubismFramework
|
||||
{
|
||||
// ファイルスコープの変数を初期化
|
||||
|
||||
let s_isStarted: boolean = false;
|
||||
let s_isInitialized: boolean = false;
|
||||
let s_option: Option = null;
|
||||
let s_cubismIdManager: CubismIdManager = null;
|
||||
|
||||
/**
|
||||
* Framework内で使う定数の宣言
|
||||
*/
|
||||
export namespace Constant
|
||||
{
|
||||
export const vertexOffset: number = 0; // メッシュ頂点のオフセット値
|
||||
export const vertexStep: number = 2; // メッシュ頂点のステップ値
|
||||
}
|
||||
|
||||
export function csmDelete<T>(address: T): void
|
||||
{
|
||||
if(!address)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
address = void 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Live2D Cubism3 Original Workflow SDKのエントリポイント
|
||||
* 利用開始時はCubismFramework.initialize()を呼び、CubismFramework.dispose()で終了する。
|
||||
*/
|
||||
export class CubismFramework
|
||||
{
|
||||
/**
|
||||
* @brief Cubism FrameworkのAPIを使用可能にする。<br>
|
||||
* APIを実行する前に必ずこの関数を実行すること。<br>
|
||||
* 引数に必ずメモリアロケータを渡してください。<br>
|
||||
* 一度準備が完了して以降は、再び実行しても内部処理がスキップされます。
|
||||
*
|
||||
* @param allocator ICubismAllocatorクラスのインスタンス
|
||||
* @param option Optionクラスのインスタンス
|
||||
*
|
||||
* @return 準備処理が完了したらtrueが返ります。
|
||||
*/
|
||||
public static startUp(option: Option = null): boolean
|
||||
{
|
||||
if(s_isStarted)
|
||||
{
|
||||
CubismLogInfo("CubismFramework::StartUp() is already done.");
|
||||
return s_isStarted;
|
||||
}
|
||||
|
||||
s_option = option;
|
||||
|
||||
if(s_option != null)
|
||||
{
|
||||
// TODO Core::csmSetLogFunction(s_option->LogFunction);
|
||||
}
|
||||
|
||||
s_isStarted = true;
|
||||
|
||||
// Live2D Cubism Coreバージョン情報を表示
|
||||
if(s_isStarted)
|
||||
{
|
||||
const version: number = 1; // TODO Core::csmGetVersion()
|
||||
const major: number = ((version & 0xFF000000) >> 24);
|
||||
const minor: number = ((version & 0x00FF0000) >> 16);
|
||||
const patch: number = ((version & 0x0000FFFF));
|
||||
const versionNumber: number = version;
|
||||
|
||||
CubismLogInfo("Live2D Cubism Core version: %02d.%02d.%04d (%d)", major, minor, patch, versionNumber);
|
||||
}
|
||||
|
||||
CubismLogInfo("CubismFramework::StartUp() is complete.");
|
||||
|
||||
return s_isStarted;
|
||||
}
|
||||
|
||||
/**
|
||||
* StartUp()で初期化したCubismFrameworkの各パラメータをクリアします。
|
||||
* Dispose()したCubismFrameworkを再利用する際に利用してください。
|
||||
*/
|
||||
public static cleanUp(): void
|
||||
{
|
||||
s_isStarted = false;
|
||||
s_isInitialized = false;
|
||||
s_option = null;
|
||||
s_cubismIdManager = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cubism Framework内のリソースを初期化してモデルを表示可能な状態にします。<br>
|
||||
* 再度Initialize()するには先にDispose()を実行する必要があります。
|
||||
*/
|
||||
public static initialize(): void
|
||||
{
|
||||
CSM_ASSERT(s_isStarted);
|
||||
if(!s_isStarted)
|
||||
{
|
||||
CubismLogWarning("CubismFramework is not started.");
|
||||
return;
|
||||
}
|
||||
|
||||
// --- s_isInitializedによる連続初期化ガード ---
|
||||
// 連続してリソース確保が行われないようにする。
|
||||
// 再度Initialize()するには先にDispose()を実行する必要がある。
|
||||
if (s_isInitialized)
|
||||
{
|
||||
CubismLogWarning("CubismFramework::Initialize() skipped, already initialized.");
|
||||
return;
|
||||
}
|
||||
|
||||
//---- static 初期化 ----
|
||||
Value.staticInitializeNotForClientCall();
|
||||
|
||||
s_cubismIdManager = new CubismIdManager();
|
||||
|
||||
s_isInitialized = true;
|
||||
|
||||
CubismLogInfo("CubismFramework::Initialize() is complete.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Cubism Framework内の全てのリソースを解放します。
|
||||
* ただし、外部で確保されたリソースについては解放しません。
|
||||
* 外部で適切に破棄する必要があります。
|
||||
*/
|
||||
public static dispose(): void
|
||||
{
|
||||
CSM_ASSERT(s_isStarted);
|
||||
if(!s_isStarted)
|
||||
{
|
||||
CubismLogWarning("CubismFramework is not started.");
|
||||
return;
|
||||
}
|
||||
|
||||
// --- s_isInitializedによる未初期化解放ガード ---
|
||||
// dispose()するには先にinitialize()を実行する必要がある。
|
||||
if(!s_isInitialized) // false...リソース未確保の場合
|
||||
{
|
||||
CubismLogWarning("CubismFramework::Dispose() skipped, not initialized.");
|
||||
return;
|
||||
}
|
||||
|
||||
Value.staticReleaseNotForClientCall();
|
||||
|
||||
s_cubismIdManager.release();
|
||||
s_cubismIdManager = void 0;
|
||||
|
||||
// レンダラの静的リソース(シェーダプログラム他)を解放する
|
||||
CubismRenderer.StaticRelease();
|
||||
|
||||
s_isInitialized = false;
|
||||
|
||||
CubismLogInfo("CubismFramework::Dispose() is complete.");
|
||||
}
|
||||
|
||||
/**
|
||||
* 現在のログ出力レベル設定の値を返す。
|
||||
*
|
||||
* @return 現在のログ出力レベル設定の値
|
||||
*/
|
||||
public static getLoggingLevel(): LogLevel
|
||||
{
|
||||
if (s_option != null)
|
||||
{
|
||||
return s_option.loggingLevel;
|
||||
}
|
||||
return LogLevel.LogLevel_Off;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cubism FrameworkのAPIを使用する準備が完了したかどうか
|
||||
* @return APIを使用する準備が完了していればtrueが返ります。
|
||||
*/
|
||||
public static isStarted(): boolean
|
||||
{
|
||||
return s_isStarted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cubism Frameworkのリソース初期化がすでに行われているかどうか
|
||||
* @return リソース確保が完了していればtrueが返ります
|
||||
*/
|
||||
public static isInitialized(): boolean
|
||||
{
|
||||
return s_isInitialized;
|
||||
}
|
||||
|
||||
/**
|
||||
* IDマネージャのインスタンスを取得する
|
||||
* @return CubismManagerクラスのインスタンス
|
||||
*/
|
||||
public static getIdManager(): CubismIdManager
|
||||
{
|
||||
return s_cubismIdManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* 静的クラスとして使用する
|
||||
* インスタンス化させない
|
||||
*/
|
||||
private constructor()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class Option
|
||||
{
|
||||
loggingLevel: LogLevel; // ログ出力レベルの設定
|
||||
}
|
||||
|
||||
/**
|
||||
* ログ出力のレベル
|
||||
*/
|
||||
export enum LogLevel
|
||||
{
|
||||
LogLevel_Verbose = 0, // 詳細ログ
|
||||
LogLevel_Debug, // デバッグログ
|
||||
LogLevel_Info, // Infoログ
|
||||
LogLevel_Warning, // 警告ログ
|
||||
LogLevel_Error, // エラーログ
|
||||
LogLevel_Off // ログ出力無効
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
@ -274,6 +274,21 @@ export namespace Live2DCubismFramework
|
|||
CubismMatrix44.multiply(m.getArray(), this._tr, this._tr);
|
||||
}
|
||||
|
||||
/**
|
||||
* オブジェクトのコピーを生成する
|
||||
*/
|
||||
public clone(): CubismMatrix44
|
||||
{
|
||||
let cloneMatrix: CubismMatrix44 = new CubismMatrix44();
|
||||
|
||||
for(let i: number = 0; i < this._tr.length; i++)
|
||||
{
|
||||
cloneMatrix._tr[i] = this._tr[i];
|
||||
}
|
||||
|
||||
return cloneMatrix;
|
||||
}
|
||||
|
||||
protected _tr: Float32Array; // 4x4行列データ
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
@ -8,6 +8,7 @@
|
|||
import {Live2DCubismFramework as csmmap} from "../type/csmmap";
|
||||
import {Live2DCubismFramework as cubismmatrix44} from "./cubismmatrix44";
|
||||
import csmMap = csmmap.csmMap;
|
||||
import iterator = csmmap.iterator;
|
||||
import CubismMatrix44 = cubismmatrix44.CubismMatrix44;
|
||||
|
||||
|
||||
|
@ -202,7 +203,7 @@ export namespace Live2DCubismFramework
|
|||
const keyLeft = "left";
|
||||
const keyRight = "right";
|
||||
|
||||
for(const ite: csmMap.iterator<string, number> = layout.begin(); ite.notEqual(layout.end()); ite.preIncrement())
|
||||
for(const ite: iterator<string, number> = layout.begin(); ite.notEqual(layout.end()); ite.preIncrement())
|
||||
{
|
||||
const key: string = ite.ptr().first;
|
||||
const value: number = ite.ptr().second;
|
||||
|
@ -217,7 +218,7 @@ export namespace Live2DCubismFramework
|
|||
}
|
||||
}
|
||||
|
||||
for(const ite: csmMap.iterator<string, number> = layout.begin(); ite.notEqual(layout.end()); ite.preIncrement())
|
||||
for(const ite: iterator<string, number> = layout.begin(); ite.notEqual(layout.end()); ite.preIncrement())
|
||||
{
|
||||
const key: string = ite.ptr().first;
|
||||
const value: number = ite.ptr().second;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
@ -73,10 +73,12 @@ export namespace Live2DCubismFramework
|
|||
*/
|
||||
deleteModel(model: CubismModel): void
|
||||
{
|
||||
model.release();
|
||||
model = void 0;
|
||||
|
||||
--this._modelCount;
|
||||
if(model != null)
|
||||
{
|
||||
model.release();
|
||||
model = null;
|
||||
--this._modelCount;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
@ -13,7 +13,7 @@ import {Live2DCubismFramework as csmmap} from "../type/csmmap";
|
|||
import {Live2DCubismFramework as csmvector} from "../type/csmvector";
|
||||
import {CSM_ASSERT} from "../utils/cubismdebug";
|
||||
import CubismFramework = cubismframework.CubismFramework;
|
||||
import CubismRenderer = cubismrenderer.CubismRenderer;
|
||||
import CubismBlendMode = cubismrenderer.CubismBlendMode;
|
||||
import csmVector = csmvector.csmVector;
|
||||
import csmMap = csmmap.csmMap;
|
||||
import CubismIdHandle = cubismid.CubismIdHandle;
|
||||
|
@ -579,15 +579,15 @@ export namespace Live2DCubismFramework
|
|||
* @param drawableIndex Drawableのインデックス
|
||||
* @return drawableのブレンドモード
|
||||
*/
|
||||
public getDrawableBlendMode(drawableIndex: number): CubismRenderer.CubismBlendMode
|
||||
public getDrawableBlendMode(drawableIndex: number): CubismBlendMode
|
||||
{
|
||||
const constantFlags = this._model.drawables.constantFlags;
|
||||
|
||||
return (Live2DCubismCore.Utils.hasBlendAdditiveBit(constantFlags[drawableIndex]))
|
||||
? CubismRenderer.CubismBlendMode.CubismBlendMode_Additive
|
||||
? CubismBlendMode.CubismBlendMode_Additive
|
||||
: (Live2DCubismCore.Utils.hasBlendMultiplicativeBit(constantFlags[drawableIndex]))
|
||||
? CubismRenderer.CubismBlendMode.CubismBlendMode_Multiplicative
|
||||
: CubismRenderer.CubismBlendMode.CubismBlendMode_Normal;
|
||||
? CubismBlendMode.CubismBlendMode_Multiplicative
|
||||
: CubismBlendMode.CubismBlendMode_Normal;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
@ -62,9 +62,11 @@ export namespace Live2DCubismFramework
|
|||
*/
|
||||
public static delete(modelUserData: CubismModelUserData): void
|
||||
{
|
||||
modelUserData.release();
|
||||
modelUserData = void 0;
|
||||
modelUserData = null;
|
||||
if(modelUserData != null)
|
||||
{
|
||||
modelUserData.release();
|
||||
modelUserData = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -127,7 +129,7 @@ export namespace Live2DCubismFramework
|
|||
{
|
||||
for(let i: number = 0; i < this._userDataNodes.getSize(); ++i)
|
||||
{
|
||||
this._userDataNodes.set(i, void 0);
|
||||
this._userDataNodes.set(i, null);
|
||||
}
|
||||
|
||||
this._userDataNodes = null;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
@ -319,9 +319,9 @@ export namespace Live2DCubismFramework
|
|||
*/
|
||||
public deleteRenderer(): void
|
||||
{
|
||||
if(this._renderer)
|
||||
if(this._renderer != null)
|
||||
{
|
||||
this._renderer = void 0;
|
||||
this._renderer.release();
|
||||
this._renderer = null;
|
||||
}
|
||||
}
|
||||
|
@ -406,33 +406,37 @@ export namespace Live2DCubismFramework
|
|||
*/
|
||||
public release()
|
||||
{
|
||||
this._motionManager.release();
|
||||
this._motionManager = void 0;
|
||||
this._motionManager = null;
|
||||
if(this._motionManager != null)
|
||||
{
|
||||
this._motionManager.release();
|
||||
this._motionManager = null;
|
||||
}
|
||||
|
||||
this._expressionManager.release();
|
||||
this._expressionManager = void 0;
|
||||
this._expressionManager = null;
|
||||
if(this._expressionManager != null)
|
||||
{
|
||||
this._expressionManager.release();
|
||||
this._expressionManager = null;
|
||||
}
|
||||
|
||||
this._moc.deleteModel(this._model);
|
||||
this._moc.release();
|
||||
this._moc = void 0;
|
||||
this._moc = null;
|
||||
if(this._moc != null)
|
||||
{
|
||||
this._moc.deleteModel(this._model);
|
||||
this._moc.release();
|
||||
this._moc = null;
|
||||
}
|
||||
|
||||
this._modelMatrix = void 0;
|
||||
this._modelMatrix = null;
|
||||
|
||||
CubismPose.delete(this._pose);
|
||||
CubismEyeBlink.delete(this._eyeBlink);
|
||||
CubismBreath.delete(this._breath);
|
||||
|
||||
this._dragManager = void 0;
|
||||
this._dragManager = null;
|
||||
|
||||
CubismPhysics.delete(this._physics);
|
||||
CubismModelUserData.delete(this._modelUserData);
|
||||
this.deleteRenderer();
|
||||
|
||||
this.deleteRenderer();
|
||||
}
|
||||
|
||||
protected _moc: CubismMoc; // Mocデータ
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
@ -80,28 +80,28 @@ export namespace Live2DCubismFramework
|
|||
const value: number = param.getMap().getValue(ExpressionKeyValue).toFloat(); // 値
|
||||
|
||||
// 計算方法の設定
|
||||
let blendType: CubismExpressionMotion.ExpressionBlendType;
|
||||
let blendType: ExpressionBlendType;
|
||||
|
||||
if(param.getMap().getValue(ExpressionKeyBlend).isNull() || param.getMap().getValue(ExpressionKeyBlend).getString() == BlendValueAdd)
|
||||
{
|
||||
blendType = this.ExpressionBlendType.ExpressionBlendType_Add;
|
||||
blendType = ExpressionBlendType.ExpressionBlendType_Add;
|
||||
}
|
||||
else if(param.getMap().getValue(ExpressionKeyBlend).getString() == BlendValueMultiply)
|
||||
{
|
||||
blendType = this.ExpressionBlendType.ExpressionBlendType_Multiply;
|
||||
blendType = ExpressionBlendType.ExpressionBlendType_Multiply;
|
||||
}
|
||||
else if(param.getMap().getValue(ExpressionKeyBlend).getString() == BlendValueOverwrite)
|
||||
{
|
||||
blendType = this.ExpressionBlendType.ExpressionBlendType_Overwrite;
|
||||
blendType = ExpressionBlendType.ExpressionBlendType_Overwrite;
|
||||
}
|
||||
else
|
||||
{
|
||||
// その他 仕様にない値を設定した時は加算モードにすることで復旧
|
||||
blendType = this.ExpressionBlendType.ExpressionBlendType_Add;
|
||||
blendType = ExpressionBlendType.ExpressionBlendType_Add;
|
||||
}
|
||||
|
||||
// 設定オブジェクトを作成してリストに追加する
|
||||
let item: CubismExpressionMotion.ExpressionParameter = new CubismExpressionMotion.ExpressionParameter();
|
||||
let item: ExpressionParameter = new ExpressionParameter();
|
||||
|
||||
item.parameterId = parameterId;
|
||||
item.blendType = blendType;
|
||||
|
@ -125,21 +125,21 @@ export namespace Live2DCubismFramework
|
|||
{
|
||||
for(let i: number = 0; i < this._parameters.getSize(); ++i)
|
||||
{
|
||||
let parameter: CubismExpressionMotion.ExpressionParameter = this._parameters.at(i);
|
||||
let parameter: ExpressionParameter = this._parameters.at(i);
|
||||
|
||||
switch(parameter.blendType)
|
||||
{
|
||||
case CubismExpressionMotion.ExpressionBlendType.ExpressionBlendType_Add:
|
||||
case ExpressionBlendType.ExpressionBlendType_Add:
|
||||
{
|
||||
model.addParameterValueById(parameter.parameterId, parameter.value, weight);
|
||||
break;
|
||||
}
|
||||
case CubismExpressionMotion.ExpressionBlendType.ExpressionBlendType_Multiply:
|
||||
case ExpressionBlendType.ExpressionBlendType_Multiply:
|
||||
{
|
||||
model.multiplyParameterValueById(parameter.parameterId, parameter.value, weight);
|
||||
break;
|
||||
}
|
||||
case CubismExpressionMotion.ExpressionBlendType.ExpressionBlendType_Overwrite:
|
||||
case ExpressionBlendType.ExpressionBlendType_Overwrite:
|
||||
{
|
||||
model.setParameterValueById(parameter.parameterId, parameter.value, weight)
|
||||
break;
|
||||
|
@ -158,32 +158,29 @@ export namespace Live2DCubismFramework
|
|||
{
|
||||
super();
|
||||
|
||||
this._parameters = new csmVector<CubismExpressionMotion.ExpressionParameter>();
|
||||
this._parameters = new csmVector<ExpressionParameter>();
|
||||
}
|
||||
|
||||
_parameters: csmVector<CubismExpressionMotion.ExpressionParameter>; // 表情のパラメータ情報リスト
|
||||
_parameters: csmVector<ExpressionParameter>; // 表情のパラメータ情報リスト
|
||||
}
|
||||
|
||||
export namespace CubismExpressionMotion
|
||||
/**
|
||||
* 表情パラメータ値の計算方式
|
||||
*/
|
||||
export enum ExpressionBlendType
|
||||
{
|
||||
/**
|
||||
* 表情パラメータ値の計算方式
|
||||
*/
|
||||
export enum ExpressionBlendType
|
||||
{
|
||||
ExpressionBlendType_Add = 0, // 加算
|
||||
ExpressionBlendType_Multiply = 1, // 乗算
|
||||
ExpressionBlendType_Overwrite = 2 // 上書き
|
||||
}
|
||||
ExpressionBlendType_Add = 0, // 加算
|
||||
ExpressionBlendType_Multiply = 1, // 乗算
|
||||
ExpressionBlendType_Overwrite = 2 // 上書き
|
||||
}
|
||||
|
||||
/**
|
||||
* 表情のパラメータ情報
|
||||
*/
|
||||
export class ExpressionParameter
|
||||
{
|
||||
parameterId: CubismIdHandle; // パラメータID
|
||||
blendType: ExpressionBlendType; // パラメータの演算種類
|
||||
value: number; // 値
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 表情のパラメータ情報
|
||||
*/
|
||||
export class ExpressionParameter
|
||||
{
|
||||
parameterId: CubismIdHandle; // パラメータID
|
||||
blendType: ExpressionBlendType; // パラメータの演算種類
|
||||
value: number; // 値
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
@ -13,6 +13,7 @@ import {Live2DCubismFramework as csmstring} from '../type/csmstring';
|
|||
import csmString = csmstring.csmString;
|
||||
import CubismModel = cubismmodel.CubismModel;
|
||||
import csmVector = csmvector.csmVector;
|
||||
import iterator = csmvector.iterator;
|
||||
import CubismMotionQueueEntry = cubismmotionqueueentry.CubismMotionQueueEntry;
|
||||
import ACubismMotion = acubismmotion.ACubismMotion;
|
||||
|
||||
|
@ -108,7 +109,7 @@ export namespace Live2DCubismFramework
|
|||
// ------- 処理を行う -------
|
||||
// 既にモーションがあれば終了フラグを立てる
|
||||
|
||||
for(let ite: csmVector.iterator<CubismMotionQueueEntry> = this._motions.begin(); ite.notEqual(this._motions.end());)
|
||||
for(let ite: iterator<CubismMotionQueueEntry> = this._motions.begin(); ite.notEqual(this._motions.end());)
|
||||
{
|
||||
let motionQueueEntry: CubismMotionQueueEntry = ite.ptr();
|
||||
|
||||
|
@ -152,7 +153,7 @@ export namespace Live2DCubismFramework
|
|||
public isFinishedByHandle(motionQueueEntryNumber: CubismMotionQueueEntryHandle): boolean
|
||||
{
|
||||
// 既にモーションがあれば終了フラグを立てる
|
||||
for(let ite: csmVector.iterator<CubismMotionQueueEntry> = this._motions.begin(); ite.notEqual(this._motions.end());ite.increment())
|
||||
for(let ite: iterator<CubismMotionQueueEntry> = this._motions.begin(); ite.notEqual(this._motions.end());ite.increment())
|
||||
{
|
||||
let motionQueueEntry: CubismMotionQueueEntry = ite.ptr();
|
||||
|
||||
|
@ -177,7 +178,7 @@ export namespace Live2DCubismFramework
|
|||
// ------- 処理を行う -------
|
||||
// 既にモーションがあれば終了フラグを立てる
|
||||
|
||||
for(let ite: csmVector.iterator<CubismMotionQueueEntry> = this._motions.begin(); ite.notEqual(this._motions.end());)
|
||||
for(let ite: iterator<CubismMotionQueueEntry> = this._motions.begin(); ite.notEqual(this._motions.end());)
|
||||
{
|
||||
let motionQueueEntry: CubismMotionQueueEntry = ite.ptr();
|
||||
|
||||
|
@ -207,7 +208,7 @@ export namespace Live2DCubismFramework
|
|||
{
|
||||
//------- 処理を行う -------
|
||||
// 既にモーションがあれば終了フラグを立てる
|
||||
for(let ite: csmVector.iterator<CubismMotionQueueEntry> = this._motions.begin(); ite.notEqual(this._motions.end()); ite.preIncrement())
|
||||
for(let ite: iterator<CubismMotionQueueEntry> = this._motions.begin(); ite.notEqual(this._motions.end()); ite.preIncrement())
|
||||
{
|
||||
let motionQueueEntry: CubismMotionQueueEntry = ite.ptr();
|
||||
|
||||
|
@ -252,7 +253,7 @@ export namespace Live2DCubismFramework
|
|||
// ------- 処理を行う --------
|
||||
// 既にモーションがあれば終了フラグを立てる
|
||||
|
||||
for(let ite: csmVector.iterator<CubismMotionQueueEntry> = this._motions.begin(); ite.notEqual(this._motions.end());)
|
||||
for(let ite: iterator<CubismMotionQueueEntry> = this._motions.begin(); ite.notEqual(this._motions.end());)
|
||||
{
|
||||
let motionQueueEntry: CubismMotionQueueEntry = ite.ptr();
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
@ -67,9 +67,11 @@ export namespace Live2DCubismFramework
|
|||
*/
|
||||
public static delete(physics: CubismPhysics): void
|
||||
{
|
||||
physics.release();
|
||||
physics = void 0;
|
||||
physics = null;
|
||||
if(physics != null)
|
||||
{
|
||||
physics.release();
|
||||
physics = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -201,7 +203,7 @@ export namespace Live2DCubismFramework
|
|||
* オプションの設定
|
||||
* @param options オプション
|
||||
*/
|
||||
public setOptions(options: CubismPhysics.Options): void
|
||||
public setOptions(options: Options): void
|
||||
{
|
||||
this._options = options;
|
||||
}
|
||||
|
@ -210,7 +212,7 @@ export namespace Live2DCubismFramework
|
|||
* オプションの取得
|
||||
* @return オプション
|
||||
*/
|
||||
public getOption(): CubismPhysics.Options
|
||||
public getOption(): Options
|
||||
{
|
||||
return this._options;
|
||||
}
|
||||
|
@ -223,7 +225,7 @@ export namespace Live2DCubismFramework
|
|||
this._physicsRig = null;
|
||||
|
||||
// set default options
|
||||
this._options = new CubismPhysics.Options();
|
||||
this._options = new Options();
|
||||
this._options.gravity.y = -1.0;
|
||||
this._options.gravity.x = 0;
|
||||
this._options.wind.x = 0;
|
||||
|
@ -401,26 +403,22 @@ export namespace Live2DCubismFramework
|
|||
}
|
||||
|
||||
_physicsRig: CubismPhysicsRig; // 物理演算のデータ
|
||||
_options: CubismPhysics.Options; // オプション
|
||||
_options: Options; // オプション
|
||||
}
|
||||
|
||||
export namespace CubismPhysics
|
||||
/**
|
||||
* 物理演算のオプション
|
||||
*/
|
||||
export class Options
|
||||
{
|
||||
/**
|
||||
* 物理演算のオプション
|
||||
*/
|
||||
export class Options
|
||||
constructor()
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
this.gravity = new CubismVector2(0, 0);
|
||||
this.wind = new CubismVector2(0, 0);
|
||||
}
|
||||
|
||||
gravity: CubismVector2; // 重力方向
|
||||
wind: CubismVector2; // 風の方向
|
||||
this.gravity = new CubismVector2(0, 0);
|
||||
this.wind = new CubismVector2(0, 0);
|
||||
}
|
||||
|
||||
gravity: CubismVector2; // 重力方向
|
||||
wind: CubismVector2; // 風の方向
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
@ -62,17 +62,8 @@ export namespace Live2DCubismFramework
|
|||
public drawModel(): void
|
||||
{
|
||||
if(this.getModel() == null) return;
|
||||
/**
|
||||
* doDrawModelの描画前と描画後に以下の関数を呼んでください
|
||||
* ・saveProfile();
|
||||
* ・restoreProfile();
|
||||
* これはレンダラの描画設定を保存復帰させることで、
|
||||
* モデル描画直前の状態に戻すための処理です。
|
||||
*/
|
||||
|
||||
this.saveProfile();
|
||||
this.doDrawModel();
|
||||
this.restoreProfile();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -152,7 +143,7 @@ export namespace Live2DCubismFramework
|
|||
*
|
||||
* @return RGBAのカラー情報
|
||||
*/
|
||||
public getModelColor(): CubismRenderer.CubismTextureColor
|
||||
public getModelColor(): CubismTextureColor
|
||||
{
|
||||
return JSON.parse(JSON.stringify(this._modelColor));
|
||||
}
|
||||
|
@ -232,7 +223,7 @@ export namespace Live2DCubismFramework
|
|||
this._isPremultipliedAlpha = false;
|
||||
this._anisortopy = 0.0;
|
||||
this._model = null;
|
||||
this._modelColor = new CubismRenderer.CubismTextureColor();
|
||||
this._modelColor = new CubismTextureColor();
|
||||
|
||||
// 単位行列に初期化
|
||||
this._mvpMatrix4x4 = new CubismMatrix44();
|
||||
|
@ -258,55 +249,42 @@ export namespace Live2DCubismFramework
|
|||
*/
|
||||
public abstract drawMesh(textureNo: number, indexCount: number, vertexCount: number,
|
||||
indexArray: Uint16Array, vertexArray: Float32Array, uvArray: Float32Array,
|
||||
opacity: number, colorBlendMode: CubismRenderer.CubismBlendMode): void;
|
||||
|
||||
/**
|
||||
* モデル描画直前のレンダラのステートを保持する
|
||||
*/
|
||||
public abstract saveProfile(): void;
|
||||
|
||||
/**
|
||||
* モデル描画直前のレンダラのステートを復帰させる
|
||||
*/
|
||||
public abstract restoreProfile(): void;
|
||||
opacity: number, colorBlendMode: CubismBlendMode): void;
|
||||
|
||||
protected _mvpMatrix4x4: CubismMatrix44; // Model-View-Projection 行列
|
||||
protected _modelColor: CubismRenderer.CubismTextureColor; // モデル自体のカラー(RGBA)
|
||||
protected _modelColor: CubismTextureColor; // モデル自体のカラー(RGBA)
|
||||
protected _isCulling: boolean; // カリングが有効ならtrue
|
||||
protected _isPremultipliedAlpha: boolean; // 乗算済みαならtrue
|
||||
protected _anisortopy: any; // テクスチャの異方性フィルタリングのパラメータ
|
||||
protected _model: CubismModel; // レンダリング対象のモデル
|
||||
}
|
||||
|
||||
export namespace CubismRenderer
|
||||
export enum CubismBlendMode
|
||||
{
|
||||
export enum CubismBlendMode
|
||||
{
|
||||
CubismBlendMode_Normal = 0, // 通常
|
||||
CubismBlendMode_Additive = 1, // 加算
|
||||
CubismBlendMode_Multiplicative = 2, // 乗算
|
||||
};
|
||||
CubismBlendMode_Normal = 0, // 通常
|
||||
CubismBlendMode_Additive = 1, // 加算
|
||||
CubismBlendMode_Multiplicative = 2, // 乗算
|
||||
};
|
||||
|
||||
/**
|
||||
* テクスチャの色をRGBAで扱うためのクラス
|
||||
*/
|
||||
export class CubismTextureColor
|
||||
{
|
||||
/**
|
||||
* テクスチャの色をRGBAで扱うためのクラス
|
||||
* コンストラクタ
|
||||
*/
|
||||
export class CubismTextureColor
|
||||
constructor()
|
||||
{
|
||||
/**
|
||||
* コンストラクタ
|
||||
*/
|
||||
constructor()
|
||||
{
|
||||
this.R = 1.0;
|
||||
this.G = 1.0;
|
||||
this.B = 1.0;
|
||||
this.A = 1.0;
|
||||
}
|
||||
|
||||
R: number; // 赤チャンネル
|
||||
G: number; // 緑チャンネル
|
||||
B: number; // 青チャンネル
|
||||
A: number; // αチャンネル
|
||||
this.R = 1.0;
|
||||
this.G = 1.0;
|
||||
this.B = 1.0;
|
||||
this.A = 1.0;
|
||||
}
|
||||
|
||||
R: number; // 赤チャンネル
|
||||
G: number; // 緑チャンネル
|
||||
B: number; // 青チャンネル
|
||||
A: number; // αチャンネル
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
@ -212,18 +212,18 @@ export namespace Live2DCubismFramework
|
|||
/**
|
||||
* コンテナの先頭要素を返す
|
||||
*/
|
||||
public begin(): csmMap.iterator<_KeyT, _ValT>
|
||||
public begin(): iterator<_KeyT, _ValT>
|
||||
{
|
||||
let ite: csmMap.iterator<_KeyT, _ValT> = new csmMap.iterator<_KeyT, _ValT>(this, 0);
|
||||
let ite: iterator<_KeyT, _ValT> = new iterator<_KeyT, _ValT>(this, 0);
|
||||
return ite;
|
||||
}
|
||||
|
||||
/**
|
||||
* コンテナの終端要素を返す
|
||||
*/
|
||||
public end(): csmMap.iterator<_KeyT, _ValT>
|
||||
public end(): iterator<_KeyT, _ValT>
|
||||
{
|
||||
let ite: csmMap.iterator<_KeyT, _ValT> = new csmMap.iterator<_KeyT, _ValT>(this, this._size); // 終了
|
||||
let ite: iterator<_KeyT, _ValT> = new iterator<_KeyT, _ValT>(this, this._size); // 終了
|
||||
return ite;
|
||||
}
|
||||
|
||||
|
@ -232,7 +232,7 @@ export namespace Live2DCubismFramework
|
|||
*
|
||||
* @param ite 削除する要素
|
||||
*/
|
||||
public erase(ite: csmMap.iterator<_KeyT, _ValT>): csmMap.iterator<_KeyT, _ValT>
|
||||
public erase(ite: iterator<_KeyT, _ValT>): iterator<_KeyT, _ValT>
|
||||
{
|
||||
let index: number = ite._index;
|
||||
if(index < 0 || this._size <= index)
|
||||
|
@ -244,7 +244,7 @@ export namespace Live2DCubismFramework
|
|||
this._keyValues.splice(index, 1);
|
||||
--this._size;
|
||||
|
||||
let ite2: csmMap.iterator<_KeyT, _ValT> = new csmMap.iterator<_KeyT, _ValT>(this, index); // 終了
|
||||
let ite2: iterator<_KeyT, _ValT> = new iterator<_KeyT, _ValT>(this, index); // 終了
|
||||
return ite2;
|
||||
}
|
||||
|
||||
|
@ -266,95 +266,93 @@ export namespace Live2DCubismFramework
|
|||
public _size: number; // コンテナの要素数
|
||||
}
|
||||
|
||||
export namespace csmMap
|
||||
|
||||
/**
|
||||
* csmMap<T>のイテレータ
|
||||
*/
|
||||
export class iterator<_KeyT, _ValT>
|
||||
{
|
||||
/**
|
||||
* csmMap<T>のイテレータ
|
||||
* コンストラクタ
|
||||
*/
|
||||
export class iterator<_KeyT, _ValT>
|
||||
constructor(v?: csmMap<_KeyT, _ValT>, idx?: number)
|
||||
{
|
||||
/**
|
||||
* コンストラクタ
|
||||
*/
|
||||
constructor(v?: csmMap<_KeyT, _ValT>, idx?: number)
|
||||
{
|
||||
this._map = (v != undefined)
|
||||
? v
|
||||
: new csmMap<_KeyT, _ValT>();
|
||||
this._map = (v != undefined)
|
||||
? v
|
||||
: new csmMap<_KeyT, _ValT>();
|
||||
|
||||
this._index = (idx != undefined)
|
||||
? idx
|
||||
: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* =演算子のオーバーロード
|
||||
*/
|
||||
public set(ite: iterator<_KeyT, _ValT>): iterator<_KeyT, _ValT>
|
||||
{
|
||||
this._index = ite._index;
|
||||
this._map = ite._map;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 前置き++演算子のオーバーロード
|
||||
*/
|
||||
public preIncrement(): iterator<_KeyT, _ValT>
|
||||
{
|
||||
++this._index;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 前置き--演算子のオーバーロード
|
||||
*/
|
||||
public preDecrement(): iterator<_KeyT, _ValT>
|
||||
{
|
||||
--this._index;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 後置き++演算子のオーバーロード
|
||||
*/
|
||||
public increment(): iterator<_KeyT, _ValT>
|
||||
{
|
||||
let iteold = new iterator<_KeyT, _ValT>(this._map, this._index++); // 古い値を保存
|
||||
this._map = iteold._map;
|
||||
this._index = iteold._index;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 後置き--演算子のオーバーロード
|
||||
*/
|
||||
public decrement(): iterator<_KeyT, _ValT>
|
||||
{
|
||||
let iteold = new iterator<_KeyT, _ValT>(this._map, this._index); // 古い値を保存
|
||||
this._map = iteold._map;
|
||||
this._index = iteold._index;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* *演算子のオーバーロード
|
||||
*/
|
||||
public ptr(): csmPair<_KeyT, _ValT>
|
||||
{
|
||||
return this._map._keyValues[this._index];
|
||||
}
|
||||
|
||||
/**
|
||||
* !=演算
|
||||
*/
|
||||
public notEqual(ite: iterator<_KeyT, _ValT>): boolean
|
||||
{
|
||||
return (this._index != ite._index) || (this._map != ite._map);
|
||||
}
|
||||
|
||||
_index: number; // コンテナのインデックス値
|
||||
_map: csmMap<_KeyT, _ValT>; // コンテナ
|
||||
this._index = (idx != undefined)
|
||||
? idx
|
||||
: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* =演算子のオーバーロード
|
||||
*/
|
||||
public set(ite: iterator<_KeyT, _ValT>): iterator<_KeyT, _ValT>
|
||||
{
|
||||
this._index = ite._index;
|
||||
this._map = ite._map;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 前置き++演算子のオーバーロード
|
||||
*/
|
||||
public preIncrement(): iterator<_KeyT, _ValT>
|
||||
{
|
||||
++this._index;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 前置き--演算子のオーバーロード
|
||||
*/
|
||||
public preDecrement(): iterator<_KeyT, _ValT>
|
||||
{
|
||||
--this._index;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 後置き++演算子のオーバーロード
|
||||
*/
|
||||
public increment(): iterator<_KeyT, _ValT>
|
||||
{
|
||||
let iteold = new iterator<_KeyT, _ValT>(this._map, this._index++); // 古い値を保存
|
||||
this._map = iteold._map;
|
||||
this._index = iteold._index;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 後置き--演算子のオーバーロード
|
||||
*/
|
||||
public decrement(): iterator<_KeyT, _ValT>
|
||||
{
|
||||
let iteold = new iterator<_KeyT, _ValT>(this._map, this._index); // 古い値を保存
|
||||
this._map = iteold._map;
|
||||
this._index = iteold._index;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* *演算子のオーバーロード
|
||||
*/
|
||||
public ptr(): csmPair<_KeyT, _ValT>
|
||||
{
|
||||
return this._map._keyValues[this._index];
|
||||
}
|
||||
|
||||
/**
|
||||
* !=演算
|
||||
*/
|
||||
public notEqual(ite: iterator<_KeyT, _ValT>): boolean
|
||||
{
|
||||
return (this._index != ite._index) || (this._map != ite._map);
|
||||
}
|
||||
|
||||
_index: number; // コンテナのインデックス値
|
||||
_map: csmMap<_KeyT, _ValT>; // コンテナ
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
@ -175,7 +175,7 @@ export namespace Live2DCubismFramework
|
|||
* @param begin 挿入するコンテナの開始位置
|
||||
* @param end 挿入するコンテナの終端位置
|
||||
*/
|
||||
public insert(position: csmVector.iterator<T>, begin: csmVector.iterator<T>, end: csmVector.iterator<T>): void
|
||||
public insert(position: iterator<T>, begin: iterator<T>, end: iterator<T>): void
|
||||
{
|
||||
let dstSi: number = position._index;
|
||||
let srcSi: number = begin._index;
|
||||
|
@ -226,7 +226,7 @@ export namespace Live2DCubismFramework
|
|||
* コンテナから要素を削除して他の要素をシフトする
|
||||
* @param ite 削除する要素
|
||||
*/
|
||||
public erase(ite: csmVector.iterator<T>): csmVector.iterator<T>
|
||||
public erase(ite: iterator<T>): iterator<T>
|
||||
{
|
||||
let index: number = ite._index;
|
||||
if(index < 0 || this._size <= index)
|
||||
|
@ -238,7 +238,7 @@ export namespace Live2DCubismFramework
|
|||
this._ptr.splice(index, 1);
|
||||
--this._size;
|
||||
|
||||
let ite2: csmVector.iterator<T> = new csmVector.iterator<T>(this, index); // 終了
|
||||
let ite2: iterator<T> = new iterator<T>(this, index); // 終了
|
||||
return ite2;
|
||||
}
|
||||
|
||||
|
@ -266,20 +266,20 @@ export namespace Live2DCubismFramework
|
|||
/**
|
||||
* コンテナの先頭要素を返す
|
||||
*/
|
||||
public begin(): csmVector.iterator<T>
|
||||
public begin(): iterator<T>
|
||||
{
|
||||
let ite: csmVector.iterator<T> = (this._size == 0)
|
||||
let ite: iterator<T> = (this._size == 0)
|
||||
? this.end()
|
||||
: new csmVector.iterator<T>(this, 0);
|
||||
: new iterator<T>(this, 0);
|
||||
return ite;
|
||||
}
|
||||
|
||||
/**
|
||||
* コンテナの終端要素を返す
|
||||
*/
|
||||
public end(): csmVector.iterator<T>
|
||||
public end(): iterator<T>
|
||||
{
|
||||
let ite: csmVector.iterator<T> = new csmVector.iterator<T>(this, this._size);
|
||||
let ite: iterator<T> = new iterator<T>(this, this._size);
|
||||
return ite;
|
||||
}
|
||||
|
||||
|
@ -300,97 +300,94 @@ export namespace Live2DCubismFramework
|
|||
static readonly s_defaultSize = 10; // コンテナ初期化のデフォルトサイズ
|
||||
}
|
||||
|
||||
export namespace csmVector
|
||||
export class iterator<T>
|
||||
{
|
||||
export class iterator<T>
|
||||
/**
|
||||
* コンストラクタ
|
||||
*/
|
||||
public constructor(v?: csmVector<T>, index?: number)
|
||||
{
|
||||
/**
|
||||
* コンストラクタ
|
||||
*/
|
||||
public constructor(v?: csmVector<T>, index?: number)
|
||||
{
|
||||
this._vector = (v != undefined) ? v : null;
|
||||
this._index = (index != undefined) ? index : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 代入
|
||||
*/
|
||||
public set(ite: iterator<T>): iterator<T>
|
||||
{
|
||||
this._index = ite._index;
|
||||
this._vector = ite._vector;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 前置き++演算
|
||||
*/
|
||||
public preIncrement(): iterator<T>
|
||||
{
|
||||
++this._index;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 前置き--演算
|
||||
*/
|
||||
public preDecrement(): iterator<T>
|
||||
{
|
||||
--this._index;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 後置き++演算子
|
||||
*/
|
||||
public increment(): iterator<T>
|
||||
{
|
||||
let iteold = new iterator<T>(this._vector, this._index++);
|
||||
this._vector = iteold._vector;
|
||||
this._index = iteold._index;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 後置き--演算子
|
||||
*/
|
||||
public decrement(): iterator<T>
|
||||
{
|
||||
let iteold = new iterator<T>(this._vector, this._index--); // 古い値を保存
|
||||
this._vector = iteold._vector;
|
||||
this._index = iteold._index;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* ptr
|
||||
*/
|
||||
public ptr(): T
|
||||
{
|
||||
return this._vector._ptr[this._index];
|
||||
}
|
||||
|
||||
/**
|
||||
* =演算子のオーバーロード
|
||||
*/
|
||||
public substitution(ite: iterator<T>): iterator<T>
|
||||
{
|
||||
this._index = ite._index;
|
||||
this._vector = ite._vector;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* !=演算子のオーバーロード
|
||||
*/
|
||||
public notEqual(ite: iterator<T>): boolean
|
||||
{
|
||||
return (this._index != ite._index) || (this._vector != ite._vector);
|
||||
}
|
||||
|
||||
_index: number; // コンテナのインデックス値
|
||||
_vector: csmVector<T>; // コンテナ
|
||||
this._vector = (v != undefined) ? v : null;
|
||||
this._index = (index != undefined) ? index : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 代入
|
||||
*/
|
||||
public set(ite: iterator<T>): iterator<T>
|
||||
{
|
||||
this._index = ite._index;
|
||||
this._vector = ite._vector;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 前置き++演算
|
||||
*/
|
||||
public preIncrement(): iterator<T>
|
||||
{
|
||||
++this._index;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 前置き--演算
|
||||
*/
|
||||
public preDecrement(): iterator<T>
|
||||
{
|
||||
--this._index;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 後置き++演算子
|
||||
*/
|
||||
public increment(): iterator<T>
|
||||
{
|
||||
let iteold = new iterator<T>(this._vector, this._index++);
|
||||
this._vector = iteold._vector;
|
||||
this._index = iteold._index;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 後置き--演算子
|
||||
*/
|
||||
public decrement(): iterator<T>
|
||||
{
|
||||
let iteold = new iterator<T>(this._vector, this._index--); // 古い値を保存
|
||||
this._vector = iteold._vector;
|
||||
this._index = iteold._index;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* ptr
|
||||
*/
|
||||
public ptr(): T
|
||||
{
|
||||
return this._vector._ptr[this._index];
|
||||
}
|
||||
|
||||
/**
|
||||
* =演算子のオーバーロード
|
||||
*/
|
||||
public substitution(ite: iterator<T>): iterator<T>
|
||||
{
|
||||
this._index = ite._index;
|
||||
this._vector = ite._vector;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* !=演算子のオーバーロード
|
||||
*/
|
||||
public notEqual(ite: iterator<T>): boolean
|
||||
{
|
||||
return (this._index != ite._index) || (this._vector != ite._vector);
|
||||
}
|
||||
|
||||
_index: number; // コンテナのインデックス値
|
||||
_vector: csmVector<T>; // コンテナ
|
||||
}
|
||||
}
|
|
@ -1,20 +1,20 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
* that can be found at http://live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import {Live2DCubismFramework as live2dcubismframework, Option} from "../live2dcubismframework";
|
||||
import {Live2DCubismFramework as live2dcubismframework, LogLevel} from "../live2dcubismframework";
|
||||
import CubismFramework = live2dcubismframework.CubismFramework;
|
||||
import { CSM_LOG_LEVEL, CSM_LOG_LEVEL_VERBOSE, CSM_LOG_LEVEL_DEBUG, CSM_LOG_LEVEL_INFO, CSM_LOG_LEVEL_WARNING, CSM_LOG_LEVEL_ERROR } from "../cubismframeworkconfig";
|
||||
|
||||
export const CubismLogPrint = (level: Option.LogLevel, fmt: string, ... args: any[]) =>
|
||||
export const CubismLogPrint = (level: LogLevel, fmt: string, ... args: any[]) =>
|
||||
{
|
||||
Live2DCubismFramework.CubismDebug.print(level, "[CSM]" + fmt, args);
|
||||
}
|
||||
|
||||
export const CubismLogPrintIn = (level: Option.LogLevel, fmt: string, ... args: any[]) =>
|
||||
export const CubismLogPrintIn = (level: LogLevel, fmt: string, ... args: any[]) =>
|
||||
{
|
||||
CubismLogPrint(level, fmt + "\n", args);
|
||||
}
|
||||
|
@ -35,85 +35,85 @@ if(CSM_LOG_LEVEL <= CSM_LOG_LEVEL_VERBOSE)
|
|||
{
|
||||
CubismLogVerbose = (fmt: string, ... args: any[]) =>
|
||||
{
|
||||
CubismLogPrintIn(Option.LogLevel.LogLevel_Verbose, "[V]" + fmt, args);
|
||||
CubismLogPrintIn(LogLevel.LogLevel_Verbose, "[V]" + fmt, args);
|
||||
};
|
||||
|
||||
CubismLogDebug = (fmt: string, ... args: any[]) =>
|
||||
{
|
||||
CubismLogPrintIn(Option.LogLevel.LogLevel_Debug, "[D]" + fmt, args);
|
||||
CubismLogPrintIn(LogLevel.LogLevel_Debug, "[D]" + fmt, args);
|
||||
};
|
||||
|
||||
CubismLogInfo = (fmt: string, ... args: any[]) =>
|
||||
{
|
||||
CubismLogPrintIn(Option.LogLevel.LogLevel_Info, "[I]" + fmt, args);
|
||||
CubismLogPrintIn(LogLevel.LogLevel_Info, "[I]" + fmt, args);
|
||||
};
|
||||
|
||||
CubismLogWarning = (fmt: string, ... args: any[]) =>
|
||||
{
|
||||
CubismLogPrintIn(Option.LogLevel.LogLevel_Warning, "[W]" + fmt, args);
|
||||
CubismLogPrintIn(LogLevel.LogLevel_Warning, "[W]" + fmt, args);
|
||||
};
|
||||
|
||||
CubismLogError = (fmt: string, ... args: any[]) =>
|
||||
{
|
||||
CubismLogPrintIn(Option.LogLevel.LogLevel_Error, "[E]" + fmt, args);
|
||||
CubismLogPrintIn(LogLevel.LogLevel_Error, "[E]" + fmt, args);
|
||||
};
|
||||
}
|
||||
else if(CSM_LOG_LEVEL == CSM_LOG_LEVEL_DEBUG)
|
||||
{
|
||||
CubismLogDebug = (fmt: string, ... args: any[]) =>
|
||||
{
|
||||
CubismLogPrintIn(Option.LogLevel.LogLevel_Debug, "[D]" + fmt, args);
|
||||
CubismLogPrintIn(LogLevel.LogLevel_Debug, "[D]" + fmt, args);
|
||||
};
|
||||
|
||||
CubismLogInfo = (fmt: string, ... args: any[]) =>
|
||||
{
|
||||
CubismLogPrintIn(Option.LogLevel.LogLevel_Info, "[I]" + fmt, args);
|
||||
CubismLogPrintIn(LogLevel.LogLevel_Info, "[I]" + fmt, args);
|
||||
};
|
||||
|
||||
CubismLogWarning = (fmt: string, ... args: any[]) =>
|
||||
{
|
||||
CubismLogPrintIn(Option.LogLevel.LogLevel_Warning, "[W]" + fmt, args);
|
||||
CubismLogPrintIn(LogLevel.LogLevel_Warning, "[W]" + fmt, args);
|
||||
};
|
||||
|
||||
CubismLogError = (fmt: string, ... args: any[]) =>
|
||||
{
|
||||
CubismLogPrintIn(Option.LogLevel.LogLevel_Error, "[E]" + fmt, args);
|
||||
CubismLogPrintIn(LogLevel.LogLevel_Error, "[E]" + fmt, args);
|
||||
};
|
||||
}
|
||||
else if(CSM_LOG_LEVEL == CSM_LOG_LEVEL_INFO)
|
||||
{
|
||||
CubismLogInfo = (fmt: string, ... args: any[]) =>
|
||||
{
|
||||
CubismLogPrintIn(Option.LogLevel.LogLevel_Info, "[I]" + fmt, args);
|
||||
CubismLogPrintIn(LogLevel.LogLevel_Info, "[I]" + fmt, args);
|
||||
};
|
||||
|
||||
CubismLogWarning = (fmt: string, ... args: any[]) =>
|
||||
{
|
||||
CubismLogPrintIn(Option.LogLevel.LogLevel_Warning, "[W]" + fmt, args);
|
||||
CubismLogPrintIn(LogLevel.LogLevel_Warning, "[W]" + fmt, args);
|
||||
};
|
||||
|
||||
CubismLogError = (fmt: string, ... args: any[]) =>
|
||||
{
|
||||
CubismLogPrintIn(Option.LogLevel.LogLevel_Error, "[E]" + fmt, args);
|
||||
CubismLogPrintIn(LogLevel.LogLevel_Error, "[E]" + fmt, args);
|
||||
};
|
||||
}
|
||||
else if(CSM_LOG_LEVEL == CSM_LOG_LEVEL_WARNING)
|
||||
{
|
||||
CubismLogWarning = (fmt: string, ... args: any[]) =>
|
||||
{
|
||||
CubismLogPrintIn(Option.LogLevel.LogLevel_Warning, "[W]" + fmt, args);
|
||||
CubismLogPrintIn(LogLevel.LogLevel_Warning, "[W]" + fmt, args);
|
||||
};
|
||||
|
||||
CubismLogError = (fmt: string, ... args: any[]) =>
|
||||
{
|
||||
CubismLogPrintIn(Option.LogLevel.LogLevel_Error, "[E]" + fmt, args);
|
||||
CubismLogPrintIn(LogLevel.LogLevel_Error, "[E]" + fmt, args);
|
||||
};
|
||||
}
|
||||
else if(CSM_LOG_LEVEL == CSM_LOG_LEVEL_ERROR)
|
||||
{
|
||||
CubismLogError = (fmt: string, ... args: any[]) =>
|
||||
{
|
||||
CubismLogPrintIn(Option.LogLevel.LogLevel_Error, "[E]" + fmt, args);
|
||||
CubismLogPrintIn(LogLevel.LogLevel_Error, "[E]" + fmt, args);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ export namespace Live2DCubismFramework
|
|||
* @param format 書式付き文字列
|
||||
* @param ... args 可変長引数
|
||||
*/
|
||||
public static print(logLevel: Option.LogLevel, format: string, ... args: any[]): void
|
||||
public static print(logLevel: LogLevel, format: string, ... args: any[]): void
|
||||
{
|
||||
// オプションで設定されたログ出力レベルを下回る場合はログに出さない
|
||||
// if(logLevel < CubismFramework.getLoggingLevel())
|
||||
|
@ -169,7 +169,7 @@ export namespace Live2DCubismFramework
|
|||
* @param data ダンプするデータ
|
||||
* @param length ダンプする長さ
|
||||
*/
|
||||
public static dumpBytes(logLevel: Option.LogLevel, data: Uint8Array, length: number): void
|
||||
public static dumpBytes(logLevel: LogLevel, data: Uint8Array, length: number): void
|
||||
{
|
||||
for (let i: number = 0; i < length; i++)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
@ -11,7 +11,9 @@ import {Live2DCubismFramework as csmvector} from "../type/csmvector";
|
|||
import {CubismLogInfo} from "./cubismdebug";
|
||||
import {strtod} from "../live2dcubismframework";
|
||||
import csmVector = csmvector.csmVector;
|
||||
import csmVector_iterator = csmvector.iterator;
|
||||
import csmMap = csmmap.csmMap;
|
||||
import csmMap_iterator = csmmap.iterator;
|
||||
import csmString = csmstring.csmString;
|
||||
|
||||
export namespace Live2DCubismFramework
|
||||
|
@ -305,6 +307,29 @@ export namespace Live2DCubismFramework
|
|||
return this._root;
|
||||
}
|
||||
|
||||
/**
|
||||
* UnicodeのバイナリをStringに変換・長い文字のスライスバージョン
|
||||
*/
|
||||
public LongArrayBufferToString(buffer: ArrayBuffer, len: number) : string
|
||||
{
|
||||
let tmp: string[] = [];
|
||||
for (let p: number = 0; p < buffer.byteLength; p += len)
|
||||
{
|
||||
tmp.push(this.ArrayBufferToString(buffer.slice(p, p + len)));
|
||||
}
|
||||
|
||||
return tmp.join("");
|
||||
}
|
||||
|
||||
/**
|
||||
* UnicodeのバイナリをStringに変換
|
||||
*/
|
||||
public ArrayBufferToString( buffer: ArrayBuffer ): string
|
||||
{
|
||||
// 8ビット変換
|
||||
return String.fromCharCode.apply("", new Uint8Array(buffer));
|
||||
}
|
||||
|
||||
/**
|
||||
* JSONのパースを実行する
|
||||
* @param buffer パース対象のデータバイト
|
||||
|
@ -315,7 +340,7 @@ export namespace Live2DCubismFramework
|
|||
public parseBytes(buffer: ArrayBuffer, size: number): boolean
|
||||
{
|
||||
let endPos: number[] = new Array(1); // 参照渡しにするため配列
|
||||
let decodeBuffer: string = new TextDecoder('utf-8').decode(buffer);
|
||||
let decodeBuffer: string = this.LongArrayBufferToString(buffer, 1024);
|
||||
this._root = this.parseValue(decodeBuffer, size, 0, endPos);
|
||||
|
||||
if(this._error)
|
||||
|
@ -1065,7 +1090,7 @@ export namespace Live2DCubismFramework
|
|||
*/
|
||||
public release(): void
|
||||
{
|
||||
for(let ite: csmVector.iterator<Value> = this._array.begin(); ite.notEqual(this._array.end()); ite.preIncrement())
|
||||
for(let ite: csmVector_iterator<Value> = this._array.begin(); ite.notEqual(this._array.end()); ite.preIncrement())
|
||||
{
|
||||
let v: Value = ite.ptr();
|
||||
|
||||
|
@ -1092,7 +1117,7 @@ export namespace Live2DCubismFramework
|
|||
{
|
||||
let stringBuffer: string = indent + "[\n";
|
||||
|
||||
for(let ite: csmVector.iterator<Value> = this._array.begin(); ite.notEqual(this._array.end()); ite.increment())
|
||||
for(let ite: csmVector_iterator<Value> = this._array.begin(); ite.notEqual(this._array.end()); ite.increment())
|
||||
{
|
||||
let v: Value = ite.ptr();
|
||||
this._stringBuffer += indent + "" + v.getString(indent + " ") + "\n";
|
||||
|
@ -1151,7 +1176,7 @@ export namespace Live2DCubismFramework
|
|||
*/
|
||||
public release(): void
|
||||
{
|
||||
const ite: csmMap.iterator<string, Value> = this._map.begin();
|
||||
const ite: csmMap_iterator<string, Value> = this._map.begin();
|
||||
|
||||
while(ite.notEqual(this._map.end()))
|
||||
{
|
||||
|
@ -1182,7 +1207,7 @@ export namespace Live2DCubismFramework
|
|||
{
|
||||
this._stringBuffer = indent + "{\n";
|
||||
|
||||
const ite: csmMap.iterator<string, Value> = this._map.begin();
|
||||
const ite: csmMap_iterator<string, Value> = this._map.begin();
|
||||
while(ite.notEqual(this._map.end()))
|
||||
{
|
||||
const key = ite.ptr().first;
|
||||
|
@ -1222,7 +1247,7 @@ export namespace Live2DCubismFramework
|
|||
{
|
||||
this._keys = new csmVector<string>();
|
||||
|
||||
const ite: csmMap.iterator<string, Value> = this._map.begin();
|
||||
const ite: csmMap_iterator<string, Value> = this._map.begin();
|
||||
|
||||
while(ite.notEqual(this._map.end()))
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
|
12
README.md
12
README.md
|
@ -96,6 +96,18 @@ F5で実行し、remote web site with sourcemapを選択します。
|
|||
当リポジトリの変更履歴については[コミットログ](https://github.com/Live2D/CubismWebSamples/commits/master)を参照ください。
|
||||
|
||||
|
||||
# 動作確認環境
|
||||
|
||||
- Windows Chrome 70.0.3538.67
|
||||
- Windows Firefox 63.0
|
||||
- Windows Edge 17.17134
|
||||
- macOS Chrome 70.0.3538.77
|
||||
- macOS Firefox 63.0
|
||||
- macOS Safari 12.0
|
||||
- iOS Safari 12.0
|
||||
- Android Chrome 70.0.3538.64
|
||||
|
||||
|
||||
# TODO
|
||||
|
||||
以下Core内関数の実装
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
* that can be found at http://live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import {Live2DCubismFramework as live2dcubismframework, Option} from "../../../../Framework/live2dcubismframework";
|
||||
import Csm_CubismFramework_Option = Option;
|
||||
import {LogLevel} from "../../../../Framework/live2dcubismframework";
|
||||
|
||||
/**
|
||||
* Sample Appで使用する定数
|
||||
|
@ -66,5 +65,5 @@ export namespace LAppDefine
|
|||
export const DebugTouchLogEnable: boolean = false;
|
||||
|
||||
// Frameworkから出力するログのレベル設定
|
||||
export const CubismLoggingLevel: Csm_CubismFramework_Option.LogLevel = Csm_CubismFramework_Option.LogLevel.LogLevel_Verbose;
|
||||
export const CubismLoggingLevel: LogLevel = LogLevel.LogLevel_Verbose;
|
||||
}
|
|
@ -1,15 +1,14 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
* that can be found at http://live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
||||
*/
|
||||
|
||||
import {Live2DCubismFramework as live2dcubismframework, Option} from "../../../../Framework/live2dcubismframework";
|
||||
import {Live2DCubismFramework as live2dcubismframework, Option as Csm_Option} from "../../../../Framework/live2dcubismframework";
|
||||
import {Live2DCubismFramework as cubismmatrix44} from "../../../../Framework/math/cubismmatrix44";
|
||||
import Csm_CubismMatrix44 = cubismmatrix44.CubismMatrix44;
|
||||
import Csm_CubismFramework = live2dcubismframework.CubismFramework;
|
||||
import Csm_Option = Option;
|
||||
import { LAppView } from "./lappview";
|
||||
import { LAppPal } from "./lapppal";
|
||||
import { LAppTextureManager } from "./lapptexturemanager";
|
||||
|
@ -18,6 +17,7 @@ import { LAppLive2DManager } from "./lapplive2dmanager";
|
|||
export let canvas: HTMLCanvasElement = null;
|
||||
export let s_instance: LAppDelegate = null;
|
||||
export let gl: WebGLRenderingContext = null;
|
||||
export let frameBuffer: WebGLFramebuffer = null;
|
||||
|
||||
/**
|
||||
* アプリケーションクラス。
|
||||
|
@ -48,7 +48,7 @@ export class LAppDelegate
|
|||
{
|
||||
if(s_instance != null)
|
||||
{
|
||||
s_instance = void 0;
|
||||
s_instance.release();
|
||||
}
|
||||
|
||||
s_instance = null;
|
||||
|
@ -74,18 +74,36 @@ export class LAppDelegate
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!frameBuffer)
|
||||
{
|
||||
frameBuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING);
|
||||
}
|
||||
|
||||
// 透過設定
|
||||
gl.enable(gl.BLEND);
|
||||
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
// マウス関連コールバック関数登録
|
||||
canvas.onmousedown = onClickBegan;
|
||||
canvas.onmousemove = onMouseMoved;
|
||||
canvas.onmouseup = onClickEnded;
|
||||
let supportTouch: boolean = 'ontouchend' in canvas;
|
||||
|
||||
if(supportTouch)
|
||||
{
|
||||
// タッチ関連コールバック関数登録
|
||||
canvas.ontouchstart = onTouchBegan;
|
||||
canvas.ontouchmove = onTouchMoved;
|
||||
canvas.ontouchend = onTouchEnded;
|
||||
canvas.ontouchcancel = onTouchCancel;
|
||||
}
|
||||
else
|
||||
{
|
||||
// マウス関連コールバック関数登録
|
||||
canvas.onmousedown = onClickBegan;
|
||||
canvas.onmousemove = onMouseMoved;
|
||||
canvas.onmouseup = onClickEnded;
|
||||
}
|
||||
|
||||
// AppViewの初期化
|
||||
this._view.initialize();
|
||||
|
||||
|
||||
// Cubism3の初期化
|
||||
this.initializeCubism();
|
||||
|
||||
|
@ -97,8 +115,11 @@ export class LAppDelegate
|
|||
*/
|
||||
public release(): void
|
||||
{
|
||||
this._textureManager = void 0;
|
||||
this._view = void 0;
|
||||
this._textureManager.release();
|
||||
this._textureManager = null;
|
||||
|
||||
this._view.release();
|
||||
this._view = null;
|
||||
|
||||
// リソースを解放
|
||||
LAppLive2DManager.releaseInstance();
|
||||
|
@ -115,6 +136,12 @@ export class LAppDelegate
|
|||
// メインループ
|
||||
let loop = () =>
|
||||
{
|
||||
// インスタンスの有無の確認
|
||||
if(s_instance == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// 時間更新
|
||||
LAppPal.updateTime();
|
||||
|
||||
|
@ -132,13 +159,15 @@ export class LAppDelegate
|
|||
|
||||
gl.clearDepth(1.0);
|
||||
|
||||
this._view.initializeSprite();
|
||||
// 透過設定
|
||||
gl.enable(gl.BLEND);
|
||||
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
// 描画更新
|
||||
this._view.render();
|
||||
|
||||
// ループのために再帰呼び出し
|
||||
setTimeout(loop, 1000.0/60);
|
||||
requestAnimationFrame(loop);
|
||||
};
|
||||
loop();
|
||||
}
|
||||
|
@ -153,7 +182,7 @@ export class LAppDelegate
|
|||
|
||||
if(vertexShaderId == null)
|
||||
{
|
||||
console.log("failed to create vertexShader");
|
||||
LAppPal.printLog("failed to create vertexShader");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -176,7 +205,7 @@ export class LAppDelegate
|
|||
|
||||
if(fragmentShaderId == null)
|
||||
{
|
||||
console.log("failed to create fragmentShader");
|
||||
LAppPal.printLog("failed to create fragmentShader");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -197,6 +226,9 @@ export class LAppDelegate
|
|||
gl.attachShader(programId, vertexShaderId);
|
||||
gl.attachShader(programId, fragmentShaderId);
|
||||
|
||||
gl.deleteShader(vertexShaderId);
|
||||
gl.deleteShader(fragmentShaderId);
|
||||
|
||||
// リンク
|
||||
gl.linkProgram(programId);
|
||||
|
||||
|
@ -213,22 +245,6 @@ export class LAppDelegate
|
|||
return this._view;
|
||||
}
|
||||
|
||||
/**
|
||||
* アプリケーションを終了するかどうか。
|
||||
*/
|
||||
public getIsEnd(): boolean
|
||||
{
|
||||
return this._isEnd;
|
||||
}
|
||||
|
||||
/**
|
||||
* アプリケーションを終了する。
|
||||
*/
|
||||
public appEnd(): void
|
||||
{
|
||||
this._isEnd = true;
|
||||
}
|
||||
|
||||
public getTextureManager(): LAppTextureManager
|
||||
{
|
||||
return this._textureManager;
|
||||
|
@ -267,6 +283,8 @@ export class LAppDelegate
|
|||
let projection: Csm_CubismMatrix44 = new Csm_CubismMatrix44();
|
||||
|
||||
LAppPal.updateTime();
|
||||
|
||||
this._view.initializeSprite();
|
||||
}
|
||||
|
||||
_cubismOption: Csm_Option; // Cubism3 Option
|
||||
|
@ -278,20 +296,18 @@ export class LAppDelegate
|
|||
_textureManager: LAppTextureManager;// テクスチャマネージャー
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* クリックしたときに呼ばれる。
|
||||
*/
|
||||
function onClickBegan(e: MouseEvent): void
|
||||
{
|
||||
LAppDelegate.getInstance()._captured = true;
|
||||
if(!LAppDelegate.getInstance()._view)
|
||||
{
|
||||
console.log("view notfound");
|
||||
LAppPal.printLog("view notfound");
|
||||
return;
|
||||
}
|
||||
|
||||
LAppDelegate.getInstance()._captured = true;
|
||||
|
||||
let posX: number = e.pageX;
|
||||
let posY: number = e.pageY;
|
||||
|
||||
|
@ -303,21 +319,21 @@ function onClickBegan(e: MouseEvent): void
|
|||
*/
|
||||
function onMouseMoved(e: MouseEvent): void
|
||||
{
|
||||
let rect = e.toElement.getBoundingClientRect();
|
||||
let posX: number = e.clientX - rect.left;
|
||||
let posY: number = e.clientY - rect.top;
|
||||
|
||||
if(!LAppDelegate.getInstance()._captured)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(!LAppDelegate.getInstance()._view)
|
||||
{
|
||||
console.log("view notfound");
|
||||
LAppPal.printLog("view notfound");
|
||||
return;
|
||||
}
|
||||
|
||||
let rect = e.srcElement.getBoundingClientRect();
|
||||
let posX: number = e.clientX - rect.left;
|
||||
let posY: number = e.clientY - rect.top;
|
||||
|
||||
LAppDelegate.getInstance()._view.onTouchesMoved(posX, posY);
|
||||
}
|
||||
|
||||
|
@ -327,14 +343,102 @@ function onMouseMoved(e: MouseEvent): void
|
|||
function onClickEnded(e: MouseEvent): void
|
||||
{
|
||||
LAppDelegate.getInstance()._captured = false;
|
||||
let rect = e.toElement.getBoundingClientRect();
|
||||
if(!LAppDelegate.getInstance()._view)
|
||||
{
|
||||
LAppPal.printLog("view notfound");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
let rect = e.srcElement.getBoundingClientRect();
|
||||
let posX: number = e.clientX - rect.left;
|
||||
let posY: number = e.clientY - rect.top;
|
||||
|
||||
LAppDelegate.getInstance()._view.onTouchesEnded(posX, posY);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* タッチしたときに呼ばれる。
|
||||
*/
|
||||
function onTouchBegan(e: TouchEvent): void
|
||||
{
|
||||
if(!LAppDelegate.getInstance()._view)
|
||||
{
|
||||
console.log("view notfound");
|
||||
LAppPal.printLog("view notfound");
|
||||
return;
|
||||
}
|
||||
|
||||
LAppDelegate.getInstance()._captured = true;
|
||||
|
||||
let posX = e.changedTouches[0].pageX;
|
||||
let posY = e.changedTouches[0].pageY;
|
||||
|
||||
LAppDelegate.getInstance()._view.onTouchesBegan(posX, posY);
|
||||
}
|
||||
|
||||
/**
|
||||
* スワイプすると呼ばれる。
|
||||
*/
|
||||
function onTouchMoved(e: TouchEvent): void
|
||||
{
|
||||
if(!LAppDelegate.getInstance()._captured)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(!LAppDelegate.getInstance()._view)
|
||||
{
|
||||
LAppPal.printLog("view notfound");
|
||||
return;
|
||||
}
|
||||
|
||||
let rect = e.srcElement.getBoundingClientRect();
|
||||
|
||||
let posX = e.changedTouches[0].clientX - rect.left;
|
||||
let posY = e.changedTouches[0].clientY - rect.top;
|
||||
|
||||
LAppDelegate.getInstance()._view.onTouchesMoved(posX, posY);
|
||||
}
|
||||
|
||||
/**
|
||||
* タッチが終了したら呼ばれる。
|
||||
*/
|
||||
function onTouchEnded(e: TouchEvent): void
|
||||
{
|
||||
LAppDelegate.getInstance()._captured = false;
|
||||
|
||||
if(!LAppDelegate.getInstance()._view)
|
||||
{
|
||||
LAppPal.printLog("view notfound");
|
||||
return;
|
||||
}
|
||||
|
||||
let rect = e.srcElement.getBoundingClientRect();
|
||||
|
||||
let posX = e.changedTouches[0].clientX - rect.left;
|
||||
let posY = e.changedTouches[0].clientY - rect.top;
|
||||
|
||||
LAppDelegate.getInstance()._view.onTouchesEnded(posX, posY);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* タッチがキャンセルされると呼ばれる。
|
||||
*/
|
||||
function onTouchCancel(e: TouchEvent): void
|
||||
{
|
||||
LAppDelegate.getInstance()._captured = false;
|
||||
|
||||
if(!LAppDelegate.getInstance()._view)
|
||||
{
|
||||
LAppPal.printLog("view notfound");
|
||||
return;
|
||||
}
|
||||
|
||||
let rect = e.srcElement.getBoundingClientRect();
|
||||
|
||||
let posX = e.changedTouches[0].clientX - rect.left;
|
||||
let posY = e.changedTouches[0].clientY - rect.top;
|
||||
|
||||
LAppDelegate.getInstance()._view.onTouchesEnded(posX, posY);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
@ -76,7 +76,8 @@ export class LAppLive2DManager
|
|||
{
|
||||
for(let i: number = 0; i < this._models.getSize(); i++)
|
||||
{
|
||||
this._models.set(i, void 0);
|
||||
this._models.at(i).release();
|
||||
this._models.set(i, null);
|
||||
}
|
||||
|
||||
this._models.clear();
|
||||
|
@ -153,13 +154,13 @@ export class LAppLive2DManager
|
|||
projection.multiplyByMatrix(this._viewMatrix);
|
||||
}
|
||||
|
||||
const saveProjection: Csm_CubismMatrix44 = projection;
|
||||
const saveProjection: Csm_CubismMatrix44 = projection.clone();
|
||||
let modelCount: number = this._models.getSize();
|
||||
|
||||
for(let i: number = 0; i < modelCount; ++i)
|
||||
{
|
||||
let model: LAppModel = this.getModel(i);
|
||||
projection = saveProjection;
|
||||
projection = saveProjection.clone();
|
||||
|
||||
model.update();
|
||||
model.draw(projection); // 参照渡しなのでprojectionは変質する。
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
@ -21,7 +21,8 @@ import {Live2DCubismFramework as cubismstring} from "../../../../Framework/utils
|
|||
import {Live2DCubismFramework as cubismmotion} from "../../../../Framework/motion/cubismmotion";
|
||||
import {Live2DCubismFramework as cubismmotionqueuemanager} from "../../../../Framework/motion/cubismmotionqueuemanager";
|
||||
import {Live2DCubismFramework as csmstring} from "../../../../Framework/type/csmstring";
|
||||
import {Live2DCubismFramework as csmrect} from "../../../../Framework/type/csmrectf";
|
||||
import {Live2DCubismFramework as csmrect } from "../../../../Framework/type/csmrectf";
|
||||
import { Live2DCubismFramework as CubismRenderer_WebGL } from "../../../../Framework/rendering/cubismrenderer_WebGL";
|
||||
import {CubismLogInfo} from "../../../../Framework/utils/cubismdebug";
|
||||
import csmRect = csmrect.csmRect;
|
||||
import csmString = csmstring.csmString;
|
||||
|
@ -33,6 +34,7 @@ import CubismMatrix44 = cubismmatrix44.CubismMatrix44;
|
|||
import csmMap = csmmap.csmMap;
|
||||
import csmVector = csmvector.csmVector;
|
||||
import CubismBreath = cubismbreath.CubismBreath;
|
||||
import BreathParameterData = cubismbreath.BreathParameterData;
|
||||
import CubismEyeBlink = cubismeyeblink.CubismEyeBlink;
|
||||
import ACubismMotion = acubismmotion.ACubismMotion;
|
||||
import CubismFramework = live2dcubismframework.CubismFramework;
|
||||
|
@ -44,7 +46,7 @@ import CubismDefaultParameterId = cubismdefaultparameterid;
|
|||
|
||||
import {LAppDefine} from "./lappdefine";
|
||||
import {LAppPal} from "./lapppal";
|
||||
import {gl} from "./lappdelegate";
|
||||
import { gl, canvas, frameBuffer} from "./lappdelegate";
|
||||
|
||||
function createBuffer(path: string, callBack: any): void
|
||||
{
|
||||
|
@ -323,12 +325,12 @@ export class LAppModel extends CubismUserModel {
|
|||
{
|
||||
this._breath = CubismBreath.create();
|
||||
|
||||
let breathParameters: csmVector<CubismBreath.BreathParameterData> = new csmVector();
|
||||
breathParameters.pushBack(new CubismBreath.BreathParameterData(this._idParamAngleX, 0.0, 15.0, 6.5345, 0.5));
|
||||
breathParameters.pushBack(new CubismBreath.BreathParameterData(this._idParamAngleY, 0.0, 8.0, 3.5345, 0.5));
|
||||
breathParameters.pushBack(new CubismBreath.BreathParameterData(this._idParamAngleZ, 0.0, 10.0, 5.5345, 0.5));
|
||||
breathParameters.pushBack(new CubismBreath.BreathParameterData(this._idParamBodyAngleX, 0.0, 4.0, 15.5345, 0.5));
|
||||
breathParameters.pushBack(new CubismBreath.BreathParameterData(CubismFramework.getIdManager().getId(CubismDefaultParameterId.ParamBreath), 0.0, 0.5, 3.2345, 0.5));
|
||||
let breathParameters: csmVector<BreathParameterData> = new csmVector();
|
||||
breathParameters.pushBack(new BreathParameterData(this._idParamAngleX, 0.0, 15.0, 6.5345, 0.5));
|
||||
breathParameters.pushBack(new BreathParameterData(this._idParamAngleY, 0.0, 8.0, 3.5345, 0.5));
|
||||
breathParameters.pushBack(new BreathParameterData(this._idParamAngleZ, 0.0, 10.0, 5.5345, 0.5));
|
||||
breathParameters.pushBack(new BreathParameterData(this._idParamBodyAngleX, 0.0, 4.0, 15.5345, 0.5));
|
||||
breathParameters.pushBack(new BreathParameterData(CubismFramework.getIdManager().getId(CubismDefaultParameterId.ParamBreath), 0.0, 0.5, 3.2345, 0.5));
|
||||
|
||||
this._breath.setParameters(breathParameters);
|
||||
this._state = LoadStep.LoadUserData;
|
||||
|
@ -467,6 +469,9 @@ export class LAppModel extends CubismUserModel {
|
|||
*/
|
||||
private setupTextures(): void
|
||||
{
|
||||
// iPhoneでのアルファ品質向上のためTypescriptではpremultipliedAlphaを採用
|
||||
let usePremultiply: boolean = true;
|
||||
|
||||
if(this._state == LoadStep.LoadTexture)
|
||||
{
|
||||
// テクスチャ読み込み用
|
||||
|
@ -500,6 +505,12 @@ export class LAppModel extends CubismUserModel {
|
|||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
||||
|
||||
// Premult処理を行わせる
|
||||
if(usePremultiply)
|
||||
{
|
||||
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 1);
|
||||
}
|
||||
|
||||
// テクスチャにピクセルを書き込む
|
||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, img[modelTextureNumber]);
|
||||
|
@ -519,7 +530,7 @@ export class LAppModel extends CubismUserModel {
|
|||
}
|
||||
img[modelTextureNumber].src = texturePath;
|
||||
|
||||
this.getRenderer().setIsPremultipliedAlpha(false);
|
||||
this.getRenderer().setIsPremultipliedAlpha(usePremultiply);
|
||||
}
|
||||
|
||||
this._state = LoadStep.WaitLoadTexture;
|
||||
|
@ -907,6 +918,15 @@ export class LAppModel extends CubismUserModel {
|
|||
{
|
||||
if(this._model == null) return;
|
||||
|
||||
// キャンバスサイズを渡す
|
||||
let viewport: number[] = [
|
||||
0,
|
||||
0,
|
||||
canvas.width,
|
||||
canvas.height
|
||||
];
|
||||
|
||||
this.getRenderer().setRenderState(frameBuffer, viewport);
|
||||
this.getRenderer().drawModel();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
@ -30,6 +30,39 @@ import { gl, canvas } from "./lappdelegate";
|
|||
this._rect.up = (y + height * 0.5);
|
||||
this._rect.down = (y - height * 0.5);
|
||||
this._texture = textureId;
|
||||
this._vertexBuffer = null;
|
||||
this._uvBuffer = null;
|
||||
this._indexBuffer = null;
|
||||
|
||||
this._positionLocation = null;
|
||||
this._uvLocation = null;
|
||||
this._textureLocation = null;
|
||||
|
||||
this._positionArray = null;
|
||||
this._uvArray = null;
|
||||
this._indexArray = null;
|
||||
|
||||
this._firstDraw = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解放する。
|
||||
*/
|
||||
public release(): void
|
||||
{
|
||||
this._rect = null;
|
||||
|
||||
gl.deleteTexture(this._texture);
|
||||
this._texture = null;
|
||||
|
||||
gl.deleteBuffer(this._uvBuffer);
|
||||
this._uvBuffer = null;
|
||||
|
||||
gl.deleteBuffer(this._vertexBuffer);
|
||||
this._vertexBuffer = null;
|
||||
|
||||
gl.deleteBuffer(this._indexBuffer);
|
||||
this._indexBuffer = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -47,62 +80,94 @@ import { gl, canvas } from "./lappdelegate";
|
|||
*/
|
||||
public render(programId: WebGLProgram): void
|
||||
{
|
||||
if(!this._texture)
|
||||
if(this._texture == null)
|
||||
{
|
||||
// ロードが完了していない
|
||||
return;
|
||||
}
|
||||
|
||||
// 何番目のattribute変数か
|
||||
let positionLocation = gl.getAttribLocation(programId, "position");
|
||||
let uvLocation = gl.getAttribLocation(programId, "uv");
|
||||
|
||||
let textureLocation: WebGLUniformLocation = null;
|
||||
textureLocation = gl.getUniformLocation(programId, "texture");
|
||||
|
||||
// attribute属性を有効にする
|
||||
gl.enableVertexAttribArray(positionLocation);
|
||||
gl.enableVertexAttribArray(uvLocation);
|
||||
|
||||
// uniform属性の登録
|
||||
gl.uniform1i(textureLocation, 0);
|
||||
|
||||
const uvVertex: Float32Array = new Float32Array([
|
||||
1.0, 0.0,
|
||||
0.0, 0.0,
|
||||
0.0, 1.0,
|
||||
1.0, 1.0
|
||||
]);
|
||||
let vuv: WebGLBuffer = gl.createBuffer();
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, vuv);
|
||||
gl.bufferData(gl.ARRAY_BUFFER, uvVertex, gl.STATIC_DRAW);
|
||||
|
||||
// 初回描画時
|
||||
if(this._firstDraw)
|
||||
{
|
||||
// 何番目のattribute変数か取得
|
||||
this._positionLocation = gl.getAttribLocation(programId, "position");
|
||||
gl.enableVertexAttribArray(this._positionLocation);
|
||||
|
||||
this._uvLocation = gl.getAttribLocation(programId, "uv");
|
||||
gl.enableVertexAttribArray(this._uvLocation);
|
||||
|
||||
// 何番目のuniform変数か取得
|
||||
this._textureLocation = gl.getUniformLocation(programId, "texture");
|
||||
|
||||
// uniform属性の登録
|
||||
gl.uniform1i(this._textureLocation, 0);
|
||||
|
||||
// uvバッファ、座標初期化
|
||||
{
|
||||
this._uvArray = [
|
||||
1.0, 0.0,
|
||||
0.0, 0.0,
|
||||
0.0, 1.0,
|
||||
1.0, 1.0
|
||||
];
|
||||
|
||||
// uvバッファを作成
|
||||
this._uvBuffer = gl.createBuffer();
|
||||
}
|
||||
|
||||
// 頂点バッファ、座標初期化
|
||||
{
|
||||
let maxWidth = canvas.width;
|
||||
let maxHeight = canvas.height;
|
||||
|
||||
// 頂点データ
|
||||
this._positionArray = [
|
||||
(this._rect.right - maxWidth * 0.5) / (maxWidth * 0.5), (this._rect.up - maxHeight * 0.5) / (maxHeight * 0.5),
|
||||
(this._rect.left - maxWidth * 0.5) / (maxWidth * 0.5), (this._rect.up - maxHeight * 0.5) / (maxHeight * 0.5),
|
||||
(this._rect.left - maxWidth * 0.5) / (maxWidth * 0.5), (this._rect.down - maxHeight * 0.5) / (maxHeight * 0.5),
|
||||
(this._rect.right - maxWidth * 0.5) / (maxWidth * 0.5), (this._rect.down - maxHeight * 0.5) / (maxHeight * 0.5)
|
||||
];
|
||||
|
||||
// 頂点バッファを作成
|
||||
this._vertexBuffer = gl.createBuffer();
|
||||
}
|
||||
|
||||
// 頂点インデックスバッファ、初期化
|
||||
{
|
||||
// インデックスデータ
|
||||
this._indexArray = [
|
||||
0, 1, 2,
|
||||
3, 2, 0
|
||||
];
|
||||
|
||||
// インデックスバッファを作成
|
||||
this._indexBuffer = gl.createBuffer();
|
||||
}
|
||||
|
||||
this._firstDraw = false;
|
||||
}
|
||||
|
||||
// UV座標登録
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, this._uvBuffer);
|
||||
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(this._uvArray), gl.STATIC_DRAW);
|
||||
|
||||
// attribute属性を登録
|
||||
gl.vertexAttribPointer(uvLocation, 2, gl.FLOAT, false, 0, 0);
|
||||
|
||||
// 画面サイズを取得する。
|
||||
let maxWidth, maxHeight;
|
||||
maxWidth = canvas.width;
|
||||
maxHeight = canvas.height;
|
||||
|
||||
// 頂点データ
|
||||
let positionVertex: Float32Array = new Float32Array([
|
||||
(this._rect.right - maxWidth * 0.5) / (maxWidth * 0.5), (this._rect.up - maxHeight * 0.5) / (maxHeight * 0.5),
|
||||
(this._rect.left - maxWidth * 0.5) / (maxWidth * 0.5), (this._rect.up - maxHeight * 0.5) / (maxHeight * 0.5),
|
||||
(this._rect.left - maxWidth * 0.5) / (maxWidth * 0.5), (this._rect.down - maxHeight * 0.5) / (maxHeight * 0.5),
|
||||
(this._rect.right - maxWidth * 0.5) / (maxWidth * 0.5), (this._rect.down - maxHeight * 0.5) / (maxHeight * 0.5)
|
||||
]);
|
||||
|
||||
let vposition: WebGLBuffer = gl.createBuffer();
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, vposition);
|
||||
gl.bufferData(gl.ARRAY_BUFFER, positionVertex, gl.STATIC_DRAW);
|
||||
|
||||
gl.vertexAttribPointer(this._uvLocation, 2, gl.FLOAT, false, 0, 0);
|
||||
|
||||
// 頂点座標を登録
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer);
|
||||
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(this._positionArray), gl.STATIC_DRAW);
|
||||
|
||||
// attribute属性を登録
|
||||
gl.vertexAttribPointer(positionLocation, 2, gl.FLOAT, false, 0, 0);
|
||||
|
||||
gl.vertexAttribPointer(this._positionLocation, 2, gl.FLOAT, false, 0, 0);
|
||||
|
||||
// 頂点インデックスを作成
|
||||
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer);
|
||||
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this._indexArray), gl.DYNAMIC_DRAW);
|
||||
|
||||
// モデルの描画
|
||||
gl.bindTexture(gl.TEXTURE_2D, this._texture);
|
||||
gl.drawArrays(gl.TRIANGLE_FAN, 0, 4);
|
||||
gl.drawElements(gl.TRIANGLES, this._indexArray.length, gl.UNSIGNED_SHORT, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -123,8 +188,21 @@ import { gl, canvas } from "./lappdelegate";
|
|||
return (pointX >= this._rect.left && pointX <= this._rect.right && y <= this._rect.up && y >= this._rect.down);
|
||||
}
|
||||
|
||||
_texture: WebGLTexture; // テクスチャ
|
||||
_rect: Rect; // 矩形
|
||||
_texture: WebGLTexture; // テクスチャ
|
||||
_vertexBuffer: WebGLBuffer; // 頂点バッファ
|
||||
_uvBuffer: WebGLBuffer; // uv頂点バッファ
|
||||
_indexBuffer: WebGLBuffer; // 頂点インデックスバッファ
|
||||
_rect: Rect; // 矩形
|
||||
|
||||
_positionLocation: number;
|
||||
_uvLocation: number;
|
||||
_textureLocation: WebGLUniformLocation;
|
||||
|
||||
_positionArray: number[];
|
||||
_uvArray: number[];
|
||||
_indexArray: number[];
|
||||
|
||||
_firstDraw: boolean;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
@ -23,6 +23,15 @@ export class LAppTextureManager
|
|||
this._textures = new Csm_csmVector<TextureInfo>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 解放する。
|
||||
*/
|
||||
public release(): void
|
||||
{
|
||||
this._textures.clear();
|
||||
this._textures = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* プリマルチプライ処理
|
||||
* @param red 画像のRed値
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
@ -12,19 +12,11 @@ import Csm_CubismMatrix44 = cubismMatrix44.CubismMatrix44;
|
|||
import { TouchManager } from "./touchmanager";
|
||||
import { LAppDefine } from "./lappdefine";
|
||||
import { LAppLive2DManager } from "./lapplive2dmanager";
|
||||
import { LAppDelegate, canvas} from "./lappdelegate";
|
||||
import { LAppDelegate, canvas, gl} from "./lappdelegate";
|
||||
import { LAppSprite } from "./lappsprite";
|
||||
import { TextureInfo } from "./lapptexturemanager";
|
||||
import { LAppPal } from "./lapppal";
|
||||
|
||||
enum LoadStep
|
||||
{
|
||||
BackImage,
|
||||
GearImage,
|
||||
PowerImage,
|
||||
CompleteLoad
|
||||
}
|
||||
|
||||
/**
|
||||
* 描画クラス。
|
||||
*/
|
||||
|
@ -35,8 +27,6 @@ export class LAppView
|
|||
*/
|
||||
constructor()
|
||||
{
|
||||
this._loadStep = LoadStep.BackImage;
|
||||
|
||||
this._programId = null;
|
||||
this._back = null;
|
||||
this._gear = null;
|
||||
|
@ -85,15 +75,31 @@ export class LAppView
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解放する
|
||||
*/
|
||||
public release(): void
|
||||
{
|
||||
this._viewMatrix = null;
|
||||
this._touchManager = null;
|
||||
this._deviceToScreen = null;
|
||||
|
||||
this._gear.release();
|
||||
this._gear = null;
|
||||
|
||||
this._back.release();
|
||||
this._back = null;
|
||||
|
||||
gl.deleteProgram(this._programId);
|
||||
this._programId = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 描画する。
|
||||
*/
|
||||
public render(): void
|
||||
{
|
||||
if(this._loadStep != LoadStep.CompleteLoad)
|
||||
{
|
||||
return;
|
||||
}
|
||||
gl.useProgram(this._programId);
|
||||
|
||||
if(this._back)
|
||||
{
|
||||
|
@ -104,6 +110,8 @@ export class LAppView
|
|||
this._gear.render(this._programId);
|
||||
}
|
||||
|
||||
gl.flush();
|
||||
|
||||
let live2DManager: LAppLive2DManager = LAppLive2DManager.getInstance();
|
||||
|
||||
live2DManager.onUpdate();
|
||||
|
@ -114,9 +122,8 @@ export class LAppView
|
|||
*/
|
||||
public initializeSprite(): void
|
||||
{
|
||||
let width: number, height: number;
|
||||
width = canvas.width;
|
||||
height = canvas.height;
|
||||
let width: number = canvas.width;
|
||||
let height: number = canvas.height;
|
||||
|
||||
let textureManager = LAppDelegate.getInstance().getTextureManager();
|
||||
const resourcesPath = LAppDefine.ResourcesPath;
|
||||
|
@ -124,54 +131,36 @@ export class LAppView
|
|||
let imageName: string = "";
|
||||
|
||||
// 背景画像初期化
|
||||
if(this._loadStep == LoadStep.BackImage)
|
||||
imageName = LAppDefine.BackImageName;
|
||||
|
||||
// 非同期なのでコールバック関数を作成
|
||||
let initBackGroundTexture = (textureInfo: TextureInfo): void =>
|
||||
{
|
||||
imageName = LAppDefine.BackImageName;
|
||||
|
||||
// 非同期なのでコールバック関数を作成
|
||||
let initBackGroundTexture = (textureInfo: TextureInfo): void =>
|
||||
{
|
||||
let x: number = width * 0.5;
|
||||
let y: number = height * 0.5;
|
||||
|
||||
let fwidth = textureInfo.width * 2.0;
|
||||
let fheight = height * 0.95;
|
||||
this._back = new LAppSprite(x, y, fwidth, fheight, textureInfo.id);
|
||||
this._loadStep = LoadStep.GearImage;
|
||||
}
|
||||
let backGroundTexture: TextureInfo = textureManager.createTextureFromPngFile(resourcesPath + imageName, initBackGroundTexture);
|
||||
|
||||
// 既に画像があれば直接初期化
|
||||
if(backGroundTexture != null)
|
||||
{
|
||||
initBackGroundTexture(backGroundTexture);
|
||||
}
|
||||
}
|
||||
let x: number = width * 0.5;
|
||||
let y: number = height * 0.5;
|
||||
|
||||
let fwidth = textureInfo.width * 2.0;
|
||||
let fheight = height * 0.95;
|
||||
this._back = new LAppSprite(x, y, fwidth, fheight, textureInfo.id);
|
||||
};
|
||||
|
||||
textureManager.createTextureFromPngFile(resourcesPath + imageName, initBackGroundTexture);
|
||||
|
||||
// 歯車画像初期化
|
||||
if(this._loadStep == LoadStep.GearImage)
|
||||
imageName = LAppDefine.GearImageName;
|
||||
let initGearTexture = (textureInfo: TextureInfo): void =>
|
||||
{
|
||||
imageName = LAppDefine.GearImageName;
|
||||
let initGearTexture = (textureInfo: TextureInfo): void =>
|
||||
{
|
||||
let x = width - textureInfo.width * 0.5;
|
||||
let y = height - textureInfo.height * 0.5;
|
||||
let fwidth = textureInfo.width;
|
||||
let fheight = textureInfo.height;
|
||||
this._gear = new LAppSprite(x, y, fwidth, fheight, textureInfo.id);
|
||||
let x = width - textureInfo.width * 0.5;
|
||||
let y = height - textureInfo.height * 0.5;
|
||||
let fwidth = textureInfo.width;
|
||||
let fheight = textureInfo.height;
|
||||
this._gear = new LAppSprite(x, y, fwidth, fheight, textureInfo.id);
|
||||
};
|
||||
|
||||
this._loadStep = LoadStep.CompleteLoad;
|
||||
}
|
||||
let gearTexture: TextureInfo = textureManager.createTextureFromPngFile(resourcesPath + imageName, initGearTexture);
|
||||
|
||||
// 既に画像があれば直接初期化
|
||||
if(gearTexture != null)
|
||||
{
|
||||
initGearTexture(gearTexture);
|
||||
}
|
||||
}
|
||||
textureManager.createTextureFromPngFile(resourcesPath + imageName, initGearTexture);
|
||||
|
||||
if(this._loadStep == LoadStep.CompleteLoad)
|
||||
// シェーダーを作成
|
||||
if(this._programId == null)
|
||||
{
|
||||
this._programId = LAppDelegate.getInstance().createShader();
|
||||
}
|
||||
|
@ -285,6 +274,4 @@ export class LAppView
|
|||
_gear: LAppSprite; // ギア画像
|
||||
_changeModel: boolean; // モデル切り替えフラグ
|
||||
_isClick: boolean; // クリック中
|
||||
|
||||
_loadStep: number;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
@ -12,7 +12,6 @@ let main: any = () =>
|
|||
// create the application instance
|
||||
if(LAppDelegate.getInstance().initialize() == false)
|
||||
{
|
||||
console.log("application iniitalize");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -27,6 +26,5 @@ main();
|
|||
*/
|
||||
window.onbeforeunload = () =>
|
||||
{
|
||||
LAppDelegate.getInstance().release();
|
||||
LAppDelegate.releaseInstance();
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright(c) Live2D Inc. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by the Live2D Open Software license
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"scripts": {
|
||||
"build-framework": "npx webpack --config framework.webpack.config.js --mode development --module-bind 'ts=ts-loader' --resolve-extensions .ts,.js",
|
||||
"watch-framework": "npx webpack --watch --config framework.webpack.config.js --mode development --module-bind 'ts=ts-loader' --resolve-extensions .ts,.js",
|
||||
"build-sample": "npx webpack --config sample.webpack.config.js --mode development --module-bind 'ts=ts-loader' --resolve-extensions .ts,.js",
|
||||
"watch-sample": "npx webpack --watch --config sample.webpack.config.js --mode development --module-bind 'ts=ts-loader' --resolve-extensions .ts,.js",
|
||||
"build-framework": "npx webpack --config framework.webpack.config.js",
|
||||
"watch-framework": "npx webpack --watch --config framework.webpack.config.js",
|
||||
"build-sample": "npx webpack --config sample.webpack.config.js",
|
||||
"watch-sample": "npx webpack --watch --config sample.webpack.config.js",
|
||||
"build-all": "npm-run-all build-framework build-sample",
|
||||
"watch-all": "npm-run-all watch-framework watch-sample"
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue