Skip to content

Commit

Permalink
新增Live2d Cubism 3
Browse files Browse the repository at this point in the history
  • Loading branch information
imuncle committed Aug 20, 2019
1 parent ce8b2ad commit 07a7f13
Show file tree
Hide file tree
Showing 159 changed files with 128,937 additions and 6 deletions.
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
live2d模型收集+展示,可直接用于静态网站

# 展示页面
https://imuncle.github.io/live2d
* [Live2d Cubism 2](https://imuncle.github.io/live2d)
* [Live2d Cubism 3](https://imuncle.github.io/live2d/live2d_3)

# 使用说明
## Live2d Cubism 2
* 引用必要的`js`文件:
```html
<script src="js/LAppDefine.js"></script>
Expand Down Expand Up @@ -46,16 +48,23 @@ https://imuncle.github.io/live2d
|__model.moc(模型本体)
```
部分模型有所不同。
## Live2d Cubism 3
以上内容都是基于旧的Cubism Editor 2制作与开发,现在官网老早就使用Cubism 3了(详见[Cubism 3 | Live2D](https://www.live2d.com/en/products/cubism3)

Cubism 3使用的是`TypeScript`,相比第二版更加稳健。

官方在[官网](https://live2d.github.io)上也提供了Demo下载。

* Demo的使用参照内附的README.md,需要使用Node.js + TypeScript + Visual Studio Code 组合。
* 本repo的live2d Cubism 3全部文件放在`live2d_3`中,可单独使用,未包含TypeSCript编译环境。

# 相关链接
* Live2D官方网站:
https://www.live2d.com/en/
https://live2d.github.io
* Live2D官方网站: https://www.live2d.com/en/https://live2d.github.io
* [梦象](https://mx-model.ga/) (live2d模型收集站)
* [Live2D!把可爱的看板娘捕捉到你的博客去吧](https://haremu.com/p/205)
* [EYHN/hexo-helper-live2d](https://github.com/EYHN/hexo-helper-live2d) (向hexo中添加live2d)
* [网页添加 Live2D 看板娘](https://www.fghrsh.net/post/123.html)
* [Live2dDemo](https://github.com/summerscar/live2dDemo) (live2d模型收集站)

# 版权须知
所有模型均收集自互联网,版权均归原公司/个人所有。您可将本站资源用于学习、非营利性的网站或项目,不得用于商业使用(付费分发售卖资源、二次修改用于盈利等)。
所有模型均收集自互联网,版权均归原公司/个人所有。您可将资源用于学习、非营利性的网站或项目,不得用于商业使用(付费分发售卖资源、二次修改用于盈利等)。
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>live2d</title>
<title>Live2d Cubism 2</title>
<meta charset="utf-8">
<link rel="icon" href="avatar.png">
<style>
Expand All @@ -23,6 +23,7 @@
<input type="number" id="model" placeholder="模型编号">
<input type="number" id="Texure" placeholder="衣服编号">
<button onclick="JumpToModel()">跳转</button>
<a href="live2d_3">Live2d Cubism 2</a>
<ol id="model_info"></ol>
<canvas class="live2d" id="live2d" width="300" height="800"></canvas>
</body>
Expand Down
272 changes: 272 additions & 0 deletions live2d_3/Core/live2dcubismcore.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,272 @@
declare namespace Live2DCubismCore {
/** Cubism version identifier. */
type csmVersion = 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;
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 {
/** 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;
/** Maximum parameter values. */
maximumValues: Float32Array;
/** Default parameter values. */
defaultValues: Float32Array;
/** Parameter values. */
values: 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>;
/** 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 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;
}
}
578 changes: 578 additions & 0 deletions live2d_3/Core/live2dcubismcore.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions live2d_3/Core/live2dcubismcore.js.map

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions live2d_3/Core/live2dcubismcore.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 07a7f13

Please sign in to comment.