| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367 |
- /**
- * Copyright(c) Live2D Inc. All rights reserved.
- *
- * Use of this source code is governed by the Live2D Proprietary Software license
- * that can be found at https://www.live2d.com/eula/live2d-proprietary-software-license-agreement_en.html.
- */
- declare namespace Live2DCubismCore {
- /** Cubism version identifier. */
- type csmVersion = number;
- /** moc3 version identifier. */
- type csmMocVersion = number;
- /** Parameter type identifier. */
- type csmParameterType = number;
- /** Necessary alignment for mocs (in bytes). */
- const AlignofMoc: number;
- /** Necessary alignment for models (in bytes). */
- const AlignofModel: number;
- /** .moc3 file version Unknown */
- const MocVersion_Unknown: number;
- /** .moc3 file version 3.0.00 - 3.2.07 */
- const MocVersion_30: number;
- /** .moc3 file version 3.3.00 - 3.3.03 */
- const MocVersion_33: number;
- /** .moc3 file version 4.0.00 - 4.1.05 */
- const MocVersion_40: number;
- /** .moc3 file version 4.2.00 - 4.2.04 */
- const MocVersion_42: number;
- /** .moc3 file version 5.0.00 - */
- const MocVersion_50: number;
- /** Normal Parameter. */
- const ParameterType_Normal: number;
- /** Parameter for blend shape. */
- const ParameterType_BlendShape: number;
- /** Log handler.
- *
- * @param message Null-terminated string message to log.
- */
- interface csmLogFunction {
- (message: string): void;
- }
- /** Cubism version. */
- class Version {
- /**
- * Queries Core version.
- *
- * @return Core version.
- */
- static csmGetVersion(): csmVersion;
- /**
- * Gets Moc file supported latest version.
- *
- * @return Moc file latest format version.
- */
- static csmGetLatestMocVersion(): csmMocVersion;
- /**
- * Gets Moc file format version.
- *
- * @param moc Moc
- *
- * @return csmMocVersion
- */
- static csmGetMocVersion(moc: Moc, mocBytes: ArrayBuffer): csmMocVersion;
- private constructor();
- }
- /** Cubism logging. */
- class Logging {
- private static logFunction;
- /**
- * Sets log handler.
- *
- * @param handler Handler to use.
- */
- static csmSetLogFunction(handler: csmLogFunction): void;
- /**
- * Queries log handler.
- *
- * @return Log handler.
- */
- static csmGetLogFunction(): csmLogFunction;
- /**
- * Wrap log function.
- *
- * @param messagePtr number
- *
- * @return string
- */
- private static wrapLogFunction;
- private constructor();
- }
- /** Cubism moc. */
- class Moc {
- /**
- * Checks consistency of a moc.
- *
- * @param mocBytes Moc bytes.
- *
- * @returns '1' if Moc is valid; '0' otherwise.
- */
- hasMocConsistency(mocBytes: ArrayBuffer): number;
- /** Creates [[Moc]] from [[ArrayBuffer]].
- *
- * @param buffer Array buffer
- *
- * @return [[Moc]] on success; [[null]] otherwise.
- */
- static fromArrayBuffer(buffer: ArrayBuffer): Moc;
- /** Releases instance. */
- _release(): void;
- /** Native moc. */
- _ptr: number;
- /**
- * Initializes instance.
- *
- * @param mocBytes Moc bytes.
- */
- private constructor();
- }
- /** Cubism model. */
- class Model {
- /** Parameters. */
- parameters: Parameters;
- /** Parts. */
- parts: Parts;
- /** Drawables. */
- drawables: Drawables;
- /** Canvas information. */
- canvasinfo: CanvasInfo;
- /**
- * Creates [[Model]] from [[Moc]].
- *
- * @param moc Moc
- *
- * @return [[Model]] on success; [[null]] otherwise.
- */
- static fromMoc(moc: Moc): Model;
- /** Updates instance. */
- update(): void;
- /** Releases instance. */
- release(): void;
- /** Native model. */
- _ptr: number;
- /**
- * Initializes instance.
- *
- * @param moc Moc
- */
- private constructor();
- }
- /** Canvas information interface. */
- class CanvasInfo {
- /** Width of native model canvas. */
- CanvasWidth: number;
- /** Height of native model canvas. */
- CanvasHeight: number;
- /** Coordinate origin of X axis. */
- CanvasOriginX: number;
- /** Coordinate origin of Y axis. */
- CanvasOriginY: number;
- /** Pixels per unit of native model. */
- PixelsPerUnit: number;
- /**
- * Initializes instance.
- *
- * @param modelPtr Native model pointer.
- */
- constructor(modelPtr: number);
- }
- /** Cubism model parameters */
- class Parameters {
- /** Parameter count. */
- count: number;
- /** Parameter IDs. */
- ids: Array<string>;
- /** Minimum parameter values. */
- minimumValues: Float32Array;
- /** Parameter types. */
- types: Int32Array;
- /** Maximum parameter values. */
- maximumValues: Float32Array;
- /** Default parameter values. */
- defaultValues: Float32Array;
- /** Parameter values. */
- values: Float32Array;
- /** Number of key values of each parameter. */
- keyCounts: Int32Array;
- /** Key values of each parameter. */
- keyValues: Array<Float32Array>;
- /**
- * Initializes instance.
- *
- * @param modelPtr Native model.
- */
- constructor(modelPtr: number);
- }
- /** Cubism model parts */
- class Parts {
- /** Part count. */
- count: number;
- /** Part IDs. */
- ids: Array<string>;
- /** Opacity values. */
- opacities: Float32Array;
- /** Part's parent part indices. */
- parentIndices: Int32Array;
- /**
- * Initializes instance.
- *
- * @param modelPtr Native model.
- */
- constructor(modelPtr: number);
- }
- /** Cubism model drawables */
- class Drawables {
- /** Drawable count. */
- count: number;
- /** Drawable IDs. */
- ids: Array<string>;
- /** Constant drawable flags. */
- constantFlags: Uint8Array;
- /** Dynamic drawable flags. */
- dynamicFlags: Uint8Array;
- /** Drawable texture indices. */
- textureIndices: Int32Array;
- /** Drawable draw orders. */
- drawOrders: Int32Array;
- /** Drawable render orders. */
- renderOrders: Int32Array;
- /** Drawable opacities. */
- opacities: Float32Array;
- /** Mask count for each drawable. */
- maskCounts: Int32Array;
- /** Masks for each drawable. */
- masks: Array<Int32Array>;
- /** Number of vertices of each drawable. */
- vertexCounts: Int32Array;
- /** 2D vertex position data of each drawable. */
- vertexPositions: Array<Float32Array>;
- /** 2D texture coordinate data of each drawables. */
- vertexUvs: Array<Float32Array>;
- /** Number of triangle indices for each drawable. */
- indexCounts: Int32Array;
- /** Triangle index data for each drawable. */
- indices: Array<Uint16Array>;
- /** Information multiply color. */
- multiplyColors: Float32Array;
- /** Information Screen color. */
- screenColors: Float32Array;
- /** Indices of drawables parent part. */
- parentPartIndices: Int32Array;
- /** Resets all dynamic drawable flags.. */
- resetDynamicFlags(): void;
- /** Native model. */
- private _modelPtr;
- /**
- * Initializes instance.
- *
- * @param modelPtr Native model.
- */
- constructor(modelPtr: number);
- }
- /** Utility functions. */
- class Utils {
- /**
- * Checks whether flag is set in bitfield.
- *
- * @param bitfield Bitfield to query against.
- *
- * @return [[true]] if bit set; [[false]] otherwise
- */
- static hasBlendAdditiveBit(bitfield: number): boolean;
- /**
- * Checks whether flag is set in bitfield.
- *
- * @param bitfield Bitfield to query against.
- *
- * @return [[true]] if bit set; [[false]] otherwise
- */
- static hasBlendMultiplicativeBit(bitfield: number): boolean;
- /**
- * Checks whether flag is set in bitfield.
- *
- * @param bitfield Bitfield to query against.
- *
- * @return [[true]] if bit set; [[false]] otherwise
- */
- static hasIsDoubleSidedBit(bitfield: number): boolean;
- /**
- * Checks whether flag is set in bitfield.
- *
- * @param bitfield Bitfield to query against.
- *
- * @return [[true]] if bit set; [[false]] otherwise
- */
- static hasIsInvertedMaskBit(bitfield: number): boolean;
- /**
- * Checks whether flag is set in bitfield.
- *
- * @param bitfield Bitfield to query against.
- *
- * @return [[true]] if bit set; [[false]] otherwise
- */
- static hasIsVisibleBit(bitfield: number): boolean;
- /**
- * Checks whether flag is set in bitfield.
- *
- * @param bitfield Bitfield to query against.
- *
- * @return [[true]] if bit set; [[false]] otherwise
- */
- static hasVisibilityDidChangeBit(bitfield: number): boolean;
- /**
- * Checks whether flag is set in bitfield.
- *
- * @param bitfield Bitfield to query against.
- *
- * @return [[true]] if bit set; [[false]] otherwise
- */
- static hasOpacityDidChangeBit(bitfield: number): boolean;
- /**
- * Checks whether flag is set in bitfield.
- *
- * @param bitfield Bitfield to query against.
- *
- * @return [[true]] if bit set; [[false]] otherwise
- */
- static hasDrawOrderDidChangeBit(bitfield: number): boolean;
- /**
- * Checks whether flag is set in bitfield.
- *
- * @param bitfield Bitfield to query against.
- *
- * @return [[true]] if bit set; [[false]] otherwise
- */
- static hasRenderOrderDidChangeBit(bitfield: number): boolean;
- /**
- * Checks whether flag is set in bitfield.
- *
- * @param bitfield Bitfield to query against.
- *
- * @return [[true]] if bit set; [[false]] otherwise
- */
- static hasVertexPositionsDidChangeBit(bitfield: number): boolean;
- /**
- * Checks whether flag is set in bitfield.
- *
- * @param bitfield Bitfield to query against.
- *
- * @return [[true]] if bit set; [[false]] otherwise
- */
- static hasBlendColorDidChangeBit(bitfield: number): boolean;
- }
- /** Memory functions. */
- class Memory {
- /**
- * HACK:
- * Extend memory size allocated during module initialization.
- * If the specified size is less than or equal to 16777216(byte), the default of 16 MB is allocated.
- *
- * @see https://github.com/emscripten-core/emscripten/blob/main/src/settings.js#L161
- *
- * @param size allocated memory size [byte(s)]
- */
- static initializeAmountOfMemory(size: number): void;
- private constructor();
- }
- /** Emscripten Cubism Core module. */
- }
|