@charivo/render-live2d 0.2.9 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type Character, type GazeCoordinates, type Message, type Renderer } from "@charivo/core";
|
|
2
|
+
import { type MouseCoordinates, type MouseTrackable } from "@charivo/render";
|
|
3
|
+
import { type Live2DRenderer, type Live2DRendererOptions } from "./renderer";
|
|
4
|
+
export declare class Live2DRendererImpl implements Renderer, MouseTrackable, Live2DRenderer {
|
|
5
|
+
private static cubismStarted;
|
|
6
|
+
private canvas?;
|
|
7
|
+
private host?;
|
|
8
|
+
private model?;
|
|
9
|
+
private lastModelPath?;
|
|
10
|
+
private teardownResize?;
|
|
11
|
+
private teardownBrowserLifecycle?;
|
|
12
|
+
private animationFrameId?;
|
|
13
|
+
private renderLoopPaused;
|
|
14
|
+
private recoveryPending;
|
|
15
|
+
private isRestoringContext;
|
|
16
|
+
private deviceToScreen;
|
|
17
|
+
private viewMatrix;
|
|
18
|
+
constructor(options?: Live2DRendererOptions);
|
|
19
|
+
initialize(): Promise<void>;
|
|
20
|
+
loadModel(modelPath: string): Promise<void>;
|
|
21
|
+
render(_message: Message, _character?: Character): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Set realtime lip sync mode (controlled by RenderManager)
|
|
24
|
+
*/
|
|
25
|
+
setRealtimeLipSync(enabled: boolean): void;
|
|
26
|
+
/**
|
|
27
|
+
* Update realtime lip sync RMS (controlled by RenderManager)
|
|
28
|
+
*/
|
|
29
|
+
updateRealtimeLipSyncRms(rms: number): void;
|
|
30
|
+
/**
|
|
31
|
+
* Get available expressions from the loaded model
|
|
32
|
+
*/
|
|
33
|
+
getAvailableExpressions(): string[];
|
|
34
|
+
/**
|
|
35
|
+
* Get available motion groups from the loaded model
|
|
36
|
+
*/
|
|
37
|
+
getAvailableMotionGroups(): Record<string, number>;
|
|
38
|
+
/**
|
|
39
|
+
* Play a specific expression by ID
|
|
40
|
+
*/
|
|
41
|
+
playExpression(expressionId: string): void;
|
|
42
|
+
/**
|
|
43
|
+
* Play a specific motion by group and index
|
|
44
|
+
*/
|
|
45
|
+
playMotionByGroup(group: string, index: number): void;
|
|
46
|
+
lookAt(coords: GazeCoordinates): void;
|
|
47
|
+
destroy(): Promise<void>;
|
|
48
|
+
private initializeCubism;
|
|
49
|
+
private startRenderLoop;
|
|
50
|
+
private renderFrame;
|
|
51
|
+
private resizeCanvas;
|
|
52
|
+
private updateViewMatrices;
|
|
53
|
+
updateViewWithMouse(coords: MouseCoordinates): void;
|
|
54
|
+
handleMouseTap(coords: MouseCoordinates): void;
|
|
55
|
+
private toViewCoordinates;
|
|
56
|
+
private bindCanvasLifecycle;
|
|
57
|
+
private unbindCanvasLifecycle;
|
|
58
|
+
private bindPageLifecycle;
|
|
59
|
+
private unbindPageLifecycle;
|
|
60
|
+
private readonly handleContextLost;
|
|
61
|
+
private readonly handleContextRestored;
|
|
62
|
+
private readonly handleHidden;
|
|
63
|
+
private readonly handleVisible;
|
|
64
|
+
private readonly handlePageHide;
|
|
65
|
+
private readonly handlePageShow;
|
|
66
|
+
private pauseRenderLoop;
|
|
67
|
+
private resumeRenderLoop;
|
|
68
|
+
private restoreAfterContextLoss;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=live2d-renderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live2d-renderer.d.ts","sourceRoot":"","sources":["../../src/live2d-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,OAAO,EACZ,KAAK,QAAQ,EACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAY7E,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAE7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,CAAC,IAAI,CAAC;IAkB9B,OAAO,CAAC,gBAAgB;IAaxB,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,WAAW;IAiCnB,OAAO,CAAC,YAAY;IAiBpB,OAAO,CAAC,kBAAkB;IAiC1B,mBAAmB,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI;IAMnD,cAAc,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI;IAe9C,OAAO,CAAC,iBAAiB;IAoBzB,OAAO,CAAC,mBAAmB;IAQ3B,OAAO,CAAC,qBAAqB;IAW7B,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,mBAAmB;IAK3B,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAIhC;IAEF,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAEpC;IAEF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAE3B;IAEF,OAAO,CAAC,QAAQ,CAAC,aAAa,CAE5B;IAEF,OAAO,CAAC,QAAQ,CAAC,cAAc,CAE7B;IAEF,OAAO,CAAC,QAAQ,CAAC,cAAc,CAE7B;IAEF,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,gBAAgB;YAQV,uBAAuB;CA+BtC"}
|
package/dist/src/renderer.d.ts
CHANGED
|
@@ -1,73 +1,14 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type
|
|
1
|
+
import { type GazeCoordinates, type Renderer } from "@charivo/core";
|
|
2
|
+
import { type MouseTrackable } from "@charivo/render";
|
|
3
3
|
export interface Live2DRendererOptions {
|
|
4
4
|
canvas?: HTMLCanvasElement;
|
|
5
5
|
}
|
|
6
|
-
export
|
|
7
|
-
private static cubismStarted;
|
|
8
|
-
private canvas?;
|
|
9
|
-
private host?;
|
|
10
|
-
private model?;
|
|
11
|
-
private lastModelPath?;
|
|
12
|
-
private teardownResize?;
|
|
13
|
-
private teardownBrowserLifecycle?;
|
|
14
|
-
private animationFrameId?;
|
|
15
|
-
private renderLoopPaused;
|
|
16
|
-
private recoveryPending;
|
|
17
|
-
private isRestoringContext;
|
|
18
|
-
private deviceToScreen;
|
|
19
|
-
private viewMatrix;
|
|
20
|
-
constructor(options?: Live2DRendererOptions);
|
|
21
|
-
initialize(): Promise<void>;
|
|
22
|
-
loadModel(modelPath: string): Promise<void>;
|
|
23
|
-
render(_message: Message, _character?: Character): Promise<void>;
|
|
24
|
-
/**
|
|
25
|
-
* Set realtime lip sync mode (controlled by RenderManager)
|
|
26
|
-
*/
|
|
27
|
-
setRealtimeLipSync(enabled: boolean): void;
|
|
28
|
-
/**
|
|
29
|
-
* Update realtime lip sync RMS (controlled by RenderManager)
|
|
30
|
-
*/
|
|
31
|
-
updateRealtimeLipSyncRms(rms: number): void;
|
|
32
|
-
/**
|
|
33
|
-
* Get available expressions from the loaded model
|
|
34
|
-
*/
|
|
35
|
-
getAvailableExpressions(): string[];
|
|
36
|
-
/**
|
|
37
|
-
* Get available motion groups from the loaded model
|
|
38
|
-
*/
|
|
39
|
-
getAvailableMotionGroups(): Record<string, number>;
|
|
40
|
-
/**
|
|
41
|
-
* Play a specific expression by ID
|
|
42
|
-
*/
|
|
6
|
+
export interface Live2DRenderer extends Renderer, MouseTrackable {
|
|
43
7
|
playExpression(expressionId: string): void;
|
|
44
|
-
/**
|
|
45
|
-
* Play a specific motion by group and index
|
|
46
|
-
*/
|
|
47
8
|
playMotionByGroup(group: string, index: number): void;
|
|
48
9
|
lookAt(coords: GazeCoordinates): void;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
private startRenderLoop;
|
|
52
|
-
private renderFrame;
|
|
53
|
-
private resizeCanvas;
|
|
54
|
-
private updateViewMatrices;
|
|
55
|
-
updateViewWithMouse(coords: MouseCoordinates): void;
|
|
56
|
-
handleMouseTap(coords: MouseCoordinates): void;
|
|
57
|
-
private toViewCoordinates;
|
|
58
|
-
private bindCanvasLifecycle;
|
|
59
|
-
private unbindCanvasLifecycle;
|
|
60
|
-
private bindPageLifecycle;
|
|
61
|
-
private unbindPageLifecycle;
|
|
62
|
-
private readonly handleContextLost;
|
|
63
|
-
private readonly handleContextRestored;
|
|
64
|
-
private readonly handleHidden;
|
|
65
|
-
private readonly handleVisible;
|
|
66
|
-
private readonly handlePageHide;
|
|
67
|
-
private readonly handlePageShow;
|
|
68
|
-
private pauseRenderLoop;
|
|
69
|
-
private resumeRenderLoop;
|
|
70
|
-
private restoreAfterContextLoss;
|
|
10
|
+
getAvailableExpressions(): string[];
|
|
11
|
+
getAvailableMotionGroups(): Record<string, number>;
|
|
71
12
|
}
|
|
72
13
|
export declare function createLive2DRenderer(options?: Live2DRendererOptions): Live2DRenderer;
|
|
73
14
|
//# sourceMappingURL=renderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/renderer.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/renderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAItD,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC5B;AAED,MAAM,WAAW,cAAe,SAAQ,QAAQ,EAAE,cAAc;IAC9D,cAAc,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACtD,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAAC;IACtC,uBAAuB,IAAI,MAAM,EAAE,CAAC;IACpC,wBAAwB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpD;AAED,wBAAgB,oBAAoB,CAClC,OAAO,CAAC,EAAE,qBAAqB,GAC9B,cAAc,CAEhB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@charivo/render-live2d",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Live2D rendering engine for Charivo",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/renderer.js",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"dist"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@charivo/core": "0.
|
|
21
|
-
"@charivo/render": "0.
|
|
20
|
+
"@charivo/core": "0.15.0",
|
|
21
|
+
"@charivo/render": "0.6.1"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"tsup": "^8.5.0",
|