Skip to content

Commit

Permalink
Merge pull request #34 from cocor-au-lait/feature/avoid-namespace
Browse files Browse the repository at this point in the history
Feature/avoid namespace
  • Loading branch information
wada-at-live2d-com authored Mar 2, 2021
2 parents b0034f9 + 9198a9f commit 2a6e811
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 88 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ dist/
.vscode/*
!/.vscode/extensions.json
!/.vscode/launch.json
!/.vscode/settings.json
!/.vscode/tasks.json
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typescript.tsdk": "./Samples/TypeScript/Demo/node_modules/typescript/lib"
}
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]

### Fixed
* Avoiding needless namespace syntax to simplify imports by [@cocor-au-lait](https://github.com/cocor-au-lait)

## [4-r.1] - 2020-01-30

Expand Down
2 changes: 1 addition & 1 deletion Framework
Submodule Framework updated 45 files
+0 −1 .eslintrc.yml
+1 −0 .gitignore
+3 −0 .vscode/settings.json
+2 −2 package.json
+103 −50 src/cubismdefaultparameterid.ts
+714 −726 src/cubismmodelsettingjson.ts
+98 −98 src/effect/cubismbreath.ts
+198 −197 src/effect/cubismeyeblink.ts
+303 −308 src/effect/cubismpose.ts
+37 −31 src/icubismallcator.ts
+192 −188 src/icubismmodelsetting.ts
+59 −53 src/id/cubismid.ts
+93 −90 src/id/cubismidmanager.ts
+190 −185 src/live2dcubismframework.ts
+164 −159 src/math/cubismmath.ts
+270 −264 src/math/cubismmatrix44.ts
+192 −189 src/math/cubismmodelmatrix.ts
+138 −133 src/math/cubismtargetpoint.ts
+157 −151 src/math/cubismvector2.ts
+300 −298 src/math/cubismviewmatrix.ts
+78 −73 src/model/cubismmoc.ts
+693 −697 src/model/cubismmodel.ts
+103 −103 src/model/cubismmodeluserdata.ts
+97 −94 src/model/cubismmodeluserdatajson.ts
+378 −391 src/model/cubismusermodel.ts
+244 −242 src/motion/acubismmotion.ts
+172 −172 src/motion/cubismexpressionmotion.ts
+787 −799 src/motion/cubismmotion.ts
+131 −115 src/motion/cubismmotioninternal.ts
+319 −317 src/motion/cubismmotionjson.ts
+103 −101 src/motion/cubismmotionmanager.ts
+216 −212 src/motion/cubismmotionqueueentry.ts
+282 −283 src/motion/cubismmotionqueuemanager.ts
+796 −811 src/physics/cubismphysics.ts
+222 −198 src/physics/cubismphysicsinternal.ts
+627 −628 src/physics/cubismphysicsjson.ts
+231 −223 src/rendering/cubismrenderer.ts
+1,980 −2,017 src/rendering/cubismrenderer_webgl.ts
+253 −243 src/type/csmmap.ts
+72 −66 src/type/csmrectf.ts
+85 −79 src/type/csmstring.ts
+289 −281 src/type/csmvector.ts
+61 −65 src/utils/cubismdebug.ts
+1,046 −1,039 src/utils/cubismjson.ts
+103 −97 src/utils/cubismstring.ts
4 changes: 2 additions & 2 deletions Samples/TypeScript/Demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"build": "webpack -d --hide-modules",
"build:prod": "webpack -p --hide-modules",
"test": "tsc --noEmit",
"lint": "eslint src -f codeframe --ext .ts",
"lint:fix": "eslint src -f codeframe --ext .ts --fix",
"lint": "eslint src --ext .ts",
"lint:fix": "eslint src --ext .ts --fix",
"serve": "serve ../../.. -p 5000",
"clean": "rimraf dist"
},
Expand Down
23 changes: 10 additions & 13 deletions Samples/TypeScript/Demo/src/lappdelegate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@
* 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 Csm_CubismFramework = live2dcubismframework.CubismFramework;
import { LAppView } from './lappview';
import { CubismFramework, Option } from '@framework/live2dcubismframework';

import * as LAppDefine from './lappdefine';
import { LAppLive2DManager } from './lapplive2dmanager';
import { LAppPal } from './lapppal';
import { LAppTextureManager } from './lapptexturemanager';
import { LAppLive2DManager } from './lapplive2dmanager';
import * as LAppDefine from './lappdefine';
import { LAppView } from './lappview';

export let canvas: HTMLCanvasElement = null;
export let s_instance: LAppDelegate = null;
Expand Down Expand Up @@ -124,7 +121,7 @@ export class LAppDelegate {
LAppLive2DManager.releaseInstance();

// Cubism SDKの解放
Csm_CubismFramework.dispose();
CubismFramework.dispose();
}

/**
Expand Down Expand Up @@ -250,7 +247,7 @@ export class LAppDelegate {
this._mouseY = 0.0;
this._isEnd = false;

this._cubismOption = new Csm_Option();
this._cubismOption = new Option();
this._view = new LAppView();
this._textureManager = new LAppTextureManager();
}
Expand All @@ -262,10 +259,10 @@ export class LAppDelegate {
// setup cubism
this._cubismOption.logFunction = LAppPal.printMessage;
this._cubismOption.loggingLevel = LAppDefine.CubismLoggingLevel;
Csm_CubismFramework.startUp(this._cubismOption);
CubismFramework.startUp(this._cubismOption);

// initialize cubism
Csm_CubismFramework.initialize();
CubismFramework.initialize();

// load model
LAppLive2DManager.getInstance();
Expand All @@ -275,7 +272,7 @@ export class LAppDelegate {
this._view.initializeSprite();
}

_cubismOption: Csm_Option; // Cubism SDK Option
_cubismOption: Option; // Cubism SDK Option
_view: LAppView; // View情報
_captured: boolean; // クリックしているか
_mouseX: number; // マウスX座標
Expand Down
25 changes: 11 additions & 14 deletions Samples/TypeScript/Demo/src/lapplive2dmanager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@
* 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 csmvector } from '@framework/type/csmvector';
import { Live2DCubismFramework as acubismmotion } from '@framework/motion/acubismmotion';
import Csm_csmVector = csmvector.csmVector;
import Csm_CubismMatrix44 = cubismmatrix44.CubismMatrix44;
import ACubismMotion = acubismmotion.ACubismMotion;
import { CubismMatrix44 } from '@framework/math/cubismmatrix44';
import { ACubismMotion } from '@framework/motion/acubismmotion';
import { csmVector } from '@framework/type/csmvector';

import * as LAppDefine from './lappdefine';
import { canvas } from './lappdelegate';
import { LAppModel } from './lappmodel';
import { LAppPal } from './lapppal';
import { canvas } from './lappdelegate';
import * as LAppDefine from './lappdefine';

export let s_instance: LAppLive2DManager = null;

Expand Down Expand Up @@ -134,7 +131,7 @@ export class LAppLive2DManager {
* モデルの更新処理及び描画処理を行う
*/
public onUpdate(): void {
let projection: Csm_CubismMatrix44 = new Csm_CubismMatrix44();
let projection: CubismMatrix44 = new CubismMatrix44();

const { width, height } = canvas;
projection.scale(1.0, width / height);
Expand All @@ -143,7 +140,7 @@ export class LAppLive2DManager {
projection.multiplyByMatrix(this._viewMatrix);
}

const saveProjection: Csm_CubismMatrix44 = projection.clone();
const saveProjection: CubismMatrix44 = projection.clone();
const modelCount: number = this._models.getSize();

for (let i = 0; i < modelCount; ++i) {
Expand Down Expand Up @@ -191,14 +188,14 @@ export class LAppLive2DManager {
* コンストラクタ
*/
constructor() {
this._viewMatrix = new Csm_CubismMatrix44();
this._models = new Csm_csmVector<LAppModel>();
this._viewMatrix = new CubismMatrix44();
this._models = new csmVector<LAppModel>();
this._sceneIndex = 0;
this.changeScene(this._sceneIndex);
}

_viewMatrix: Csm_CubismMatrix44; // モデル描画に用いるview行列
_models: Csm_csmVector<LAppModel>; // モデルインスタンスのコンテナ
_viewMatrix: CubismMatrix44; // モデル描画に用いるview行列
_models: csmVector<LAppModel>; // モデルインスタンスのコンテナ
_sceneIndex: number; // 表示するシーンのインデックス値
// モーション再生終了のコールバック関数
_finishedMotion = (self: ACubismMotion): void => {
Expand Down
67 changes: 29 additions & 38 deletions Samples/TypeScript/Demo/src/lappmodel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,39 @@
* 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 cubismid } from '@framework/id/cubismid';
import { Live2DCubismFramework as cubismusermodel } from '@framework/model/cubismusermodel';
import { Live2DCubismFramework as icubismmodelsetting } from '@framework/icubismmodelsetting';
import { Live2DCubismFramework as cubismmodelsettingjson } from '@framework/cubismmodelsettingjson';
import { Live2DCubismFramework as cubismdefaultparameterid } from '@framework/cubismdefaultparameterid';
import { Live2DCubismFramework as acubismmotion } from '@framework/motion/acubismmotion';
import { Live2DCubismFramework as cubismeyeblink } from '@framework/effect/cubismeyeblink';
import { Live2DCubismFramework as cubismbreath } from '@framework/effect/cubismbreath';
import { Live2DCubismFramework as csmvector } from '@framework/type/csmvector';
import { Live2DCubismFramework as csmmap } from '@framework/type/csmmap';
import { Live2DCubismFramework as cubismmatrix44 } from '@framework/math/cubismmatrix44';
import { Live2DCubismFramework as cubismmotion } from '@framework/motion/cubismmotion';
import { Live2DCubismFramework as cubismmotionqueuemanager } from '@framework/motion/cubismmotionqueuemanager';
import { Live2DCubismFramework as csmstring } from '@framework/type/csmstring';
import { Live2DCubismFramework as csmrect } from '@framework/type/csmrectf';
import 'whatwg-fetch';

import { CubismDefaultParameterId } from '@framework/cubismdefaultparameterid';
import { CubismModelSettingJson } from '@framework/cubismmodelsettingjson';
import {
BreathParameterData,
CubismBreath
} from '@framework/effect/cubismbreath';
import { CubismEyeBlink } from '@framework/effect/cubismeyeblink';
import { ICubismModelSetting } from '@framework/icubismmodelsetting';
import { CubismIdHandle } from '@framework/id/cubismid';
import { CubismFramework } from '@framework/live2dcubismframework';
import { CubismMatrix44 } from '@framework/math/cubismmatrix44';
import { CubismUserModel } from '@framework/model/cubismusermodel';
import {
ACubismMotion,
FinishedMotionCallback
} from '@framework/motion/acubismmotion';
import { CubismMotion } from '@framework/motion/cubismmotion';
import {
CubismMotionQueueEntryHandle,
InvalidMotionQueueEntryHandleValue
} from '@framework/motion/cubismmotionqueuemanager';
import { csmMap } from '@framework/type/csmmap';
import { csmRect } from '@framework/type/csmrectf';
import { csmString } from '@framework/type/csmstring';
import { csmVector } from '@framework/type/csmvector';
import { CubismLogInfo } from '@framework/utils/cubismdebug';
import csmRect = csmrect.csmRect;
import csmString = csmstring.csmString;
import InvalidMotionQueueEntryHandleValue = cubismmotionqueuemanager.InvalidMotionQueueEntryHandleValue;
import CubismMotionQueueEntryHandle = cubismmotionqueuemanager.CubismMotionQueueEntryHandle;
import CubismMotion = cubismmotion.CubismMotion;
import CubismMatrix44 = cubismmatrix44.CubismMatrix44;
import csmMap = csmmap.csmMap;
import csmVector = csmvector.csmVector;
import CubismBreath = cubismbreath.CubismBreath;
import BreathParameterData = cubismbreath.BreathParameterData;
import CubismEyeBlink = cubismeyeblink.CubismEyeBlink;
import ACubismMotion = acubismmotion.ACubismMotion;
import FinishedMotionCallback = acubismmotion.FinishedMotionCallback;
import CubismFramework = live2dcubismframework.CubismFramework;
import CubismIdHandle = cubismid.CubismIdHandle;
import CubismUserModel = cubismusermodel.CubismUserModel;
import ICubismModelSetting = icubismmodelsetting.ICubismModelSetting;
import CubismModelSettingJson = cubismmodelsettingjson.CubismModelSettingJson;
import CubismDefaultParameterId = cubismdefaultparameterid;

import * as LAppDefine from './lappdefine';
import { canvas, frameBuffer, gl, LAppDelegate } from './lappdelegate';
import { LAppPal } from './lapppal';
import { gl, canvas, frameBuffer, LAppDelegate } from './lappdelegate';
import { TextureInfo } from './lapptexturemanager';
import * as LAppDefine from './lappdefine';
import 'whatwg-fetch';

enum LoadStep {
LoadAssets,
Expand Down
2 changes: 1 addition & 1 deletion Samples/TypeScript/Demo/src/lappsprite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/

import { gl, canvas } from './lappdelegate';
import { canvas, gl } from './lappdelegate';

/**
* スプライトを実装するクラス
Expand Down
13 changes: 6 additions & 7 deletions Samples/TypeScript/Demo/src/lapptexturemanager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
* 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 Csm_csmVector = csmvector.csmVector;
import csmVector_iterator = csmvector.iterator;
import { csmVector, iterator } from '@framework/type/csmvector';

import { gl } from './lappdelegate';

/**
Expand All @@ -19,15 +18,15 @@ export class LAppTextureManager {
* コンストラクタ
*/
constructor() {
this._textures = new Csm_csmVector<TextureInfo>();
this._textures = new csmVector<TextureInfo>();
}

/**
* 解放する。
*/
public release(): void {
for (
let ite: csmVector_iterator<TextureInfo> = this._textures.begin();
let ite: iterator<TextureInfo> = this._textures.begin();
ite.notEqual(this._textures.end());
ite.preIncrement()
) {
Expand All @@ -50,7 +49,7 @@ export class LAppTextureManager {
): void {
// search loaded texture already
for (
let ite: csmVector_iterator<TextureInfo> = this._textures.begin();
let ite: iterator<TextureInfo> = this._textures.begin();
ite.notEqual(this._textures.end());
ite.preIncrement()
) {
Expand Down Expand Up @@ -162,7 +161,7 @@ export class LAppTextureManager {
}
}

_textures: Csm_csmVector<TextureInfo>;
_textures: csmVector<TextureInfo>;
}

/**
Expand Down
23 changes: 11 additions & 12 deletions Samples/TypeScript/Demo/src/lappview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
* 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 cubismviewmatrix } from '@framework/math/cubismviewmatrix';
import Csm_CubismViewMatrix = cubismviewmatrix.CubismViewMatrix;
import Csm_CubismMatrix44 = cubismMatrix44.CubismMatrix44;
import { TouchManager } from './touchmanager';
import { CubismMatrix44 } from '@framework/math/cubismmatrix44';
import { CubismViewMatrix } from '@framework/math/cubismviewmatrix';

import * as LAppDefine from './lappdefine';
import { canvas, gl, LAppDelegate } from './lappdelegate';
import { LAppLive2DManager } from './lapplive2dmanager';
import { LAppDelegate, canvas, gl } from './lappdelegate';
import { LAppPal } from './lapppal';
import { LAppSprite } from './lappsprite';
import { TextureInfo } from './lapptexturemanager';
import { LAppPal } from './lapppal';
import * as LAppDefine from './lappdefine';
import { TouchManager } from './touchmanager';

/**
* 描画クラス。
Expand All @@ -33,10 +32,10 @@ export class LAppView {
this._touchManager = new TouchManager();

// デバイス座標からスクリーン座標に変換するための
this._deviceToScreen = new Csm_CubismMatrix44();
this._deviceToScreen = new CubismMatrix44();

// 画面の表示の拡大縮小や移動の変換を行う行列
this._viewMatrix = new Csm_CubismViewMatrix();
this._viewMatrix = new CubismViewMatrix();
}

/**
Expand Down Expand Up @@ -257,8 +256,8 @@ export class LAppView {
}

_touchManager: TouchManager; // タッチマネージャー
_deviceToScreen: Csm_CubismMatrix44; // デバイスからスクリーンへの行列
_viewMatrix: Csm_CubismViewMatrix; // viewMatrix
_deviceToScreen: CubismMatrix44; // デバイスからスクリーンへの行列
_viewMatrix: CubismViewMatrix; // viewMatrix
_programId: WebGLProgram; // シェーダID
_back: LAppSprite; // 背景画像
_gear: LAppSprite; // ギア画像
Expand Down

0 comments on commit 2a6e811

Please sign in to comment.