Update to Cubism 4 SDK for Web beta1

translate
ito 2019-09-02 19:14:43 +09:00
parent cef7cbcb6f
commit 5300562826
74 changed files with 15682 additions and 880 deletions

12
.editorconfig Normal file
View File

@ -0,0 +1,12 @@
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true
[*.{json,lock,yml}]
indent_size = 2

24
.gitattributes vendored
View File

@ -1,5 +1,19 @@
*.ts text # Auto detect text files and perform LF normalization
*.js text * text=auto
*.json text
*.html text # Explicitly declare files as LF
*.md text *.ts text eol=lf
*.js text eol=lf
*.json text eol=lf
*.html text eol=lf
*.md text eol=lf
*.map text eol=lf
*.lock text eol=lf
.editorconfig text eol=lf
.gitattributes text eol=lf
*.gitignore text eol=lf
# Library and media files as binary
*.moc3 binary
*.jpg binary
*.png binary

21
.gitignore vendored
View File

@ -1,4 +1,17 @@
.idea/ # Cubism Core
/Core/*
node_modules/ !/Core/Please_copy_cubism_core_for_web
Sample/TypeScript/Demo/dist/
# IDE/Editor files
.idea/
.vs/
.vscode/*
!/.vscode/launch.json
!/.vscode/tasks.json
*.iml
# Package files
/node_modules/
# Build files
/Sample/TypeScript/Demo/dist/

44
.vscode/launch.json vendored
View File

@ -1,26 +1,20 @@
{ {
"version": "0.2.0", "version": "0.2.0",
"configurations": [
"configurations": [ // Web
// Web {
{ //
// "name": "Launch remote website with sourcemaps",
"name": "Launch remote website with sourcemaps", // (chrome)
"type": "chrome",
// (chrome) // launchattach
"type": "chrome", "request": "launch",
// WebURL
// launchattach "url": "http://localhost:5500/Sample/TypeScript/Demo/index.html",
"request": "launch", //
"webRoot": "${workspaceFolder}/",
// WebURL // true/false
"url": "http://localhost:5500/Sample/TypeScript/Demo/index.html", "sourceMaps": true
}
// ]
"webRoot": "${workspaceFolder}/", }
// true/false
"sourceMaps": true,
}
]
}

67
.vscode/tasks.json vendored
View File

@ -1,32 +1,37 @@
{ {
// See https://go.microsoft.com/fwlink/?LinkId=733558 // See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format // for the documentation about the tasks.json format
"version": "2.0.0", "version": "2.0.0",
"tasks": [ "tasks": [
{ {
"type": "npm", "type": "npm",
"script": "build-all", "script": "build-all",
"problemMatcher": [] "problemMatcher": []
}, },
{ {
"type": "npm", "type": "npm",
"script": "watch-all", "script": "watch-all",
"problemMatcher": [] "problemMatcher": []
}, },
{ {
"type": "npm", "type": "npm",
"script": "build-sample", "script": "build-sample",
"problemMatcher": [] "problemMatcher": []
}, },
{ {
"type": "npm", "type": "npm",
"script": "watch-sample", "script": "watch-sample",
"problemMatcher": [] "problemMatcher": []
}, },
{ {
"type": "npm", "type": "npm",
"script": "build-framework", "script": "build-framework",
"problemMatcher": [] "problemMatcher": []
} },
] {
} "type": "npm",
"script": "serve",
"problemMatcher": []
}
]
}

36
CHANGELOG.md Normal file
View File

@ -0,0 +1,36 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [4-beta.1] - 2019-09-04
### Added
- Add method for Moc file version.
- Support new Inverted Masking features.
- Add `.editorconfig` and `.gitattributes` to manage file formats.
- Add `CHANGELOG.md`.
- Add way to create a simpler local server.
- Add sample model `/Sample/TypeScript/Demo/Resources/Rice`.
### Changed
- Upgrade Core version to 04.00.0000 (67108864).
- Convert all file formats according to `.editorconfig`.
- Rename `cubismrenderer_WebGL.ts` to `cubismrenderer_webgl.ts`.
- What was `CubismSdkPackage.json` is currently being changed to`cubism-info.yml`.
- Upgrade all dependency packages and lock package version by adding `package-lock.json`.
- Update `README.md`.
- Delete guidance from `README.md` due to suspension of *Cubism Bindings*.
- Update `.gitignore`.
### Fixed
- Fix issue with reloading model images in WebKit.
[4-beta.1]: https://github.com/Live2D/CubismWebSamples/compare/e36ab2233a89de9225f64e5a02d521bc7235bd03...4-beta.1

View File

@ -1 +0,0 @@
Please copy cubism native core

View File

View File

@ -1,14 +1,14 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
/** /**
* @brief ID<br> * @brief ID<br>
* <br> * <br>
* http://docs.live2d.com/cubism-editor-manual/standard-parametor-list/ * https://docs.live2d.com/cubism-editor-manual/standard-parametor-list/
*/ */
export namespace Live2DCubismFramework export namespace Live2DCubismFramework
{ {
@ -63,4 +63,4 @@ export namespace Live2DCubismFramework
export const ParamBaseX: string = "ParamBaseX"; export const ParamBaseX: string = "ParamBaseX";
export const ParamBaseY: string = "ParamBaseY"; export const ParamBaseY: string = "ParamBaseY";
export const ParamNONE: string = "NONE:"; export const ParamNONE: string = "NONE:";
} }

View File

@ -1,9 +1,9 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
//======================================================== //========================================================
// ログ出力関数の設定 // ログ出力関数の設定
@ -29,4 +29,4 @@ export const CSM_LOG_LEVEL_OFF: number = 5;
* *
* CSM_LOG_LEVEL_VERBOSE CSM_LOG_LEVEL_OFF * CSM_LOG_LEVEL_VERBOSE CSM_LOG_LEVEL_OFF
*/ */
export const CSM_LOG_LEVEL: number = CSM_LOG_LEVEL_VERBOSE; export const CSM_LOG_LEVEL: number = CSM_LOG_LEVEL_VERBOSE;

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as cubismframework} from "./live2dcubismframework"; import {Live2DCubismFramework as cubismframework} from "./live2dcubismframework";
@ -33,21 +33,21 @@ export namespace Live2DCubismFramework
const Groups: string = "Groups"; const Groups: string = "Groups";
const Layout: string = "Layout"; const Layout: string = "Layout";
const HitAreas: string = "HitAreas"; const HitAreas: string = "HitAreas";
const Moc: string = "Moc"; const Moc: string = "Moc";
const Textures: string = "Textures"; const Textures: string = "Textures";
const Physics: string = "Physics"; const Physics: string = "Physics";
const Pose: string = "Pose"; const Pose: string = "Pose";
const Expressions: string = "Expressions"; const Expressions: string = "Expressions";
const Motions: string = "Motions"; const Motions: string = "Motions";
const UserData: string = "UserData"; const UserData: string = "UserData";
const Name: string = "Name"; const Name: string = "Name";
const FilePath: string = "File"; const FilePath: string = "File";
const Id: string = "Id"; const Id: string = "Id";
const Ids: string = "Ids"; const Ids: string = "Ids";
const Target: string = "Target"; const Target: string = "Target";
// Motions // Motions
const Idle: string = "Idle"; const Idle: string = "Idle";
const TapBody: string = "TapBody"; const TapBody: string = "TapBody";
@ -56,11 +56,11 @@ export namespace Live2DCubismFramework
const Shake: string = "Shake"; const Shake: string = "Shake";
const FlickHead: string = "FlickHead"; const FlickHead: string = "FlickHead";
const Parameter: string = "Parameter"; const Parameter: string = "Parameter";
const SoundPath: string = "Sound"; const SoundPath: string = "Sound";
const FadeInTime: string = "FadeInTime"; const FadeInTime: string = "FadeInTime";
const FadeOutTime: string = "FadeOutTime"; const FadeOutTime: string = "FadeOutTime";
// Layout // Layout
const CenterX: string = "CenterX"; const CenterX: string = "CenterX";
const CenterY: string = "CenterY"; const CenterY: string = "CenterY";
@ -68,10 +68,10 @@ export namespace Live2DCubismFramework
const Y: string = "Y"; const Y: string = "Y";
const Width: string = "Width"; const Width: string = "Width";
const Height: string = "Height"; const Height: string = "Height";
const LipSync: string = "LipSync"; const LipSync: string = "LipSync";
const EyeBlink: string = "EyeBlink"; const EyeBlink: string = "EyeBlink";
const InitParameter: string = "init_param"; const InitParameter: string = "init_param";
const InitPartsVisible: string = "init_parts_visible"; const InitPartsVisible: string = "init_parts_visible";
const Val: string = "val"; const Val: string = "val";
@ -91,14 +91,14 @@ export namespace Live2DCubismFramework
/** /**
* Model3Json * Model3Json
* *
* model3.json * model3.json
*/ */
export class CubismModelSettingJson extends ICubismModelSetting export class CubismModelSettingJson extends ICubismModelSetting
{ {
/** /**
* *
* *
* @param buffer Model3Json * @param buffer Model3Json
* @param size Model3Json * @param size Model3Json
*/ */
@ -135,7 +135,7 @@ export namespace Live2DCubismFramework
/** /**
* CubismJson * CubismJson
* *
* @return CubismJson * @return CubismJson
*/ */
public GetJson(): CubismJson public GetJson(): CubismJson
@ -166,7 +166,7 @@ export namespace Live2DCubismFramework
{ {
return 0; return 0;
} }
return this._jsonValue.at(FrequestNode.FrequestNode_Textures).getSize(); return this._jsonValue.at(FrequestNode.FrequestNode_Textures).getSize();
} }
@ -205,7 +205,7 @@ export namespace Live2DCubismFramework
/** /**
* ID * ID
* *
* @param index index * @param index index
* @return ID * @return ID
*/ */
@ -374,7 +374,7 @@ export namespace Live2DCubismFramework
{ {
return -1.0; return -1.0;
} }
return this._jsonValue.at(FrequestNode.FrequestNode_Motions).getValueByString(groupName).getValueByIndex(index).getValueByString(FadeInTime).toFloat(); return this._jsonValue.at(FrequestNode.FrequestNode_Motions).getValueByString(groupName).getValueByIndex(index).getValueByString(FadeInTime).toFloat();
} }
@ -445,7 +445,7 @@ export namespace Live2DCubismFramework
{ {
return 0; return 0;
} }
let num: number = 0; let num: number = 0;
for (let i = 0; i < this._jsonValue.at(FrequestNode.FrequestNode_Groups).getSize(); i++) for (let i = 0; i < this._jsonValue.at(FrequestNode.FrequestNode_Groups).getSize(); i++)
{ {
@ -461,7 +461,7 @@ export namespace Live2DCubismFramework
break; break;
} }
} }
return num; return num;
} }
@ -476,7 +476,7 @@ export namespace Live2DCubismFramework
{ {
return null; return null;
} }
for (let i = 0; i < this._jsonValue.at(FrequestNode.FrequestNode_Groups).getSize(); i++) for (let i = 0; i < this._jsonValue.at(FrequestNode.FrequestNode_Groups).getSize(); i++)
{ {
let refI: Value = this._jsonValue.at(FrequestNode.FrequestNode_Groups).getValueByIndex(i); let refI: Value = this._jsonValue.at(FrequestNode.FrequestNode_Groups).getValueByIndex(i);
@ -503,7 +503,7 @@ export namespace Live2DCubismFramework
{ {
return 0; return 0;
} }
let num: number = 0; let num: number = 0;
for (let i: number = 0; i < this._jsonValue.at(FrequestNode.FrequestNode_Groups).getSize(); i++) for (let i: number = 0; i < this._jsonValue.at(FrequestNode.FrequestNode_Groups).getSize(); i++)
{ {
@ -519,7 +519,7 @@ export namespace Live2DCubismFramework
break; break;
} }
} }
return num; return num;
} }
@ -534,7 +534,7 @@ export namespace Live2DCubismFramework
{ {
return null; return null;
} }
for (let i: number = 0; i < this._jsonValue.at(FrequestNode.FrequestNode_Groups).getSize(); i++) for (let i: number = 0; i < this._jsonValue.at(FrequestNode.FrequestNode_Groups).getSize(); i++)
{ {
let refI: Value = this._jsonValue.at(FrequestNode.FrequestNode_Groups).getValueByIndex(i); let refI: Value = this._jsonValue.at(FrequestNode.FrequestNode_Groups).getValueByIndex(i);
@ -605,7 +605,7 @@ export namespace Live2DCubismFramework
let node: Value = this._jsonValue.at(FrequestNode.FrequestNode_Pose); let node: Value = this._jsonValue.at(FrequestNode.FrequestNode_Pose);
return !node.isNull() && !node.isError(); return !node.isNull() && !node.isError();
} }
/** /**
* *
* @return true * @return true
@ -709,7 +709,7 @@ export namespace Live2DCubismFramework
return true; return true;
} }
} }
return false; return false;
} }
@ -733,9 +733,9 @@ export namespace Live2DCubismFramework
} }
return false; return false;
} }
private _json: CubismJson; private _json: CubismJson;
private _jsonValue: csmVector<Value>; private _jsonValue: csmVector<Value>;
} }
} }

View File

@ -1,9 +1,9 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as csmvector} from "../type/csmvector"; import {Live2DCubismFramework as csmvector} from "../type/csmvector";
import {Live2DCubismFramework as cubismmodel} from "../model/cubismmodel"; import {Live2DCubismFramework as cubismmodel} from "../model/cubismmodel";
@ -17,7 +17,7 @@ export namespace Live2DCubismFramework
{ {
/** /**
* *
* *
* *
*/ */
export class CubismBreath export class CubismBreath
@ -96,7 +96,7 @@ export namespace Live2DCubismFramework
_breathParameters: csmVector<BreathParameterData>; // 呼吸にひもづいているパラメータのリスト _breathParameters: csmVector<BreathParameterData>; // 呼吸にひもづいているパラメータのリスト
_currentTime: number; // 積算時間[秒] _currentTime: number; // 積算時間[秒]
} }
/** /**
* *
*/ */
@ -112,11 +112,11 @@ export namespace Live2DCubismFramework
*/ */
constructor(parameterId?: CubismIdHandle, offset?: number, peak?: number, cycle?: number, weight?: number) constructor(parameterId?: CubismIdHandle, offset?: number, peak?: number, cycle?: number, weight?: number)
{ {
this.parameterId = (parameterId == undefined) this.parameterId = (parameterId == undefined)
? null ? null
: parameterId; : parameterId;
this.offset = (offset == undefined) this.offset = (offset == undefined)
? 0.0 ? 0.0
: offset; : offset;
this.peak = (peak == undefined) this.peak = (peak == undefined)
? 0.0 ? 0.0
@ -125,7 +125,7 @@ export namespace Live2DCubismFramework
? 0.0 ? 0.0
: cycle; : cycle;
this.weight = (weight == undefined) this.weight = (weight == undefined)
? 0.0 ? 0.0
: weight; : weight;
} }
@ -135,4 +135,4 @@ export namespace Live2DCubismFramework
cycle: number; // 呼吸を正弦波としたときの、波の周期 cycle: number; // 呼吸を正弦波としたときの、波の周期
weight: number; // パラメータへの重み weight: number; // パラメータへの重み
} }
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as csmvector} from "../type/csmvector"; import {Live2DCubismFramework as csmvector} from "../type/csmvector";
@ -18,7 +18,7 @@ export namespace Live2DCubismFramework
{ {
/** /**
* *
* *
* *
*/ */
export class CubismEyeBlink export class CubismEyeBlink
@ -101,7 +101,7 @@ export namespace Live2DCubismFramework
{ {
case EyeState.EyeState_Closing: case EyeState.EyeState_Closing:
t = ((this._userTimeSeconds - this._stateStartTimeSeconds) / this._closingSeconds); t = ((this._userTimeSeconds - this._stateStartTimeSeconds) / this._closingSeconds);
if(t >= 1.0) if(t >= 1.0)
{ {
t = 1.0; t = 1.0;
@ -196,7 +196,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @return [] * @return []
*/ */
public determinNextBlinkingTiming(): number public determinNextBlinkingTiming(): number
@ -217,13 +217,13 @@ export namespace Live2DCubismFramework
/** /**
* ID0 true 1 false * ID0 true 1 false
*/ */
static readonly CloseIfZero: boolean = true; static readonly CloseIfZero: boolean = true;
} }
/** /**
* *
* *
* *
*/ */
export enum EyeState export enum EyeState
@ -234,4 +234,4 @@ export namespace Live2DCubismFramework
EyeState_Closed, // まぶたが閉じている状態 EyeState_Closed, // まぶたが閉じている状態
EyeState_Opening // まぶたが開いていく途中の状態 EyeState_Opening // まぶたが開いていく途中の状態
} }
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as cubismid} from "../id/cubismid"; import {Live2DCubismFramework as cubismid} from "../id/cubismid";
@ -23,7 +23,7 @@ export namespace Live2DCubismFramework
{ {
const Epsilon: number = 0.001; const Epsilon: number = 0.001;
const DefaultFadeInSeconds: number = 0.5; const DefaultFadeInSeconds: number = 0.5;
// Pose.jsonのタグ // Pose.jsonのタグ
const FadeIn: string = "FadeInTime"; const FadeIn: string = "FadeInTime";
const Link: string = "Link"; const Link: string = "Link";
@ -33,7 +33,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* *
*/ */
export class CubismPose export class CubismPose
@ -197,7 +197,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param model * @param model
*/ */
public copyPartOpacities(model: CubismModel): void public copyPartOpacities(model: CubismModel): void
@ -349,7 +349,7 @@ export namespace Live2DCubismFramework
this.parameterIndex = 0; this.parameterIndex = 0;
this.partIndex = 0; this.partIndex = 0;
this.link = new csmVector<PartData>(); this.link = new csmVector<PartData>();
if(v != undefined) if(v != undefined)
{ {
this.partId = v.partId; this.partId = v.partId;
@ -407,10 +407,10 @@ export namespace Live2DCubismFramework
return clonePartData; return clonePartData;
} }
partId: CubismIdHandle; // パーツID partId: CubismIdHandle; // パーツID
parameterIndex: number; // パラメータのインデックス parameterIndex: number; // パラメータのインデックス
partIndex: number; // パーツのインデックス partIndex: number; // パーツのインデックス
link: csmVector<PartData>; // 連動するパラメータ link: csmVector<PartData>; // 連動するパラメータ
} }
} }

View File

@ -1,15 +1,15 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
export namespace Live2DCubismFramework export namespace Live2DCubismFramework
{ {
/** /**
* *
* *
* *
* *
*/ */
@ -17,7 +17,7 @@ export namespace Live2DCubismFramework
{ {
/** /**
* *
* *
* @param size * @param size
* @return '0' * @return '0'
*/ */
@ -25,7 +25,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param memory * @param memory
*/ */
public abstract deallocate(memory: any): void; public abstract deallocate(memory: any): void;

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as cubismid} from './id/cubismid'; import {Live2DCubismFramework as cubismid} from './id/cubismid';
@ -52,7 +52,7 @@ export namespace Live2DCubismFramework
/** /**
* ID * ID
* *
* @param index index * @param index index
* @return ID * @return ID
*/ */
@ -190,4 +190,4 @@ export namespace Live2DCubismFramework
*/ */
public abstract getLipSyncParameterId(index: number): CubismIdHandle; public abstract getLipSyncParameterId(index: number): CubismIdHandle;
} }
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as csmstring} from "../type/csmstring"; import {Live2DCubismFramework as csmstring} from "../type/csmstring";
@ -12,7 +12,7 @@ export namespace Live2DCubismFramework
{ {
/** /**
* Drawable * Drawable
* *
* Drawable * Drawable
*/ */
export class CubismId export class CubismId
@ -24,7 +24,7 @@ export namespace Live2DCubismFramework
{ {
return this._id; return this._id;
} }
/** /**
* *
*/ */
@ -35,7 +35,7 @@ export namespace Live2DCubismFramework
this._id = new csmString(id); this._id = new csmString(id);
return; return;
} }
this._id = id; this._id = id;
} }
@ -87,4 +87,4 @@ export namespace Live2DCubismFramework
} }
export declare type CubismIdHandle = CubismId; export declare type CubismIdHandle = CubismId;
} }

View File

@ -1,9 +1,9 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as csmvector} from "../type/csmvector"; import {Live2DCubismFramework as csmvector} from "../type/csmvector";
import {Live2DCubismFramework as cubismid} from "./cubismid"; import {Live2DCubismFramework as cubismid} from "./cubismid";
@ -16,7 +16,7 @@ export namespace Live2DCubismFramework
{ {
/** /**
* ID * ID
* *
* ID * ID
*/ */
export class CubismIdManager export class CubismIdManager
@ -40,10 +40,10 @@ export namespace Live2DCubismFramework
} }
this._ids = null; this._ids = null;
} }
/** /**
* ID * ID
* *
* @param ids ID * @param ids ID
* @param count ID * @param count ID
*/ */
@ -57,7 +57,7 @@ export namespace Live2DCubismFramework
/** /**
* ID * ID
* *
* @param id ID * @param id ID
*/ */
public registerId(id: string | csmString): CubismId public registerId(id: string | csmString): CubismId
@ -84,7 +84,7 @@ export namespace Live2DCubismFramework
/** /**
* IDID * IDID
* *
* @param id ID * @param id ID
*/ */
public getId(id: csmString | string): CubismId public getId(id: csmString | string): CubismId
@ -94,13 +94,13 @@ export namespace Live2DCubismFramework
/** /**
* IDID * IDID
* *
* @return true * @return true
* @return false * @return false
*/ */
public isExist(id: csmString | string): boolean public isExist(id: csmString | string): boolean
{ {
if ('string' == typeof(id)) if ('string' == typeof(id))
{ {
return (this.findId(id) != null); return (this.findId(id) != null);
} }
@ -109,7 +109,7 @@ export namespace Live2DCubismFramework
/** /**
* IDID * IDID
* *
* @param id ID * @param id ID
* @return IDNULL * @return IDNULL
*/ */
@ -128,4 +128,4 @@ export namespace Live2DCubismFramework
private _ids: csmVector<CubismId>; // 登録されているIDのリスト private _ids: csmVector<CubismId>; // 登録されているIDのリスト
} }
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
/// <reference path="../Core/live2dcubismcore.d.ts" /> /// <reference path="../Core/live2dcubismcore.d.ts" />
@ -55,12 +55,12 @@ export function strtod(s: string, endPtr: string[]): number
export namespace Live2DCubismFramework export namespace Live2DCubismFramework
{ {
// ファイルスコープの変数を初期化 // ファイルスコープの変数を初期化
let s_isStarted: boolean = false; let s_isStarted: boolean = false;
let s_isInitialized: boolean = false; let s_isInitialized: boolean = false;
let s_option: Option = null; let s_option: Option = null;
let s_cubismIdManager: CubismIdManager = null; let s_cubismIdManager: CubismIdManager = null;
/** /**
* Framework使 * Framework使
*/ */
@ -81,7 +81,7 @@ export namespace Live2DCubismFramework
} }
/** /**
* Live2D Cubism3 Original Workflow SDK * Live2D Cubism SDK Original Workflow SDK
* CubismFramework.initialize()CubismFramework.dispose() * CubismFramework.initialize()CubismFramework.dispose()
*/ */
export class CubismFramework export class CubismFramework
@ -121,7 +121,7 @@ export namespace Live2DCubismFramework
const patch: number = ((version & 0x0000FFFF)); const patch: number = ((version & 0x0000FFFF));
const versionNumber: number = version; const versionNumber: number = version;
CubismLogInfo(`Live2D Cubism Core version: {0}.{1}.{2} ({3})`, CubismLogInfo(`Live2D Cubism Core version: {0}.{1}.{2} ({3})`,
('00' + major).slice(-2), ('00' + major).slice(-2),
('00' + minor).slice(-2), ('00' + minor).slice(-2),
('0000' + patch).slice(-4), ('0000' + patch).slice(-4),
@ -213,7 +213,7 @@ export namespace Live2DCubismFramework
CubismLogInfo("CubismFramework.dispose() is complete."); CubismLogInfo("CubismFramework.dispose() is complete.");
} }
/** /**
* Cubism FrameworkAPI使 * Cubism FrameworkAPI使
* @return API使true * @return API使true
@ -222,7 +222,7 @@ export namespace Live2DCubismFramework
{ {
return s_isStarted; return s_isStarted;
} }
/** /**
* Cubism Framework * Cubism Framework
* @return true * @return true
@ -234,7 +234,7 @@ export namespace Live2DCubismFramework
/** /**
* Core API * Core API
* *
* @praram message * @praram message
*/ */
public static coreLogFunction(message: string): void public static coreLogFunction(message: string): void
@ -247,7 +247,7 @@ export namespace Live2DCubismFramework
Live2DCubismCore.Logging.csmGetLogFunction()(message); Live2DCubismCore.Logging.csmGetLogFunction()(message);
} }
/** /**
* *
* *

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as cubismvector2} from "./cubismvector2"; import {Live2DCubismFramework as cubismvector2} from "./cubismvector2";
@ -17,7 +17,7 @@ export namespace Live2DCubismFramework
{ {
/** /**
* *
* *
* @param value * @param value
* @param min * @param min
* @param max * @param max
@ -36,10 +36,10 @@ export namespace Live2DCubismFramework
return value; return value;
} }
/** /**
* *
* *
* @param x * @param x
* @return sin(x) * @return sin(x)
*/ */
@ -50,7 +50,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param x () * @param x ()
* @return cos(x) * @return cos(x)
*/ */
@ -61,7 +61,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param x * @param x
* @return * @return
*/ */
@ -83,7 +83,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* *
* @param value * @param value
* @return * @return
*/ */
@ -92,7 +92,7 @@ export namespace Live2DCubismFramework
if (value < 0.0) if (value < 0.0)
{ {
return 0.0; return 0.0;
} }
else if (value > 1.0) else if (value > 1.0)
{ {
return 1.0; return 1.0;
@ -103,7 +103,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param left * @param left
* @param right * @param right
* @return * @return
@ -117,7 +117,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param left * @param left
* @param right   * @param right  
* @return * @return
@ -131,7 +131,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param degrees * @param degrees
* @return * @return
*/ */
@ -142,7 +142,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param radian * @param radian
* @return * @return
*/ */
@ -153,7 +153,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param from * @param from
* @param to * @param to
* @return * @return
@ -180,7 +180,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param from * @param from
* @param to * @param to
* @return * @return
@ -200,7 +200,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param totalAngle * @param totalAngle
* @return * @return
*/ */
@ -223,4 +223,4 @@ export namespace Live2DCubismFramework
} }
} }
} }

View File

@ -1,15 +1,15 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
export namespace Live2DCubismFramework export namespace Live2DCubismFramework
{ {
/** /**
* 4x4 * 4x4
* *
* 4x4便 * 4x4便
*/ */
export class CubismMatrix44 export class CubismMatrix44
@ -25,7 +25,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param a a * @param a a
* @param b b * @param b b
* @return * @return
@ -79,7 +79,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param tr 164x4 * @param tr 164x4
*/ */
public setMatrix(tr: Float32Array): void public setMatrix(tr: Float32Array): void
@ -92,7 +92,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @return 164x4 * @return 164x4
*/ */
public getArray(): Float32Array public getArray(): Float32Array
@ -111,7 +111,7 @@ export namespace Live2DCubismFramework
/** /**
* Y * Y
* *
* @return Y * @return Y
*/ */
public getScaleY(): number public getScaleY(): number
@ -139,7 +139,7 @@ export namespace Live2DCubismFramework
/** /**
* X * X
* *
* @param src X * @param src X
* @return X * @return X
*/ */
@ -150,7 +150,7 @@ export namespace Live2DCubismFramework
/** /**
* Y * Y
* *
* @param src Y * @param src Y
* @return Y * @return Y
*/ */
@ -177,9 +177,9 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* *
* *
* @param x X * @param x X
* @param y Y * @param y Y
*/ */
@ -199,9 +199,9 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* *
* *
* @param x X * @param x X
* @param y y * @param y y
*/ */
@ -213,7 +213,7 @@ export namespace Live2DCubismFramework
/** /**
* X * X
* *
* @param x X * @param x X
*/ */
public translateX(x: number): void public translateX(x: number): void
@ -223,7 +223,7 @@ export namespace Live2DCubismFramework
/** /**
* Y * Y
* *
* @param y Y * @param y Y
*/ */
public translateY(y: number): void public translateY(y: number): void
@ -234,7 +234,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param x X * @param x X
* @param y Y * @param y Y
*/ */
@ -243,7 +243,7 @@ export namespace Live2DCubismFramework
let tr1: Float32Array = new Float32Array( let tr1: Float32Array = new Float32Array(
[ [
x, 0.0, 0.0, 0.0, x, 0.0, 0.0, 0.0,
0.0, y, 0.0, 0.0, 0.0, y, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0 0.0, 0.0, 0.0, 1.0
] ]
@ -254,7 +254,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param x X * @param x X
* @param y Y * @param y Y
*/ */
@ -291,4 +291,4 @@ export namespace Live2DCubismFramework
protected _tr: Float32Array; // 4x4行列データ protected _tr: Float32Array; // 4x4行列データ
} }
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as csmmap} from "../type/csmmap"; import {Live2DCubismFramework as csmmap} from "../type/csmmap";
@ -16,14 +16,14 @@ export namespace Live2DCubismFramework
{ {
/** /**
* 4x4 * 4x4
* *
* 4x4 * 4x4
*/ */
export class CubismModelMatrix extends CubismMatrix44 export class CubismModelMatrix extends CubismMatrix44
{ {
/** /**
* *
* *
* @param w * @param w
* @param h * @param h
*/ */
@ -31,27 +31,19 @@ export namespace Live2DCubismFramework
{ {
super(); super();
this._width = (w !== undefined) this._width = (w !== undefined)
? w ? w
: 0.0; : 0.0;
this._height = (h !== undefined) this._height = (h !== undefined)
? h ? h
: 0.0; : 0.0;
// 原点(0, 0)を中心にして、画面に納まるような大きさで初期化 this.setHeight(1.0);
if (this._width > this._height)
{
this.setWidth(this._height / this._width);
}
else
{
this.setHeight(1.0);
}
} }
/** /**
* *
* *
* @param w * @param w
*/ */
public setWidth(w: number): void public setWidth(w: number): void
@ -74,7 +66,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param x X * @param x X
* @param y Y * @param y Y
*/ */
@ -85,10 +77,10 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param x X * @param x X
* @param y Y * @param y Y
* *
* @note widthheight * @note widthheight
*/ */
public setCenterPosition(x: number, y: number) public setCenterPosition(x: number, y: number)
@ -99,17 +91,17 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param y Y * @param y Y
*/ */
public top(y: number): void public top(y: number): void
{ {
this.setY(y); this.setY(y);
} }
/** /**
* *
* *
* @param y Y * @param y Y
*/ */
public bottom(y: number) public bottom(y: number)
@ -121,7 +113,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param x X * @param x X
*/ */
public left(x: number): void public left(x: number): void
@ -131,7 +123,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param x X * @param x X
*/ */
public right(x: number): void public right(x: number): void
@ -143,7 +135,7 @@ export namespace Live2DCubismFramework
/** /**
* X * X
* *
* @param x X * @param x X
*/ */
public centerX(x: number): void public centerX(x: number): void
@ -155,7 +147,7 @@ export namespace Live2DCubismFramework
/** /**
* X * X
* *
* @param x X * @param x X
*/ */
public setX(x: number): void public setX(x: number): void
@ -165,7 +157,7 @@ export namespace Live2DCubismFramework
/** /**
* Y * Y
* *
* @param y Y * @param y Y
*/ */
public centerY(y: number): void public centerY(y: number): void
@ -177,7 +169,7 @@ export namespace Live2DCubismFramework
/** /**
* Y * Y
* *
* @param y Y * @param y Y
*/ */
public setY(y: number): void public setY(y: number): void
@ -187,7 +179,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param layout * @param layout
*/ */
public setupFromLayout(layout: csmMap<string, number>): void public setupFromLayout(layout: csmMap<string, number>): void
@ -202,7 +194,7 @@ export namespace Live2DCubismFramework
const keyBottom = "bottom"; const keyBottom = "bottom";
const keyLeft = "left"; const keyLeft = "left";
const keyRight = "right"; const keyRight = "right";
for(const ite: 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 key: string = ite.ptr().first;
@ -261,4 +253,4 @@ export namespace Live2DCubismFramework
private _width: number; // 横幅 private _width: number; // 横幅
private _height: number; // 縦幅 private _height: number; // 縦幅
} }
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as cubismmath} from "./cubismmath"; import {Live2DCubismFramework as cubismmath} from "./cubismmath";
@ -16,7 +16,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* *
*/ */
export class CubismTargetPoint export class CubismTargetPoint
@ -35,7 +35,7 @@ export namespace Live2DCubismFramework
this._lastTimeSeconds = 0.0; this._lastTimeSeconds = 0.0;
this._userTimeSeconds = 0.0; this._userTimeSeconds = 0.0;
} }
/** /**
* *
*/ */
@ -48,7 +48,7 @@ export namespace Live2DCubismFramework
// 顔の振り具合を、中央0.0)から、左右は(+-1.0)とする // 顔の振り具合を、中央0.0)から、左右は(+-1.0)とする
const faceParamMaxV: number = 40.0 / 10.0; // 7.5秒間に40分移動(5.3/sc) const faceParamMaxV: number = 40.0 / 10.0; // 7.5秒間に40分移動(5.3/sc)
const maxV: number = faceParamMaxV * 1.0 / FrameRate; // 1frameあたりに変化できる速度の上限 const maxV: number = faceParamMaxV * 1.0 / FrameRate; // 1frameあたりに変化できる速度の上限
if(this._lastTimeSeconds == 0.0) if(this._lastTimeSeconds == 0.0)
{ {
this._lastTimeSeconds = this._userTimeSeconds; this._lastTimeSeconds = this._userTimeSeconds;
@ -113,7 +113,7 @@ export namespace Live2DCubismFramework
const maxV: number = 0.5 * (CubismMath.sqrt((maxA * maxA) + 16.0 * maxA * d - 8.0 * maxA * d) - maxA); const maxV: number = 0.5 * (CubismMath.sqrt((maxA * maxA) + 16.0 * maxA * d - 8.0 * maxA * d) - maxA);
const curV: number = CubismMath.sqrt((this._faceVX * this._faceVX) + (this._faceVY * this._faceVY)); const curV: number = CubismMath.sqrt((this._faceVX * this._faceVX) + (this._faceVY * this._faceVY));
if(curV > maxV) if(curV > maxV)
{ {
// 現在の速度 > 最高速度のとき、最高速度まで減速 // 現在の速度 > 最高速度のとき、最高速度まで減速
@ -128,7 +128,7 @@ export namespace Live2DCubismFramework
/** /**
* X * X
* *
* @return X-1.0 ~ 1.0 * @return X-1.0 ~ 1.0
*/ */
public getX(): number public getX(): number
@ -138,7 +138,7 @@ export namespace Live2DCubismFramework
/** /**
* Y * Y
* *
* @return Y-1.0 ~ 1.0 * @return Y-1.0 ~ 1.0
*/ */
public getY(): number public getY(): number
@ -148,7 +148,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param x X-1.0 ~ 1.0 * @param x X-1.0 ~ 1.0
* @param y Y-1.0 ~ 1.0 * @param y Y-1.0 ~ 1.0
*/ */
@ -169,4 +169,4 @@ export namespace Live2DCubismFramework
private _userTimeSeconds: number; // デルタ時間の積算値[秒] private _userTimeSeconds: number; // デルタ時間の積算値[秒]
} }
} }

View File

@ -1,19 +1,19 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
export namespace Live2DCubismFramework export namespace Live2DCubismFramework
{ {
/** /**
* 2 * 2
* *
* 2 * 2
*/ */
export class CubismVector2 export class CubismVector2
{ {
/** /**
* *
*/ */
@ -22,15 +22,15 @@ export namespace Live2DCubismFramework
this.x = (x == undefined) this.x = (x == undefined)
? 0.0 ? 0.0
: x; : x;
this.y = (y == undefined) this.y = (y == undefined)
? 0.0 ? 0.0
: y; : y;
} }
/** /**
* *
* *
* @param vector2 * @param vector2
* @return * @return
*/ */
@ -41,10 +41,10 @@ export namespace Live2DCubismFramework
ret.y = this.y + vector2.y; ret.y = this.y + vector2.y;
return ret; return ret;
} }
/** /**
* *
* *
* @param vector2 * @param vector2
* @return * @return
*/ */
@ -55,10 +55,10 @@ export namespace Live2DCubismFramework
ret.y = this.y - vector2.y; ret.y = this.y - vector2.y;
return ret; return ret;
} }
/** /**
* *
* *
* @param vector2 * @param vector2
* @return   * @return  
*/ */
@ -69,10 +69,10 @@ export namespace Live2DCubismFramework
ret.y = this.y * vector2.y; ret.y = this.y * vector2.y;
return ret; return ret;
} }
/** /**
* () * ()
* *
* @param scalar * @param scalar
* @return   * @return  
*/ */
@ -83,7 +83,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param vector2 * @param vector2
* @return   * @return  
*/ */
@ -97,7 +97,7 @@ export namespace Live2DCubismFramework
/** /**
* () * ()
* *
* @param scalar * @param scalar
* @return   * @return  
*/ */
@ -108,7 +108,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @return * @return
*/ */
public getLength(): number public getLength(): number
@ -118,7 +118,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param a * @param a
* @return * @return
*/ */
@ -129,7 +129,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param a * @param a
* @return * @return
*/ */
@ -151,9 +151,9 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* *
* *
* @param rhs * @param rhs
* @return true * @return true
* @return false * @return false
@ -165,9 +165,9 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* *
* *
* @param rhs * @param rhs
* @return true * @return true
* @return false * @return false
@ -177,4 +177,4 @@ export namespace Live2DCubismFramework
return !(this.isEqual(rhs)); return !(this.isEqual(rhs));
} }
} }
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as cubismmatrix44} from "./cubismmatrix44"; import {Live2DCubismFramework as cubismmatrix44} from "./cubismmatrix44";
@ -12,12 +12,12 @@ export namespace Live2DCubismFramework
{ {
/** /**
* 使便4x4 * 使便4x4
* *
* 使便4x4 * 使便4x4
*/ */
export class CubismViewMatrix extends CubismMatrix44 export class CubismViewMatrix extends CubismMatrix44
{ {
/** /**
* *
*/ */
@ -38,7 +38,7 @@ export namespace Live2DCubismFramework
/** /**
* 調 * 調
* *
* @param x X * @param x X
* @param y Y * @param y Y
*/ */
@ -78,7 +78,7 @@ export namespace Live2DCubismFramework
/** /**
* 調 * 調
* *
* @param cx X * @param cx X
* @param cy Y * @param cy Y
* @param scale  * @param scale 
@ -139,7 +139,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param left X * @param left X
* @param right X * @param right X
* @param bottom Y * @param bottom Y
@ -206,7 +206,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @return true * @return true
* @return false * @return false
*/ */
@ -217,7 +217,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @return true * @return true
* @return false * @return false
*/ */
@ -309,4 +309,4 @@ export namespace Live2DCubismFramework
private _maxScale: number; // 拡大率の最大値 private _maxScale: number; // 拡大率の最大値
private _minScale: number; // 拡大率の最小値 private _minScale: number; // 拡大率の最小値
} }
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
/// <reference path="../../Core/live2dcubismcore.d.ts" /> /// <reference path="../../Core/live2dcubismcore.d.ts" />
@ -14,7 +14,7 @@ export namespace Live2DCubismFramework
{ {
/** /**
* Moc * Moc
* *
* Moc * Moc
*/ */
export class CubismMoc export class CubismMoc
@ -37,7 +37,7 @@ export namespace Live2DCubismFramework
/** /**
* Moc * Moc
* *
* Moc * Moc
*/ */
public static delete(moc: CubismMoc): void public static delete(moc: CubismMoc): void
@ -46,10 +46,10 @@ export namespace Live2DCubismFramework
moc._moc = null; moc._moc = null;
moc = null; moc = null;
} }
/** /**
* *
* *
* @return Moc * @return Moc
*/ */
createModel(): CubismModel createModel(): CubismModel
@ -106,4 +106,4 @@ export namespace Live2DCubismFramework
_moc: Live2DCubismCore.Moc; ///< Mocデータ _moc: Live2DCubismCore.Moc; ///< Mocデータ
_modelCount: number; ///< Mocデータから作られたモデルの個数 _modelCount: number; ///< Mocデータから作られたモデルの個数
} }
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
/// <reference path="../../Core/live2dcubismcore.d.ts" /> /// <reference path="../../Core/live2dcubismcore.d.ts" />
@ -22,7 +22,7 @@ export namespace Live2DCubismFramework
{ {
/** /**
* *
* *
* Moc * Moc
*/ */
export class CubismModel export class CubismModel
@ -47,7 +47,7 @@ export namespace Live2DCubismFramework
{ {
return 0.0; return 0.0;
} }
return this._model.canvasinfo.CanvasWidth / this._model.canvasinfo.PixelsPerUnit; return this._model.canvasinfo.CanvasWidth / this._model.canvasinfo.PixelsPerUnit;
} }
@ -121,7 +121,7 @@ export namespace Live2DCubismFramework
partIndex = partCount + this._notExistPartId.getSize(); partIndex = partCount + this._notExistPartId.getSize();
this._notExistPartId.setValue(partId, partIndex); this._notExistPartId.setValue(partId, partIndex);
this._notExistPartOpacities.appendKey(partIndex); this._notExistPartOpacities.appendKey(partIndex);
return partIndex; return partIndex;
} }
@ -297,7 +297,7 @@ export namespace Live2DCubismFramework
// インデックスの範囲内検知 // インデックスの範囲内検知
CSM_ASSERT(0 <= parameterIndex && parameterIndex < this.getParameterCount()); CSM_ASSERT(0 <= parameterIndex && parameterIndex < this.getParameterCount());
return this._parameterValues[parameterIndex]; return this._parameterValues[parameterIndex];
} }
@ -573,7 +573,7 @@ export namespace Live2DCubismFramework
return !Live2DCubismCore.Utils.hasIsDoubleSidedBit(constantFlags[drawableIndex]); return !Live2DCubismCore.Utils.hasIsDoubleSidedBit(constantFlags[drawableIndex]);
} }
/** /**
* Drawable * Drawable
* @param drawableIndex Drawable * @param drawableIndex Drawable
@ -582,7 +582,7 @@ export namespace Live2DCubismFramework
public getDrawableBlendMode(drawableIndex: number): CubismBlendMode public getDrawableBlendMode(drawableIndex: number): CubismBlendMode
{ {
const constantFlags = this._model.drawables.constantFlags; const constantFlags = this._model.drawables.constantFlags;
return (Live2DCubismCore.Utils.hasBlendAdditiveBit(constantFlags[drawableIndex])) return (Live2DCubismCore.Utils.hasBlendAdditiveBit(constantFlags[drawableIndex]))
? CubismBlendMode.CubismBlendMode_Additive ? CubismBlendMode.CubismBlendMode_Additive
: (Live2DCubismCore.Utils.hasBlendMultiplicativeBit(constantFlags[drawableIndex])) : (Live2DCubismCore.Utils.hasBlendMultiplicativeBit(constantFlags[drawableIndex]))
@ -590,6 +590,22 @@ export namespace Live2DCubismFramework
: CubismBlendMode.CubismBlendMode_Normal; : CubismBlendMode.CubismBlendMode_Normal;
} }
/**
* Drawable使
*
* Drawable使
* 使
*
* @param drawableIndex Drawable
* @return Drawable
*/
public getDrawableInvertedMaskBit(drawableIndex: number): boolean
{
const constantFlags: Uint8Array = this._model.drawables.constantFlags;
return (Live2DCubismCore.Utils.hasIsInvertedMaskBit(constantFlags[drawableIndex]));
}
/** /**
* Drawable * Drawable
* @return Drawable * @return Drawable
@ -612,7 +628,7 @@ export namespace Live2DCubismFramework
/** /**
* 使 * 使
* *
* @return true 使 * @return true 使
* @return false 使 * @return false 使
*/ */
@ -631,7 +647,7 @@ export namespace Live2DCubismFramework
/** /**
* Drawable * Drawable
* *
* @param drawableIndex Drawable * @param drawableIndex Drawable
* @return true Drawable * @return true Drawable
* @return false Drawable * @return false Drawable
@ -644,7 +660,7 @@ export namespace Live2DCubismFramework
/** /**
* DrawableDrawOrder * DrawableDrawOrder
* *
* CubismModel.updatedrawabledrawOrder * CubismModel.updatedrawabledrawOrder
* drawOrderartMesh01000 * drawOrderartMesh01000
* @param drawableIndex drawable * @param drawableIndex drawable
@ -659,9 +675,9 @@ export namespace Live2DCubismFramework
/** /**
* Drawable * Drawable
* *
* CubismModel.updatedrawable * CubismModel.updatedrawable
* *
* @param drawableIndex drawable * @param drawableIndex drawable
* @return true DrawableCubismModel.update * @return true DrawableCubismModel.update
* @return false DrawableCubismModel.update * @return false DrawableCubismModel.update
@ -674,9 +690,9 @@ export namespace Live2DCubismFramework
/** /**
* Drawable * Drawable
* *
* CubismModel.updateDrawable * CubismModel.updateDrawable
* *
* @param drawableIndex Drawable * @param drawableIndex Drawable
* @return true DrawableCubismModel.update * @return true DrawableCubismModel.update
* @return false DrawableCubismModel.update * @return false DrawableCubismModel.update
@ -803,4 +819,4 @@ export namespace Live2DCubismFramework
private _partIds: csmVector<CubismIdHandle>; private _partIds: csmVector<CubismIdHandle>;
private _drawableIds: csmVector<CubismIdHandle>; private _drawableIds: csmVector<CubismIdHandle>;
} }
} }

View File

@ -1,9 +1,9 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as cubismmodeluserdatajson} from "./cubismmodeluserdatajson"; import {Live2DCubismFramework as cubismmodeluserdatajson} from "./cubismmodeluserdatajson";
import {Live2DCubismFramework as cubismid} from "../id/cubismid"; import {Live2DCubismFramework as cubismid} from "../id/cubismid";
@ -22,7 +22,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* Json * Json
*/ */
export class CubismModelUserDataNode export class CubismModelUserDataNode
@ -34,14 +34,14 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* *
*/ */
export class CubismModelUserData export class CubismModelUserData
{ {
/** /**
* *
* *
* @param buffer userdata3.json * @param buffer userdata3.json
* @param size * @param size
* @return * @return
@ -57,7 +57,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param modelUserData * @param modelUserData
*/ */
public static delete(modelUserData: CubismModelUserData): void public static delete(modelUserData: CubismModelUserData): void
@ -71,7 +71,7 @@ export namespace Live2DCubismFramework
/** /**
* ArtMesh * ArtMesh
* *
* @return * @return
*/ */
public getArtMeshUserDatas(): csmVector<CubismModelUserDataNode> public getArtMeshUserDatas(): csmVector<CubismModelUserDataNode>
@ -81,7 +81,7 @@ export namespace Live2DCubismFramework
/** /**
* userdata3.json * userdata3.json
* *
* @param buffer userdata3.json * @param buffer userdata3.json
* @param size * @param size
*/ */
@ -106,7 +106,7 @@ export namespace Live2DCubismFramework
this._artMeshUserDataNode.pushBack(addNode); this._artMeshUserDataNode.pushBack(addNode);
} }
} }
json.release(); json.release();
json = void 0; json = void 0;
} }
@ -122,7 +122,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* *
*/ */
public release(): void public release(): void
@ -138,4 +138,4 @@ export namespace Live2DCubismFramework
private _userDataNodes: csmVector<CubismModelUserDataNode>; // ユーザーデータ構造体配列 private _userDataNodes: csmVector<CubismModelUserDataNode>; // ユーザーデータ構造体配列
private _artMeshUserDataNode: csmVector<CubismModelUserDataNode>; // 閲覧リストの保持 private _artMeshUserDataNode: csmVector<CubismModelUserDataNode>; // 閲覧リストの保持
} }
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as cubismjson} from "../utils/cubismjson"; import {Live2DCubismFramework as cubismjson} from "../utils/cubismjson";
@ -54,7 +54,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @return * @return
*/ */
public getTotalUserDataSize(): number public getTotalUserDataSize(): number
@ -64,7 +64,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @return * @return
*/ */
public getUserDataTargetType(i: number): string public getUserDataTargetType(i: number): string
@ -74,7 +74,7 @@ export namespace Live2DCubismFramework
/** /**
* ID * ID
* *
* @param i * @param i
* @return ID * @return ID
*/ */
@ -85,7 +85,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param i * @param i
* @return * @return
*/ */
@ -96,4 +96,4 @@ export namespace Live2DCubismFramework
private _json: CubismJson; private _json: CubismJson;
} }
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as cubismframework} from "../live2dcubismframework"; import {Live2DCubismFramework as cubismframework} from "../live2dcubismframework";
@ -22,7 +22,7 @@ import {Live2DCubismFramework as csmstring} from "../type/csmstring";
import {Live2DCubismFramework as cubismmotionqueuemanager} from "../motion/cubismmotionqueuemanager"; import {Live2DCubismFramework as cubismmotionqueuemanager} from "../motion/cubismmotionqueuemanager";
import {Live2DCubismFramework as cubismbreath} from "../effect/cubismbreath"; import {Live2DCubismFramework as cubismbreath} from "../effect/cubismbreath";
import {Live2DCubismFramework as cubismeyeblink} from "../effect/cubismeyeblink"; import {Live2DCubismFramework as cubismeyeblink} from "../effect/cubismeyeblink";
import {Live2DCubismFramework as cubismrenderer_webgl} from "../rendering/cubismrenderer_WebGL"; import {Live2DCubismFramework as cubismrenderer_webgl} from "../rendering/cubismrenderer_webgl";
import {CubismLogError, CubismLogInfo} from "../utils/cubismdebug"; import {CubismLogError, CubismLogInfo} from "../utils/cubismdebug";
import CubismRenderer_WebGL = cubismrenderer_webgl.CubismRenderer_WebGL; import CubismRenderer_WebGL = cubismrenderer_webgl.CubismRenderer_WebGL;
import CubismEyeBlink = cubismeyeblink.CubismEyeBlink; import CubismEyeBlink = cubismeyeblink.CubismEyeBlink;
@ -47,16 +47,16 @@ export namespace Live2DCubismFramework
{ {
/** /**
* 使 * 使
* *
* 使 * 使
*/ */
export class CubismUserModel export class CubismUserModel
{ {
/** /**
* *
* *
* *
* *
* @return true * @return true
* @return false * @return false
*/ */
@ -67,9 +67,9 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* *
* *
* @param v * @param v
*/ */
public setInitialized(v: boolean): void public setInitialized(v: boolean): void
@ -79,9 +79,9 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* *
* *
* @return true * @return true
* @return false * @return false
*/ */
@ -92,9 +92,9 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* *
* *
* @param v * @param v
*/ */
public setUpdating(v: boolean): void public setUpdating(v: boolean): void
@ -154,7 +154,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param buffer moc3 * @param buffer moc3
*/ */
public loadModel(buffer: ArrayBuffer) public loadModel(buffer: ArrayBuffer)
@ -241,7 +241,7 @@ export namespace Live2DCubismFramework
{ {
return false; // 存在しない場合はfalse return false; // 存在しない場合はfalse
} }
const count: number = this._model.getDrawableVertexCount(drawIndex); const count: number = this._model.getDrawableVertexCount(drawIndex);
const vertices: Float32Array = this._model.getDrawableVertices(drawIndex); const vertices: Float32Array = this._model.getDrawableVertices(drawIndex);
@ -259,7 +259,7 @@ export namespace Live2DCubismFramework
{ {
left = x; // Min x left = x; // Min x
} }
if(x > right) if(x > right)
{ {
right = x; // Max x right = x; // Max x
@ -328,11 +328,11 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* Event * Event
* *
* *
* *
* @param eventValue * @param eventValue
*/ */
public motionEventFired(eventValue: csmString): void public motionEventFired(eventValue: csmString): void
@ -342,10 +342,10 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* CubismMotionQueueManagerCallback * CubismMotionQueueManagerCallback
* CubismUserModelEventFired * CubismUserModelEventFired
* *
* @param caller * @param caller
* @param eventValue * @param eventValue
* @param customData CubismUserModel * @param customData CubismUserModel
@ -417,22 +417,22 @@ export namespace Live2DCubismFramework
this._expressionManager.release(); this._expressionManager.release();
this._expressionManager = null; this._expressionManager = null;
} }
if(this._moc != null) if(this._moc != null)
{ {
this._moc.deleteModel(this._model); this._moc.deleteModel(this._model);
this._moc.release(); this._moc.release();
this._moc = null; this._moc = null;
} }
this._modelMatrix = null; this._modelMatrix = null;
CubismPose.delete(this._pose); CubismPose.delete(this._pose);
CubismEyeBlink.delete(this._eyeBlink); CubismEyeBlink.delete(this._eyeBlink);
CubismBreath.delete(this._breath); CubismBreath.delete(this._breath);
this._dragManager = null; this._dragManager = null;
CubismPhysics.delete(this._physics); CubismPhysics.delete(this._physics);
CubismModelUserData.delete(this._modelUserData); CubismModelUserData.delete(this._modelUserData);
@ -441,7 +441,7 @@ export namespace Live2DCubismFramework
protected _moc: CubismMoc; // Mocデータ protected _moc: CubismMoc; // Mocデータ
protected _model: CubismModel; // Modelインスタンス protected _model: CubismModel; // Modelインスタンス
protected _motionManager: CubismMotionManager; // モーション管理 protected _motionManager: CubismMotionManager; // モーション管理
protected _expressionManager: CubismMotionManager; // 表情管理 protected _expressionManager: CubismMotionManager; // 表情管理
protected _eyeBlink: CubismEyeBlink; // 自動まばたき protected _eyeBlink: CubismEyeBlink; // 自動まばたき
@ -451,7 +451,7 @@ export namespace Live2DCubismFramework
protected _dragManager: CubismTargetPoint; // マウスドラッグ protected _dragManager: CubismTargetPoint; // マウスドラッグ
protected _physics: CubismPhysics; // 物理演算 protected _physics: CubismPhysics; // 物理演算
protected _modelUserData: CubismModelUserData; // ユーザーデータ protected _modelUserData: CubismModelUserData; // ユーザーデータ
protected _initialized: boolean; // 初期化されたかどうか protected _initialized: boolean; // 初期化されたかどうか
protected _updating: boolean; // 更新されたかどうか protected _updating: boolean; // 更新されたかどうか
protected _opacity: number; // 不透明度 protected _opacity: number; // 不透明度
@ -467,4 +467,4 @@ export namespace Live2DCubismFramework
private _renderer: CubismRenderer_WebGL; // レンダラ private _renderer: CubismRenderer_WebGL; // レンダラ
} }
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as cubismmath} from '../math/cubismmath'; import {Live2DCubismFramework as cubismmath} from '../math/cubismmath';
@ -21,7 +21,7 @@ export namespace Live2DCubismFramework
{ {
/** /**
* *
* *
* MotionQueueManager * MotionQueueManager
*/ */
export abstract class ACubismMotion export abstract class ACubismMotion
@ -171,7 +171,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* @return [] * @return []
* *
* @note -1 * @note -1
* *
* *
@ -185,7 +185,7 @@ export namespace Live2DCubismFramework
/** /**
* 1 * 1
* @return [] * @return []
* *
* @note getDuration() * @note getDuration()
* ()-1 * ()-1
*/ */
@ -205,10 +205,10 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* *
* *
* *
* @param beforeCheckTimeSeconds [] * @param beforeCheckTimeSeconds []
* @param motionTimeSeconds [] * @param motionTimeSeconds []
*/ */
@ -236,4 +236,4 @@ export namespace Live2DCubismFramework
public _firedEventValues: csmVector<csmString>; public _firedEventValues: csmVector<csmString>;
} }
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as acubismmotion} from './acubismmotion'; import {Live2DCubismFramework as acubismmotion} from './acubismmotion';
@ -38,7 +38,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* *
*/ */
export class CubismExpressionMotion extends ACubismMotion export class CubismExpressionMotion extends ACubismMotion
@ -55,7 +55,7 @@ export namespace Live2DCubismFramework
let json: CubismJson = CubismJson.create(buffer, size); let json: CubismJson = CubismJson.create(buffer, size);
let root: Value = json.getRoot(); let root: Value = json.getRoot();
expression.setFadeInTime(root.getValueByString(ExpressionKeyFadeIn).toFloat(DefaultFadeTime)); // フェードイン expression.setFadeInTime(root.getValueByString(ExpressionKeyFadeIn).toFloat(DefaultFadeTime)); // フェードイン
expression.setFadeOutTime(root.getValueByString(ExpressionKeyFadeOut).toFloat(DefaultFadeTime)); // フェードアウト expression.setFadeOutTime(root.getValueByString(ExpressionKeyFadeOut).toFloat(DefaultFadeTime)); // フェードアウト
@ -174,4 +174,4 @@ export namespace Live2DCubismFramework
blendType: ExpressionBlendType; // パラメータの演算種類 blendType: ExpressionBlendType; // パラメータの演算種類
value: number; // 値 value: number; // 値
} }
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as cubismmotionjson} from './cubismmotionjson'; import {Live2DCubismFramework as cubismmotionjson} from './cubismmotionjson';
@ -59,7 +59,7 @@ export namespace Live2DCubismFramework
{ {
t = 0.0; t = 0.0;
} }
return points[0].value + ((points[1].value - points[0].value) * t); return points[0].value + ((points[1].value - points[0].value) * t);
} }
@ -75,10 +75,10 @@ export namespace Live2DCubismFramework
const p01: CubismMotionPoint = lerpPoints(points[0], points[1], t); const p01: CubismMotionPoint = lerpPoints(points[0], points[1], t);
const p12: CubismMotionPoint = lerpPoints(points[1], points[2], t); const p12: CubismMotionPoint = lerpPoints(points[1], points[2], t);
const p23: CubismMotionPoint = lerpPoints(points[2], points[3], t); const p23: CubismMotionPoint = lerpPoints(points[2], points[3], t);
const p012: CubismMotionPoint = lerpPoints(p01, p12, t); const p012: CubismMotionPoint = lerpPoints(p01, p12, t);
const p123: CubismMotionPoint = lerpPoints(p12, p23, t); const p123: CubismMotionPoint = lerpPoints(p12, p23, t);
return lerpPoints(p012, p123, t).value; return lerpPoints(p012, p123, t).value;
} }
@ -91,7 +91,7 @@ export namespace Live2DCubismFramework
{ {
return points[1].value; return points[1].value;
} }
function evaluateCurve(motionData: CubismMotionData, index: number, time: number): number function evaluateCurve(motionData: CubismMotionData, index: number, time: number): number
{ {
// Find segment to evaluate. // Find segment to evaluate.
@ -131,14 +131,14 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* *
*/ */
export class CubismMotion extends ACubismMotion export class CubismMotion extends ACubismMotion
{ {
/** /**
* *
* *
* @param buffer motion3.json * @param buffer motion3.json
* @param size * @param size
* @return * @return
@ -150,7 +150,7 @@ export namespace Live2DCubismFramework
ret.parse(buffer, size); ret.parse(buffer, size);
ret._sourceFrameRate = ret._motionData.fps; ret._sourceFrameRate = ret._motionData.fps;
ret._loopDurationSeconds = ret._motionData.duration; ret._loopDurationSeconds = ret._motionData.duration;
// NOTE: Editorではループありのモーション書き出しは非対応 // NOTE: Editorではループありのモーション書き出しは非対応
// ret->_loop = (ret->_motionData->Loop > 0); // ret->_loop = (ret->_motionData->Loop > 0);
return ret; return ret;
@ -184,7 +184,7 @@ export namespace Live2DCubismFramework
let lipSyncValue: number = Number.MAX_VALUE; let lipSyncValue: number = Number.MAX_VALUE;
let eyeBlinkValue: number = Number.MAX_VALUE; let eyeBlinkValue: number = Number.MAX_VALUE;
//まばたき、リップシンクのうちモーションの適用を検出するためのビットmaxFlagCount個まで //まばたき、リップシンクのうちモーションの適用を検出するためのビットmaxFlagCount個まで
const MaxTargetSize = 64; const MaxTargetSize = 64;
let lipSyncFlags = 0; let lipSyncFlags = 0;
@ -228,7 +228,7 @@ export namespace Live2DCubismFramework
{ {
// Evaluate curve and call handler. // Evaluate curve and call handler.
value = evaluateCurve(this._motionData, c, time); value = evaluateCurve(this._motionData, c, time);
if (curves.at(c).id == this._modelCurveIdEyeBlink) if (curves.at(c).id == this._modelCurveIdEyeBlink)
{ {
eyeBlinkValue = value; eyeBlinkValue = value;
@ -247,13 +247,13 @@ export namespace Live2DCubismFramework
// Find parameter index. // Find parameter index.
parameterIndex = model.getParameterIndex(curves.at(c).id); parameterIndex = model.getParameterIndex(curves.at(c).id);
// Skip curve evaluation if no value in sink. // Skip curve evaluation if no value in sink.
if (parameterIndex == -1) if (parameterIndex == -1)
{ {
continue; continue;
} }
const sourceValue: number = model.getParameterValueByIndex(parameterIndex); const sourceValue: number = model.getParameterValueByIndex(parameterIndex);
// Evaluate curve and apply value. // Evaluate curve and apply value.
@ -592,13 +592,13 @@ export namespace Live2DCubismFramework
this._motionData = new CubismMotionData(); this._motionData = new CubismMotionData();
let json: CubismMotionJson = new CubismMotionJson(motionJson, size); let json: CubismMotionJson = new CubismMotionJson(motionJson, size);
this._motionData.duration = json.getMotionDuration(); this._motionData.duration = json.getMotionDuration();
this._motionData.loop = json.isMotionLoop(); this._motionData.loop = json.isMotionLoop();
this._motionData.curveCount = json.getMotionCurveCount(); this._motionData.curveCount = json.getMotionCurveCount();
this._motionData.fps = json.getMotionFps(); this._motionData.fps = json.getMotionFps();
this._motionData.eventCount = json.getEventCount(); this._motionData.eventCount = json.getEventCount();
if (json.isExistMotionFadeInTime()) if (json.isExistMotionFadeInTime())
{ {
this._fadeInSeconds = (json.getMotionFadeInTime() < 0.0) this._fadeInSeconds = (json.getMotionFadeInTime() < 0.0)
@ -625,10 +625,10 @@ export namespace Live2DCubismFramework
this._motionData.segments.updateSize(json.getMotionTotalSegmentCount(), CubismMotionSegment, true); this._motionData.segments.updateSize(json.getMotionTotalSegmentCount(), CubismMotionSegment, true);
this._motionData.points.updateSize(json.getMotionTotalPointCount(), CubismMotionPoint, true); this._motionData.points.updateSize(json.getMotionTotalPointCount(), CubismMotionPoint, true);
this._motionData.events.updateSize(this._motionData.eventCount, CubismMotionEvent, true); this._motionData.events.updateSize(this._motionData.eventCount, CubismMotionEvent, true);
let totalPointCount: number = 0; let totalPointCount: number = 0;
let totalSegmentCount: number = 0; let totalSegmentCount: number = 0;
// Curves // Curves
for (let curveCount: number = 0; curveCount < this._motionData.curveCount; ++curveCount) for (let curveCount: number = 0; curveCount < this._motionData.curveCount; ++curveCount)
{ {
@ -648,7 +648,7 @@ export namespace Live2DCubismFramework
this._motionData.curves.at(curveCount).id = json.getMotionCurveId(curveCount); this._motionData.curves.at(curveCount).id = json.getMotionCurveId(curveCount);
this._motionData.curves.at(curveCount).baseSegmentIndex = totalSegmentCount; this._motionData.curves.at(curveCount).baseSegmentIndex = totalSegmentCount;
this._motionData.curves.at(curveCount).fadeInTime = this._motionData.curves.at(curveCount).fadeInTime =
(json.isExistMotionCurveFadeInTime(curveCount)) (json.isExistMotionCurveFadeInTime(curveCount))
? json.getMotionCurveFadeInTime(curveCount) ? json.getMotionCurveFadeInTime(curveCount)
@ -664,10 +664,10 @@ export namespace Live2DCubismFramework
if (segmentPosition == 0) if (segmentPosition == 0)
{ {
this._motionData.segments.at(totalSegmentCount).basePointIndex = totalPointCount; this._motionData.segments.at(totalSegmentCount).basePointIndex = totalPointCount;
this._motionData.points.at(totalPointCount).time = json.getMotionCurveSegment(curveCount, segmentPosition); this._motionData.points.at(totalPointCount).time = json.getMotionCurveSegment(curveCount, segmentPosition);
this._motionData.points.at(totalPointCount).value = json.getMotionCurveSegment(curveCount, segmentPosition + 1); this._motionData.points.at(totalPointCount).value = json.getMotionCurveSegment(curveCount, segmentPosition + 1);
totalPointCount += 1; totalPointCount += 1;
segmentPosition += 2; segmentPosition += 2;
} }
@ -679,24 +679,24 @@ export namespace Live2DCubismFramework
const segment: number = json.getMotionCurveSegment(curveCount, segmentPosition); const segment: number = json.getMotionCurveSegment(curveCount, segmentPosition);
switch (segment) switch (segment)
{ {
case CubismMotionSegmentType.CubismMotionSegmentType_Linear: case CubismMotionSegmentType.CubismMotionSegmentType_Linear:
{ {
this._motionData.segments.at(totalSegmentCount).segmentType = CubismMotionSegmentType.CubismMotionSegmentType_Linear; this._motionData.segments.at(totalSegmentCount).segmentType = CubismMotionSegmentType.CubismMotionSegmentType_Linear;
this._motionData.segments.at(totalSegmentCount).evaluate = linearEvaluate; this._motionData.segments.at(totalSegmentCount).evaluate = linearEvaluate;
this._motionData.points.at(totalPointCount).time = json.getMotionCurveSegment(curveCount, (segmentPosition + 1)); this._motionData.points.at(totalPointCount).time = json.getMotionCurveSegment(curveCount, (segmentPosition + 1));
this._motionData.points.at(totalPointCount).value = json.getMotionCurveSegment(curveCount, (segmentPosition + 2)); this._motionData.points.at(totalPointCount).value = json.getMotionCurveSegment(curveCount, (segmentPosition + 2));
totalPointCount += 1; totalPointCount += 1;
segmentPosition += 3; segmentPosition += 3;
break; break;
} }
case CubismMotionSegmentType.CubismMotionSegmentType_Bezier: case CubismMotionSegmentType.CubismMotionSegmentType_Bezier:
{ {
this._motionData.segments.at(totalSegmentCount).segmentType = CubismMotionSegmentType.CubismMotionSegmentType_Bezier; this._motionData.segments.at(totalSegmentCount).segmentType = CubismMotionSegmentType.CubismMotionSegmentType_Bezier;
this._motionData.segments.at(totalSegmentCount).evaluate = bezierEvaluate; this._motionData.segments.at(totalSegmentCount).evaluate = bezierEvaluate;
this._motionData.points.at(totalPointCount).time = json.getMotionCurveSegment(curveCount, (segmentPosition + 1)); this._motionData.points.at(totalPointCount).time = json.getMotionCurveSegment(curveCount, (segmentPosition + 1));
this._motionData.points.at(totalPointCount).value = json.getMotionCurveSegment(curveCount, (segmentPosition + 2)); this._motionData.points.at(totalPointCount).value = json.getMotionCurveSegment(curveCount, (segmentPosition + 2));
@ -705,38 +705,38 @@ export namespace Live2DCubismFramework
this._motionData.points.at(totalPointCount + 2).time = json.getMotionCurveSegment(curveCount, (segmentPosition + 5)); this._motionData.points.at(totalPointCount + 2).time = json.getMotionCurveSegment(curveCount, (segmentPosition + 5));
this._motionData.points.at(totalPointCount + 2).value = json.getMotionCurveSegment(curveCount, (segmentPosition + 6)); this._motionData.points.at(totalPointCount + 2).value = json.getMotionCurveSegment(curveCount, (segmentPosition + 6));
totalPointCount += 3; totalPointCount += 3;
segmentPosition += 7; segmentPosition += 7;
break; break;
} }
case CubismMotionSegmentType.CubismMotionSegmentType_Stepped: case CubismMotionSegmentType.CubismMotionSegmentType_Stepped:
{ {
this._motionData.segments.at(totalSegmentCount).segmentType = CubismMotionSegmentType.CubismMotionSegmentType_Stepped; this._motionData.segments.at(totalSegmentCount).segmentType = CubismMotionSegmentType.CubismMotionSegmentType_Stepped;
this._motionData.segments.at(totalSegmentCount).evaluate = steppedEvaluate; this._motionData.segments.at(totalSegmentCount).evaluate = steppedEvaluate;
this._motionData.points.at(totalPointCount).time = json.getMotionCurveSegment(curveCount, (segmentPosition + 1)); this._motionData.points.at(totalPointCount).time = json.getMotionCurveSegment(curveCount, (segmentPosition + 1));
this._motionData.points.at(totalPointCount).value = json.getMotionCurveSegment(curveCount, (segmentPosition + 2)); this._motionData.points.at(totalPointCount).value = json.getMotionCurveSegment(curveCount, (segmentPosition + 2));
totalPointCount += 1; totalPointCount += 1;
segmentPosition += 3; segmentPosition += 3;
break; break;
} }
case CubismMotionSegmentType.CubismMotionSegmentType_InverseStepped: case CubismMotionSegmentType.CubismMotionSegmentType_InverseStepped:
{ {
this._motionData.segments.at(totalSegmentCount).segmentType = CubismMotionSegmentType.CubismMotionSegmentType_InverseStepped; this._motionData.segments.at(totalSegmentCount).segmentType = CubismMotionSegmentType.CubismMotionSegmentType_InverseStepped;
this._motionData.segments.at(totalSegmentCount).evaluate = inverseSteppedEvaluate; this._motionData.segments.at(totalSegmentCount).evaluate = inverseSteppedEvaluate;
this._motionData.points.at(totalPointCount).time = json.getMotionCurveSegment(curveCount, (segmentPosition + 1)); this._motionData.points.at(totalPointCount).time = json.getMotionCurveSegment(curveCount, (segmentPosition + 1));
this._motionData.points.at(totalPointCount).value = json.getMotionCurveSegment(curveCount, (segmentPosition + 2)); this._motionData.points.at(totalPointCount).value = json.getMotionCurveSegment(curveCount, (segmentPosition + 2));
totalPointCount += 1; totalPointCount += 1;
segmentPosition += 3; segmentPosition += 3;
break; break;
} }
default: default:
@ -756,7 +756,7 @@ export namespace Live2DCubismFramework
this._motionData.events.at(userdatacount).fireTime = json.getEventTime(userdatacount); this._motionData.events.at(userdatacount).fireTime = json.getEventTime(userdatacount);
this._motionData.events.at(userdatacount).value = json.getEventValue(userdatacount); this._motionData.events.at(userdatacount).value = json.getEventValue(userdatacount);
} }
json.release(); json.release();
json = void 0; json = void 0;
json = null; json = null;
@ -774,7 +774,7 @@ export namespace Live2DCubismFramework
public getFiredEvent(beforeCheckTimeSeconds: number, motionTimeSeconds: number): csmVector<csmString> public getFiredEvent(beforeCheckTimeSeconds: number, motionTimeSeconds: number): csmVector<csmString>
{ {
this._firedEventValues.updateSize(0); this._firedEventValues.updateSize(0);
// イベントの発火チェック // イベントの発火チェック
for (let u: number = 0; u < this._motionData.eventCount; ++u) for (let u: number = 0; u < this._motionData.eventCount; ++u)
{ {
@ -795,11 +795,11 @@ export namespace Live2DCubismFramework
public _lastWeight: number; // 最後に設定された重み public _lastWeight: number; // 最後に設定された重み
public _motionData: CubismMotionData; // 実際のモーションデータ本体 public _motionData: CubismMotionData; // 実際のモーションデータ本体
public _eyeBlinkParameterIds: csmVector<CubismIdHandle>; // 自動まばたきを適用するパラメータIDハンドルのリスト。 モデル(モデルセッティング)とパラメータを対応付ける。 public _eyeBlinkParameterIds: csmVector<CubismIdHandle>; // 自動まばたきを適用するパラメータIDハンドルのリスト。 モデル(モデルセッティング)とパラメータを対応付ける。
public _lipSyncParameterIds: csmVector<CubismIdHandle>; // リップシンクを適用するパラメータIDハンドルのリスト。 モデル(モデルセッティング)とパラメータを対応付ける。 public _lipSyncParameterIds: csmVector<CubismIdHandle>; // リップシンクを適用するパラメータIDハンドルのリスト。 モデル(モデルセッティング)とパラメータを対応付ける。
public _modelCurveIdEyeBlink: CubismIdHandle; // モデルが持つ自動まばたき用パラメータIDのハンドル。 モデルとモーションを対応付ける。 public _modelCurveIdEyeBlink: CubismIdHandle; // モデルが持つ自動まばたき用パラメータIDのハンドル。 モデルとモーションを対応付ける。
public _modelCurveIdLipSync: CubismIdHandle; // モデルが持つリップシンク用パラメータIDのハンドル。 モデルとモーションを対応付ける。 public _modelCurveIdLipSync: CubismIdHandle; // モデルが持つリップシンク用パラメータIDのハンドル。 モデルとモーションを対応付ける。
} }
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as cubismid} from '../id/cubismid'; import {Live2DCubismFramework as cubismid} from '../id/cubismid';
@ -16,7 +16,7 @@ export namespace Live2DCubismFramework
{ {
/** /**
* @brief * @brief
* *
* *
*/ */
export enum CubismMotionCurveTarget export enum CubismMotionCurveTarget
@ -29,7 +29,7 @@ export namespace Live2DCubismFramework
/** /**
* @brief * @brief
* *
* *
*/ */
export enum CubismMotionSegmentType export enum CubismMotionSegmentType
@ -42,7 +42,7 @@ export namespace Live2DCubismFramework
/** /**
* @brief * @brief
* *
* *
*/ */
export class CubismMotionPoint export class CubismMotionPoint
@ -54,7 +54,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param points * @param points
* @param time [] * @param time []
*/ */
@ -68,14 +68,14 @@ export namespace Live2DCubismFramework
/** /**
* @brief * @brief
* *
* *
*/ */
export class CubismMotionSegment export class CubismMotionSegment
{ {
/** /**
* @brief * @brief
* *
* *
*/ */
public constructor() public constructor()
@ -92,7 +92,7 @@ export namespace Live2DCubismFramework
/** /**
* @brief * @brief
* *
* *
*/ */
export class CubismMotionCurve export class CubismMotionCurve
@ -125,7 +125,7 @@ export namespace Live2DCubismFramework
/** /**
* @brief * @brief
* *
* *
*/ */
export class CubismMotionData export class CubismMotionData
@ -154,4 +154,4 @@ export namespace Live2DCubismFramework
points: csmVector<CubismMotionPoint>; // ポイントのリスト points: csmVector<CubismMotionPoint>; // ポイントのリスト
events: csmVector<CubismMotionEvent>; // イベントのリスト events: csmVector<CubismMotionEvent>; // イベントのリスト
}; };
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as cubismjson} from '../utils/cubismjson'; import {Live2DCubismFramework as cubismjson} from '../utils/cubismjson';
@ -104,7 +104,7 @@ export namespace Live2DCubismFramework
{ {
return this._json.getRoot().getValueByString(Meta).getValueByString(TotalSegmentCount).toInt(); return this._json.getRoot().getValueByString(Meta).getValueByString(TotalSegmentCount).toInt();
} }
/** /**
* *
* @return * @return
@ -275,4 +275,4 @@ export namespace Live2DCubismFramework
_json: CubismJson; // motion3.jsonのデータ _json: CubismJson; // motion3.jsonのデータ
} }
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as cubismmotionqueuemanager} from "./cubismmotionqueuemanager"; import {Live2DCubismFramework as cubismmotionqueuemanager} from "./cubismmotionqueuemanager";
@ -17,7 +17,7 @@ export namespace Live2DCubismFramework
{ {
/** /**
* *
* *
* *
*/ */
export class CubismMotionManager extends CubismMotionQueueManager export class CubismMotionManager extends CubismMotionQueueManager
@ -92,7 +92,7 @@ export namespace Live2DCubismFramework
this._userTimeSeconds += deltaTimeSeconds; this._userTimeSeconds += deltaTimeSeconds;
const updated: boolean = super.doUpdateMotion(model, this._userTimeSeconds); const updated: boolean = super.doUpdateMotion(model, this._userTimeSeconds);
if(this.isFinished()) if(this.isFinished())
{ {
this._currentPriority = 0; // 再生中のモーションの優先度を解除 this._currentPriority = 0; // 再生中のモーションの優先度を解除
@ -123,5 +123,5 @@ export namespace Live2DCubismFramework
_currentPriority: number; // 現在再生中のモーションの優先度 _currentPriority: number; // 現在再生中のモーションの優先度
_reservePriority: number; // 再生予定のモーションの優先度。再生中は0になる。モーションファイルを別スレッドで読み込むときの機能。 _reservePriority: number; // 再生予定のモーションの優先度。再生中は0になる。モーションファイルを別スレッドで読み込むときの機能。
} }
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as acubismmotion} from './acubismmotion'; import {Live2DCubismFramework as acubismmotion} from './acubismmotion';
@ -64,7 +64,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @return true * @return true
* @return false * @return false
*/ */
@ -184,7 +184,7 @@ export namespace Live2DCubismFramework
this._stateTimeSeconds = timeSeconds; this._stateTimeSeconds = timeSeconds;
this._stateWeight = weight; this._stateWeight = weight;
} }
/** /**
* *
* @return [] * @return []
@ -205,7 +205,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @return [] * @return []
*/ */
public getLastCheckEventTime(): number public getLastCheckEventTime(): number
@ -237,4 +237,4 @@ export namespace Live2DCubismFramework
_motionQueueEntryHandle: CubismMotionQueueEntryHandle; // インスタンスごとに一意の値を持つ識別番号 _motionQueueEntryHandle: CubismMotionQueueEntryHandle; // インスタンスごとに一意の値を持つ識別番号
} }
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as acubismmotion} from './acubismmotion'; import {Live2DCubismFramework as acubismmotion} from './acubismmotion';
@ -216,7 +216,7 @@ export namespace Live2DCubismFramework
{ {
continue; continue;
} }
if(motionQueueEntry._motionQueueEntryHandle == motionQueueEntryNumber) if(motionQueueEntry._motionQueueEntryHandle == motionQueueEntryNumber)
{ {
return motionQueueEntry; return motionQueueEntry;
@ -228,7 +228,7 @@ export namespace Live2DCubismFramework
/** /**
* Callback * Callback
* *
* @param callback * @param callback
* @param customData * @param customData
*/ */
@ -281,7 +281,7 @@ export namespace Live2DCubismFramework
// ------ ユーザトリガーイベントを検査する ---- // ------ ユーザトリガーイベントを検査する ----
const firedList: csmVector<csmString> = motion.getFiredEvent( const firedList: csmVector<csmString> = motion.getFiredEvent(
motionQueueEntry.getLastCheckEventTime() - motionQueueEntry.getStartTime(), motionQueueEntry.getLastCheckEventTime() - motionQueueEntry.getStartTime(),
userTimeSeconds - motionQueueEntry.getStartTime() userTimeSeconds - motionQueueEntry.getStartTime()
); );
@ -318,7 +318,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* *
* @param caller CubismMotionQueueManager * @param caller CubismMotionQueueManager
* @param eventValue * @param eventValue
@ -335,9 +335,9 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* *
*/ */
export declare type CubismMotionQueueEntryHandle = any; export declare type CubismMotionQueueEntryHandle = any;
export const InvalidMotionQueueEntryHandleValue: CubismMotionQueueEntryHandle = -1; export const InvalidMotionQueueEntryHandleValue: CubismMotionQueueEntryHandle = -1;
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as cubismphysicsinternal} from './cubismphysicsinternal'; import {Live2DCubismFramework as cubismphysicsinternal} from './cubismphysicsinternal';
@ -30,13 +30,13 @@ export namespace Live2DCubismFramework
const PhysicsTypeTagX: string = "X"; const PhysicsTypeTagX: string = "X";
const PhysicsTypeTagY: string = "Y"; const PhysicsTypeTagY: string = "Y";
const PhysicsTypeTagAngle: string = "Angle"; const PhysicsTypeTagAngle: string = "Angle";
/// Constant of air resistance. /// Constant of air resistance.
const AirResistance: number = 5.0; const AirResistance: number = 5.0;
/// Constant of maximum weight of input and output ratio. /// Constant of maximum weight of input and output ratio.
const MaximumWeight: number = 100.0; const MaximumWeight: number = 100.0;
/// Constant of threshold of movement. /// Constant of threshold of movement.
const MovementThreshold: number = 0.001; const MovementThreshold: number = 0.001;
@ -90,7 +90,7 @@ export namespace Live2DCubismFramework
let currentInput: CubismPhysicsInput[]; let currentInput: CubismPhysicsInput[];
let currentOutput: CubismPhysicsOutput[]; let currentOutput: CubismPhysicsOutput[];
let currentParticles: CubismPhysicsParticle[]; let currentParticles: CubismPhysicsParticle[];
let parameterValue: Float32Array; let parameterValue: Float32Array;
let parameterMaximumValue: Float32Array; let parameterMaximumValue: Float32Array;
let parameterMinimumValue: Float32Array; let parameterMinimumValue: Float32Array;
@ -139,7 +139,7 @@ export namespace Live2DCubismFramework
totalTranslation.x = (totalTranslation.x * CubismMath.cos(radAngle) - totalTranslation.y * CubismMath.sin(radAngle)); totalTranslation.x = (totalTranslation.x * CubismMath.cos(radAngle) - totalTranslation.y * CubismMath.sin(radAngle));
totalTranslation.y = (totalTranslation.x * CubismMath.sin(radAngle) + totalTranslation.y * CubismMath.cos(radAngle)); totalTranslation.y = (totalTranslation.x * CubismMath.sin(radAngle) + totalTranslation.y * CubismMath.cos(radAngle));
// Calculate particles position. // Calculate particles position.
updateParticles( updateParticles(
currentParticles, currentParticles,
@ -251,7 +251,7 @@ export namespace Live2DCubismFramework
public parse(physicsJson: ArrayBuffer, size: number): void public parse(physicsJson: ArrayBuffer, size: number): void
{ {
this._physicsRig = new CubismPhysicsRig(); this._physicsRig = new CubismPhysicsRig();
let json: CubismPhysicsJson = new CubismPhysicsJson(physicsJson, size); let json: CubismPhysicsJson = new CubismPhysicsJson(physicsJson, size);
this._physicsRig.gravity = json.getGravity(); this._physicsRig.gravity = json.getGravity();
@ -278,7 +278,7 @@ export namespace Live2DCubismFramework
// Input // Input
this._physicsRig.settings.at(i).inputCount = json.getInputCount(i); this._physicsRig.settings.at(i).inputCount = json.getInputCount(i);
this._physicsRig.settings.at(i).baseInputIndex = inputIndex; this._physicsRig.settings.at(i).baseInputIndex = inputIndex;
for(let j: number = 0; j < this._physicsRig.settings.at(i).inputCount; ++j) for(let j: number = 0; j < this._physicsRig.settings.at(i).inputCount; ++j)
{ {
this._physicsRig.inputs.at(inputIndex + j).sourceParameterIndex = -1; this._physicsRig.inputs.at(inputIndex + j).sourceParameterIndex = -1;
@ -379,7 +379,7 @@ export namespace Live2DCubismFramework
{ {
currentSetting = this._physicsRig.settings.at(settingIndex); currentSetting = this._physicsRig.settings.at(settingIndex);
strand = this._physicsRig.particles.get(currentSetting.baseParticleIndex); strand = this._physicsRig.particles.get(currentSetting.baseParticleIndex);
// Initialize the top of particle. // Initialize the top of particle.
strand[0].initialPosition = new CubismVector2(0.0, 0.0); strand[0].initialPosition = new CubismVector2(0.0, 0.0);
strand[0].lastPosition = new CubismVector2(strand[0].initialPosition.x, strand[0].initialPosition.y); strand[0].lastPosition = new CubismVector2(strand[0].initialPosition.x, strand[0].initialPosition.y);
@ -387,7 +387,7 @@ export namespace Live2DCubismFramework
strand[0].lastGravity.y *= -1.0; strand[0].lastGravity.y *= -1.0;
strand[0].velocity = new CubismVector2(0.0, 0.0); strand[0].velocity = new CubismVector2(0.0, 0.0);
strand[0].force = new CubismVector2(0.0, 0.0); strand[0].force = new CubismVector2(0.0, 0.0);
// Initialize paritcles. // Initialize paritcles.
for (let i: number = 1; i < currentSetting.particleCount; ++i) for (let i: number = 1; i < currentSetting.particleCount; ++i)
{ {
@ -425,9 +425,9 @@ export namespace Live2DCubismFramework
/** /**
* Gets sign. * Gets sign.
* *
* @param value Evaluation target value. * @param value Evaluation target value.
* *
* @return Sign of value. * @return Sign of value.
*/ */
function sign(value: number): number function sign(value: number): number
@ -611,7 +611,7 @@ export namespace Live2DCubismFramework
/** /**
* Updates particles. * Updates particles.
* *
* @param strand Target array of particle. * @param strand Target array of particle.
* @param strandCount Count of particle. * @param strandCount Count of particle.
* @param totalTranslation Total translation value. * @param totalTranslation Total translation value.
@ -684,11 +684,11 @@ export namespace Live2DCubismFramework
strand[i].velocity = strand[i].velocity.divisionByScalar(delay); strand[i].velocity = strand[i].velocity.divisionByScalar(delay);
strand[i].velocity = strand[i].velocity.multiplyByScaler(strand[i].mobility); strand[i].velocity = strand[i].velocity.multiplyByScaler(strand[i].mobility);
} }
strand[i].force = new CubismVector2(0.0, 0.0); strand[i].force = new CubismVector2(0.0, 0.0);
strand[i].lastGravity = new CubismVector2(currentGravity.x, currentGravity.y); strand[i].lastGravity = new CubismVector2(currentGravity.x, currentGravity.y);
} }
} }
/** /**
@ -708,9 +708,9 @@ export namespace Live2DCubismFramework
let outputScale: number; let outputScale: number;
let value: number; let value: number;
let weight: number; let weight: number;
outputScale = output.getScale(output.translationScale, output.angleScale); outputScale = output.getScale(output.translationScale, output.angleScale);
value = translation * outputScale; value = translation * outputScale;
if (value < parameterValueMinimum) if (value < parameterValueMinimum)
@ -719,7 +719,7 @@ export namespace Live2DCubismFramework
{ {
output.valueBelowMinimum = value; output.valueBelowMinimum = value;
} }
value = parameterValueMinimum; value = parameterValueMinimum;
} }
else if (value > parameterValueMaximum) else if (value > parameterValueMaximum)
@ -728,7 +728,7 @@ export namespace Live2DCubismFramework
{ {
output.valueExceededMaximum = value; output.valueExceededMaximum = value;
} }
value = parameterValueMaximum; value = parameterValueMaximum;
} }
@ -798,7 +798,7 @@ export namespace Live2DCubismFramework
{ {
const nLength: number = minNormValue - middleNormValue; const nLength: number = minNormValue - middleNormValue;
const pLength: number = minValue - middleValue; const pLength: number = minValue - middleValue;
if(pLength != 0.0) if(pLength != 0.0)
{ {
result = paramValue * (nLength / pLength); result = paramValue * (nLength / pLength);
@ -823,4 +823,4 @@ export namespace Live2DCubismFramework
? result ? result
: (result * -1.0); : (result * -1.0);
} }
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as cubismvector2} from '../math/cubismvector2'; import {Live2DCubismFramework as cubismvector2} from '../math/cubismvector2';
@ -34,7 +34,7 @@ export namespace Live2DCubismFramework
/** /**
* @brief 使 * @brief 使
* *
* 使 * 使
*/ */
export class PhysicsJsonEffectiveForces export class PhysicsJsonEffectiveForces
@ -174,7 +174,7 @@ export namespace Live2DCubismFramework
translationScale: CubismVector2, translationScale: CubismVector2,
angleScale: number angleScale: number
): number; ): number;
} }
/** /**
* *
@ -195,7 +195,7 @@ export namespace Live2DCubismFramework
/** /**
* @brief * @brief
* *
* *
*/ */
export class CubismPhysicsOutput export class CubismPhysicsOutput
@ -222,7 +222,7 @@ export namespace Live2DCubismFramework
/** /**
* @brief * @brief
* *
* *
*/ */
export class CubismPhysicsRig export class CubismPhysicsRig
@ -245,4 +245,4 @@ export namespace Live2DCubismFramework
gravity: CubismVector2; ///< 重力 gravity: CubismVector2; ///< 重力
wind: CubismVector2; ///< 風 wind: CubismVector2; ///< 風
}; };
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as cubismjson} from '../utils/cubismjson'; import {Live2DCubismFramework as cubismjson} from '../utils/cubismjson';
@ -115,7 +115,7 @@ export namespace Live2DCubismFramework
{ {
return this._json.getRoot().getValueByString(Meta).getValueByString(PhysicsSettingCount).toInt(); return this._json.getRoot().getValueByString(Meta).getValueByString(PhysicsSettingCount).toInt();
} }
/** /**
* *
* @return * @return
@ -142,7 +142,7 @@ export namespace Live2DCubismFramework
{ {
return this._json.getRoot().getValueByString(Meta).getValueByString(VertexCount).toInt(); return this._json.getRoot().getValueByString(Meta).getValueByString(VertexCount).toInt();
} }
/** /**
* *
* @param physicsSettingIndex * @param physicsSettingIndex
@ -404,4 +404,4 @@ export namespace Live2DCubismFramework
_json: CubismJson; // physics3.jsonデータ _json: CubismJson; // physics3.jsonデータ
} }
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as cubismmatrix44} from '../math/cubismmatrix44'; import {Live2DCubismFramework as cubismmatrix44} from '../math/cubismmatrix44';
@ -14,14 +14,14 @@ export namespace Live2DCubismFramework
{ {
/** /**
* *
* *
* *
*/ */
export abstract class CubismRenderer export abstract class CubismRenderer
{ {
/** /**
* *
* *
* @return * @return
*/ */
public static create(): CubismRenderer public static create(): CubismRenderer
@ -131,7 +131,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* 0.0~1.0(1.0) * 0.0~1.0(1.0)
* *
* @return RGBA * @return RGBA
*/ */
public getModelColor(): CubismTextureColor public getModelColor(): CubismTextureColor
@ -186,7 +186,7 @@ export namespace Live2DCubismFramework
{ {
this._anisortopy = n; this._anisortopy = n;
} }
/** /**
* *
* @return * @return
@ -237,10 +237,11 @@ export namespace Live2DCubismFramework
* @param uvArray uv * @param uvArray uv
* @param opacity * @param opacity
* @param colorBlendMode * @param colorBlendMode
* @param invertedMask 使使
*/ */
public abstract drawMesh(textureNo: number, indexCount: number, vertexCount: number, public abstract drawMesh(textureNo: number, indexCount: number, vertexCount: number,
indexArray: Uint16Array, vertexArray: Float32Array, uvArray: Float32Array, indexArray: Uint16Array, vertexArray: Float32Array, uvArray: Float32Array,
opacity: number, colorBlendMode: CubismBlendMode): void; opacity: number, colorBlendMode: CubismBlendMode, invertedMask: boolean): void;
/** /**
* *
@ -283,4 +284,4 @@ export namespace Live2DCubismFramework
B: number; // 青チャンネル B: number; // 青チャンネル
A: number; // αチャンネル A: number; // αチャンネル
} }
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as cubismframework} from "../live2dcubismframework"; import {Live2DCubismFramework as cubismframework} from "../live2dcubismframework";
@ -27,7 +27,7 @@ export namespace Live2DCubismFramework
{ {
const ColorChannelCount: number = 4; // 実験時に1チャンネルの場合は1、RGBだけの場合は3、アルファも含める場合は4 const ColorChannelCount: number = 4; // 実験時に1チャンネルの場合は1、RGBだけの場合は3、アルファも含める場合は4
const shaderCount: number = 7; // シェーダーの数 = マスク生成用 + (通常用 + 加算 + 乗算) * (マスク無の乗算済アルファ対応版 + マスク有の乗算済アルファ対応版) const shaderCount: number = 10; // シェーダーの数 = マスク生成用 + (通常用 + 加算 + 乗算) * (マスク無の乗算済アルファ対応版 + マスク有の乗算済アルファ対応版 + マスク有反転の乗算済アルファ対応版)
let s_instance: CubismShader_WebGL; let s_instance: CubismShader_WebGL;
let s_viewport: number[]; let s_viewport: number[];
let s_fbo: WebGLFramebuffer; let s_fbo: WebGLFramebuffer;
@ -49,7 +49,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* FrameBufferObject * FrameBufferObject
* *
* @return * @return
*/ */
public getMaskRenderTexture(): WebGLFramebuffer public getMaskRenderTexture(): WebGLFramebuffer
@ -454,7 +454,8 @@ export namespace Live2DCubismFramework
model.getDrawableVertices(clipDrawIndex), model.getDrawableVertices(clipDrawIndex),
model.getDrawableVertexUvs(clipDrawIndex), model.getDrawableVertexUvs(clipDrawIndex),
model.getDrawableOpacity(clipDrawIndex), model.getDrawableOpacity(clipDrawIndex),
CubismBlendMode.CubismBlendMode_Normal // クリッピングは通常描画を強制 CubismBlendMode.CubismBlendMode_Normal, // クリッピングは通常描画を強制
false // マスク生成時はクリッピングの反転使用は全く関係がない
); );
} }
} }
@ -482,7 +483,7 @@ export namespace Live2DCubismFramework
{ {
let clippingContext: CubismClippingContext = this._clippingContextListForMask.at(i); let clippingContext: CubismClippingContext = this._clippingContextListForMask.at(i);
const count: number = clippingContext._clippingIdCount; const count: number = clippingContext._clippingIdCount;
// 個数が違う場合は別物 // 個数が違う場合は別物
if(count != drawableMaskCounts) if(count != drawableMaskCounts)
{ {
@ -495,7 +496,7 @@ export namespace Live2DCubismFramework
for(let j: number = 0; j < count; j++) for(let j: number = 0; j < count; j++)
{ {
const clipId: number = clippingContext._clippingIdList[j]; const clipId: number = clippingContext._clippingIdList[j];
for(let k: number = 0; k < count; k++) for(let k: number = 0; k < count; k++)
{ {
if(drawableMasks[k] == clipId) if(drawableMasks[k] == clipId)
@ -519,7 +520,7 @@ export namespace Live2DCubismFramework
* *
* 使 * 使
* 4RGBA56RGBA2,2,1,1 * 4RGBA56RGBA2,2,1,1
* *
* @param usingClipCount * @param usingClipCount
*/ */
public setupLayoutBounds(usingClipCount: number): void public setupLayoutBounds(usingClipCount: number): void
@ -752,7 +753,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param drawableIndex * @param drawableIndex
*/ */
public addClippedDrawable(drawableIndex: number) public addClippedDrawable(drawableIndex: number)
@ -849,6 +850,7 @@ export namespace Live2DCubismFramework
* @param baseColor * @param baseColor
* @param isPremultipliedAlpha * @param isPremultipliedAlpha
* @param matrix4x4 Model-View-Projection * @param matrix4x4 Model-View-Projection
* @param invertedMask 使
*/ */
public setupShaderProgram(renderer: CubismRenderer_WebGL, public setupShaderProgram(renderer: CubismRenderer_WebGL,
textureId: WebGLTexture, textureId: WebGLTexture,
@ -865,7 +867,8 @@ export namespace Live2DCubismFramework
colorBlendMode: CubismBlendMode, colorBlendMode: CubismBlendMode,
baseColor: CubismTextureColor, baseColor: CubismTextureColor,
isPremultipliedAlpha: boolean, isPremultipliedAlpha: boolean,
matrix4x4: CubismMatrix44): void matrix4x4: CubismMatrix44,
invertedMask: boolean): void
{ {
if(!isPremultipliedAlpha) if(!isPremultipliedAlpha)
{ {
@ -938,7 +941,7 @@ export namespace Live2DCubismFramework
else // マスク生成以外の場合 else // マスク生成以外の場合
{ {
const masked: boolean = renderer.getClippingContextBufferForDraw() != null; // この描画オブジェクトはマスク対象か const masked: boolean = renderer.getClippingContextBufferForDraw() != null; // この描画オブジェクトはマスク対象か
const offset: number = (masked ? 1 : 0); const offset: number = (masked ? (invertedMask ? 2 : 1) : 0);
let shaderSet: CubismShaderSet = new CubismShaderSet(); let shaderSet: CubismShaderSet = new CubismShaderSet();
@ -960,7 +963,7 @@ export namespace Live2DCubismFramework
SRC_ALPHA = this.gl.ZERO; SRC_ALPHA = this.gl.ZERO;
DST_ALPHA = this.gl.ONE; DST_ALPHA = this.gl.ONE;
break; break;
case CubismBlendMode.CubismBlendMode_Multiplicative: case CubismBlendMode.CubismBlendMode_Multiplicative:
shaderSet = this._shaderSets.at(ShaderNames.ShaderNames_MultPremultipliedAlpha + offset); shaderSet = this._shaderSets.at(ShaderNames.ShaderNames_MultPremultipliedAlpha + offset);
SRC_COLOR = this.gl.DST_COLOR; SRC_COLOR = this.gl.DST_COLOR;
@ -1015,7 +1018,7 @@ export namespace Live2DCubismFramework
// 座標変換 // 座標変換
this.gl.uniformMatrix4fv(shaderSet.uniformMatrixLocation, false, matrix4x4.getArray()); this.gl.uniformMatrix4fv(shaderSet.uniformMatrixLocation, false, matrix4x4.getArray());
this.gl.uniform4f(shaderSet.uniformBaseColorLocation, baseColor.R, baseColor.G, baseColor.B, baseColor.A); this.gl.uniform4f(shaderSet.uniformBaseColorLocation, baseColor.R, baseColor.G, baseColor.B, baseColor.A);
} }
@ -1056,17 +1059,20 @@ export namespace Live2DCubismFramework
} }
this._shaderSets.at(0).shaderProgram = this.loadShaderProgram(vertexShaderSrcSetupMask, fragmentShaderSrcsetupMask); this._shaderSets.at(0).shaderProgram = this.loadShaderProgram(vertexShaderSrcSetupMask, fragmentShaderSrcsetupMask);
this._shaderSets.at(1).shaderProgram = this.loadShaderProgram(vertexShaderSrc, fragmentShaderSrcPremultipliedAlpha); this._shaderSets.at(1).shaderProgram = this.loadShaderProgram(vertexShaderSrc, fragmentShaderSrcPremultipliedAlpha);
this._shaderSets.at(2).shaderProgram = this.loadShaderProgram(vertexShaderSrcMasked, fragmentShaderSrcMaskPremultipliedAlpha); this._shaderSets.at(2).shaderProgram = this.loadShaderProgram(vertexShaderSrcMasked, fragmentShaderSrcMaskPremultipliedAlpha);
this._shaderSets.at(3).shaderProgram = this.loadShaderProgram(vertexShaderSrcMasked, fragmentShaderSrcMaskInvertedPremultipliedAlpha);
// 加算も通常と同じシェーダーを利用する // 加算も通常と同じシェーダーを利用する
this._shaderSets.at(3).shaderProgram = this._shaderSets.at(1).shaderProgram; this._shaderSets.at(4).shaderProgram = this._shaderSets.at(1).shaderProgram;
this._shaderSets.at(4).shaderProgram = this._shaderSets.at(2).shaderProgram; this._shaderSets.at(5).shaderProgram = this._shaderSets.at(2).shaderProgram;
this._shaderSets.at(6).shaderProgram = this._shaderSets.at(3).shaderProgram;
// 乗算も通常と同じシェーダーを利用する // 乗算も通常と同じシェーダーを利用する
this._shaderSets.at(5).shaderProgram = this._shaderSets.at(1).shaderProgram; this._shaderSets.at(7).shaderProgram = this._shaderSets.at(1).shaderProgram;
this._shaderSets.at(6).shaderProgram = this._shaderSets.at(2).shaderProgram; this._shaderSets.at(8).shaderProgram = this._shaderSets.at(2).shaderProgram;
this._shaderSets.at(9).shaderProgram = this._shaderSets.at(3).shaderProgram;
// SetupMask // SetupMask
this._shaderSets.at(0).attributePositionLocation = this.gl.getAttribLocation(this._shaderSets.at(0).shaderProgram, "a_position"); this._shaderSets.at(0).attributePositionLocation = this.gl.getAttribLocation(this._shaderSets.at(0).shaderProgram, "a_position");
@ -1093,31 +1099,34 @@ export namespace Live2DCubismFramework
this._shaderSets.at(2).uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets.at(2).shaderProgram, "u_channelFlag"); this._shaderSets.at(2).uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets.at(2).shaderProgram, "u_channelFlag");
this._shaderSets.at(2).uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets.at(2).shaderProgram, "u_baseColor"); this._shaderSets.at(2).uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets.at(2).shaderProgram, "u_baseColor");
// 加算(PremultipliedAlpha // 通常(クリッピング・反転, PremultipliedAlpha
this._shaderSets.at(3).attributePositionLocation = this.gl.getAttribLocation(this._shaderSets.at(3).shaderProgram, "a_position"); this._shaderSets.at(3).attributePositionLocation = this.gl.getAttribLocation(this._shaderSets.at(3).shaderProgram, "a_position");
this._shaderSets.at(3).attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets.at(3).shaderProgram, "a_texCoord"); this._shaderSets.at(3).attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets.at(3).shaderProgram, "a_texCoord");
this._shaderSets.at(3).samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets.at(3).shaderProgram, "s_texture0"); this._shaderSets.at(3).samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets.at(3).shaderProgram, "s_texture0");
this._shaderSets.at(3).samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets.at(3).shaderProgram, "s_texture1");
this._shaderSets.at(3).uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(3).shaderProgram, "u_matrix"); this._shaderSets.at(3).uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(3).shaderProgram, "u_matrix");
this._shaderSets.at(3).uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(3).shaderProgram, "u_clipMatrix");
this._shaderSets.at(3).uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets.at(3).shaderProgram, "u_channelFlag");
this._shaderSets.at(3).uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets.at(3).shaderProgram, "u_baseColor"); this._shaderSets.at(3).uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets.at(3).shaderProgram, "u_baseColor");
// 加算(クリッピング、PremultipliedAlpha // 加算(PremultipliedAlpha
this._shaderSets.at(4).attributePositionLocation = this.gl.getAttribLocation(this._shaderSets.at(4).shaderProgram, "a_position"); this._shaderSets.at(4).attributePositionLocation = this.gl.getAttribLocation(this._shaderSets.at(4).shaderProgram, "a_position");
this._shaderSets.at(4).attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets.at(4).shaderProgram, "a_texCoord"); this._shaderSets.at(4).attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets.at(4).shaderProgram, "a_texCoord");
this._shaderSets.at(4).samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets.at(4).shaderProgram, "s_texture0"); this._shaderSets.at(4).samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets.at(4).shaderProgram, "s_texture0");
this._shaderSets.at(4).samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets.at(4).shaderProgram, "s_texture1");
this._shaderSets.at(4).uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(4).shaderProgram, "u_matrix"); this._shaderSets.at(4).uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(4).shaderProgram, "u_matrix");
this._shaderSets.at(4).uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(4).shaderProgram, "u_clipMatrix");
this._shaderSets.at(4).uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets.at(4).shaderProgram, "u_channelFlag");
this._shaderSets.at(4).uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets.at(4).shaderProgram, "u_baseColor"); this._shaderSets.at(4).uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets.at(4).shaderProgram, "u_baseColor");
// 乗算(PremultipliedAlpha // 加算(クリッピング、PremultipliedAlpha
this._shaderSets.at(5).attributePositionLocation = this.gl.getAttribLocation(this._shaderSets.at(5).shaderProgram, "a_position"); this._shaderSets.at(5).attributePositionLocation = this.gl.getAttribLocation(this._shaderSets.at(5).shaderProgram, "a_position");
this._shaderSets.at(5).attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets.at(5).shaderProgram, "a_texCoord"); this._shaderSets.at(5).attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets.at(5).shaderProgram, "a_texCoord");
this._shaderSets.at(5).samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets.at(5).shaderProgram, "s_texture0"); this._shaderSets.at(5).samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets.at(5).shaderProgram, "s_texture0");
this._shaderSets.at(5).samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets.at(5).shaderProgram, "s_texture1");
this._shaderSets.at(5).uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(5).shaderProgram, "u_matrix"); this._shaderSets.at(5).uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(5).shaderProgram, "u_matrix");
this._shaderSets.at(5).uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(5).shaderProgram, "u_clipMatrix");
this._shaderSets.at(5).uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets.at(5).shaderProgram, "u_channelFlag");
this._shaderSets.at(5).uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets.at(5).shaderProgram, "u_baseColor"); this._shaderSets.at(5).uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets.at(5).shaderProgram, "u_baseColor");
// 乗算(クリッピング、PremultipliedAlpha // 加算(クリッピング・反転、PremultipliedAlpha
this._shaderSets.at(6).attributePositionLocation = this.gl.getAttribLocation(this._shaderSets.at(6).shaderProgram, "a_position"); this._shaderSets.at(6).attributePositionLocation = this.gl.getAttribLocation(this._shaderSets.at(6).shaderProgram, "a_position");
this._shaderSets.at(6).attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets.at(6).shaderProgram, "a_texCoord"); this._shaderSets.at(6).attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets.at(6).shaderProgram, "a_texCoord");
this._shaderSets.at(6).samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets.at(6).shaderProgram, "s_texture0"); this._shaderSets.at(6).samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets.at(6).shaderProgram, "s_texture0");
@ -1126,6 +1135,33 @@ export namespace Live2DCubismFramework
this._shaderSets.at(6).uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(6).shaderProgram, "u_clipMatrix"); this._shaderSets.at(6).uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(6).shaderProgram, "u_clipMatrix");
this._shaderSets.at(6).uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets.at(6).shaderProgram, "u_channelFlag"); this._shaderSets.at(6).uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets.at(6).shaderProgram, "u_channelFlag");
this._shaderSets.at(6).uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets.at(6).shaderProgram, "u_baseColor"); this._shaderSets.at(6).uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets.at(6).shaderProgram, "u_baseColor");
// 乗算PremultipliedAlpha
this._shaderSets.at(7).attributePositionLocation = this.gl.getAttribLocation(this._shaderSets.at(7).shaderProgram, "a_position");
this._shaderSets.at(7).attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets.at(7).shaderProgram, "a_texCoord");
this._shaderSets.at(7).samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets.at(7).shaderProgram, "s_texture0");
this._shaderSets.at(7).uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(7).shaderProgram, "u_matrix");
this._shaderSets.at(7).uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets.at(7).shaderProgram, "u_baseColor");
// 乗算クリッピング、PremultipliedAlpha
this._shaderSets.at(8).attributePositionLocation = this.gl.getAttribLocation(this._shaderSets.at(8).shaderProgram, "a_position");
this._shaderSets.at(8).attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets.at(8).shaderProgram, "a_texCoord");
this._shaderSets.at(8).samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets.at(8).shaderProgram, "s_texture0");
this._shaderSets.at(8).samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets.at(8).shaderProgram, "s_texture1");
this._shaderSets.at(8).uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(8).shaderProgram, "u_matrix");
this._shaderSets.at(8).uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(8).shaderProgram, "u_clipMatrix");
this._shaderSets.at(8).uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets.at(8).shaderProgram, "u_channelFlag");
this._shaderSets.at(8).uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets.at(8).shaderProgram, "u_baseColor");
// 乗算クリッピング・反転、PremultipliedAlpha
this._shaderSets.at(9).attributePositionLocation = this.gl.getAttribLocation(this._shaderSets.at(9).shaderProgram, "a_position");
this._shaderSets.at(9).attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets.at(9).shaderProgram, "a_texCoord");
this._shaderSets.at(9).samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets.at(9).shaderProgram, "s_texture0");
this._shaderSets.at(9).samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets.at(9).shaderProgram, "s_texture1");
this._shaderSets.at(9).uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(9).shaderProgram, "u_matrix");
this._shaderSets.at(9).uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(9).shaderProgram, "u_clipMatrix");
this._shaderSets.at(9).uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets.at(9).shaderProgram, "u_channelFlag");
this._shaderSets.at(9).uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets.at(9).shaderProgram, "u_baseColor");
} }
/** /**
@ -1163,7 +1199,7 @@ export namespace Live2DCubismFramework
// link program // link program
this.gl.linkProgram(shaderProgram) this.gl.linkProgram(shaderProgram)
let linkStatus = this.gl.getProgramParameter(shaderProgram, this.gl.LINK_STATUS); let linkStatus = this.gl.getProgramParameter(shaderProgram, this.gl.LINK_STATUS);
// リンクに失敗したらシェーダーを削除 // リンクに失敗したらシェーダーを削除
if(!linkStatus) if(!linkStatus)
{ {
@ -1195,7 +1231,7 @@ export namespace Live2DCubismFramework
* *
* @param shaderType (Vertex/Fragment) * @param shaderType (Vertex/Fragment)
* @param shaderSource * @param shaderSource
* *
* @return * @return
*/ */
public compileShaderSource(shaderType: GLenum, shaderSource: string): WebGLProgram public compileShaderSource(shaderType: GLenum, shaderSource: string): WebGLProgram
@ -1205,7 +1241,7 @@ export namespace Live2DCubismFramework
let shader: WebGLProgram = this.gl.createShader(shaderType); let shader: WebGLProgram = this.gl.createShader(shaderType);
this.gl.shaderSource(shader, source); this.gl.shaderSource(shader, source);
this.gl.compileShader(shader); this.gl.compileShader(shader);
if(!shader) if(!shader)
{ {
let log: string = this.gl.getShaderInfoLog(shader); let log: string = this.gl.getShaderInfoLog(shader);
@ -1255,14 +1291,17 @@ export namespace Live2DCubismFramework
// Normal // Normal
ShaderNames_NormalPremultipliedAlpha, ShaderNames_NormalPremultipliedAlpha,
ShaderNames_NormalMaskedPremultipliedAlpha, ShaderNames_NormalMaskedPremultipliedAlpha,
ShaderNames_NomralMaskedInvertedPremultipliedAlpha,
// Add // Add
ShaderNames_AddPremultipliedAlpha, ShaderNames_AddPremultipliedAlpha,
ShaderNames_AddMaskedPremultipledAlpha, ShaderNames_AddMaskedPremultipliedAlpha,
ShaderNames_AddMaskedPremultipliedAlphaInverted,
// Mult // Mult
ShaderNames_MultPremultipliedAlpha, ShaderNames_MultPremultipliedAlpha,
ShaderNames_MultMaskedPremultipliedAlpha, ShaderNames_MultMaskedPremultipliedAlpha,
ShaderNames_MultMaskedPremultipliedAlphaInverted
}; };
export const vertexShaderSrcSetupMask = export const vertexShaderSrcSetupMask =
@ -1355,6 +1394,24 @@ export namespace Live2DCubismFramework
" gl_FragColor = col_formask;" + " gl_FragColor = col_formask;" +
"}"; "}";
// Normal & Add & Mult 共通クリッピングされて反転使用の描画用、PremultipliedAlphaの場合
export const fragmentShaderSrcMaskInvertedPremultipliedAlpha =
"precision mediump float;" +
"varying vec2 v_texCoord;" +
"varying vec4 v_clipPos;" +
"uniform sampler2D s_texture0;" +
"uniform sampler2D s_texture1;" +
"uniform vec4 u_channelFlag;" +
"uniform vec4 u_baseColor;" +
"void main()" +
"{" +
"vec4 col_formask = texture2D(s_texture0, v_texCoord) * u_baseColor;" +
"vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag;" +
"float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a;" +
"col_formask = col_formask * (1.0 - maskVal);" +
"gl_FragColor = col_formask;" +
"}";
/** /**
* WebGL * WebGL
*/ */
@ -1363,7 +1420,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* *
* @param model * @param model
*/ */
public initialize(model: CubismModel): void public initialize(model: CubismModel): void
@ -1532,7 +1589,8 @@ export namespace Live2DCubismFramework
this.getModel().getDrawableVertices(drawableIndex), this.getModel().getDrawableVertices(drawableIndex),
this.getModel().getDrawableVertexUvs(drawableIndex), this.getModel().getDrawableVertexUvs(drawableIndex),
this.getModel().getDrawableOpacity(drawableIndex), this.getModel().getDrawableOpacity(drawableIndex),
this.getModel().getDrawableBlendMode(drawableIndex) this.getModel().getDrawableBlendMode(drawableIndex),
this.getModel().getDrawableInvertedMaskBit(drawableIndex)
); );
} }
} }
@ -1549,10 +1607,11 @@ export namespace Live2DCubismFramework
* @param uvArray uv * @param uvArray uv
* @param opacity * @param opacity
* @param colorBlendMode * @param colorBlendMode
* @param invertedMask 使使
*/ */
public drawMesh(textureNo: number, indexCount: number, vertexCount: number, public drawMesh(textureNo: number, indexCount: number, vertexCount: number,
indexArray: Uint16Array, vertexArray: Float32Array, uvArray: Float32Array, indexArray: Uint16Array, vertexArray: Float32Array, uvArray: Float32Array,
opacity: number, colorBlendMode: CubismBlendMode): void opacity: number, colorBlendMode: CubismBlendMode, invertedMask: boolean): void
{ {
// 裏面描画の有効・無効 // 裏面描画の有効・無効
if(this.isCulling()) if(this.isCulling())
@ -1564,7 +1623,7 @@ export namespace Live2DCubismFramework
this.gl.disable(this.gl.CULL_FACE); this.gl.disable(this.gl.CULL_FACE);
} }
this.gl.frontFace(this.gl.CCW); // Cubism3 OpenGLはマスク・アートメッシュ共にCCWが表面 this.gl.frontFace(this.gl.CCW); // Cubism SDK OpenGLはマスク・アートメッシュ共にCCWが表面
let modelColorRGBA: CubismTextureColor = this.getModelColor(); let modelColorRGBA: CubismTextureColor = this.getModelColor();
@ -1596,9 +1655,9 @@ export namespace Live2DCubismFramework
this, drawtexture, vertexCount, vertexArray, indexArray, uvArray, this, drawtexture, vertexCount, vertexArray, indexArray, uvArray,
this._bufferData, this._bufferData,
opacity, colorBlendMode, modelColorRGBA, this.isPremultipliedAlpha(), opacity, colorBlendMode, modelColorRGBA, this.isPremultipliedAlpha(),
this.getMvpMatrix() this.getMvpMatrix(), invertedMask
); );
// ポリゴンメッシュを描画する // ポリゴンメッシュを描画する
this.gl.drawElements(this.gl.TRIANGLES, indexCount, this.gl.UNSIGNED_SHORT, 0); this.gl.drawElements(this.gl.TRIANGLES, indexCount, this.gl.UNSIGNED_SHORT, 0);
@ -1723,4 +1782,4 @@ export namespace Live2DCubismFramework
{ {
CubismRenderer_WebGL.doStaticRelease(); CubismRenderer_WebGL.doStaticRelease();
} }
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import { CubismLogDebug } from "../utils/cubismdebug"; import { CubismLogDebug } from "../utils/cubismdebug";
@ -22,13 +22,13 @@ export namespace Live2DCubismFramework
*/ */
public constructor(key?: _KeyT, value?: _ValT) public constructor(key?: _KeyT, value?: _ValT)
{ {
this.first = (key == undefined) this.first = (key == undefined)
? null ? null
: key; : key;
this.second = (value == undefined) this.second = (value == undefined)
? null ? null
: value; : value;
} }
public first: _KeyT; // keyとして用いる変数 public first: _KeyT; // keyとして用いる変数
@ -75,7 +75,7 @@ export namespace Live2DCubismFramework
{ {
this.clear(); this.clear();
} }
/** /**
* *
* @param key * @param key
@ -97,7 +97,7 @@ export namespace Live2DCubismFramework
public getValue(key: _KeyT): _ValT public getValue(key: _KeyT): _ValT
{ {
let found = -1; let found = -1;
for(let i: number = 0; i < this._size; i++) for(let i: number = 0; i < this._size; i++)
{ {
if(this._keyValues[i].first == key) if(this._keyValues[i].first == key)
@ -106,7 +106,7 @@ export namespace Live2DCubismFramework
break; break;
} }
} }
if(found >= 0) if(found >= 0)
{ {
return this._keyValues[found].second; return this._keyValues[found].second;
@ -117,7 +117,7 @@ export namespace Live2DCubismFramework
return this._keyValues[this._size - 1].second; return this._keyValues[this._size - 1].second;
} }
} }
/** /**
* [key](set) * [key](set)
* @param key Value * @param key Value
@ -126,7 +126,7 @@ export namespace Live2DCubismFramework
public setValue(key: _KeyT, value: _ValT): void public setValue(key: _KeyT, value: _ValT): void
{ {
let found = -1; let found = -1;
for(let i: number = 0; i < this._size; i++) for(let i: number = 0; i < this._size; i++)
{ {
if(this._keyValues[i].first == key) if(this._keyValues[i].first == key)
@ -135,7 +135,7 @@ export namespace Live2DCubismFramework
break; break;
} }
} }
if(found >= 0) if(found >= 0)
{ {
this._keyValues[found].second = value; this._keyValues[found].second = value;
@ -146,7 +146,7 @@ export namespace Live2DCubismFramework
this._keyValues[this._size - 1].second = value; this._keyValues[this._size - 1].second = value;
} }
} }
/** /**
* Key * Key
* @param key key * @param key key
@ -164,7 +164,7 @@ export namespace Live2DCubismFramework
} }
return false; return false;
} }
/** /**
* keyValue * keyValue
*/ */
@ -173,13 +173,13 @@ export namespace Live2DCubismFramework
this._keyValues = void 0; this._keyValues = void 0;
this._keyValues = null; this._keyValues = null;
this._keyValues = new Array(); this._keyValues = new Array();
this._size = 0; this._size = 0;
} }
/** /**
* *
* *
* @return * @return
*/ */
public getSize(): number public getSize(): number
@ -229,7 +229,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param ite * @param ite
*/ */
public erase(ite: iterator<_KeyT, _ValT>): iterator<_KeyT, _ValT> public erase(ite: iterator<_KeyT, _ValT>): iterator<_KeyT, _ValT>
@ -355,4 +355,4 @@ export namespace Live2DCubismFramework
_index: number; // コンテナのインデックス値 _index: number; // コンテナのインデックス値
_map: csmMap<_KeyT, _ValT>; // コンテナ _map: csmMap<_KeyT, _ValT>; // コンテナ
} }
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
export namespace Live2DCubismFramework export namespace Live2DCubismFramework
@ -89,4 +89,4 @@ export namespace Live2DCubismFramework
public width: number; // 幅 public width: number; // 幅
public height: number; // 高さ public height: number; // 高さ
} }
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
export namespace Live2DCubismFramework export namespace Live2DCubismFramework
@ -14,7 +14,7 @@ export namespace Live2DCubismFramework
{ {
/** /**
* *
* *
* @param c * @param c
* @return * @return
*/ */
@ -114,4 +114,4 @@ export namespace Live2DCubismFramework
s: string; s: string;
} }
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
export namespace Live2DCubismFramework export namespace Live2DCubismFramework
@ -74,7 +74,7 @@ export namespace Live2DCubismFramework
{ {
this.prepareCapacity(this._capacity == 0 ? csmVector.s_defaultSize : this._capacity * 2); this.prepareCapacity(this._capacity == 0 ? csmVector.s_defaultSize : this._capacity * 2);
} }
this._ptr[this._size++] = value; this._ptr[this._size++] = value;
} }
@ -132,7 +132,7 @@ export namespace Live2DCubismFramework
public updateSize(newSize: number, value: any = null, callPlacementNew: boolean = true): void public updateSize(newSize: number, value: any = null, callPlacementNew: boolean = true): void
{ {
let curSize: number = this._size; let curSize: number = this._size;
if(curSize < newSize) if(curSize < newSize)
{ {
this.prepareCapacity(newSize); // capacity更新 this.prepareCapacity(newSize); // capacity更新
@ -194,7 +194,7 @@ export namespace Live2DCubismFramework
this._ptr.splice(dstSi + i, 0, null); this._ptr.splice(dstSi + i, 0, null);
} }
} }
for(let i: number = srcSi; i < srcEi; i++, dstSi++) for(let i: number = srcSi; i < srcEi; i++, dstSi++)
{ {
this._ptr[dstSi] = begin._vector._ptr[i]; this._ptr[dstSi] = begin._vector._ptr[i];
@ -268,7 +268,7 @@ export namespace Live2DCubismFramework
*/ */
public begin(): iterator<T> public begin(): iterator<T>
{ {
let ite: iterator<T> = (this._size == 0) let ite: iterator<T> = (this._size == 0)
? this.end() ? this.end()
: new iterator<T>(this, 0); : new iterator<T>(this, 0);
return ite; return ite;
@ -329,7 +329,7 @@ export namespace Live2DCubismFramework
++this._index; ++this._index;
return this; return this;
} }
/** /**
* -- * --
*/ */
@ -390,4 +390,4 @@ export namespace Live2DCubismFramework
_index: number; // コンテナのインデックス値 _index: number; // コンテナのインデックス値
_vector: csmVector<T>; // コンテナ _vector: csmVector<T>; // コンテナ
} }
} }

View File

@ -1,15 +1,15 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as cubismframework, LogLevel} from "../live2dcubismframework"; import {Live2DCubismFramework as cubismframework, LogLevel} from "../live2dcubismframework";
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"; 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: LogLevel, fmt: string, args: any[]) => export const CubismLogPrint = (level: LogLevel, fmt: string, args: any[]) =>
{ {
Live2DCubismFramework.CubismDebug.print(level, "[CSM]" + fmt, args); Live2DCubismFramework.CubismDebug.print(level, "[CSM]" + fmt, args);
} }
@ -130,7 +130,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* CubismFramework.initialize() * CubismFramework.initialize()
* *
* @param logLevel * @param logLevel
* @param format * @param format
* @param args * @param args
@ -148,7 +148,7 @@ export namespace Live2DCubismFramework
if (!logPrint) if (!logPrint)
return; return;
let buffer: string = let buffer: string =
format.replace( format.replace(
/\{(\d+)\}/g, /\{(\d+)\}/g,
(m, k) => (m, k) =>
@ -162,7 +162,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* CubismFramework.initialize() * CubismFramework.initialize()
* *
* @param logLevel * @param logLevel
* @param data * @param data
* @param length * @param length
@ -175,7 +175,7 @@ export namespace Live2DCubismFramework
else if (i % 8 == 0 && i > 0) this.print(logLevel, " "); else if (i % 8 == 0 && i > 0) this.print(logLevel, " ");
this.print(logLevel, "{0} ", [(data[i] & 0xFF)]); this.print(logLevel, "{0} ", [(data[i] & 0xFF)]);
} }
this.print(logLevel, "\n"); this.print(logLevel, "\n");
} }
@ -189,4 +189,4 @@ export namespace Live2DCubismFramework
} }
} }
//------------ LIVE2D NAMESPACE ------------ //------------ LIVE2D NAMESPACE ------------

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as csmstring} from "../type/csmstring"; import {Live2DCubismFramework as csmstring} from "../type/csmstring";
@ -123,7 +123,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @return * @return
*/ */
public getKeys(): csmVector<string> public getKeys(): csmVector<string>
@ -228,7 +228,7 @@ export namespace Live2DCubismFramework
Value.s_dummyKeys = new csmVector<string>(); Value.s_dummyKeys = new csmVector<string>();
} }
/** /**
* *
*/ */
@ -259,7 +259,7 @@ export namespace Live2DCubismFramework
* AsciiJSON * AsciiJSON
* JSON * JSON
* (model3.json) * (model3.json)
* *
* [] * []
* ASCII * ASCII
* e * e
@ -283,7 +283,7 @@ export namespace Live2DCubismFramework
/** /**
* *
* *
* @param buffer * @param buffer
* @param size * @param size
* @return CubismJsonNULL * @return CubismJsonNULL
@ -293,7 +293,7 @@ export namespace Live2DCubismFramework
let json = new CubismJson(); let json = new CubismJson();
const succeeded: boolean = json.parseBytes(buffer, size); const succeeded: boolean = json.parseBytes(buffer, size);
if(!succeeded) if(!succeeded)
{ {
CubismJson.delete(json); CubismJson.delete(json);
return null; return null;
@ -306,7 +306,7 @@ export namespace Live2DCubismFramework
/** /**
* JSON * JSON
* *
* @param instance CubismJson * @param instance CubismJson
*/ */
public static delete(instance: CubismJson) public static delete(instance: CubismJson)
@ -324,7 +324,7 @@ export namespace Live2DCubismFramework
/** /**
* UnicodeString * UnicodeString
* *
* @param buffer * @param buffer
* @return * @return
*/ */
@ -385,7 +385,7 @@ export namespace Live2DCubismFramework
/** /**
* *
*/ */
public getParseError(): string public getParseError(): string
{ {
return this._error; return this._error;
} }
@ -411,7 +411,7 @@ export namespace Live2DCubismFramework
protected parseValue(buffer: string, length: number, begin: number, outEndPos: number[]) protected parseValue(buffer: string, length: number, begin: number, outEndPos: number[])
{ {
if (this._error) return null; if (this._error) return null;
let o: Value = null; let o: Value = null;
let i: number = begin; let i: number = begin;
let f: number; let f: number;
@ -486,7 +486,7 @@ export namespace Live2DCubismFramework
case ']': // 不正な}だがスキップする。配列の最後に不要な , があると思われる case ']': // 不正な}だがスキップする。配列の最後に不要な , があると思われる
outEndPos[0] = i; // 同じ文字を再処理 outEndPos[0] = i; // 同じ文字を再処理
return null; return null;
case '\n': case '\n':
this._lineCount++; this._lineCount++;
case ' ': case ' ':
case '\t': case '\t':
@ -502,7 +502,7 @@ export namespace Live2DCubismFramework
/** /**
* " * "
* *
* @param string -> * @param string ->
* @param length -> * @param length ->
* @param begin -> * @param begin ->
@ -525,7 +525,7 @@ export namespace Live2DCubismFramework
switch(c) switch(c)
{ {
case '\"': // 終端の”、エスケープ文字は別に処理されるのでここに来ない case '\"': // 終端の”、エスケープ文字は別に処理されるのでここに来ない
{ {
outEndPos[0] = i + 1; // ”の次の文字 outEndPos[0] = i + 1; // ”の次の文字
ret.append(string.slice(bufStart), (i - bufStart)); // 前の文字までを登録する ret.append(string.slice(bufStart), (i - bufStart)); // 前の文字までを登録する
return ret.s; return ret.s;
@ -533,17 +533,17 @@ export namespace Live2DCubismFramework
case '//': // エスケープの場合 case '//': // エスケープの場合
{ {
i++; // 2文字をセットで扱う i++; // 2文字をセットで扱う
if(i - 1 > bufStart) if(i - 1 > bufStart)
{ {
ret.append(string.slice(bufStart), (i - bufStart)); // 前の文字までを登録する ret.append(string.slice(bufStart), (i - bufStart)); // 前の文字までを登録する
} }
bufStart = i + 1; // エスケープ(2文字)の次の文字から bufStart = i + 1; // エスケープ(2文字)の次の文字から
if (i < length) if (i < length)
{ {
c2 = string[i]; c2 = string[i];
switch(c2) switch(c2)
{ {
case '\\': case '\\':
@ -595,7 +595,7 @@ export namespace Live2DCubismFramework
/** /**
* JSONValue * JSONValue
* *
* @param buffer JSON * @param buffer JSON
* @param length * @param length
* @param begin * @param begin
@ -639,7 +639,7 @@ export namespace Live2DCubismFramework
case ':': case ':':
this._error = "illegal ':' position"; this._error = "illegal ':' position";
break; break;
case '\n': case '\n':
this._lineCount++; this._lineCount++;
default: default:
break; // スキップする文字 break; // スキップする文字
@ -685,7 +685,7 @@ export namespace Live2DCubismFramework
if(this._error) if(this._error)
{ {
return null; return null;
} }
i = localRetEndPos2[0]; i = localRetEndPos2[0];
@ -768,7 +768,7 @@ export namespace Live2DCubismFramework
case '\n': case '\n':
++this._lineCount; ++this._lineCount;
//case ' ': case '\t': case '\r': //case ' ': case '\t': case '\r':
default: default:
break; // スキップ break; // スキップ
} }
} }
@ -815,7 +815,7 @@ export namespace Live2DCubismFramework
let strbuf: string = '\0'; let strbuf: string = '\0';
this._value = parseFloat(strbuf); this._value = parseFloat(strbuf);
this._stringBuffer = strbuf; this._stringBuffer = strbuf;
return this._stringBuffer; return this._stringBuffer;
} }
@ -936,7 +936,7 @@ export namespace Live2DCubismFramework
private _boolValue: boolean; // JSON要素の値 private _boolValue: boolean; // JSON要素の値
} }
/** /**
* JSON * JSON
*/ */
@ -955,7 +955,7 @@ export namespace Live2DCubismFramework
{ {
this._stringBuffer = s; this._stringBuffer = s;
} }
if(s instanceof csmString) if(s instanceof csmString)
{ {
this._stringBuffer = s.s; this._stringBuffer = s.s;
@ -1114,7 +1114,7 @@ export namespace Live2DCubismFramework
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(); let v: Value = ite.ptr();
if(v && !v.isStatic()) if(v && !v.isStatic())
{ {
v = void 0; v = void 0;
@ -1171,7 +1171,7 @@ export namespace Live2DCubismFramework
let v: Value = ite.ptr(); let v: Value = ite.ptr();
this._stringBuffer += indent + "" + v.getString(indent + " ") + "\n"; this._stringBuffer += indent + "" + v.getString(indent + " ") + "\n";
} }
this._stringBuffer = stringBuffer + indent + "]\n"; this._stringBuffer = stringBuffer + indent + "]\n";
return this._stringBuffer; return this._stringBuffer;
@ -1229,7 +1229,7 @@ export namespace Live2DCubismFramework
while(ite.notEqual(this._map.end())) while(ite.notEqual(this._map.end()))
{ {
let v: Value = ite.ptr().second; let v: Value = ite.ptr().second;
if(v && !v.isStatic()) if(v && !v.isStatic())
{ {
v = void 0; v = void 0;
@ -1352,9 +1352,9 @@ export namespace Live2DCubismFramework
{ {
return this._keys.getSize(); return this._keys.getSize();
} }
private _map: csmMap<string, Value>; // JSON要素の値 private _map: csmMap<string, Value>; // JSON要素の値
private _keys: csmVector<string>; // JSON要素の値 private _keys: csmVector<string>; // JSON要素の値
} }
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
export namespace Live2DCubismFramework export namespace Live2DCubismFramework
@ -50,7 +50,7 @@ export namespace Live2DCubismFramework
/** /**
* position * position
* *
* @param string * @param string
* @param length * @param length
* @param position * @param position
@ -133,4 +133,4 @@ export namespace Live2DCubismFramework
} }
} }
} }

205
README.md
View File

@ -1,146 +1,155 @@
# Cubism Web Samples # Cubism Web Samples
Live2D Cubism 3 Editorで出力したモデルを表示するアプリケーションのサンプル実装です。 Live2D Cubism 4 Editorで出力したモデルを表示するアプリケーションのサンプル実装です。
Cubism Coreライブラリと組み合わせて使用します。 Cubism Coreライブラリと組み合わせて使用します。
# フォルダ構成 ## ディレクトリ構成
- README.md ...本ドキュメント ```
- Core ...Coreライブラリが含まれるフォルダ .
- Framework ...レンダリングやアニメーション機能などのソースコードが含まれるフォルダ ├─ .vscode # Visual Studio Codeのタスクや設定が含まれるディレクトリ
- Samples ...サンプルプロジェクトが含まれるフォルダ ├─ Core # Cubism Coreが含まれるディレクトリ
- .vscode ...Visual Studio Codeのタスクや設定が含まれるフォルダ ├─ Framework # レンダリングやアニメーション機能などのソースコードが含まれるディレクトリ
└─ Samples
└─ TypeScript
└─ Demo # サンプルプロジェクトが含まれるディレクトリ
├─ Resources # モデルのファイルや画像などのリソースが含まれるディレクトリ
└─ src
```
# Live2D Cubism Core for Web ## Live2D Cubism Core for Web
モデルをロードするためのライブラリです。 モデルをロードするためのライブラリです。
当リポジトリではCubism Coreを管理していません。
# TypeScript環境 [こちら](https://www.live2d.com/download/cubism-sdk/download-web/)からCubism SDK for Webをダウンロードして、
Coreディレクトリのファイルをコピーしてください。
1. node.jsをインストールします。
- https://nodejs.org/en/
2. typescriptをインストールします。
- https://www.typescriptlang.org/
3. Visual Studio Codeをインストールします。
4. 拡張機能として下記を追加します。
- Debugger for Chrome
- Live Server
5. Visual Studio Codeを再起動します。
6. ビルドに必要な物をインストールします。
package.jsonがあるディレクトリに移動し、下記コマンドを実行します。
`npm install`
# TypeScript Core Binding ## 開発環境の構築方法
CoreライブラリはTypeScript用に以下プロジェクトでバインドし、出力されたファイルをCoreフォルダに入れる必要があります。 1. [Node.js](https://nodejs.org/)をインストールします。
インストール、バインドに必要な手順については下記を参考にしてください。 1. [Visual Studio Code](https://code.visualstudio.com/)をインストールします。
https://github.com/Live2D/CubismBindings
動作確認バージョン 1. Visual Studio Codeの拡張機能として下記を追加します。
- emscripten 1.37.40, 1.38.12, 1.38.21 - [Debugger for Chrome](https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome)
- Python 2.7.15 - [Live Server](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer)
- PyYAML 3.12
- Pystache 0.5.4
バインドに必要なemscriptenについては下記を参考にしてください。
https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html#updating-the-sdk
# ビルド方法 ## ビルド方法
上記TypeScript環境を前提とした操作になります。 1. Visual Studio Codeでプロジェクトディレクトリを開きます。
1. Visual Studio Codeでプロジェクトフォルダを開きます。 1. ビルドに必要な物をインストールします。
(例)E:\Workspace\CubismWebSamples ctrl+shift+P(macOSでは⌘+⇧+P)で`Tasks: Run Task`から`npm: install`を選択、
または、`package.json`があるディレクトリ上にてターミナル上で`npm install`でサーバが起動します。
2. ビルドし、JavaScriptを生成します。 1. ビルドを行います。
ctrl+shift+Bでビルドタスクを選択 ctrl+shift+B(macOSでは⌘+⇧+B)でビルドタスクを選択、またはターミナル上でnpmコマンドを実行してJavaScriptを生成します。
または ターミナル上で npm run build-sample を実行すると、JavaScriptが生成されます。
各タスクの説明 ### ビルドタスクの説明
`npm:build-framework` : フレームワークのみをビルドし、JavaScriptファイルを生成します。
`npm:watch-framework` : フレームワークのみをウォッチし、変更が保存された際にJavaScriptファイルを生成します。
`npm:build-sample` : サンプルをビルドします。
`npm:watch-sample` : サンプルをウォッチします。
`npm:build-all` : フレームワークとサンプルをビルドします。
`npm:watch-all` : フレームワークとサンプルをウォッチします。
3. サーバーを起動します。 | コマンド | 説明 |
Visual Studio Codeの画面下の水色のフッターからGo Liveをクリックすると、サーバーが起動します。 | --- | --- |
| `npm: build-framework` | フレームワークのみをビルドし、JavaScriptファイルを生成します |
4. 実行 | `npm: watch-framework` | フレームワークのみをウォッチし、変更が保存された際にJavaScriptファイルを再生成します |
F5で実行し、remote web site with sourcemapを選択します。 | `npm: build-sample` | サンプルをビルドします |
| `npm: watch-sample` | サンプルをウォッチします |
| `npm: build-all` | フレームワークとサンプルをビルドします |
| `npm: watch-all` | フレームワークとサンプルをウォッチします |
# SDKマニュアル ## ローカルサーバの起動方法
[Cubism SDK Manual](http://docs.live2d.com/cubism-sdk-manual/top/) ビルドした成果物はそのままファイルを開くだけでは正常に動作しないため、ローカルサーバを起動する必要があります。
### 開発時
Visual Studio Codeの画面下の水色のフッターから「Go Live」をクリックするとサーバが起動します。
ブラウザ上で`index.html`のパスまで進むと動作を確認することが出来ます。
ファイルの更新が行われると自動でブラウザのリロードが行われます。
また、`F5`を押すとでDebugger for Chromeの拡張が起動してデバッグを行うことが出来ます。
### 検証時
ctrl+shift+P(macOSでは⌘+⇧+P)で`Tasks: Run Task`から`npm: serve`を選択、
または、`package.json`があるディレクトリ上にてターミナル上で`npm run serve`でサーバが起動します。
ブラウザ上で`index.html`のパスまで進むと動作を確認することが出来ます。
シンプルな構成のサーバのため検証時におすすめです。
# 変更履歴 ## SDKマニュアル
当リポジトリの変更履歴については[コミットログ](https://github.com/Live2D/CubismWebSamples/commits/master)を参照ください。 [Cubism SDK Manual](https://docs.live2d.com/cubism-sdk-manual/top/)
# 動作確認環境 ## 変更履歴
- Windows Google Chrome 70.0.3538.67 当リポジトリの変更履歴については[CHANGELOG.md](/CHANGELOG.md)を参照ください。
- Windows Mozilla Firefox 63.0
- Windows Microsoft Edge 17.17134
- Windows Internet Explorer11 11.407.17134.0 ※(こちらのコミット以降に限ります。: [923b2398266be6f98b9fdbbdeb0bf3fd1d27a2b5](https://github.com/Live2D/CubismWebSamples/commit/923b2398266be6f98b9fdbbdeb0bf3fd1d27a2b5)
- macOS Google Chrome 70.0.3538.77
- macOS Mozilla Firefox 63.0
- macOS Safari 12.0
- iOS Safari 12.0
- Android Google Chrome 70.0.3538.64
# TODO ## 動作確認環境
- 無し
| Node.js | バージョン |
| --- | --- |
| Current | 12.9.1 |
| LTS | 10.16.3 |
| プラットフォーム | ブラウザ | バージョン |
| --- | --- | --- |
| Android | Google Chrome | 76.0.3809.89 |
| Android | Microsoft Edge | 42.0.2.3819 |
| Android | Mozilla Firefox | 68.0 |
| iOS | Google Chrome | 76.0.3809.81 |
| iOS | Microsoft Edge | 44.5.3 |
| iOS | Mozilla Firefox | 18.1 |
| iOS | Safari | 604.1 |
| macOS | Google Chrome | 76.0.3809.87 |
| macOS | Mozilla Firefox | 68.0.1 |
| macOS | Safari | 12.1.2 |
| Windows | Google Chrome | 76.0.3809.100 |
| Windows | Internet Explorer 11 | 11.885.17134.0 |
| Windows | Microsoft Edge | 44.18362.1.0 |
| Windows | Mozilla Firefox | 68.0.1 |
Note: 動作確認時のサーバの起動は[検証時](/README.md#検証時)の方法で行っています。
# ライセンス ## ライセンス
Cubism Web Samples は Live2D Open Software License で提供しています。 Cubism Web Samples は Live2D Open Software License で提供しています。
- Live2D Open Software License - Live2D Open Software License
[日本語](http://www.live2d.com/eula/live2d-open-software-license-agreement_jp.html)
[English](http://www.live2d.com/eula/live2d-open-software-license-agreement_en.html)
[日本語](https://www.live2d.com/eula/live2d-open-software-license-agreement_jp.html)
[English](https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html)
Live2D Cubism Core for Web は Live2D Proprietary Software License で提供しています。 Live2D Cubism Core for Web は Live2D Proprietary Software License で提供しています。
- Live2D Proprietary Software License - Live2D Proprietary Software License
[日本語](http://www.live2d.com/eula/live2d-proprietary-software-license-agreement_jp.html)
[English](http://www.live2d.com/eula/live2d-proprietary-software-license-agreement_en.html)
[日本語](https://www.live2d.com/eula/live2d-proprietary-software-license-agreement_jp.html)
[English](https://www.live2d.com/eula/live2d-proprietary-software-license-agreement_en.html)
Live2D のサンプルモデルは Free Material License で提供しています。 Live2D のサンプルモデルは Free Material License で提供しています。
- Free Material License - Free Material License
[日本語](http://www.live2d.com/eula/live2d-free-material-license-agreement_jp.html)
[English](http://www.live2d.com/eula/live2d-free-material-license-agreement_en.html) [日本語](https://www.live2d.com/eula/live2d-free-material-license-agreement_jp.html)
- Samples/Resources/Haru/* [English](https://www.live2d.com/eula/live2d-free-material-license-agreement_en.html)
- Samples/Resources/Hiyori/* - `./Sample/TypeScript/Demo/Resources/Haru`
- Samples/Resources/Mark/* - `./Sample/TypeScript/Demo/Resources/Hiyori`
- Samples/Res/Natori/ - `./Sample/TypeScript/Demo/Resources/Mark`
- `./Sample/TypeScript/Demo/Resources/Natori`
- `./Sample/TypeScript/Demo/Resources/Rice`
上記のモデルをご利用になられる場合、[こちら](https://docs.live2d.com/cubism-editor-manual/sample-model/)で各モデルに設定された利用条件に同意して頂く必要がございます。 上記のモデルをご利用になられる場合、[こちら](https://docs.live2d.com/cubism-editor-manual/sample-model/)で各モデルに設定された利用条件に同意して頂く必要がございます。
直近会計年度の売上高が 1000 万円以上の事業者様がご利用になる場合は、SDKリリース(出版許諾)ライセンスに同意していただく必要がございます。 直近会計年度の売上高が 1000 万円以上の事業者様がご利用になる場合は、SDKリリース(出版許諾)ライセンスに同意していただく必要がございます。
- [SDKリリース(出版許諾)ライセンス](http://www.live2d.com/ja/products/releaselicense) - [SDKリリース(出版許諾)ライセンス](https://www.live2d.com/ja/products/releaselicense)
*All business* users must obtain a Publication License. "Business" means an entity with the annual gross revenue more than ten million (10,000,000) JPY for the most recent fiscal year.
*All business* users must obtain a Publication License. "Business" means an entity with the annual gross revenue more than ten million (10,000,000) JPY for the most recent fiscal year. - [SDK Release (Publication) License](https://www.live2d.com/en/products/releaselicense)
- [SDK Release (Publication) License](http://www.live2d.com/en/products/releaselicense)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

View File

@ -0,0 +1,679 @@
{
"Version": 3,
"Parameters": [
{
"Id": "ParamAngleX",
"GroupId": "ParamGroupFace",
"Name": "角度 X"
},
{
"Id": "ParamAngleZ",
"GroupId": "ParamGroupFace",
"Name": "角度 Z"
},
{
"Id": "ParamEyeLOpen",
"GroupId": "ParamGroupEyes",
"Name": "左目 開閉"
},
{
"Id": "ParamEyeROpen",
"GroupId": "ParamGroupEyes",
"Name": "右目 開閉"
},
{
"Id": "ParamEyeBallX",
"GroupId": "ParamGroupEyes",
"Name": "目玉 X"
},
{
"Id": "ParamEyeBallY",
"GroupId": "ParamGroupEyes",
"Name": "目玉 Y"
},
{
"Id": "ParamBodyAngleX",
"GroupId": "ParamGroupBody",
"Name": "体の回転 X"
},
{
"Id": "ParamBodyAngleY",
"GroupId": "ParamGroupBody",
"Name": "体の回転 Y"
},
{
"Id": "ParamBodyAngleZ",
"GroupId": "ParamGroupBody",
"Name": "体の回転 Z"
},
{
"Id": "ParamShoulderR",
"GroupId": "ParamGroupBody",
"Name": "右肩"
},
{
"Id": "ParamShoulderL",
"GroupId": "ParamGroupBody",
"Name": "左肩"
},
{
"Id": "ParamLegKnee",
"GroupId": "ParamGroupBody",
"Name": "屈伸"
},
{
"Id": "ParamLegR",
"GroupId": "ParamGroupBody",
"Name": "右足の位置"
},
{
"Id": "ParamLegRUpDw",
"GroupId": "ParamGroupBody",
"Name": "右足の上下"
},
{
"Id": "ParamAllZ",
"GroupId": "ParamGroupBody",
"Name": "全体のZ"
},
{
"Id": "ParamArmR01",
"GroupId": "ParamGroupArms",
"Name": "右上腕"
},
{
"Id": "ParamArmR01Y",
"GroupId": "ParamGroupArms",
"Name": "右上腕 Y"
},
{
"Id": "ParamArmR02",
"GroupId": "ParamGroupArms",
"Name": "右前腕"
},
{
"Id": "ParamArmR02Y",
"GroupId": "ParamGroupArms",
"Name": "右前腕 Y"
},
{
"Id": "ParamArmR03",
"GroupId": "ParamGroupArms",
"Name": "右手"
},
{
"Id": "ParamArmL01",
"GroupId": "ParamGroupArms",
"Name": "左上腕"
},
{
"Id": "ParamArmL02",
"GroupId": "ParamGroupArms",
"Name": "左前腕"
},
{
"Id": "ParamArmL03",
"GroupId": "ParamGroupArms",
"Name": "左手"
},
{
"Id": "ParamArmChange",
"GroupId": "ParamGroupArms",
"Name": "腕 切り替え"
},
{
"Id": "ParamBookPage",
"GroupId": "ParamGroupArms",
"Name": "本 ページ"
},
{
"Id": "ParamFlameOn",
"GroupId": "ParamGroupFlame",
"Name": "炎 表示"
},
{
"Id": "ParamFlame",
"GroupId": "ParamGroupFlame",
"Name": "炎"
},
{
"Id": "ParamFlameShaking",
"GroupId": "ParamGroupFlame",
"Name": "炎の揺れ"
},
{
"Id": "ParamFlameX",
"GroupId": "ParamGroupFlame",
"Name": "炎の位置 X"
},
{
"Id": "ParamFlameY",
"GroupId": "ParamGroupFlame",
"Name": "炎の位置 Y"
},
{
"Id": "ParamCharge01On",
"GroupId": "ParamGroupEffectsA",
"Name": "溜めの表示"
},
{
"Id": "ParamCharge01",
"GroupId": "ParamGroupEffectsA",
"Name": "溜め"
},
{
"Id": "ParamHandLightAOn",
"GroupId": "ParamGroupEffectsA",
"Name": "手の光Aの表示"
},
{
"Id": "ParamHandLightASize",
"GroupId": "ParamGroupEffectsA",
"Name": "手の光Aの拡縮"
},
{
"Id": "ParamMagicPowersA",
"GroupId": "ParamGroupEffectsA",
"Name": "波動A"
},
{
"Id": "ParamMagicAOn",
"GroupId": "ParamGroupEffectsA",
"Name": "魔法陣Aの表示"
},
{
"Id": "ParamMagicARotation",
"GroupId": "ParamGroupEffectsA",
"Name": "魔法陣Aの回転"
},
{
"Id": "ParamMagicALight",
"GroupId": "ParamGroupEffectsA",
"Name": "魔法陣A 光"
},
{
"Id": "ParamEffectAX",
"GroupId": "ParamGroupEffectsA",
"Name": "エフェクトAの位置 X"
},
{
"Id": "ParamEffectAY",
"GroupId": "ParamGroupEffectsA",
"Name": "エフェクトAの位置 Y"
},
{
"Id": "ParamHandLightBOn",
"GroupId": "ParamGroupEffectsB",
"Name": "手の光Bの表示"
},
{
"Id": "ParamHandLightBSize",
"GroupId": "ParamGroupEffectsB",
"Name": "手の光Bの拡張"
},
{
"Id": "ParamMagicBOn",
"GroupId": "ParamGroupEffectsB",
"Name": "魔法陣Bの表示"
},
{
"Id": "ParamMagicBRotation",
"GroupId": "ParamGroupEffectsB",
"Name": "魔法陣Bの回転"
},
{
"Id": "ParamMagicBMove",
"GroupId": "ParamGroupEffectsB",
"Name": "魔法陣Bの移動"
},
{
"Id": "ParamMagicBX",
"GroupId": "ParamGroupEffectsB",
"Name": "魔法陣Bの角度 X"
},
{
"Id": "ParamMagicPowersBOn",
"GroupId": "ParamGroupEffectsB",
"Name": "波動Bの表示"
},
{
"Id": "ParamMagicPowersBSize",
"GroupId": "ParamGroupEffectsB",
"Name": "波動Bの拡張"
},
{
"Id": "ParamMagicPowersBThicknesses",
"GroupId": "ParamGroupEffectsB",
"Name": "波動Bの太さ"
},
{
"Id": "ParamEffectBX",
"GroupId": "ParamGroupEffectsB",
"Name": "エフェクトBの位置 X"
},
{
"Id": "ParamEffectBY",
"GroupId": "ParamGroupEffectsB",
"Name": "エフェクトBの位置 Y"
},
{
"Id": "ParamHeadRibbon",
"GroupId": "ParamGroupSwing",
"Name": "頭リボンの揺れ"
},
{
"Id": "ParamBustRibbon01",
"GroupId": "ParamGroupSwing",
"Name": "胸リボンの揺れ01"
},
{
"Id": "ParamBustRibbon02",
"GroupId": "ParamGroupSwing",
"Name": "胸リボンの揺れ02"
},
{
"Id": "ParamWaistRibbon01",
"GroupId": "ParamGroupSwing",
"Name": "腰リボンの揺れ01"
},
{
"Id": "ParamWaistRibbon02",
"GroupId": "ParamGroupSwing",
"Name": "腰リボンの揺れ02"
},
{
"Id": "ParamSkirt",
"GroupId": "ParamGroupSwing",
"Name": "スカートのなびき"
},
{
"Id": "ParamSkirtX",
"GroupId": "ParamGroupSwing",
"Name": "スカートの揺れ X"
},
{
"Id": "ParamSkirtY",
"GroupId": "ParamGroupSwing",
"Name": "スカートの揺れ Y"
},
{
"Id": "ParamHairFront01",
"GroupId": "ParamGroupHairFront",
"Name": "髪揺れ 前01"
},
{
"Id": "ParamHairFront02",
"GroupId": "ParamGroupHairFront",
"Name": "髪揺れ 前02"
},
{
"Id": "Param_Angle_Rotation_1_ArtMesh67",
"GroupId": "ParamGroupHairSideR",
"Name": "[0]右横髪"
},
{
"Id": "Param_Angle_Rotation_2_ArtMesh67",
"GroupId": "ParamGroupHairSideR",
"Name": "[1]右横髪"
},
{
"Id": "Param_Angle_Rotation_3_ArtMesh67",
"GroupId": "ParamGroupHairSideR",
"Name": "[2]右横髪"
},
{
"Id": "Param_Angle_Rotation_4_ArtMesh67",
"GroupId": "ParamGroupHairSideR",
"Name": "[3]右横髪"
},
{
"Id": "Param_Angle_Rotation_5_ArtMesh67",
"GroupId": "ParamGroupHairSideR",
"Name": "[4]右横髪"
},
{
"Id": "Param_Angle_Rotation_1_ArtMesh20",
"GroupId": "ParamGroupHairSideL",
"Name": "[0]左横髪"
},
{
"Id": "Param_Angle_Rotation_2_ArtMesh20",
"GroupId": "ParamGroupHairSideL",
"Name": "[1]左横髪"
},
{
"Id": "Param_Angle_Rotation_3_ArtMesh20",
"GroupId": "ParamGroupHairSideL",
"Name": "[2]左横髪"
},
{
"Id": "Param_Angle_Rotation_4_ArtMesh20",
"GroupId": "ParamGroupHairSideL",
"Name": "[3]左横髪"
},
{
"Id": "Param_Angle_Rotation_5_ArtMesh20",
"GroupId": "ParamGroupHairSideL",
"Name": "[4]左横髪"
},
{
"Id": "Param_Angle_Rotation_1_ArtMesh82",
"GroupId": "ParamGroupHairBackA",
"Name": "[0]後髪A"
},
{
"Id": "Param_Angle_Rotation_2_ArtMesh82",
"GroupId": "ParamGroupHairBackA",
"Name": "[1]後髪A"
},
{
"Id": "Param_Angle_Rotation_3_ArtMesh82",
"GroupId": "ParamGroupHairBackA",
"Name": "[2]後髪A"
},
{
"Id": "Param_Angle_Rotation_4_ArtMesh82",
"GroupId": "ParamGroupHairBackA",
"Name": "[3]後髪A"
},
{
"Id": "Param_Angle_Rotation_5_ArtMesh82",
"GroupId": "ParamGroupHairBackA",
"Name": "[4]後髪A"
},
{
"Id": "Param_Angle_Rotation_6_ArtMesh82",
"GroupId": "ParamGroupHairBackA",
"Name": "[5]後髪A"
},
{
"Id": "Param_Angle_Rotation_7_ArtMesh82",
"GroupId": "ParamGroupHairBackA",
"Name": "[6]後髪A"
},
{
"Id": "Param_Angle_Rotation_1_ArtMesh81",
"GroupId": "ParamGroupHairBackB",
"Name": "[0]後髪B"
},
{
"Id": "Param_Angle_Rotation_2_ArtMesh81",
"GroupId": "ParamGroupHairBackB",
"Name": "[1]後髪B"
},
{
"Id": "Param_Angle_Rotation_3_ArtMesh81",
"GroupId": "ParamGroupHairBackB",
"Name": "[2]後髪B"
},
{
"Id": "Param_Angle_Rotation_4_ArtMesh81",
"GroupId": "ParamGroupHairBackB",
"Name": "[3]後髪B"
},
{
"Id": "Param_Angle_Rotation_5_ArtMesh81",
"GroupId": "ParamGroupHairBackB",
"Name": "[4]後髪B"
},
{
"Id": "Param_Angle_Rotation_6_ArtMesh81",
"GroupId": "ParamGroupHairBackB",
"Name": "[5]後髪B"
},
{
"Id": "Param_Angle_Rotation_7_ArtMesh81",
"GroupId": "ParamGroupHairBackB",
"Name": "[6]後髪B"
},
{
"Id": "Param_Angle_Rotation_8_ArtMesh81",
"GroupId": "ParamGroupHairBackB",
"Name": "[7]後髪B"
},
{
"Id": "Param_Angle_Rotation_9_ArtMesh81",
"GroupId": "ParamGroupHairBackB",
"Name": "[8]後髪B"
},
{
"Id": "Param_Angle_Rotation_1_ArtMesh80",
"GroupId": "ParamGroupHairBackC",
"Name": "[0]後髪C"
},
{
"Id": "Param_Angle_Rotation_2_ArtMesh80",
"GroupId": "ParamGroupHairBackC",
"Name": "[1]後髪C"
},
{
"Id": "Param_Angle_Rotation_3_ArtMesh80",
"GroupId": "ParamGroupHairBackC",
"Name": "[2]後髪C"
},
{
"Id": "Param_Angle_Rotation_4_ArtMesh80",
"GroupId": "ParamGroupHairBackC",
"Name": "[3]後髪C"
},
{
"Id": "Param_Angle_Rotation_5_ArtMesh80",
"GroupId": "ParamGroupHairBackC",
"Name": "[4]後髪C"
},
{
"Id": "Param_Angle_Rotation_6_ArtMesh80",
"GroupId": "ParamGroupHairBackC",
"Name": "[5]後髪C"
},
{
"Id": "Param_Angle_Rotation_7_ArtMesh80",
"GroupId": "ParamGroupHairBackC",
"Name": "[6]後髪C"
},
{
"Id": "Param_Angle_Rotation_8_ArtMesh80",
"GroupId": "ParamGroupHairBackC",
"Name": "[7]後髪C"
},
{
"Id": "Param_Angle_Rotation_9_ArtMesh80",
"GroupId": "ParamGroupHairBackC",
"Name": "[8]後髪C"
}
],
"ParameterGroups": [
{
"Id": "ParamGroupFace",
"GroupId": "",
"Name": "顔"
},
{
"Id": "ParamGroupEyes",
"GroupId": "",
"Name": "目"
},
{
"Id": "ParamGroupBody",
"GroupId": "",
"Name": "体"
},
{
"Id": "ParamGroupArms",
"GroupId": "",
"Name": "腕"
},
{
"Id": "ParamGroupFlame",
"GroupId": "",
"Name": "炎"
},
{
"Id": "ParamGroupEffectsA",
"GroupId": "",
"Name": "エフェクトA"
},
{
"Id": "ParamGroupEffectsB",
"GroupId": "",
"Name": "エフェクトB"
},
{
"Id": "ParamGroupSwing",
"GroupId": "",
"Name": "揺れもの"
},
{
"Id": "ParamGroupHairFront",
"GroupId": "",
"Name": "前髪"
},
{
"Id": "ParamGroupHairSideR",
"GroupId": "",
"Name": "右横髪"
},
{
"Id": "ParamGroupHairSideL",
"GroupId": "",
"Name": "左横髪"
},
{
"Id": "ParamGroupHairBackA",
"GroupId": "",
"Name": "後髪A"
},
{
"Id": "ParamGroupHairBackB",
"GroupId": "",
"Name": "後髪B"
},
{
"Id": "ParamGroupHairBackC",
"GroupId": "",
"Name": "後髪C"
}
],
"Parts": [
{
"Id": "PartCore",
"Name": "コア"
},
{
"Id": "PartFlame",
"Name": "炎"
},
{
"Id": "PartMagicPowersB",
"Name": "波動B"
},
{
"Id": "PartMagicB",
"Name": "魔法陣B"
},
{
"Id": "PartMagicPowersA",
"Name": "波動A"
},
{
"Id": "PartMagicA",
"Name": "魔法陣A"
},
{
"Id": "PartHat",
"Name": "帽子"
},
{
"Id": "PartHair",
"Name": "髪"
},
{
"Id": "PartBrow",
"Name": "眉"
},
{
"Id": "PartEyeL",
"Name": "左目"
},
{
"Id": "PartEyeR",
"Name": "右目"
},
{
"Id": "PartFace",
"Name": "顔"
},
{
"Id": "PartArmR02",
"Name": "右腕 差分"
},
{
"Id": "PartArmR01",
"Name": "右腕"
},
{
"Id": "PartBody",
"Name": "体"
},
{
"Id": "PartLegR",
"Name": "右足"
},
{
"Id": "PartLegL",
"Name": "左足"
},
{
"Id": "PartArmL",
"Name": "左腕"
},
{
"Id": "PartHairBack",
"Name": "後ろ髪"
},
{
"Id": "PartWaveSave",
"Name": "波動 溜め"
},
{
"Id": "ArtMesh20_Skinning",
"Name": "左横髪(スキニング)"
},
{
"Id": "Part20",
"Name": "左横髪(回転)"
},
{
"Id": "ArtMesh67_Skinning",
"Name": "右横髪(スキニング)"
},
{
"Id": "Part19",
"Name": "右横髪(回転)"
},
{
"Id": "ArtMesh80_Skinning",
"Name": "後髪C(スキニング)"
},
{
"Id": "Part17",
"Name": "後髪C(回転)"
},
{
"Id": "ArtMesh81_Skinning",
"Name": "後髪B(スキニング)"
},
{
"Id": "Part18",
"Name": "後髪B(回転)"
},
{
"Id": "ArtMesh82_Skinning",
"Name": "後髪A(スキニング)"
},
{
"Id": "Part16",
"Name": "後髪A(回転)"
}
]
}

Binary file not shown.

View File

@ -0,0 +1,51 @@
{
"Version": 3,
"FileReferences": {
"Moc": "Rice.moc3",
"Textures": [
"Rice.2048/texture_00.png",
"Rice.2048/texture_01.png"
],
"Physics": "Rice.physics3.json",
"DisplayInfo": "Rice.cdi3.json",
"Motions": {
"Idle": [
{
"File": "motions/mtn_00.motion3.json"
}
],
"TapBody": [
{
"File": "motions/mtn_01.motion3.json"
},
{
"File": "motions/mtn_02.motion3.json"
},
{
"File": "motions/mtn_03.motion3.json"
}
]
}
},
"Groups": [
{
"Target": "Parameter",
"Name": "EyeBlink",
"Ids": [
"ParamEyeLOpen",
"ParamEyeROpen"
]
},
{
"Target": "Parameter",
"Name": "LipSync",
"Ids": []
}
],
"HitAreas": [
{
"Id": "HitAreaBody",
"Name": "Body"
}
]
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2,9 +2,9 @@
<html lang="ja"> <html lang="ja">
<head> <head>
<meta name="viewport" content="width=1900">
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>TypeScript HTML App</title> <title>TypeScript HTML App</title>
<meta name="viewport" content="width=1900">
</head> </head>
<body> <body>
<!-- Canvas --> <!-- Canvas -->

View File

@ -1,9 +1,9 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {LogLevel} from "../../../../Framework/live2dcubismframework"; import {LogLevel} from "../../../../Framework/live2dcubismframework";
@ -43,7 +43,8 @@ export namespace LAppDefine
"Haru", "Haru",
"Hiyori", "Hiyori",
"Mark", "Mark",
"Natori" "Natori",
"Rice"
] ]
export const ModelDirSize: number = ModelDir.length; export const ModelDirSize: number = ModelDir.length;
@ -67,4 +68,4 @@ export namespace LAppDefine
// Frameworkから出力するログのレベル設定 // Frameworkから出力するログのレベル設定
export const CubismLoggingLevel: LogLevel = LogLevel.LogLevel_Verbose; export const CubismLoggingLevel: LogLevel = LogLevel.LogLevel_Verbose;
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as live2dcubismframework, Option as Csm_Option} from "../../../../Framework/live2dcubismframework"; import {Live2DCubismFramework as live2dcubismframework, Option as Csm_Option} from "../../../../Framework/live2dcubismframework";
@ -22,14 +22,14 @@ export let frameBuffer: WebGLFramebuffer = null;
/** /**
* *
* Cubism3 * Cubism SDK
*/ */
export class LAppDelegate export class LAppDelegate
{ {
/** /**
* *
* *
* *
* @return * @return
*/ */
public static getInstance(): LAppDelegate public static getInstance(): LAppDelegate
@ -77,7 +77,7 @@ export class LAppDelegate
if (!frameBuffer) if (!frameBuffer)
{ {
frameBuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING); frameBuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING);
} }
// 透過設定 // 透過設定
@ -104,8 +104,8 @@ export class LAppDelegate
// AppViewの初期化 // AppViewの初期化
this._view.initialize(); this._view.initialize();
// Cubism3の初期化 // Cubism SDKの初期化
this.initializeCubism(); this.initializeCubism();
return true; return true;
@ -125,7 +125,7 @@ export class LAppDelegate
// リソースを解放 // リソースを解放
LAppLive2DManager.releaseInstance(); LAppLive2DManager.releaseInstance();
// Cubism3の解放 // Cubism SDKの解放
Csm_CubismFramework.dispose(); Csm_CubismFramework.dispose();
} }
@ -203,7 +203,7 @@ export class LAppDelegate
// フラグメントシェーダのコンパイル // フラグメントシェーダのコンパイル
let fragmentShaderId = gl.createShader(gl.FRAGMENT_SHADER); let fragmentShaderId = gl.createShader(gl.FRAGMENT_SHADER);
if(fragmentShaderId == null) if(fragmentShaderId == null)
{ {
LAppPal.printLog("failed to create fragmentShader"); LAppPal.printLog("failed to create fragmentShader");
@ -250,7 +250,7 @@ export class LAppDelegate
{ {
return this._textureManager; return this._textureManager;
} }
/** /**
* *
*/ */
@ -267,7 +267,7 @@ export class LAppDelegate
} }
/** /**
* Cubism3 * Cubism SDK
*/ */
public initializeCubism(): void public initializeCubism(): void
{ {
@ -290,7 +290,7 @@ export class LAppDelegate
this._view.initializeSprite(); this._view.initializeSprite();
} }
_cubismOption: Csm_Option; // Cubism3 Option _cubismOption: Csm_Option; // Cubism SDK Option
_view: LAppView; // View情報 _view: LAppView; // View情報
_captured: boolean; // クリックしているか _captured: boolean; // クリックしているか
_mouseX: number; // マウスX座標 _mouseX: number; // マウスX座標
@ -310,7 +310,7 @@ function onClickBegan(e: MouseEvent): void
return; return;
} }
LAppDelegate.getInstance()._captured = true; LAppDelegate.getInstance()._captured = true;
let posX: number = e.pageX; let posX: number = e.pageX;
let posY: number = e.pageY; let posY: number = e.pageY;
@ -326,7 +326,7 @@ function onMouseMoved(e: MouseEvent): void
{ {
return; return;
} }
if(!LAppDelegate.getInstance()._view) if(!LAppDelegate.getInstance()._view)
{ {
LAppPal.printLog("view notfound"); LAppPal.printLog("view notfound");
@ -351,8 +351,8 @@ function onClickEnded(e: MouseEvent): void
LAppPal.printLog("view notfound"); LAppPal.printLog("view notfound");
return; return;
} }
let rect = (<Element>e.target).getBoundingClientRect(); let rect = (<Element>e.target).getBoundingClientRect();
let posX: number = e.clientX - rect.left; let posX: number = e.clientX - rect.left;
let posY: number = e.clientY - rect.top; let posY: number = e.clientY - rect.top;
@ -395,7 +395,7 @@ function onTouchMoved(e: TouchEvent): void
LAppPal.printLog("view notfound"); LAppPal.printLog("view notfound");
return; return;
} }
let rect = (<Element>e.target).getBoundingClientRect(); let rect = (<Element>e.target).getBoundingClientRect();
let posX = e.changedTouches[0].clientX - rect.left; let posX = e.changedTouches[0].clientX - rect.left;
@ -418,7 +418,7 @@ function onTouchEnded(e: TouchEvent): void
} }
let rect = (<Element>e.target).getBoundingClientRect(); let rect = (<Element>e.target).getBoundingClientRect();
let posX = e.changedTouches[0].clientX - rect.left; let posX = e.changedTouches[0].clientX - rect.left;
let posY = e.changedTouches[0].clientY - rect.top; let posY = e.changedTouches[0].clientY - rect.top;
@ -439,7 +439,7 @@ function onTouchCancel(e: TouchEvent): void
} }
let rect = (<Element>e.target).getBoundingClientRect(); let rect = (<Element>e.target).getBoundingClientRect();
let posX = e.changedTouches[0].clientX - rect.left; let posX = e.changedTouches[0].clientX - rect.left;
let posY = e.changedTouches[0].clientY - rect.top; let posY = e.changedTouches[0].clientY - rect.top;

View File

@ -1,9 +1,9 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as cubismmatrix44} from "../../../../Framework/math/cubismmatrix44"; import {Live2DCubismFramework as cubismmatrix44} from "../../../../Framework/math/cubismmatrix44";
import {Live2DCubismFramework as csmvector} from "../../../../Framework/type/csmvector"; import {Live2DCubismFramework as csmvector} from "../../../../Framework/type/csmvector";
@ -27,7 +27,7 @@ export class LAppLive2DManager
/** /**
* *
* *
* *
* @return * @return
*/ */
public static getInstance(): LAppLive2DManager public static getInstance(): LAppLive2DManager
@ -49,13 +49,13 @@ export class LAppLive2DManager
{ {
s_instance = void 0; s_instance = void 0;
} }
s_instance = null; s_instance = null;
} }
/** /**
* *
* *
* @param no * @param no
* @return NULL * @return NULL
*/ */
@ -85,7 +85,7 @@ export class LAppLive2DManager
/** /**
* *
* *
* @param x X * @param x X
* @param y Y * @param y Y
*/ */
@ -104,7 +104,7 @@ export class LAppLive2DManager
/** /**
* *
* *
* @param x X * @param x X
* @param y Y * @param y Y
*/ */

View File

@ -1,9 +1,9 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as live2dcubismframework} from "../../../../Framework/live2dcubismframework"; import {Live2DCubismFramework as live2dcubismframework} from "../../../../Framework/live2dcubismframework";
import {Live2DCubismFramework as cubismid} from "../../../../Framework/id/cubismid"; import {Live2DCubismFramework as cubismid} from "../../../../Framework/id/cubismid";
@ -93,10 +93,10 @@ enum LoadStep
export class LAppModel extends CubismUserModel { export class LAppModel extends CubismUserModel {
/** /**
* model3.json * model3.json
* @param dir * @param dir
* @param fileName * @param fileName
*/ */
public loadAssets(dir: string, fileName: string): void public loadAssets(dir: string, fileName: string): void
{ {
this._modelHomeDir = dir; this._modelHomeDir = dir;
@ -157,7 +157,7 @@ export class LAppModel extends CubismUserModel {
this.loadModel(buffer); this.loadModel(buffer);
deleteBuffer(buffer, path); deleteBuffer(buffer, path);
this._state = LoadStep.LoadExpression; this._state = LoadStep.LoadExpression;
// callback // callback
loadCubismExpression(); loadCubismExpression();
} }
@ -176,15 +176,15 @@ export class LAppModel extends CubismUserModel {
if(this._modelSetting.getExpressionCount() > 0) if(this._modelSetting.getExpressionCount() > 0)
{ {
const count: number = this._modelSetting.getExpressionCount(); const count: number = this._modelSetting.getExpressionCount();
for(let i: number = 0; i < count; i++) for(let i: number = 0; i < count; i++)
{ {
let name: string = this._modelSetting.getExpressionName(i); let name: string = this._modelSetting.getExpressionName(i);
let path: string = this._modelSetting.getExpressionFileName(i); let path: string = this._modelSetting.getExpressionFileName(i);
path = this._modelHomeDir + path; path = this._modelHomeDir + path;
fetch(path).then( fetch(path).then(
(response) => (response) =>
{ {
return response.arrayBuffer(); return response.arrayBuffer();
} }
@ -193,21 +193,21 @@ export class LAppModel extends CubismUserModel {
{ {
let buffer: ArrayBuffer = arrayBuffer; let buffer: ArrayBuffer = arrayBuffer;
let size: number = buffer.byteLength; let size: number = buffer.byteLength;
let motion: ACubismMotion = this.loadExpression(buffer, size, name); let motion: ACubismMotion = this.loadExpression(buffer, size, name);
if(this._expressions.getValue(name) != null) if(this._expressions.getValue(name) != null)
{ {
ACubismMotion.delete(this._expressions.getValue(name)); ACubismMotion.delete(this._expressions.getValue(name));
this._expressions.setValue(name, null); this._expressions.setValue(name, null);
} }
this._expressions.setValue(name, motion); this._expressions.setValue(name, motion);
deleteBuffer(buffer, path); deleteBuffer(buffer, path);
this._expressionCount++; this._expressionCount++;
if(this._expressionCount >= count) if(this._expressionCount >= count)
{ {
this._state = LoadStep.LoadPhysics; this._state = LoadStep.LoadPhysics;
@ -238,7 +238,7 @@ export class LAppModel extends CubismUserModel {
path = this._modelHomeDir + path; path = this._modelHomeDir + path;
fetch(path).then( fetch(path).then(
(response) => (response) =>
{ {
return response.arrayBuffer(); return response.arrayBuffer();
} }
@ -247,10 +247,10 @@ export class LAppModel extends CubismUserModel {
{ {
let buffer: ArrayBuffer = arrayBuffer; let buffer: ArrayBuffer = arrayBuffer;
let size: number = buffer.byteLength; let size: number = buffer.byteLength;
this.loadPhysics(buffer, size); this.loadPhysics(buffer, size);
deleteBuffer(buffer, path); deleteBuffer(buffer, path);
this._state = LoadStep.LoadPose; this._state = LoadStep.LoadPose;
// callback // callback
@ -277,7 +277,7 @@ export class LAppModel extends CubismUserModel {
path = this._modelHomeDir + path; path = this._modelHomeDir + path;
fetch(path).then( fetch(path).then(
(response) => (response) =>
{ {
return response.arrayBuffer(); return response.arrayBuffer();
} }
@ -286,10 +286,10 @@ export class LAppModel extends CubismUserModel {
{ {
let buffer: ArrayBuffer = arrayBuffer; let buffer: ArrayBuffer = arrayBuffer;
let size: number = buffer.byteLength; let size: number = buffer.byteLength;
this.loadPose(buffer, size); this.loadPose(buffer, size);
deleteBuffer(buffer, path); deleteBuffer(buffer, path);
this._state = LoadStep.SetupEyeBlink; this._state = LoadStep.SetupEyeBlink;
// callback // callback
@ -301,7 +301,7 @@ export class LAppModel extends CubismUserModel {
else else
{ {
this._state = LoadStep.SetupEyeBlink; this._state = LoadStep.SetupEyeBlink;
// callback // callback
setupEyeBlink(); setupEyeBlink();
} }
@ -325,18 +325,18 @@ export class LAppModel extends CubismUserModel {
let setupBreath = () => let setupBreath = () =>
{ {
this._breath = CubismBreath.create(); this._breath = CubismBreath.create();
let breathParameters: csmVector<BreathParameterData> = new csmVector(); 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._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._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._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(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)); breathParameters.pushBack(new BreathParameterData(CubismFramework.getIdManager().getId(CubismDefaultParameterId.ParamBreath), 0.0, 0.5, 3.2345, 0.5));
this._breath.setParameters(breathParameters); this._breath.setParameters(breathParameters);
this._state = LoadStep.LoadUserData; this._state = LoadStep.LoadUserData;
// callback // callback
loadUserData(); loadUserData();
}; };
@ -349,7 +349,7 @@ export class LAppModel extends CubismUserModel {
path = this._modelHomeDir + path; path = this._modelHomeDir + path;
fetch(path).then( fetch(path).then(
(response) => (response) =>
{ {
return response.arrayBuffer(); return response.arrayBuffer();
} }
@ -358,10 +358,10 @@ export class LAppModel extends CubismUserModel {
{ {
let buffer: ArrayBuffer = arrayBuffer; let buffer: ArrayBuffer = arrayBuffer;
let size: number = buffer.byteLength; let size: number = buffer.byteLength;
this.loadUserData(buffer, size); this.loadUserData(buffer, size);
deleteBuffer(buffer, path); deleteBuffer(buffer, path);
this._state = LoadStep.SetupEyeBlinkIds; this._state = LoadStep.SetupEyeBlinkIds;
// callback // callback
@ -400,13 +400,13 @@ export class LAppModel extends CubismUserModel {
let setupLipSyncIds = () => let setupLipSyncIds = () =>
{ {
let lipSyncIdCount = this._modelSetting.getLipSyncParameterCount(); let lipSyncIdCount = this._modelSetting.getLipSyncParameterCount();
for(let i: number = 0; i < lipSyncIdCount; ++i) for(let i: number = 0; i < lipSyncIdCount; ++i)
{ {
this._lipSyncIds.pushBack(this._modelSetting.getLipSyncParameterId(i)); this._lipSyncIds.pushBack(this._modelSetting.getLipSyncParameterId(i));
} }
this._state = LoadStep.SetupLayout; this._state = LoadStep.SetupLayout;
// callback // callback
setupLayout(); setupLayout();
}; };
@ -431,9 +431,9 @@ export class LAppModel extends CubismUserModel {
this._allMotionCount = 0; this._allMotionCount = 0;
this._motionCount = 0; this._motionCount = 0;
let group: string[] = []; let group: string[] = [];
let motionGroupCount: number = this._modelSetting.getMotionGroupCount(); let motionGroupCount: number = this._modelSetting.getMotionGroupCount();
// モーションの総数を求める // モーションの総数を求める
for(let i: number = 0; i < motionGroupCount; i++) for(let i: number = 0; i < motionGroupCount; i++)
{ {
@ -451,7 +451,7 @@ export class LAppModel extends CubismUserModel {
if(motionGroupCount == 0) if(motionGroupCount == 0)
{ {
this._state = LoadStep.LoadTexture; this._state = LoadStep.LoadTexture;
// 全てのモーションを停止する // 全てのモーションを停止する
this._motionManager.stopAllMotions(); this._motionManager.stopAllMotions();
@ -470,7 +470,7 @@ export class LAppModel extends CubismUserModel {
*/ */
private setupTextures(): void private setupTextures(): void
{ {
// iPhoneでのアルファ品質向上のためTypescriptではpremultipliedAlphaを採用 // iPhoneでのアルファ品質向上のためTypescriptではpremultipliedAlphaを採用
let usePremultiply: boolean = true; let usePremultiply: boolean = true;
if(this._state == LoadStep.LoadTexture) if(this._state == LoadStep.LoadTexture)
@ -486,25 +486,25 @@ export class LAppModel extends CubismUserModel {
console.log("getTextureFileName null"); console.log("getTextureFileName null");
continue; continue;
} }
// WebGLのテクスチャユニットにテクスチャをロードする // WebGLのテクスチャユニットにテクスチャをロードする
let texturePath = this._modelSetting.getTextureFileName(modelTextureNumber); let texturePath = this._modelSetting.getTextureFileName(modelTextureNumber);
texturePath = this._modelHomeDir + texturePath; texturePath = this._modelHomeDir + texturePath;
// ロード完了時に呼び出すコールバック関数 // ロード完了時に呼び出すコールバック関数
let onLoad = (textureInfo: TextureInfo) : void => let onLoad = (textureInfo: TextureInfo) : void =>
{ {
this.getRenderer().bindTexture(modelTextureNumber, textureInfo.id); this.getRenderer().bindTexture(modelTextureNumber, textureInfo.id);
this._textureCount++; this._textureCount++;
if(this._textureCount >= textureCount) if(this._textureCount >= textureCount)
{ {
// ロード完了 // ロード完了
this._state = LoadStep.CompleteSetup; this._state = LoadStep.CompleteSetup;
} }
}; };
// 読み込み // 読み込み
LAppDelegate.getInstance().getTextureManager().createTextureFromPngFile(texturePath, usePremultiply, onLoad); LAppDelegate.getInstance().getTextureManager().createTextureFromPngFile(texturePath, usePremultiply, onLoad);
this.getRenderer().setIsPremultipliedAlpha(usePremultiply); this.getRenderer().setIsPremultipliedAlpha(usePremultiply);
@ -530,11 +530,11 @@ export class LAppModel extends CubismUserModel {
public update(): void public update(): void
{ {
if(this._state != LoadStep.CompleteSetup) return; if(this._state != LoadStep.CompleteSetup) return;
const deltaTimeSeconds: number = LAppPal.getDeltaTime(); const deltaTimeSeconds: number = LAppPal.getDeltaTime();
this._userTimeSeconds += deltaTimeSeconds; this._userTimeSeconds += deltaTimeSeconds;
this._dragManager.update(deltaTimeSeconds); this._dragManager.update(deltaTimeSeconds);
this._dragX = this._dragManager.getX(); this._dragX = this._dragManager.getX();
this._dragY = this._dragManager.getY(); this._dragY = this._dragManager.getY();
@ -548,7 +548,7 @@ export class LAppModel extends CubismUserModel {
{ {
// モーションの再生がない場合、待機モーションの中からランダムで再生する // モーションの再生がない場合、待機モーションの中からランダムで再生する
this.startRandomMotion(LAppDefine.MotionGroupIdle, LAppDefine.PriorityIdle); this.startRandomMotion(LAppDefine.MotionGroupIdle, LAppDefine.PriorityIdle);
} }
else else
{ {
@ -607,7 +607,7 @@ export class LAppModel extends CubismUserModel {
this._model.addParameterValueById(this._lipSyncIds.at(i), value, 0.8); this._model.addParameterValueById(this._lipSyncIds.at(i), value, 0.8);
} }
} }
// ポーズの設定 // ポーズの設定
if(this._pose != null) if(this._pose != null)
{ {
@ -661,24 +661,24 @@ export class LAppModel extends CubismUserModel {
{ {
let buffer: ArrayBuffer = arrayBuffer; let buffer: ArrayBuffer = arrayBuffer;
let size = buffer.byteLength; let size = buffer.byteLength;
motion = <CubismMotion>this.loadMotion(buffer, size, null); motion = <CubismMotion>this.loadMotion(buffer, size, null);
let fadeTime: number = this._modelSetting.getMotionFadeInTimeValue(group, no); let fadeTime: number = this._modelSetting.getMotionFadeInTimeValue(group, no);
if(fadeTime >= 0.0) if(fadeTime >= 0.0)
{ {
motion.setFadeInTime(fadeTime); motion.setFadeInTime(fadeTime);
} }
fadeTime = this._modelSetting.getMotionFadeOutTimeValue(group, no); fadeTime = this._modelSetting.getMotionFadeOutTimeValue(group, no);
if(fadeTime >= 0.0) if(fadeTime >= 0.0)
{ {
motion.setFadeOutTime(fadeTime); motion.setFadeOutTime(fadeTime);
} }
motion.setEffectIds(this._eyeBlinkIds, this._lipSyncIds); motion.setEffectIds(this._eyeBlinkIds, this._lipSyncIds);
autoDelete = true; // 終了時にメモリから削除 autoDelete = true; // 終了時にメモリから削除
deleteBuffer(buffer, path); deleteBuffer(buffer, path);
} }
); );
@ -711,7 +711,7 @@ export class LAppModel extends CubismUserModel {
/** /**
* *
* *
* @param expressionId ID * @param expressionId ID
*/ */
public setExpression(expressionId: string): void public setExpression(expressionId: string): void
@ -770,7 +770,7 @@ export class LAppModel extends CubismUserModel {
/** /**
* *
* *
* *
* @param hitArenaName ID * @param hitArenaName ID
* @param x X * @param x X
* @param y Y * @param y Y
@ -800,7 +800,7 @@ export class LAppModel extends CubismUserModel {
/** /**
* *
* ModelSetting * ModelSetting
* *
* @param group * @param group
*/ */
public preLoadMotionGroup(group: string): void public preLoadMotionGroup(group: string): void
@ -816,9 +816,9 @@ export class LAppModel extends CubismUserModel {
{ {
LAppPal.printLog("[APP]load motion: {0} => [{1}_{2}]", path, group, i); LAppPal.printLog("[APP]load motion: {0} => [{1}_{2}]", path, group, i);
} }
fetch(path).then( fetch(path).then(
(response) => (response) =>
{ {
return response.arrayBuffer(); return response.arrayBuffer();
} }
@ -827,22 +827,22 @@ export class LAppModel extends CubismUserModel {
{ {
let buffer: ArrayBuffer = arrayBuffer; let buffer: ArrayBuffer = arrayBuffer;
let size = buffer.byteLength; let size = buffer.byteLength;
let tmpMotion: CubismMotion = <CubismMotion>this.loadMotion(buffer, size, name); let tmpMotion: CubismMotion = <CubismMotion>this.loadMotion(buffer, size, name);
let fadeTime = this._modelSetting.getMotionFadeInTimeValue(group, i); let fadeTime = this._modelSetting.getMotionFadeInTimeValue(group, i);
if(fadeTime >= 0.0) if(fadeTime >= 0.0)
{ {
tmpMotion.setFadeInTime(fadeTime); tmpMotion.setFadeInTime(fadeTime);
} }
fadeTime = this._modelSetting.getMotionFadeOutTimeValue(group, i); fadeTime = this._modelSetting.getMotionFadeOutTimeValue(group, i);
if(fadeTime >= 0.0) if(fadeTime >= 0.0)
{ {
tmpMotion.setFadeOutTime(fadeTime); tmpMotion.setFadeOutTime(fadeTime);
} }
tmpMotion.setEffectIds(this._eyeBlinkIds, this._lipSyncIds); tmpMotion.setEffectIds(this._eyeBlinkIds, this._lipSyncIds);
if(this._motions.getValue(name) != null) if(this._motions.getValue(name) != null)
{ {
ACubismMotion.delete(this._motions.getValue(name)); ACubismMotion.delete(this._motions.getValue(name));
@ -851,7 +851,7 @@ export class LAppModel extends CubismUserModel {
this._motions.setValue(name, tmpMotion); this._motions.setValue(name, tmpMotion);
deleteBuffer(buffer, path); deleteBuffer(buffer, path);
this._motionCount++; this._motionCount++;
if(this._motionCount >= this._allMotionCount) if(this._motionCount >= this._allMotionCount)
{ {
@ -897,8 +897,8 @@ export class LAppModel extends CubismUserModel {
// キャンバスサイズを渡す // キャンバスサイズを渡す
let viewport: number[] = [ let viewport: number[] = [
0, 0,
0, 0,
canvas.width, canvas.width,
canvas.height canvas.height
]; ];
@ -912,7 +912,7 @@ export class LAppModel extends CubismUserModel {
*/ */
public draw(matrix: CubismMatrix44): void public draw(matrix: CubismMatrix44): void
{ {
if(this._model == null) if(this._model == null)
{ {
return; return;
} }
@ -921,9 +921,9 @@ export class LAppModel extends CubismUserModel {
if(this._state == LoadStep.CompleteSetup) if(this._state == LoadStep.CompleteSetup)
{ {
matrix.multiplyByMatrix(this._modelMatrix); matrix.multiplyByMatrix(this._modelMatrix);
this.getRenderer().setMvpMatrix(matrix); this.getRenderer().setMvpMatrix(matrix);
this.doDraw(); this.doDraw();
} }
} }
@ -931,7 +931,7 @@ export class LAppModel extends CubismUserModel {
/** /**
* *
*/ */
public constructor() public constructor()
{ {
super(); super();
@ -947,7 +947,7 @@ export class LAppModel extends CubismUserModel {
this._hitArea = new csmVector<csmRect>(); this._hitArea = new csmVector<csmRect>();
this._userArea = new csmVector<csmRect>(); this._userArea = new csmVector<csmRect>();
this._idParamAngleX = CubismFramework.getIdManager().getId(CubismDefaultParameterId.ParamAngleX); this._idParamAngleX = CubismFramework.getIdManager().getId(CubismDefaultParameterId.ParamAngleX);
this._idParamAngleY = CubismFramework.getIdManager().getId(CubismDefaultParameterId.ParamAngleY); this._idParamAngleY = CubismFramework.getIdManager().getId(CubismDefaultParameterId.ParamAngleY);
this._idParamAngleZ = CubismFramework.getIdManager().getId(CubismDefaultParameterId.ParamAngleZ); this._idParamAngleZ = CubismFramework.getIdManager().getId(CubismDefaultParameterId.ParamAngleZ);
@ -987,4 +987,4 @@ export class LAppModel extends CubismUserModel {
_textureCount: number; // テクスチャカウント _textureCount: number; // テクスチャカウント
_motionCount: number; // モーションデータカウント _motionCount: number; // モーションデータカウント
_allMotionCount: number; // モーション総数 _allMotionCount: number; // モーション総数
} }

View File

@ -1,23 +1,23 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
/** /**
* Cubism Platform Abstraction Layer. * Cubism Platform Abstraction Layer.
* *
* *
*/ */
export class LAppPal export class LAppPal
{ {
/** /**
* *
* *
* @param filePath * @param filePath
* @return * @return
* { * {
* buffer, * buffer,
* size * size
* } * }
@ -99,4 +99,4 @@ export class LAppPal
static s_currentFrame = 0.0; static s_currentFrame = 0.0;
static s_lastFrame = 0.0; static s_lastFrame = 0.0;
static s_deltaTime = 0.0; static s_deltaTime = 0.0;
} }

View File

@ -1,15 +1,15 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import { gl, canvas } from "./lappdelegate"; import { gl, canvas } from "./lappdelegate";
/** /**
* *
* *
* Rect * Rect
*/ */
export class LAppSprite export class LAppSprite
@ -37,11 +37,11 @@ import { gl, canvas } from "./lappdelegate";
this._positionLocation = null; this._positionLocation = null;
this._uvLocation = null; this._uvLocation = null;
this._textureLocation = null; this._textureLocation = null;
this._positionArray = null; this._positionArray = null;
this._uvArray = null; this._uvArray = null;
this._indexArray = null; this._indexArray = null;
this._firstDraw = true; this._firstDraw = true;
} }
@ -98,7 +98,7 @@ import { gl, canvas } from "./lappdelegate";
// 何番目のuniform変数か取得 // 何番目のuniform変数か取得
this._textureLocation = gl.getUniformLocation(programId, "texture"); this._textureLocation = gl.getUniformLocation(programId, "texture");
// uniform属性の登録 // uniform属性の登録
gl.uniform1i(this._textureLocation, 0); gl.uniform1i(this._textureLocation, 0);
@ -110,7 +110,7 @@ import { gl, canvas } from "./lappdelegate";
0.0, 1.0, 0.0, 1.0,
1.0, 1.0 1.0, 1.0
]); ]);
// uvバッファを作成 // uvバッファを作成
this._uvBuffer = gl.createBuffer(); this._uvBuffer = gl.createBuffer();
} }
@ -119,7 +119,7 @@ import { gl, canvas } from "./lappdelegate";
{ {
let maxWidth = canvas.width; let maxWidth = canvas.width;
let maxHeight = canvas.height; let maxHeight = canvas.height;
// 頂点データ // 頂点データ
this._positionArray = new Float32Array([ this._positionArray = new Float32Array([
(this._rect.right - maxWidth * 0.5) / (maxWidth * 0.5), (this._rect.up - maxHeight * 0.5) / (maxHeight * 0.5), (this._rect.right - maxWidth * 0.5) / (maxWidth * 0.5), (this._rect.up - maxHeight * 0.5) / (maxHeight * 0.5),
@ -169,7 +169,7 @@ import { gl, canvas } from "./lappdelegate";
gl.bindTexture(gl.TEXTURE_2D, this._texture); gl.bindTexture(gl.TEXTURE_2D, this._texture);
gl.drawElements(gl.TRIANGLES, this._indexArray.length, gl.UNSIGNED_SHORT, 0); gl.drawElements(gl.TRIANGLES, this._indexArray.length, gl.UNSIGNED_SHORT, 0);
} }
/** /**
* *
* @param pointX x * @param pointX x
@ -212,4 +212,4 @@ import { gl, canvas } from "./lappdelegate";
public right: number; // 右辺 public right: number; // 右辺
public up: number; // 上辺 public up: number; // 上辺
public down: number; // 下辺 public down: number; // 下辺
} }

View File

@ -1,8 +1,8 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as csmvector} from "../../../../Framework/type/csmvector"; import {Live2DCubismFramework as csmvector} from "../../../../Framework/type/csmvector";
@ -38,7 +38,7 @@ export class LAppTextureManager
/** /**
* *
* *
* @param fileName * @param fileName
* @param usePremultiply Premult * @param usePremultiply Premult
* @return null * @return null
@ -50,7 +50,10 @@ export class LAppTextureManager
{ {
if(ite.ptr().fileName == fileName && ite.ptr().usePremultply == usePremultiply) if(ite.ptr().fileName == fileName && ite.ptr().usePremultply == usePremultiply)
{ {
// 2回目以降はキャッシュが使用される(待ち時間なし) // 2回目以降はキャッシュが使用される(待ち時間なし)
// WebKitでは同じImageのonloadを再度呼ぶには再インスタンスが必要
// 詳細https://stackoverflow.com/a/5024181
ite.ptr().img = new Image();
ite.ptr().img.onload = () => ite.ptr().img.onload = () =>
{ {
callback(ite.ptr()); callback(ite.ptr());
@ -69,12 +72,12 @@ export class LAppTextureManager
// テクスチャを選択 // テクスチャを選択
gl.bindTexture(gl.TEXTURE_2D, tex); gl.bindTexture(gl.TEXTURE_2D, tex);
// テクスチャにピクセルを書き込む // テクスチャにピクセルを書き込む
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
// Premult処理を行わせる // Premult処理を行わせる
if(usePremultiply) if(usePremultiply)
{ {
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 1); gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 1);
@ -108,7 +111,7 @@ export class LAppTextureManager
/** /**
* *
* *
* *
*/ */
public releaseTextures(): void public releaseTextures(): void
@ -123,7 +126,7 @@ export class LAppTextureManager
/** /**
* *
* *
* *
* @param texture * @param texture
*/ */
@ -144,7 +147,7 @@ export class LAppTextureManager
/** /**
* *
* *
* *
* @param fileName * @param fileName
*/ */
@ -174,5 +177,5 @@ export class TextureInfo
width: number = 0; // 横幅 width: number = 0; // 横幅
height: number = 0; // 高さ height: number = 0; // 高さ
usePremultply: boolean; // Premult処理を有効にするか usePremultply: boolean; // Premult処理を有効にするか
fileName: string; // ファイル名 fileName: string; // ファイル名
} }

View File

@ -1,9 +1,9 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import {Live2DCubismFramework as cubismMatrix44} from "../../../../Framework/math/cubismmatrix44"; import {Live2DCubismFramework as cubismMatrix44} from "../../../../Framework/math/cubismmatrix44";
import {Live2DCubismFramework as cubismviewmatrix} from "../../../../Framework/math/cubismviewmatrix"; import {Live2DCubismFramework as cubismviewmatrix} from "../../../../Framework/math/cubismviewmatrix";
@ -80,13 +80,13 @@ export class LAppView
*/ */
public release(): void public release(): void
{ {
this._viewMatrix = null; this._viewMatrix = null;
this._touchManager = null; this._touchManager = null;
this._deviceToScreen = null; this._deviceToScreen = null;
this._gear.release(); this._gear.release();
this._gear = null; this._gear = null;
this._back.release(); this._back.release();
this._back = null; this._back = null;
@ -113,7 +113,7 @@ export class LAppView
gl.flush(); gl.flush();
let live2DManager: LAppLive2DManager = LAppLive2DManager.getInstance(); let live2DManager: LAppLive2DManager = LAppLive2DManager.getInstance();
live2DManager.onUpdate(); live2DManager.onUpdate();
} }
@ -145,7 +145,7 @@ export class LAppView
}; };
textureManager.createTextureFromPngFile(resourcesPath + imageName, false, initBackGroundTexture); textureManager.createTextureFromPngFile(resourcesPath + imageName, false, initBackGroundTexture);
// 歯車画像初期化 // 歯車画像初期化
imageName = LAppDefine.GearImageName; imageName = LAppDefine.GearImageName;
let initGearTexture = (textureInfo: TextureInfo): void => let initGearTexture = (textureInfo: TextureInfo): void =>
@ -168,7 +168,7 @@ export class LAppView
/** /**
* *
* *
* @param pointX X * @param pointX X
* @param pointY Y * @param pointY Y
*/ */
@ -179,7 +179,7 @@ export class LAppView
/** /**
* *
* *
* @param pointX X * @param pointX X
* @param pointY Y * @param pointY Y
*/ */
@ -196,7 +196,7 @@ export class LAppView
/** /**
* *
* *
* @param pointX X * @param pointX X
* @param pointY Y * @param pointY Y
*/ */
@ -227,7 +227,7 @@ export class LAppView
/** /**
* XView * XView
* *
* @param deviceX X * @param deviceX X
*/ */
public transformViewX(deviceX: number): number public transformViewX(deviceX: number): number
@ -238,7 +238,7 @@ export class LAppView
/** /**
* YView * YView
* *
* @param deviceY Y * @param deviceY Y
*/ */
public transformViewY(deviceY: number): number public transformViewY(deviceY: number): number
@ -258,7 +258,7 @@ export class LAppView
/** /**
* YScreen * YScreen
* *
* @param deviceY Y * @param deviceY Y
*/ */
public transformScreenY(deviceY: number): number public transformScreenY(deviceY: number): number
@ -274,4 +274,4 @@ export class LAppView
_gear: LAppSprite; // ギア画像 _gear: LAppSprite; // ギア画像
_changeModel: boolean; // モデル切り替えフラグ _changeModel: boolean; // モデル切り替えフラグ
_isClick: boolean; // クリック中 _isClick: boolean; // クリック中
} }

View File

@ -1,9 +1,9 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
import { LAppDelegate } from "./lappdelegate"; import { LAppDelegate } from "./lappdelegate";

View File

@ -1,9 +1,9 @@
/* /**
* Copyright(c) Live2D Inc. All rights reserved. * Copyright(c) Live2D Inc. All rights reserved.
* *
* Use of this source code is governed by the Live2D Open Software license * 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. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/ */
export class TouchManager export class TouchManager
{ {
@ -32,7 +32,7 @@ export class TouchManager
{ {
return this._lastX; return this._lastX;
} }
public getCenterY(): number public getCenterY(): number
{ {
return this._lastY; return this._lastY;
@ -148,7 +148,7 @@ export class TouchManager
/** /**
* *
* *
* @param x1 x * @param x1 x
* @param y1 y * @param y1 y
* @param x2 x * @param x2 x
@ -162,15 +162,15 @@ export class TouchManager
/** /**
* *
* *
* *
* @param v1 * @param v1
* @param v2 * @param v2
* *
* @return * @return
*/ */
public calculateMovingAmount(v1: number, v2: number): number public calculateMovingAmount(v1: number, v2: number): number
{ {
if ((v1 > 0.0) != (v2 > 0.0)) if ((v1 > 0.0) != (v2 > 0.0))
{ {
return 0.0; return 0.0;
} }
@ -196,4 +196,4 @@ export class TouchManager
_scale: number; // このフレームで掛け合わせる拡大率。拡大操作中以外は1。 _scale: number; // このフレームで掛け合わせる拡大率。拡大操作中以外は1。
_touchSingle: boolean; // シングルタッチ時はtrue _touchSingle: boolean; // シングルタッチ時はtrue
_flipAvailable: boolean; // フリップが有効かどうか _flipAvailable: boolean; // フリップが有効かどうか
} }

5360
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -5,15 +5,17 @@
"build-sample": "npx webpack --config sample.webpack.config.js", "build-sample": "npx webpack --config sample.webpack.config.js",
"watch-sample": "npx webpack --watch --config sample.webpack.config.js", "watch-sample": "npx webpack --watch --config sample.webpack.config.js",
"build-all": "npm-run-all build-framework build-sample", "build-all": "npm-run-all build-framework build-sample",
"watch-all": "npm-run-all watch-framework watch-sample" "watch-all": "npm-run-all watch-framework watch-sample",
"serve": "serve"
}, },
"devDependencies": { "devDependencies": {
"npm-run-all": "^4.1.3", "glob": "^7.1.4",
"ts-loader": "^4.4.2", "npm-run-all": "^4.1.5",
"typescript": "^3.0.1", "serve": "^11.1.0",
"webpack": "^4.16.5", "ts-loader": "^6.0.4",
"webpack-cli": "^3.1.0", "typescript": "^3.5.3",
"glob": "^7.1.2" "webpack": "^4.39.1",
"webpack-cli": "^3.3.6"
}, },
"dependencies": { "dependencies": {
"whatwg-fetch": "^3.0.0" "whatwg-fetch": "^3.0.0"