@doki-land/live2d 0.0.0 → 0.0.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,367 @@
1
+ /**
2
+ * Copyright(c) Live2D Inc. All rights reserved.
3
+ *
4
+ * Use of this source code is governed by the Live2D Proprietary Software license
5
+ * that can be found at https://www.live2d.com/eula/live2d-proprietary-software-license-agreement_en.html.
6
+ */
7
+ declare namespace Live2DCubismCore {
8
+ /** Cubism version identifier. */
9
+ type csmVersion = number;
10
+ /** moc3 version identifier. */
11
+ type csmMocVersion = number;
12
+ /** Parameter type identifier. */
13
+ type csmParameterType = number;
14
+ /** Necessary alignment for mocs (in bytes). */
15
+ const AlignofMoc: number;
16
+ /** Necessary alignment for models (in bytes). */
17
+ const AlignofModel: number;
18
+ /** .moc3 file version Unknown */
19
+ const MocVersion_Unknown: number;
20
+ /** .moc3 file version 3.0.00 - 3.2.07 */
21
+ const MocVersion_30: number;
22
+ /** .moc3 file version 3.3.00 - 3.3.03 */
23
+ const MocVersion_33: number;
24
+ /** .moc3 file version 4.0.00 - 4.1.05 */
25
+ const MocVersion_40: number;
26
+ /** .moc3 file version 4.2.00 - 4.2.04 */
27
+ const MocVersion_42: number;
28
+ /** .moc3 file version 5.0.00 - */
29
+ const MocVersion_50: number;
30
+ /** Normal Parameter. */
31
+ const ParameterType_Normal: number;
32
+ /** Parameter for blend shape. */
33
+ const ParameterType_BlendShape: number;
34
+ /** Log handler.
35
+ *
36
+ * @param message Null-terminated string message to log.
37
+ */
38
+ interface csmLogFunction {
39
+ (message: string): void;
40
+ }
41
+ /** Cubism version. */
42
+ class Version {
43
+ /**
44
+ * Queries Core version.
45
+ *
46
+ * @return Core version.
47
+ */
48
+ static csmGetVersion(): csmVersion;
49
+ /**
50
+ * Gets Moc file supported latest version.
51
+ *
52
+ * @return Moc file latest format version.
53
+ */
54
+ static csmGetLatestMocVersion(): csmMocVersion;
55
+ /**
56
+ * Gets Moc file format version.
57
+ *
58
+ * @param moc Moc
59
+ *
60
+ * @return csmMocVersion
61
+ */
62
+ static csmGetMocVersion(moc: Moc, mocBytes: ArrayBuffer): csmMocVersion;
63
+ private constructor();
64
+ }
65
+ /** Cubism logging. */
66
+ class Logging {
67
+ private static logFunction;
68
+ /**
69
+ * Sets log handler.
70
+ *
71
+ * @param handler Handler to use.
72
+ */
73
+ static csmSetLogFunction(handler: csmLogFunction): void;
74
+ /**
75
+ * Queries log handler.
76
+ *
77
+ * @return Log handler.
78
+ */
79
+ static csmGetLogFunction(): csmLogFunction;
80
+ /**
81
+ * Wrap log function.
82
+ *
83
+ * @param messagePtr number
84
+ *
85
+ * @return string
86
+ */
87
+ private static wrapLogFunction;
88
+ private constructor();
89
+ }
90
+ /** Cubism moc. */
91
+ class Moc {
92
+ /**
93
+ * Checks consistency of a moc.
94
+ *
95
+ * @param mocBytes Moc bytes.
96
+ *
97
+ * @returns '1' if Moc is valid; '0' otherwise.
98
+ */
99
+ hasMocConsistency(mocBytes: ArrayBuffer): number;
100
+ /** Creates [[Moc]] from [[ArrayBuffer]].
101
+ *
102
+ * @param buffer Array buffer
103
+ *
104
+ * @return [[Moc]] on success; [[null]] otherwise.
105
+ */
106
+ static fromArrayBuffer(buffer: ArrayBuffer): Moc;
107
+ /** Releases instance. */
108
+ _release(): void;
109
+ /** Native moc. */
110
+ _ptr: number;
111
+ /**
112
+ * Initializes instance.
113
+ *
114
+ * @param mocBytes Moc bytes.
115
+ */
116
+ private constructor();
117
+ }
118
+ /** Cubism model. */
119
+ class Model {
120
+ /** Parameters. */
121
+ parameters: Parameters;
122
+ /** Parts. */
123
+ parts: Parts;
124
+ /** Drawables. */
125
+ drawables: Drawables;
126
+ /** Canvas information. */
127
+ canvasinfo: CanvasInfo;
128
+ /**
129
+ * Creates [[Model]] from [[Moc]].
130
+ *
131
+ * @param moc Moc
132
+ *
133
+ * @return [[Model]] on success; [[null]] otherwise.
134
+ */
135
+ static fromMoc(moc: Moc): Model;
136
+ /** Updates instance. */
137
+ update(): void;
138
+ /** Releases instance. */
139
+ release(): void;
140
+ /** Native model. */
141
+ _ptr: number;
142
+ /**
143
+ * Initializes instance.
144
+ *
145
+ * @param moc Moc
146
+ */
147
+ private constructor();
148
+ }
149
+ /** Canvas information interface. */
150
+ class CanvasInfo {
151
+ /** Width of native model canvas. */
152
+ CanvasWidth: number;
153
+ /** Height of native model canvas. */
154
+ CanvasHeight: number;
155
+ /** Coordinate origin of X axis. */
156
+ CanvasOriginX: number;
157
+ /** Coordinate origin of Y axis. */
158
+ CanvasOriginY: number;
159
+ /** Pixels per unit of native model. */
160
+ PixelsPerUnit: number;
161
+ /**
162
+ * Initializes instance.
163
+ *
164
+ * @param modelPtr Native model pointer.
165
+ */
166
+ constructor(modelPtr: number);
167
+ }
168
+ /** Cubism model parameters */
169
+ class Parameters {
170
+ /** Parameter count. */
171
+ count: number;
172
+ /** Parameter IDs. */
173
+ ids: Array<string>;
174
+ /** Minimum parameter values. */
175
+ minimumValues: Float32Array;
176
+ /** Parameter types. */
177
+ types: Int32Array;
178
+ /** Maximum parameter values. */
179
+ maximumValues: Float32Array;
180
+ /** Default parameter values. */
181
+ defaultValues: Float32Array;
182
+ /** Parameter values. */
183
+ values: Float32Array;
184
+ /** Number of key values of each parameter. */
185
+ keyCounts: Int32Array;
186
+ /** Key values of each parameter. */
187
+ keyValues: Array<Float32Array>;
188
+ /**
189
+ * Initializes instance.
190
+ *
191
+ * @param modelPtr Native model.
192
+ */
193
+ constructor(modelPtr: number);
194
+ }
195
+ /** Cubism model parts */
196
+ class Parts {
197
+ /** Part count. */
198
+ count: number;
199
+ /** Part IDs. */
200
+ ids: Array<string>;
201
+ /** Opacity values. */
202
+ opacities: Float32Array;
203
+ /** Part's parent part indices. */
204
+ parentIndices: Int32Array;
205
+ /**
206
+ * Initializes instance.
207
+ *
208
+ * @param modelPtr Native model.
209
+ */
210
+ constructor(modelPtr: number);
211
+ }
212
+ /** Cubism model drawables */
213
+ class Drawables {
214
+ /** Drawable count. */
215
+ count: number;
216
+ /** Drawable IDs. */
217
+ ids: Array<string>;
218
+ /** Constant drawable flags. */
219
+ constantFlags: Uint8Array;
220
+ /** Dynamic drawable flags. */
221
+ dynamicFlags: Uint8Array;
222
+ /** Drawable texture indices. */
223
+ textureIndices: Int32Array;
224
+ /** Drawable draw orders. */
225
+ drawOrders: Int32Array;
226
+ /** Drawable render orders. */
227
+ renderOrders: Int32Array;
228
+ /** Drawable opacities. */
229
+ opacities: Float32Array;
230
+ /** Mask count for each drawable. */
231
+ maskCounts: Int32Array;
232
+ /** Masks for each drawable. */
233
+ masks: Array<Int32Array>;
234
+ /** Number of vertices of each drawable. */
235
+ vertexCounts: Int32Array;
236
+ /** 2D vertex position data of each drawable. */
237
+ vertexPositions: Array<Float32Array>;
238
+ /** 2D texture coordinate data of each drawables. */
239
+ vertexUvs: Array<Float32Array>;
240
+ /** Number of triangle indices for each drawable. */
241
+ indexCounts: Int32Array;
242
+ /** Triangle index data for each drawable. */
243
+ indices: Array<Uint16Array>;
244
+ /** Information multiply color. */
245
+ multiplyColors: Float32Array;
246
+ /** Information Screen color. */
247
+ screenColors: Float32Array;
248
+ /** Indices of drawables parent part. */
249
+ parentPartIndices: Int32Array;
250
+ /** Resets all dynamic drawable flags.. */
251
+ resetDynamicFlags(): void;
252
+ /** Native model. */
253
+ private _modelPtr;
254
+ /**
255
+ * Initializes instance.
256
+ *
257
+ * @param modelPtr Native model.
258
+ */
259
+ constructor(modelPtr: number);
260
+ }
261
+ /** Utility functions. */
262
+ class Utils {
263
+ /**
264
+ * Checks whether flag is set in bitfield.
265
+ *
266
+ * @param bitfield Bitfield to query against.
267
+ *
268
+ * @return [[true]] if bit set; [[false]] otherwise
269
+ */
270
+ static hasBlendAdditiveBit(bitfield: number): boolean;
271
+ /**
272
+ * Checks whether flag is set in bitfield.
273
+ *
274
+ * @param bitfield Bitfield to query against.
275
+ *
276
+ * @return [[true]] if bit set; [[false]] otherwise
277
+ */
278
+ static hasBlendMultiplicativeBit(bitfield: number): boolean;
279
+ /**
280
+ * Checks whether flag is set in bitfield.
281
+ *
282
+ * @param bitfield Bitfield to query against.
283
+ *
284
+ * @return [[true]] if bit set; [[false]] otherwise
285
+ */
286
+ static hasIsDoubleSidedBit(bitfield: number): boolean;
287
+ /**
288
+ * Checks whether flag is set in bitfield.
289
+ *
290
+ * @param bitfield Bitfield to query against.
291
+ *
292
+ * @return [[true]] if bit set; [[false]] otherwise
293
+ */
294
+ static hasIsInvertedMaskBit(bitfield: number): boolean;
295
+ /**
296
+ * Checks whether flag is set in bitfield.
297
+ *
298
+ * @param bitfield Bitfield to query against.
299
+ *
300
+ * @return [[true]] if bit set; [[false]] otherwise
301
+ */
302
+ static hasIsVisibleBit(bitfield: number): boolean;
303
+ /**
304
+ * Checks whether flag is set in bitfield.
305
+ *
306
+ * @param bitfield Bitfield to query against.
307
+ *
308
+ * @return [[true]] if bit set; [[false]] otherwise
309
+ */
310
+ static hasVisibilityDidChangeBit(bitfield: number): boolean;
311
+ /**
312
+ * Checks whether flag is set in bitfield.
313
+ *
314
+ * @param bitfield Bitfield to query against.
315
+ *
316
+ * @return [[true]] if bit set; [[false]] otherwise
317
+ */
318
+ static hasOpacityDidChangeBit(bitfield: number): boolean;
319
+ /**
320
+ * Checks whether flag is set in bitfield.
321
+ *
322
+ * @param bitfield Bitfield to query against.
323
+ *
324
+ * @return [[true]] if bit set; [[false]] otherwise
325
+ */
326
+ static hasDrawOrderDidChangeBit(bitfield: number): boolean;
327
+ /**
328
+ * Checks whether flag is set in bitfield.
329
+ *
330
+ * @param bitfield Bitfield to query against.
331
+ *
332
+ * @return [[true]] if bit set; [[false]] otherwise
333
+ */
334
+ static hasRenderOrderDidChangeBit(bitfield: number): boolean;
335
+ /**
336
+ * Checks whether flag is set in bitfield.
337
+ *
338
+ * @param bitfield Bitfield to query against.
339
+ *
340
+ * @return [[true]] if bit set; [[false]] otherwise
341
+ */
342
+ static hasVertexPositionsDidChangeBit(bitfield: number): boolean;
343
+ /**
344
+ * Checks whether flag is set in bitfield.
345
+ *
346
+ * @param bitfield Bitfield to query against.
347
+ *
348
+ * @return [[true]] if bit set; [[false]] otherwise
349
+ */
350
+ static hasBlendColorDidChangeBit(bitfield: number): boolean;
351
+ }
352
+ /** Memory functions. */
353
+ class Memory {
354
+ /**
355
+ * HACK:
356
+ * Extend memory size allocated during module initialization.
357
+ * If the specified size is less than or equal to 16777216(byte), the default of 16 MB is allocated.
358
+ *
359
+ * @see https://github.com/emscripten-core/emscripten/blob/main/src/settings.js#L161
360
+ *
361
+ * @param size allocated memory size [byte(s)]
362
+ */
363
+ static initializeAmountOfMemory(size: number): void;
364
+ private constructor();
365
+ }
366
+ /** Emscripten Cubism Core module. */
367
+ }