untitled-pixi-live2d-engine 1.0.2 → 1.2.0
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.
- package/README.md +99 -90
- package/dist/cubism-legacy.es.js +274 -136
- package/dist/cubism-legacy.js +273 -135
- package/dist/cubism-legacy.min.js +1 -1
- package/dist/cubism.es.js +306 -134
- package/dist/cubism.js +305 -133
- package/dist/cubism.min.js +1 -1
- package/dist/index.es.js +315 -137
- package/dist/index.js +314 -136
- package/dist/index.min.js +1 -1
- package/package.json +1 -1
- package/types/index.d.ts +145 -21
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Generated by dts-bundle-generator v6.11.0
|
|
2
2
|
|
|
3
3
|
import { Sound } from '@pixi/sound';
|
|
4
|
-
import { Bounds, Container, EventEmitter, FederatedPointerEvent, GlRenderingContext, InstructionSet, Matrix, ObservablePoint, Point, RenderLayer, Renderer, Texture, Ticker, Transform } from 'pixi.js';
|
|
4
|
+
import { Bounds, Container, EventEmitter, ExtensionType, FederatedPointerEvent, GlRenderingContext, InstructionSet, Matrix, ObservablePoint, Point, RenderLayer, Renderer, Texture, Ticker, Transform } from 'pixi.js';
|
|
5
5
|
|
|
6
6
|
declare class Live2DModelWebGL {
|
|
7
7
|
static loadModel(buffer: ArrayBuffer): Live2DModelWebGL;
|
|
@@ -3119,6 +3119,12 @@ export interface InternalModelOptions extends MotionManagerOptions {
|
|
|
3119
3119
|
* @default 0.4
|
|
3120
3120
|
*/
|
|
3121
3121
|
lipSyncWeight?: number;
|
|
3122
|
+
/**
|
|
3123
|
+
* Whether to use Cubism's high precision clipping mask rendering.
|
|
3124
|
+
* Only supported by Cubism 3/4/5 models.
|
|
3125
|
+
* @default 'auto'
|
|
3126
|
+
*/
|
|
3127
|
+
useHighPrecisionMask?: boolean | "auto";
|
|
3122
3128
|
}
|
|
3123
3129
|
/**
|
|
3124
3130
|
* A wrapper that manages the states of a Live2D core model, and delegates all operations to it.
|
|
@@ -3933,6 +3939,91 @@ export declare class SoundManager {
|
|
|
3933
3939
|
static destroy(): void;
|
|
3934
3940
|
}
|
|
3935
3941
|
export type Middleware<T> = (context: T, next: (err?: Error | null) => Promise<void>) => Promise<void>;
|
|
3942
|
+
/**
|
|
3943
|
+
* Atlas texture LOD strategy used when loading and rendering Live2D model textures.
|
|
3944
|
+
*
|
|
3945
|
+
* - `full`: ask Pixi to generate a full mipmap chain for the original atlas.
|
|
3946
|
+
* - `single-auto`: keep the original atlas, and render with one generated downsampled
|
|
3947
|
+
* atlas when the model is small enough on screen.
|
|
3948
|
+
* - `false`: use the original atlas only.
|
|
3949
|
+
*/
|
|
3950
|
+
export type Live2DTextureLODMode = false | "full" | "single-auto";
|
|
3951
|
+
/**
|
|
3952
|
+
* Sampling filter used while generating a `single-auto` downsampled atlas.
|
|
3953
|
+
*/
|
|
3954
|
+
export type Live2DTextureLODFilter = "linear" | "nearest";
|
|
3955
|
+
export interface Live2DTextureLODOptions {
|
|
3956
|
+
/**
|
|
3957
|
+
* Selects the atlas LOD strategy for model textures.
|
|
3958
|
+
*
|
|
3959
|
+
* `full` is the default and uses Pixi's mipmap generation for the original atlas.
|
|
3960
|
+
* `single-auto` creates one downsampled atlas on demand and switches to it while
|
|
3961
|
+
* rendering small models. `false` disables both paths.
|
|
3962
|
+
*
|
|
3963
|
+
* @default 'full'
|
|
3964
|
+
*/
|
|
3965
|
+
lod?: Live2DTextureLODMode;
|
|
3966
|
+
/**
|
|
3967
|
+
* Effective screen scale below which `single-auto` can switch to a generated
|
|
3968
|
+
* downsampled atlas. The effective scale is computed from model world scale and
|
|
3969
|
+
* renderer resolution.
|
|
3970
|
+
*
|
|
3971
|
+
* Ignored unless `lod` is `'single-auto'`.
|
|
3972
|
+
*
|
|
3973
|
+
* @default 0.5
|
|
3974
|
+
*/
|
|
3975
|
+
lodScaleThreshold?: number;
|
|
3976
|
+
/**
|
|
3977
|
+
* Minimum original atlas side length required before `single-auto` considers
|
|
3978
|
+
* generating a downsampled atlas.
|
|
3979
|
+
*
|
|
3980
|
+
* Ignored unless `lod` is `'single-auto'`.
|
|
3981
|
+
*
|
|
3982
|
+
* @default 4096
|
|
3983
|
+
*/
|
|
3984
|
+
lodTextureSizeThreshold?: number;
|
|
3985
|
+
/**
|
|
3986
|
+
* Maximum generated `single-auto` LOD level. Each level halves the atlas width and
|
|
3987
|
+
* height once, so level 1 is 1/2 size and level 2 is 1/4 size.
|
|
3988
|
+
*
|
|
3989
|
+
* Ignored unless `lod` is `'single-auto'`.
|
|
3990
|
+
*
|
|
3991
|
+
* @default undefined
|
|
3992
|
+
*/
|
|
3993
|
+
lodMaxLevel?: number;
|
|
3994
|
+
/**
|
|
3995
|
+
* Sampling filter used while drawing the generated `single-auto` atlas.
|
|
3996
|
+
*
|
|
3997
|
+
* Ignored unless `lod` is `'single-auto'`.
|
|
3998
|
+
*
|
|
3999
|
+
* @default 'linear'
|
|
4000
|
+
*/
|
|
4001
|
+
lodFilter?: Live2DTextureLODFilter;
|
|
4002
|
+
}
|
|
4003
|
+
export interface TextureLODPlanInput extends Live2DTextureLODOptions {
|
|
4004
|
+
effectiveScale: number;
|
|
4005
|
+
textureWidth: number;
|
|
4006
|
+
textureHeight: number;
|
|
4007
|
+
}
|
|
4008
|
+
export interface TextureLODPlan {
|
|
4009
|
+
level: number;
|
|
4010
|
+
width: number;
|
|
4011
|
+
height: number;
|
|
4012
|
+
}
|
|
4013
|
+
/**
|
|
4014
|
+
* Texture loading options accepted by Live2D model atlas loading.
|
|
4015
|
+
*/
|
|
4016
|
+
export interface Live2DTextureSourceOptions extends Live2DTextureLODOptions {
|
|
4017
|
+
/**
|
|
4018
|
+
* Forces Pixi to load texture resources without createImageBitmap.
|
|
4019
|
+
* Cubism 2 textures use this because their WebGL upload path depends on HTML image sources.
|
|
4020
|
+
* @default undefined
|
|
4021
|
+
*/
|
|
4022
|
+
preferCreateImageBitmap?: boolean;
|
|
4023
|
+
}
|
|
4024
|
+
export interface CreateTextureOptions extends Live2DTextureSourceOptions {
|
|
4025
|
+
crossOrigin?: string;
|
|
4026
|
+
}
|
|
3936
4027
|
export interface Live2DFactoryOptions extends Live2DModelOptions {
|
|
3937
4028
|
/**
|
|
3938
4029
|
* Whether to check the consistency of the moc file. It's an internal
|
|
@@ -3960,6 +4051,14 @@ export interface Live2DFactoryOptions extends Live2DModelOptions {
|
|
|
3960
4051
|
* @default false
|
|
3961
4052
|
*/
|
|
3962
4053
|
checkMotionConsistency?: boolean;
|
|
4054
|
+
/**
|
|
4055
|
+
* Texture loading and atlas LOD options.
|
|
4056
|
+
*
|
|
4057
|
+
* See {@link Live2DTextureLODOptions} for the available `lod` strategies.
|
|
4058
|
+
*
|
|
4059
|
+
* @default { lod: 'full' }
|
|
4060
|
+
*/
|
|
4061
|
+
textureOptions?: Live2DTextureSourceOptions;
|
|
3963
4062
|
}
|
|
3964
4063
|
/**
|
|
3965
4064
|
* The context transferred through the model creation middlewares.
|
|
@@ -4167,10 +4266,47 @@ declare class Automator {
|
|
|
4167
4266
|
export declare class Live2DTransform extends Transform {
|
|
4168
4267
|
}
|
|
4169
4268
|
export interface Live2DModelOptions extends InternalModelOptions, AutomatorOptions {
|
|
4269
|
+
/**
|
|
4270
|
+
* Texture loading and atlas LOD options for this model.
|
|
4271
|
+
*
|
|
4272
|
+
* See {@link Live2DTextureLODOptions} for the available `lod` strategies.
|
|
4273
|
+
*
|
|
4274
|
+
* @default { lod: 'full' }
|
|
4275
|
+
*/
|
|
4276
|
+
textureOptions?: Live2DTextureSourceOptions;
|
|
4170
4277
|
}
|
|
4171
4278
|
export type Live2DConstructor = {
|
|
4172
4279
|
new (options?: Live2DModelOptions): Live2DModel;
|
|
4173
4280
|
};
|
|
4281
|
+
declare class Live2DPipe {
|
|
4282
|
+
private renderer;
|
|
4283
|
+
static extension: {
|
|
4284
|
+
readonly type: readonly [
|
|
4285
|
+
ExtensionType.WebGLPipes
|
|
4286
|
+
];
|
|
4287
|
+
readonly name: "live2d";
|
|
4288
|
+
};
|
|
4289
|
+
constructor(renderer: Renderer);
|
|
4290
|
+
addRenderable(model: Live2DModel, instructionSet: InstructionSet): void;
|
|
4291
|
+
execute(model: Live2DModel): void;
|
|
4292
|
+
updateRenderable(): void;
|
|
4293
|
+
destroyRenderable(): void;
|
|
4294
|
+
validateRenderable(): boolean;
|
|
4295
|
+
destroy(): void;
|
|
4296
|
+
}
|
|
4297
|
+
/**
|
|
4298
|
+
* PixiJS extension entry for registering the Live2D WebGL render pipe.
|
|
4299
|
+
*
|
|
4300
|
+
* Register it before creating a renderer:
|
|
4301
|
+
*
|
|
4302
|
+
* ```ts
|
|
4303
|
+
* import { extensions } from 'pixi.js'
|
|
4304
|
+
* import { Live2DPlugin } from 'untitled-pixi-live2d-engine'
|
|
4305
|
+
*
|
|
4306
|
+
* extensions.add(Live2DPlugin)
|
|
4307
|
+
* ```
|
|
4308
|
+
*/
|
|
4309
|
+
export declare const Live2DPlugin: typeof Live2DPipe;
|
|
4174
4310
|
/**
|
|
4175
4311
|
* A wrapper that allows the Live2D model to be used as a DisplayObject in PixiJS.
|
|
4176
4312
|
*
|
|
@@ -4238,6 +4374,9 @@ export declare class Live2DModel<IM extends InternalModel = InternalModel> exten
|
|
|
4238
4374
|
* @type {Texture[]}
|
|
4239
4375
|
*/
|
|
4240
4376
|
textures: Texture[];
|
|
4377
|
+
private readonly textureOptions?;
|
|
4378
|
+
private readonly textureLODStates;
|
|
4379
|
+
private readonly textureLODFailures;
|
|
4241
4380
|
/** @override
|
|
4242
4381
|
* The Live2DTransform instance for this model.
|
|
4243
4382
|
*/
|
|
@@ -4436,6 +4575,11 @@ export declare class Live2DModel<IM extends InternalModel = InternalModel> exten
|
|
|
4436
4575
|
* @param dt - The elapsed time in milliseconds since last frame.
|
|
4437
4576
|
*/
|
|
4438
4577
|
update(dt: DOMHighResTimeStamp): void;
|
|
4578
|
+
private resolveTextureForRender;
|
|
4579
|
+
private markTextureLODFailure;
|
|
4580
|
+
private destroyTextureLODState;
|
|
4581
|
+
private destroyTextureLODStates;
|
|
4582
|
+
private uploadTextureForRender;
|
|
4439
4583
|
/**
|
|
4440
4584
|
* Renders the Live2DModel to the renderer.
|
|
4441
4585
|
* @param renderer - The PixiJS Renderer instance.
|
|
@@ -4622,26 +4766,6 @@ export declare class FileLoader {
|
|
|
4622
4766
|
*/
|
|
4623
4767
|
static readText(file: File): Promise<string>;
|
|
4624
4768
|
}
|
|
4625
|
-
export type ZipReader = never;
|
|
4626
|
-
/**
|
|
4627
|
-
* Experimental loader to load resources from a zip file.
|
|
4628
|
-
*
|
|
4629
|
-
* Though named as a "Loader", this class has nothing to do with Live2DLoader,
|
|
4630
|
-
* it only contains a middleware for the Live2DFactory.
|
|
4631
|
-
*/
|
|
4632
|
-
export declare class ZipLoader {
|
|
4633
|
-
private static live2dFactory;
|
|
4634
|
-
static ZIP_PROTOCOL: string;
|
|
4635
|
-
static uid: number;
|
|
4636
|
-
static factory: Middleware<Live2DFactoryContext>;
|
|
4637
|
-
static unzip(reader: ZipReader, settings: ModelSettings): Promise<File[]>;
|
|
4638
|
-
static createSettings(reader: ZipReader): Promise<ModelSettings>;
|
|
4639
|
-
static zipReader(data: Blob, url: string): Promise<ZipReader>;
|
|
4640
|
-
static getFilePaths(reader: ZipReader): Promise<string[]>;
|
|
4641
|
-
static getFiles(reader: ZipReader, paths: string[]): Promise<File[]>;
|
|
4642
|
-
static readText(reader: ZipReader, path: string): Promise<string>;
|
|
4643
|
-
static releaseReader(reader: ZipReader): void;
|
|
4644
|
-
}
|
|
4645
4769
|
/**
|
|
4646
4770
|
* A simple tagged logger.
|
|
4647
4771
|
*
|