cubism

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2024 License: MIT Imports: 13 Imported by: 0

README

Cubism Go

Go Reference Go Report Card CI

cubism-goはLive2D Cubism SDKの非公式版のGolang実装です。ebitengine/puregoを用いているため扱いやすいです。

インストール

go get -u github.com/aethiopicuschan/cubism-go

動作に必要なもの

  • cubism coreの動的ライブラリ
  • Live2Dモデル

使い方

exampleディレクトリにサンプルコードがあります。おおむね全ての機能を利用したものとなっているので、Go Referenceと合わせて参照してください。

また、描画の実装として render/ebitengine パッケージがあります。 これにより、Ebitegineを用いたプロジェクトで簡単に利用することができます。もちろん、自身で実装した renderer を使うことも可能です。

また、音声の再生のための実装をいくつか用意しています。

  • sound/normal
    • 一番素直と思われる実装
  • sound/delay
    • 音声ファイルの読み込みやデコード等を再生時まで遅延させる実装
  • sound/disabled
    • 音声再生を無効化する実装

こちらも自身で実装することが可能です。

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cubism

type Cubism struct {

	// 音声ファイルを読み込む関数
	LoadSound func(fp string) (s sound.Sound, err error)
	// contains filtered or unexported fields
}

cubism-goの本体

func NewCubism

func NewCubism(lib string) (c Cubism, err error)

func (*Cubism) LoadModel

func (c *Cubism) LoadModel(path string) (m *Model, err error)

model3.jsonからモデルを読み込む

type Drawable

type Drawable struct {
	Id              string
	Texture         string
	VertexPositions []drawable.Vector2
	VertexUvs       []drawable.Vector2
	VertexIndices   []uint16
	ConstantFlag    drawable.ConstantFlag
	DynamicFlag     drawable.DynamicFlag
	Opacity         float32
	Masks           []int32
}

type Model

type Model struct {
	// contains filtered or unexported fields
}

モデルを表す構造体

func (m *Model) DisableAutoBlink()

自動まばたきを無効にする

func (m *Model) EnableAutoBlink()

自動まばたきを有効にする

func (*Model) GetCore

func (m *Model) GetCore() core.Core

コアを取得する

func (*Model) GetDrawable

func (m *Model) GetDrawable(id string) (d Drawable, err error)

指定したIDのDrawableを取得する

func (*Model) GetDrawables

func (m *Model) GetDrawables() []Drawable

Drawablesを取得する

func (*Model) GetHitAreas

func (m *Model) GetHitAreas() []model.HitArea

ヒットエリアの一覧を取得する

func (*Model) GetMoc

func (m *Model) GetMoc() moc.Moc

Mocを取得する

func (*Model) GetMotionGroupNames

func (m *Model) GetMotionGroupNames() (names []string)

モーションのグループ名の一覧を取得する

func (*Model) GetMotions

func (m *Model) GetMotions(groupName string) []motion.Motion

グループに含まれるモーションの一覧を取得する

func (*Model) GetOpacity

func (m *Model) GetOpacity() float32

透明度を取得する

func (*Model) GetParameterValue

func (m *Model) GetParameterValue(id string) float32

パラメータの値を取得する

func (*Model) GetParameters

func (m *Model) GetParameters() []parameter.Parameter

パラメータの一覧を取得する

func (*Model) GetSortedIndices

func (m *Model) GetSortedIndices() []int

ソート済みの描画順のインデックスを取得する

func (*Model) GetTextures

func (m *Model) GetTextures() []string

テクスチャ画像のパスを取得する

func (*Model) GetVersion

func (m *Model) GetVersion() int

バージョンを取得する

func (*Model) PlayMotion

func (m *Model) PlayMotion(groupName string, index int, loop bool) (id int)

モーションを再生する

func (*Model) SetParameterValue

func (m *Model) SetParameterValue(id string, value float32)

パラメータの値を設定する

func (*Model) StopMotion

func (m *Model) StopMotion(id int)

モーションを停止する

func (*Model) Update

func (m *Model) Update(delta float64)

モデルを更新する

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL