pmx

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2025 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const BONE_DIRECTION_PREFIX string = "{d}"
View Source
const MLIB_PREFIX string = "[mlib]"

MLIB_PREFIX システム用接頭辞

Variables

View Source
var CollisionGroupFlags = []uint16{
	0x0001,
	0x0002,
	0x0004,
	0x0008,
	0x0010,
	0x0020,
	0x0040,
	0x0080,
	0x0100,
	0x0200,
	0x0400,
	0x0800,
	0x1000,
	0x2000,
	0x4000,
	0x8000,
}

Functions

func GetStandardBoneConfigs added in v0.0.4

func GetStandardBoneConfigs() map[StandardBoneName]*BoneConfig

func NewCollisionGroup

func NewCollisionGroup(collisionGroupMask uint16) []uint16

Types

type Bdef1

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

Bdef1 represents the BDEF1 deformation.

func NewBdef1

func NewBdef1(index0 int) *Bdef1

NewBdef1 creates a new Bdef1 instance.

func (*Bdef1) Add

func (deform *Bdef1) Add(boneIndex, separateIndex int, ratio float64)

Add ウェイトを分割して追加する(separateIndexのウェイトをratioで分割して追加)

func (*Bdef1) Index

func (deform *Bdef1) Index(boneIndex int) int

func (*Bdef1) IndexWeight

func (deform *Bdef1) IndexWeight(boneIndex int) float64

func (*Bdef1) Indexes

func (deform *Bdef1) Indexes() []int

func (*Bdef1) IndexesByWeight

func (deform *Bdef1) IndexesByWeight(weightThreshold float64) []int

Indexes ウェイト閾値以上のウェイトを持っているINDEXのみを取得する

func (*Bdef1) Normalize

func (deform *Bdef1) Normalize(align bool)

Normalize ウェイト正規化

func (*Bdef1) Packed

func (bdef1 *Bdef1) Packed() [8]float32

Packed 4つのボーンINDEXとウェイトを返す(合計8個)

func (*Bdef1) SetIndexes

func (deform *Bdef1) SetIndexes(indexes []int)

func (*Bdef1) SetWeights

func (deform *Bdef1) SetWeights(weights []float64)

func (*Bdef1) Weights

func (deform *Bdef1) Weights() []float64

func (*Bdef1) WeightsByWeight

func (deform *Bdef1) WeightsByWeight(weightThreshold float64) []float64

Weights ウェイト閾値以上のウェイトを持っているウェイトのみを取得する

type Bdef2

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

Bdef2 represents the BDEF2 deformation.

func NewBdef2

func NewBdef2(index0, index1 int, weight0 float64) *Bdef2

NewBdef2 creates a new Bdef2 instance.

func (*Bdef2) Add

func (deform *Bdef2) Add(boneIndex, separateIndex int, ratio float64)

Add ウェイトを分割して追加する(separateIndexのウェイトをratioで分割して追加)

func (*Bdef2) Index

func (deform *Bdef2) Index(boneIndex int) int

func (*Bdef2) IndexWeight

func (deform *Bdef2) IndexWeight(boneIndex int) float64

func (*Bdef2) Indexes

func (deform *Bdef2) Indexes() []int

func (*Bdef2) IndexesByWeight

func (deform *Bdef2) IndexesByWeight(weightThreshold float64) []int

Indexes ウェイト閾値以上のウェイトを持っているINDEXのみを取得する

func (*Bdef2) Normalize

func (deform *Bdef2) Normalize(align bool)

Normalize ウェイト正規化

func (*Bdef2) Packed

func (bdef2 *Bdef2) Packed() [8]float32

Packed 4つのボーンINDEXとウェイトを返す(合計8個)

func (*Bdef2) SetIndexes

func (deform *Bdef2) SetIndexes(indexes []int)

func (*Bdef2) SetWeights

func (deform *Bdef2) SetWeights(weights []float64)

func (*Bdef2) Weights

func (deform *Bdef2) Weights() []float64

func (*Bdef2) WeightsByWeight

func (deform *Bdef2) WeightsByWeight(weightThreshold float64) []float64

Weights ウェイト閾値以上のウェイトを持っているウェイトのみを取得する

type Bdef4

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

Bdef4 represents the BDEF4 deformation.

func NewBdef4

func NewBdef4(index0, index1, index2, index3 int, weight0, weight1, weight2, weight3 float64) *Bdef4

NewBdef4 creates a new Bdef4 instance.

func (*Bdef4) Add

func (deform *Bdef4) Add(boneIndex, separateIndex int, ratio float64)

Add ウェイトを分割して追加する(separateIndexのウェイトをratioで分割して追加)

func (*Bdef4) Index

func (deform *Bdef4) Index(boneIndex int) int

func (*Bdef4) IndexWeight

func (deform *Bdef4) IndexWeight(boneIndex int) float64

func (*Bdef4) Indexes

func (deform *Bdef4) Indexes() []int

func (*Bdef4) IndexesByWeight

func (deform *Bdef4) IndexesByWeight(weightThreshold float64) []int

Indexes ウェイト閾値以上のウェイトを持っているINDEXのみを取得する

func (*Bdef4) Normalize

func (deform *Bdef4) Normalize(align bool)

Normalize ウェイト正規化

func (*Bdef4) Packed

func (bdef4 *Bdef4) Packed() [8]float32

Packed 4つのボーンINDEXとウェイトを返す(合計8個)

func (*Bdef4) SetIndexes

func (deform *Bdef4) SetIndexes(indexes []int)

func (*Bdef4) SetWeights

func (deform *Bdef4) SetWeights(weights []float64)

func (*Bdef4) Weights

func (deform *Bdef4) Weights() []float64

func (*Bdef4) WeightsByWeight

func (deform *Bdef4) WeightsByWeight(weightThreshold float64) []float64

Weights ウェイト閾値以上のウェイトを持っているウェイトのみを取得する

type Bone

type Bone struct {
	Position               *mmath.MVec3 // ボーン位置
	ParentIndex            int          // 親ボーンのボーンIndex
	Layer                  int          // 変形階層
	BoneFlag               BoneFlag     // ボーンフラグ(16bit) 各bit 0:OFF 1:ON
	TailPosition           *mmath.MVec3 // 接続先:0 の場合 座標オフセット, ボーン位置からの相対分
	TailIndex              int          // 接続先:1 の場合 接続先ボーンのボーンIndex
	EffectIndex            int          // 回転付与:1 または 移動付与:1 の場合 付与親ボーンのボーンIndex
	EffectFactor           float64      // 付与率
	FixedAxis              *mmath.MVec3 // 軸固定:1 の場合 軸の方向ベクトル
	LocalAxisX             *mmath.MVec3 // ローカル軸:1 の場合 X軸の方向ベクトル
	LocalAxisZ             *mmath.MVec3 // ローカル軸:1 の場合 Z軸の方向ベクトル
	EffectorKey            int          // 外部親変形:1 の場合 Key値
	Ik                     *Ik          // IK:1 の場合 IKデータを格納
	DisplaySlot            int          // 該当表示枠
	IsSystem               bool         // システム計算用追加ボーン の場合 true
	NormalizedLocalAxisX   *mmath.MVec3 // 計算済みのX軸の方向ベクトル
	NormalizedLocalAxisY   *mmath.MVec3 // 計算済みのY軸の方向ベクトル
	NormalizedLocalAxisZ   *mmath.MVec3 // 計算済みのZ軸の方向ベクトル
	NormalizedFixedAxis    *mmath.MVec3 // 計算済みの軸制限ベクトル
	LocalAxis              *mmath.MVec3 // ローカル軸の方向ベクトル(CorrectedLocalXVectorの正規化ベクトル)
	ParentRelativePosition *mmath.MVec3 // 親ボーンからの相対位置
	ChildRelativePosition  *mmath.MVec3 // Tailボーンへの相対位置
	RevertOffsetMatrix     *mmath.MMat4 // 逆オフセット行列(親ボーンからの相対位置分を戻す)
	OffsetMatrix           *mmath.MMat4 // オフセット行列 (自身の位置を原点に戻す行列)
	TreeBoneIndexes        []int        // 自分のボーンまでのボーンIndexのリスト
	ParentBoneIndexes      []int        // 自分の親ボーンからルートまでのボーンIndexのリスト
	ParentBoneNames        []string     // 自分の親ボーンからルートまでのボーン名のリスト
	RelativeBoneIndexes    []int        // 関連ボーンINDEX一覧(付与親とかIKとか)
	ChildBoneIndexes       []int        // 自分を親として登録しているボーンINDEX一覧
	EffectiveBoneIndexes   []int        // 自分を付与親として登録しているボーンINDEX一覧
	IkLinkBoneIndexes      []int        // 自分をIKリンクとして登録されているIKボーンのボーンIndex
	IkTargetBoneIndexes    []int        // 自分をIKターゲットとして登録されているIKボーンのボーンIndex
	AngleLimit             bool         // 自分がIKリンクボーンの角度制限がある場合、true
	MinAngleLimit          *mmath.MVec3 // 自分がIKリンクボーンの角度制限の下限
	MaxAngleLimit          *mmath.MVec3 // 自分がIKリンクボーンの角度制限の上限
	LocalAngleLimit        bool         // 自分がIKリンクボーンのローカル軸角度制限がある場合、true
	LocalMinAngleLimit     *mmath.MVec3 // 自分がIKリンクボーンのローカル軸角度制限の下限
	LocalMaxAngleLimit     *mmath.MVec3 // 自分がIKリンクボーンのローカル軸角度制限の上限
	AxisSign               int          // ボーンの軸ベクトル(左は-1, 右は1)
	RigidBody              *RigidBody   // 物理演算用剛体
	OriginalLayer          int          // 元の変形階層
	ParentBone             *Bone        // 親ボーン
	// contains filtered or unexported fields
}

func NewBone

func NewBone() *Bone

func NewBoneByName

func NewBoneByName(name string) *Bone

func (*Bone) CanManipulate

func (bone *Bone) CanManipulate() bool

操作可であるか

func (*Bone) CanRotate

func (bone *Bone) CanRotate() bool

回転可能であるか

func (*Bone) CanTranslate

func (bone *Bone) CanTranslate() bool

移動可能であるか

func (*Bone) Config

func (bone *Bone) Config() *BoneConfig

func (*Bone) ConfigChildBoneNames

func (bone *Bone) ConfigChildBoneNames() []string

定義上の子ボーン名

func (*Bone) ConfigParentBoneNames

func (bone *Bone) ConfigParentBoneNames() []string

定義上の親ボーン名

func (*Bone) Copy

func (bone *Bone) Copy() core.IIndexNameModel

func (*Bone) Direction

func (bone *Bone) Direction() BoneDirection

func (*Bone) EnglishName

func (bone *Bone) EnglishName() string

func (*Bone) HasFixedAxis

func (bone *Bone) HasFixedAxis() bool

軸固定であるか

func (*Bone) HasLocalAxis

func (bone *Bone) HasLocalAxis() bool

ローカル軸を持つか

func (*Bone) HasPhysics added in v0.0.4

func (bone *Bone) HasPhysics() bool

func (*Bone) Index

func (bone *Bone) Index() int

func (*Bone) IsAfterPhysicsDeform

func (bone *Bone) IsAfterPhysicsDeform() bool

物理後変形であるか

func (*Bone) IsEffectorLocal

func (bone *Bone) IsEffectorLocal() bool

ローカル付与であるか

func (*Bone) IsEffectorParentDeform

func (bone *Bone) IsEffectorParentDeform() bool

外部親変形であるか

func (*Bone) IsEffectorRotation

func (bone *Bone) IsEffectorRotation() bool

回転付与であるか

func (*Bone) IsEffectorTranslation

func (bone *Bone) IsEffectorTranslation() bool

移動付与であるか

func (*Bone) IsIK

func (bone *Bone) IsIK() bool

IKであるか

func (*Bone) IsTailBone

func (bone *Bone) IsTailBone() bool

表示先がボーンであるか

func (*Bone) IsValid

func (bone *Bone) IsValid() bool

func (*Bone) IsVisible

func (bone *Bone) IsVisible() bool

表示であるか

func (*Bone) Name

func (bone *Bone) Name() string

func (*Bone) NormalizeFixedAxis

func (bone *Bone) NormalizeFixedAxis(fixedAxis *mmath.MVec3)

func (*Bone) NormalizeLocalAxis

func (bone *Bone) NormalizeLocalAxis(localAxisX *mmath.MVec3)

func (*Bone) SetEnglishName

func (bone *Bone) SetEnglishName(englishName string)

func (*Bone) SetIndex

func (bone *Bone) SetIndex(index int)

func (*Bone) SetName

func (bone *Bone) SetName(name string)

type BoneCategory

type BoneCategory int
const (
	// ルート
	CATEGORY_ROOT BoneCategory = iota
	// 体幹
	CATEGORY_TRUNK BoneCategory = iota
	// 上半身
	CATEGORY_UPPER BoneCategory = iota
	// 下半身
	CATEGORY_LOWER BoneCategory = iota
	// 肩
	CATEGORY_SHOULDER BoneCategory = iota
	// 腕
	CATEGORY_ARM BoneCategory = iota
	// ひじ
	CATEGORY_ELBOW BoneCategory = iota
	// 足
	CATEGORY_LEG BoneCategory = iota
	// 指
	CATEGORY_FINGER BoneCategory = iota
	// 先
	CATEGORY_TAIL BoneCategory = iota
	// 足D
	CATEGORY_LEG_D BoneCategory = iota
	// 肩P
	CATEGORY_SHOULDER_P BoneCategory = iota
	// 足FK
	CATEGORY_LEG_FK BoneCategory = iota
	// 足IK
	CATEGORY_LEG_IK BoneCategory = iota
	// 足首
	CATEGORY_ANKLE BoneCategory = iota
	// 靴底
	CATEGORY_SOLE BoneCategory = iota
	// 捩
	CATEGORY_TWIST BoneCategory = iota
	// 頭
	CATEGORY_HEAD BoneCategory = iota
	// フィッティングの時に移動だけさせるか
	CATEGORY_FITTING_ONLY_MOVE BoneCategory = iota
)

type BoneConfig

type BoneConfig struct {
	// 親ボーン名候補リスト
	ParentBoneNames []StandardBoneName
	// 末端ボーン名候補リスト
	ChildBoneNames [][]StandardBoneName
	// ボーンカテゴリ
	Categories []BoneCategory
	// 表示枠
	DisplaySlot StandardBoneName
	// バウンディングボックスの形
	BoundingBoxShape Shape
	// 準標準までのボーンか
	IsStandard bool
	// 重心先ボーン名
	GravityTargetBoneName StandardBoneName
	// 略称
	Abbreviation StandardBoneName
}

func BoneConfigFromName added in v0.0.4

func BoneConfigFromName(name string) *BoneConfig

func (*BoneConfig) IsArm added in v0.0.4

func (c *BoneConfig) IsArm() bool

func (*BoneConfig) IsFinger added in v0.0.4

func (c *BoneConfig) IsFinger() bool

type BoneDirection

type BoneDirection string
const (
	// 右
	BONE_DIRECTION_RIGHT BoneDirection = "右"
	// 左
	BONE_DIRECTION_LEFT BoneDirection = "左"
	// 体幹
	BONE_DIRECTION_TRUNK BoneDirection = ""
)

func (BoneDirection) Sign added in v0.0.4

func (d BoneDirection) Sign() float64

func (BoneDirection) String

func (d BoneDirection) String() string

type BoneFlag

type BoneFlag uint16
const (
	// 初期値
	BONE_FLAG_NONE BoneFlag = 0x0000
	// 接続先(PMD子ボーン指定)表示方法 -> 0:座標オフセットで指定 1:ボーンで指定
	BONE_FLAG_TAIL_IS_BONE BoneFlag = 0x0001
	// 回転可能
	BONE_FLAG_CAN_ROTATE BoneFlag = 0x0002
	// 移動可能
	BONE_FLAG_CAN_TRANSLATE BoneFlag = 0x0004
	// 表示
	BONE_FLAG_IS_VISIBLE BoneFlag = 0x0008
	// 操作可
	BONE_FLAG_CAN_MANIPULATE BoneFlag = 0x0010
	// IK
	BONE_FLAG_IS_IK BoneFlag = 0x0020
	// ローカル付与 | 付与対象 0:ユーザー変形値/IKリンク/多重付与 1:親のローカル変形量
	BONE_FLAG_IS_EXTERNAL_LOCAL BoneFlag = 0x0080
	// 回転付与
	BONE_FLAG_IS_EXTERNAL_ROTATION BoneFlag = 0x0100
	// 移動付与
	BONE_FLAG_IS_EXTERNAL_TRANSLATION BoneFlag = 0x0200
	// 軸固定
	BONE_FLAG_HAS_FIXED_AXIS BoneFlag = 0x0400
	// ローカル軸
	BONE_FLAG_HAS_LOCAL_AXIS BoneFlag = 0x0800
	// 物理後変形
	BONE_FLAG_IS_AFTER_PHYSICS_DEFORM BoneFlag = 0x1000
	// 外部親変形
	BONE_FLAG_IS_EXTERNAL_PARENT_DEFORM BoneFlag = 0x2000
)

type BoneMorphOffset

type BoneMorphOffset struct {
	BoneIndex          int                // ボーンIndex
	Position           *mmath.MVec3       // グローバル移動量
	CancelablePosition *mmath.MVec3       // 親キャンセル位置
	Rotation           *mmath.MQuaternion // グローバル回転量
	CancelableRotation *mmath.MQuaternion // 親キャンセル回転
	Scale              *mmath.MVec3       // グローバル縮尺量
	CancelableScale    *mmath.MVec3       // 親キャンセルスケール
	LocalMat           *mmath.MMat4       // ローカル変換行列
}

BoneMorphOffset represents a bone morph.

func NewBoneMorphOffset

func NewBoneMorphOffset(boneIndex int) *BoneMorphOffset

func (*BoneMorphOffset) Type

func (offset *BoneMorphOffset) Type() int

type Bones

type Bones struct {
	*core.IndexNameModels[*Bone]
	LayerSortedBones       map[bool][]*Bone
	LayerSortedNames       map[bool]map[string]int
	LayerSortedBoneIndexes map[bool][]int
	DeformBoneIndexes      map[int][]int
	LayerSortedIndexes     []int
}

ボーンリスト

func NewBones

func NewBones(capacity int) *Bones

func (*Bones) CreateAnkleD

func (bones *Bones) CreateAnkleD(direction BoneDirection) (*Bone, error)

CreateAnkleD 足首D作成

func (*Bones) CreateAnkleDGround added in v0.0.4

func (bones *Bones) CreateAnkleDGround(direction BoneDirection) (*Bone, error)

CreateAnkleDGround 足首地面作成

func (*Bones) CreateArmTwist

func (bones *Bones) CreateArmTwist(direction BoneDirection) (*Bone, error)

CreateArmTwist 腕捩作成

func (*Bones) CreateArmTwistChild

func (bones *Bones) CreateArmTwistChild(direction BoneDirection, idx int) (*Bone, error)

CreateArmTwistChild 腕捩分割作成

func (*Bones) CreateBodyAxis added in v0.0.4

func (bones *Bones) CreateBodyAxis() (*Bone, error)

func (*Bones) CreateGroove

func (bones *Bones) CreateGroove() (*Bone, error)

CreateGroove グルーブ作成

func (*Bones) CreateHead

func (bones *Bones) CreateHead() (*Bone, error)

CreateHead 頭作成

func (*Bones) CreateHeadTail

func (bones *Bones) CreateHeadTail() (*Bone, error)

CreateHeadTail 頭先作成

func (*Bones) CreateHeel

func (bones *Bones) CreateHeel(direction BoneDirection) (*Bone, error)

CreateHeel かかと作成

func (*Bones) CreateHeelD

func (bones *Bones) CreateHeelD(direction BoneDirection) (*Bone, error)

CreateHeelD かかとD作成

func (*Bones) CreateHip added in v0.0.4

func (bones *Bones) CreateHip(direction BoneDirection) (*Bone, error)

CreateHip 腰骨作成

func (*Bones) CreateIndexTail

func (bones *Bones) CreateIndexTail(direction BoneDirection) (*Bone, error)

CreateIndexTail 親指先先作成

func (*Bones) CreateKneeD

func (bones *Bones) CreateKneeD(direction BoneDirection) (*Bone, error)

CreateKneeD ひざD作成

func (*Bones) CreateLegCenter

func (bones *Bones) CreateLegCenter() (*Bone, error)

CreateLegCenter 足中心作成

func (*Bones) CreateLegD

func (bones *Bones) CreateLegD(direction BoneDirection) (*Bone, error)

CreateLegD 足D作成

func (*Bones) CreateLegIkParent

func (bones *Bones) CreateLegIkParent(direction BoneDirection) (*Bone, error)

CreateLegIkParent 足IK親作成

func (*Bones) CreateLegRoot

func (bones *Bones) CreateLegRoot(direction BoneDirection) (*Bone, error)

CreateLegRoot 足根元作成

func (*Bones) CreateLowerRoot

func (bones *Bones) CreateLowerRoot() (*Bone, error)

CreateLowerRoot 下半身根元作成

func (*Bones) CreateMiddleTail

func (bones *Bones) CreateMiddleTail(direction BoneDirection) (*Bone, error)

CreateMiddleTail 親指先先作成

func (*Bones) CreateNeck

func (bones *Bones) CreateNeck() (*Bone, error)

CreateNeck 首作成

func (*Bones) CreateNeckRoot

func (bones *Bones) CreateNeckRoot() (*Bone, error)

CreateNeckRoot 首根元作成

func (*Bones) CreatePinkyTail

func (bones *Bones) CreatePinkyTail(direction BoneDirection) (*Bone, error)

CreateLittleTail 親指先先作成

func (*Bones) CreateRingTail

func (bones *Bones) CreateRingTail(direction BoneDirection) (*Bone, error)

CreateRingTail 親指先先作成

func (*Bones) CreateRoot

func (bones *Bones) CreateRoot() (*Bone, error)

CreateRoot すべての親作成

func (*Bones) CreateShoulderC

func (bones *Bones) CreateShoulderC(direction BoneDirection) (*Bone, error)

CreateShoulderC 肩C作成

func (*Bones) CreateShoulderP

func (bones *Bones) CreateShoulderP(direction BoneDirection) (*Bone, error)

CreateShoulderP 肩P作成

func (*Bones) CreateShoulderRoot

func (bones *Bones) CreateShoulderRoot(direction BoneDirection) (*Bone, error)

CreateShoulderRoot 肩根元作成

func (*Bones) CreateThumb0

func (bones *Bones) CreateThumb0(direction BoneDirection) (*Bone, error)

CreateThumb0 親指0作成

func (*Bones) CreateThumbTail

func (bones *Bones) CreateThumbTail(direction BoneDirection) (*Bone, error)

CreateThumbTail 親指先先作成

func (*Bones) CreateToeC

func (bones *Bones) CreateToeC(direction BoneDirection) (*Bone, error)

CreateToeC つま先子作成

func (*Bones) CreateToeCD

func (bones *Bones) CreateToeCD(direction BoneDirection) (*Bone, error)

CreateToeCD つま先子D作成

func (*Bones) CreateToeEx

func (bones *Bones) CreateToeEx(direction BoneDirection) (*Bone, error)

CreateToeEx 足先EX作成

func (*Bones) CreateToeP

func (bones *Bones) CreateToeP(direction BoneDirection) (*Bone, error)

CreateToeP つま先親作成

func (*Bones) CreateToePD

func (bones *Bones) CreateToePD(direction BoneDirection) (*Bone, error)

CreateToePD つま先親D作成

func (*Bones) CreateToeT

func (bones *Bones) CreateToeT(direction BoneDirection) (*Bone, error)

CreateToeT つま先先作成

func (*Bones) CreateToeTD

func (bones *Bones) CreateToeTD(direction BoneDirection) (*Bone, error)

CreateToeTD つま先先D作成

func (*Bones) CreateTrunkRoot

func (bones *Bones) CreateTrunkRoot() (*Bone, error)

CreateTrunkRoot 体幹中心作成

func (*Bones) CreateUpper2

func (bones *Bones) CreateUpper2() (*Bone, error)

CreateUpper2 上半身2作成

func (*Bones) CreateUpperRoot

func (bones *Bones) CreateUpperRoot() (*Bone, error)

CreateUpperRoot 上半身根元作成

func (*Bones) CreateWaist

func (bones *Bones) CreateWaist() (*Bone, error)

CreateWaist 腰作成

func (*Bones) CreateWaistCancel

func (bones *Bones) CreateWaistCancel(direction BoneDirection) (*Bone, error)

CreateWaistCancel 腰キャンセル作成

func (*Bones) CreateWristTail

func (bones *Bones) CreateWristTail(direction BoneDirection) (*Bone, error)

CreateWristTail 手首先先作成

func (*Bones) CreateWristTwist

func (bones *Bones) CreateWristTwist(direction BoneDirection) (*Bone, error)

CreateWristTwist 腕捩作成

func (*Bones) CreateWristTwistChild

func (bones *Bones) CreateWristTwistChild(direction BoneDirection, idx int) (*Bone, error)

CreateWristTwistChild 腕捩分割作成

func (*Bones) GetAnkle

func (bones *Bones) GetAnkle(direction BoneDirection) (*Bone, error)

GetAnkle 足首取得

func (*Bones) GetAnkleD

func (bones *Bones) GetAnkleD(direction BoneDirection) (*Bone, error)

GetAnkleD 足首D取得

func (*Bones) GetAnkleDGround added in v0.0.4

func (bones *Bones) GetAnkleDGround(direction BoneDirection) (*Bone, error)

GetAnkleDGround 足首地面取得

func (*Bones) GetArm

func (bones *Bones) GetArm(direction BoneDirection) (*Bone, error)

GetArm 腕取得

func (*Bones) GetArmTwist

func (bones *Bones) GetArmTwist(direction BoneDirection) (*Bone, error)

GetArmTwist 腕捩取得

func (*Bones) GetArmTwistChild

func (bones *Bones) GetArmTwistChild(direction BoneDirection, idx int) (*Bone, error)

GetArmTwistChild 腕捩分割取得

func (*Bones) GetBodyAxis added in v0.0.4

func (bones *Bones) GetBodyAxis() (*Bone, error)

func (*Bones) GetCenter

func (bones *Bones) GetCenter() (*Bone, error)

GetCenter センター取得

func (*Bones) GetElbow

func (bones *Bones) GetElbow(direction BoneDirection) (*Bone, error)

GetElbowRoot ひじ取得

func (*Bones) GetEye

func (bones *Bones) GetEye(direction BoneDirection) (*Bone, error)

GetEye 目取得

func (*Bones) GetEyes

func (bones *Bones) GetEyes() (*Bone, error)

GetEyes 両目取得

func (*Bones) GetGroove

func (bones *Bones) GetGroove() (*Bone, error)

GetGroove グルーブ取得

func (*Bones) GetHead

func (bones *Bones) GetHead() (*Bone, error)

GetHead 頭取得

func (*Bones) GetHeadTail

func (bones *Bones) GetHeadTail() (*Bone, error)

GetHeadTail 頭先取得

func (*Bones) GetHeel

func (bones *Bones) GetHeel(direction BoneDirection) (*Bone, error)

GetHeel かかと取得

func (*Bones) GetHeelD

func (bones *Bones) GetHeelD(direction BoneDirection) (*Bone, error)

GetHeelD かかとD取得

func (*Bones) GetHip added in v0.0.4

func (bones *Bones) GetHip(direction BoneDirection) (*Bone, error)

GetHip 腰骨取得

func (*Bones) GetIkTarget

func (bones *Bones) GetIkTarget(ikBoneIndex int) (*Bone, error)

func (*Bones) GetIkTargetByName added in v0.0.4

func (bones *Bones) GetIkTargetByName(ikBoneName string) (*Bone, error)

func (*Bones) GetIndex

func (bones *Bones) GetIndex(direction BoneDirection, idx int) (*Bone, error)

GetIndex 人差し指取得

func (*Bones) GetIndexTail

func (bones *Bones) GetIndexTail(direction BoneDirection) (*Bone, error)

GetIndexTail 人差し指先先取得

func (*Bones) GetKnee

func (bones *Bones) GetKnee(direction BoneDirection) (*Bone, error)

GetKnee ひざ取得

func (*Bones) GetKneeD

func (bones *Bones) GetKneeD(direction BoneDirection) (*Bone, error)

GetKneeD ひざD取得

func (*Bones) GetLeg

func (bones *Bones) GetLeg(direction BoneDirection) (*Bone, error)

GetLeg 足取得

func (*Bones) GetLegCenter

func (bones *Bones) GetLegCenter() (*Bone, error)

GetLegCenter 足中心取得

func (*Bones) GetLegD

func (bones *Bones) GetLegD(direction BoneDirection) (*Bone, error)

GetLegD 足D取得

func (*Bones) GetLegIk

func (bones *Bones) GetLegIk(direction BoneDirection) (*Bone, error)

GetLegIk 足IK取得

func (*Bones) GetLegIkParent

func (bones *Bones) GetLegIkParent(direction BoneDirection) (*Bone, error)

GetLegIkParent 足IK親取得

func (*Bones) GetLegRoot

func (bones *Bones) GetLegRoot(direction BoneDirection) (*Bone, error)

GetLegRoot 足根元取得

func (*Bones) GetLower

func (bones *Bones) GetLower() (*Bone, error)

GetLower 下半身

func (*Bones) GetLowerRoot

func (bones *Bones) GetLowerRoot() (*Bone, error)

GetLowerRoot 下半身根元取得

func (*Bones) GetMiddle

func (bones *Bones) GetMiddle(direction BoneDirection, idx int) (*Bone, error)

GetMiddle 中指取得

func (*Bones) GetMiddleTail

func (bones *Bones) GetMiddleTail(direction BoneDirection) (*Bone, error)

GetMiddleTail 中指先先取得

func (*Bones) GetNeck

func (bones *Bones) GetNeck() (*Bone, error)

GetNeck 首取得

func (*Bones) GetNeckRoot

func (bones *Bones) GetNeckRoot() (*Bone, error)

GetNeckRoot 首根元取得

func (*Bones) GetPinky

func (bones *Bones) GetPinky(direction BoneDirection, idx int) (*Bone, error)

GetPinky 小指取得

func (*Bones) GetPinkyTail

func (bones *Bones) GetPinkyTail(direction BoneDirection) (*Bone, error)

GetPinkyTail 小指先先取得

func (*Bones) GetRing

func (bones *Bones) GetRing(direction BoneDirection, idx int) (*Bone, error)

GetRing 薬指取得

func (*Bones) GetRingTail

func (bones *Bones) GetRingTail(direction BoneDirection) (*Bone, error)

GetRingTail 薬指先先取得

func (*Bones) GetRoot

func (bones *Bones) GetRoot() (*Bone, error)

GetRoot すべての親

func (*Bones) GetShoulder

func (bones *Bones) GetShoulder(direction BoneDirection) (*Bone, error)

GetShoulder 肩取得

func (*Bones) GetShoulderC

func (bones *Bones) GetShoulderC(direction BoneDirection) (*Bone, error)

GetShoulderC 肩C取得

func (*Bones) GetShoulderP

func (bones *Bones) GetShoulderP(direction BoneDirection) (*Bone, error)

GetShoulderP 肩P取得

func (*Bones) GetShoulderRoot

func (bones *Bones) GetShoulderRoot(direction BoneDirection) (*Bone, error)

GetShoulderRoot 肩根元取得

func (*Bones) GetStandardBoneNames added in v0.0.4

func (b *Bones) GetStandardBoneNames() []string

func (*Bones) GetThumb

func (bones *Bones) GetThumb(direction BoneDirection, idx int) (*Bone, error)

GetThumb 親指取得

func (*Bones) GetThumbTail

func (bones *Bones) GetThumbTail(direction BoneDirection) (*Bone, error)

GetThumbTail 親指先先取得

func (*Bones) GetToeC

func (bones *Bones) GetToeC(direction BoneDirection) (*Bone, error)

GetToeC つま先子取得

func (*Bones) GetToeCD

func (bones *Bones) GetToeCD(direction BoneDirection) (*Bone, error)

GetToeCD つま先子D取得

func (*Bones) GetToeEx

func (bones *Bones) GetToeEx(direction BoneDirection) (*Bone, error)

GetToeEx 足先EX取得

func (*Bones) GetToeIK

func (bones *Bones) GetToeIK(direction BoneDirection) (*Bone, error)

GetToeIK つま先IK取得

func (*Bones) GetToeIk added in v0.0.4

func (bones *Bones) GetToeIk(direction BoneDirection) (*Bone, error)

func (*Bones) GetToeP

func (bones *Bones) GetToeP(direction BoneDirection) (*Bone, error)

GetToeP つま先親取得

func (*Bones) GetToePD

func (bones *Bones) GetToePD(direction BoneDirection) (*Bone, error)

GetToePD つま先親D取得

func (*Bones) GetToeT

func (bones *Bones) GetToeT(direction BoneDirection) (*Bone, error)

GetToeT つま先先取得

func (*Bones) GetToeTD

func (bones *Bones) GetToeTD(direction BoneDirection) (*Bone, error)

GetToeTD つま先先D取得

func (*Bones) GetTrunkRoot

func (bones *Bones) GetTrunkRoot() (*Bone, error)

GetTrunkRoot 体幹中心取得

func (*Bones) GetUpper

func (bones *Bones) GetUpper() (*Bone, error)

GetUpper 上半身取得

func (*Bones) GetUpper2

func (bones *Bones) GetUpper2() (*Bone, error)

GetUpper2 上半身2取得

func (*Bones) GetUpperRoot

func (bones *Bones) GetUpperRoot() (*Bone, error)

GetUpperRoot 上半身根元取得

func (*Bones) GetWaist

func (bones *Bones) GetWaist() (*Bone, error)

GetWaist 腰取得

func (*Bones) GetWaistCancel

func (bones *Bones) GetWaistCancel(direction BoneDirection) (*Bone, error)

GetWaistCancel 腰キャンセル取得

func (*Bones) GetWrist

func (bones *Bones) GetWrist(direction BoneDirection) (*Bone, error)

GetWrist 手首取得

func (*Bones) GetWristTail

func (bones *Bones) GetWristTail(direction BoneDirection) (*Bone, error)

GetWristTail 手首先先取得

func (*Bones) GetWristTwist

func (bones *Bones) GetWristTwist(direction BoneDirection) (*Bone, error)

GetWristTwist 腕捩取得

func (*Bones) GetWristTwistChild

func (bones *Bones) GetWristTwistChild(direction BoneDirection, idx int) (*Bone, error)

GetWristTwistChild 腕捩分割取得

func (*Bones) Insert

func (bones *Bones) Insert(bone *Bone) error

func (*Bones) InsertShortageOverrideBones added in v0.0.4

func (bones *Bones) InsertShortageOverrideBones() error

InsertShortageOverrideBones 不足ボーン作成

func (*Bones) MaxBoneIndex

func (bones *Bones) MaxBoneIndex(boneIndexes []int) int

指定されたボーンのうち、もっとも変形階層が大きいINDEXを取得

func (*Bones) MinBoneIndex

func (bones *Bones) MinBoneIndex(boneIndexes []int) int

指定されたボーンのうち、もっとも変形階層が小さいINDEXを取得

func (*Bones) Range added in v0.0.4

func (bones *Bones) Range(fromBoneIndex, toBoneIndex int) []int

指定された範囲のボーンの範囲のINDEXを取得

func (*Bones) SetParentFromConfig added in v0.0.4

func (bones *Bones) SetParentFromConfig(bone *Bone)

func (*Bones) Setup

func (bones *Bones) Setup()

type CollisionGroup

type CollisionGroup struct {
	IsCollisions []uint16
}

func NewCollisionGroupFromSlice

func NewCollisionGroupFromSlice(collisionGroup []uint16) CollisionGroup

type DeformType

type DeformType byte

DeformType ウェイト変形方式

const (
	BDEF1 DeformType = 0
	BDEF2 DeformType = 1
	BDEF4 DeformType = 2
	SDEF  DeformType = 3
)

type DisplaySlot

type DisplaySlot struct {
	SpecialFlag SpecialFlag  // 特殊枠フラグ - 0:通常枠 1:特殊枠
	References  []*Reference // 表示枠要素
	// contains filtered or unexported fields
}

func NewDisplaySlot

func NewDisplaySlot() *DisplaySlot

NewDisplaySlot

func NewMorphDisplaySlot

func NewMorphDisplaySlot() *DisplaySlot

func NewRootDisplaySlot

func NewRootDisplaySlot() *DisplaySlot

func (*DisplaySlot) Copy

func (displaySlot *DisplaySlot) Copy() core.IIndexNameModel

Copy

func (*DisplaySlot) EnglishName

func (displaySlot *DisplaySlot) EnglishName() string

func (*DisplaySlot) Index

func (displaySlot *DisplaySlot) Index() int

func (*DisplaySlot) IsValid

func (displaySlot *DisplaySlot) IsValid() bool

func (*DisplaySlot) Name

func (displaySlot *DisplaySlot) Name() string

func (*DisplaySlot) SetEnglishName

func (displaySlot *DisplaySlot) SetEnglishName(englishName string)

func (*DisplaySlot) SetIndex

func (displaySlot *DisplaySlot) SetIndex(index int)

func (*DisplaySlot) SetName

func (displaySlot *DisplaySlot) SetName(name string)

type DisplaySlots

type DisplaySlots struct {
	*core.IndexNameModels[*DisplaySlot]
}

表示枠リスト

func NewDisplaySlots

func NewDisplaySlots(capacity int) *DisplaySlots

func NewInitialDisplaySlots added in v0.0.4

func NewInitialDisplaySlots() *DisplaySlots

func (*DisplaySlots) GetByBoneIndex

func (displaySlots *DisplaySlots) GetByBoneIndex(boneIndex int) *DisplaySlot

func (*DisplaySlots) GetMorphDisplaySlot

func (displaySlots *DisplaySlots) GetMorphDisplaySlot() (*DisplaySlot, error)

func (*DisplaySlots) GetRootDisplaySlot

func (displaySlots *DisplaySlots) GetRootDisplaySlot() (*DisplaySlot, error)

type DisplayType

type DisplayType int

表示枠要素タイプ

const (
	DISPLAY_TYPE_BONE  DisplayType = 0 // ボーン
	DISPLAY_TYPE_MORPH DisplayType = 1 // モーフ
)

type DrawFlag

type DrawFlag byte
const (
	// 初期値
	DRAW_FLAG_NONE DrawFlag = 0x0000
	// 0x01:両面描画
	DRAW_FLAG_DOUBLE_SIDED_DRAWING DrawFlag = 0x0001
	// 0x02:地面影
	DRAW_FLAG_GROUND_SHADOW DrawFlag = 0x0002
	// 0x04:セルフシャドウマップへの描画
	DRAW_FLAG_DRAWING_ON_SELF_SHADOW_MAPS DrawFlag = 0x0004
	// 0x08:セルフシャドウの描画
	DRAW_FLAG_DRAWING_SELF_SHADOWS DrawFlag = 0x0008
	// 0x10:エッジ描画
	DRAW_FLAG_DRAWING_EDGE DrawFlag = 0x0010
)

func (DrawFlag) IsDoubleSidedDrawing

func (drawFlg DrawFlag) IsDoubleSidedDrawing() bool

0x01:両面描画

func (DrawFlag) IsDrawingEdge

func (drawFlg DrawFlag) IsDrawingEdge() bool

0x10:エッジ描画

func (DrawFlag) IsDrawingOnSelfShadowMaps

func (drawFlg DrawFlag) IsDrawingOnSelfShadowMaps() bool

0x04:セルフシャドウマップへの描画

func (DrawFlag) IsDrawingSelfShadows

func (drawFlg DrawFlag) IsDrawingSelfShadows() bool

0x08:セルフシャドウの描画

func (DrawFlag) IsGroundShadow

func (drawFlg DrawFlag) IsGroundShadow() bool

0x02:地面影

func (DrawFlag) SetDoubleSidedDrawing

func (drawFlg DrawFlag) SetDoubleSidedDrawing(flag bool) DrawFlag

func (DrawFlag) SetDrawingEdge

func (drawFlg DrawFlag) SetDrawingEdge(flag bool) DrawFlag

func (DrawFlag) SetDrawingOnSelfShadowMaps

func (drawFlg DrawFlag) SetDrawingOnSelfShadowMaps(flag bool) DrawFlag

func (DrawFlag) SetDrawingSelfShadows

func (drawFlg DrawFlag) SetDrawingSelfShadows(flag bool) DrawFlag

func (DrawFlag) SetGroundShadow

func (drawFlg DrawFlag) SetGroundShadow(flag bool) DrawFlag

type Face

type Face struct {
	VertexIndexes [3]int // 頂点INDEXリスト
	// contains filtered or unexported fields
}

面データ

func NewFace

func NewFace() *Face

func (*Face) Copy

func (face *Face) Copy() core.IIndexModel

func (*Face) Index

func (face *Face) Index() int

func (*Face) IsValid

func (face *Face) IsValid() bool

func (*Face) SetIndex

func (face *Face) SetIndex(index int)

type FaceGL

type FaceGL struct {
	VertexIndexes [3]uint32
}

type Faces

type Faces struct {
	*core.IndexModels[*Face]
}

面リスト

func NewFaces

func NewFaces(capacity int) *Faces

type GroupMorphOffset

type GroupMorphOffset struct {
	MorphIndex  int     // モーフINDEX
	MorphFactor float64 // モーフ変動量
}

GroupMorphOffset represents a group morph.

func NewGroupMorphOffset

func NewGroupMorphOffset(morphIndex int, morphFactor float64) *GroupMorphOffset

func (*GroupMorphOffset) Type

func (offset *GroupMorphOffset) Type() int

type IDeform

type IDeform interface {
	Indexes() []int
	Weights() []float64
	IndexesByWeight(weightThreshold float64) []int
	WeightsByWeight(weightThreshold float64) []float64
	Packed() [8]float32
	Normalize(align bool)
	Index(boneIndex int) int
	IndexWeight(boneIndex int) float64
	Add(boneIndex, separateIndex int, ratio float64)
	SetIndexes(indexes []int)
}

type IMorphOffset

type IMorphOffset interface {
	Type() int
}

IMorphOffset represents a morph offset.

type Ik

type Ik struct {
	BoneIndex    int          // IKターゲットボーンのボーンIndex
	LoopCount    int          // IKループ回数 (最大255)
	UnitRotation *mmath.MVec3 // IKループ計算時の1回あたりの制限角度
	Links        []*IkLink    // IKリンクリスト
}

func NewIk

func NewIk() *Ik

func (*Ik) Copy

func (ik *Ik) Copy() *Ik
type IkLink struct {
	BoneIndex          int          // リンクボーンのボーンIndex
	AngleLimit         bool         // 角度制限有無
	MinAngleLimit      *mmath.MVec3 // 下限
	MaxAngleLimit      *mmath.MVec3 // 上限
	LocalAngleLimit    bool         // ローカル軸の角度制限有無
	LocalMinAngleLimit *mmath.MVec3 // ローカル軸制限の下限
	LocalMaxAngleLimit *mmath.MVec3 // ローカル軸制限の上限
}
func NewIkLink() *IkLink

func (*IkLink) Copy

func (ikLink *IkLink) Copy() *IkLink

type Joint

type Joint struct {
	JointType       byte         // Joint種類 - 0:スプリング6DOF   | PMX2.0では 0 のみ(拡張用)
	RigidbodyIndexA int          // 関連剛体AのIndex
	RigidbodyIndexB int          // 関連剛体BのIndex
	Position        *mmath.MVec3 // 位置(x,y,z)
	Rotation        *mmath.MVec3 // 回転
	JointParam      *JointParam  // ジョイントパラメーター
	IsSystem        bool
	// contains filtered or unexported fields
}

func NewJoint

func NewJoint() *Joint

func NewJointByName

func NewJointByName(name string) *Joint

func (*Joint) Copy

func (joint *Joint) Copy() core.IIndexNameModel

func (*Joint) EnglishName

func (joint *Joint) EnglishName() string

func (*Joint) Index

func (joint *Joint) Index() int

func (*Joint) IsValid

func (joint *Joint) IsValid() bool

func (*Joint) Name

func (joint *Joint) Name() string

func (*Joint) SetEnglishName

func (joint *Joint) SetEnglishName(englishName string)

func (*Joint) SetIndex

func (joint *Joint) SetIndex(index int)

func (*Joint) SetName

func (joint *Joint) SetName(name string)

type JointParam

type JointParam struct {
	TranslationLimitMin       *mmath.MVec3 // 移動制限-下限(x,y,z)
	TranslationLimitMax       *mmath.MVec3 // 移動制限-上限(x,y,z)
	RotationLimitMin          *mmath.MVec3 // 回転制限-下限
	RotationLimitMax          *mmath.MVec3 // 回転制限-上限
	SpringConstantTranslation *mmath.MVec3 // バネ定数-移動(x,y,z)
	SpringConstantRotation    *mmath.MVec3 // バネ定数-回転(x,y,z)
}

func NewJointParam

func NewJointParam() *JointParam

func (*JointParam) String added in v0.0.4

func (param *JointParam) String() string

type Joints

type Joints struct {
	*core.IndexNameModels[*Joint]
}

ジョイントリスト

func NewJoints

func NewJoints(capacity int) *Joints

type Material

type Material struct {
	Diffuse            *mmath.MVec4 // Diffuse (R,G,B,A)(拡散色+非透過度)
	Specular           *mmath.MVec4 // Specular (R,G,B,A)(反射色 + 反射強度)
	Ambient            *mmath.MVec3 // Ambient (R,G,B)(環境色)
	DrawFlag           DrawFlag     // 描画フラグ(8bit) - 各bit 0:OFF 1:ON
	Edge               *mmath.MVec4 // エッジ色 (R,G,B,A)
	EdgeSize           float64      // エッジサイズ
	TextureIndex       int          // 通常テクスチャINDEX
	SphereTextureIndex int          // スフィアテクスチャINDEX
	SphereMode         SphereMode   // スフィアモード
	ToonSharingFlag    ToonSharing  // 共有Toonフラグ
	ToonTextureIndex   int          // ToonテクスチャINDEX
	Memo               string       // メモ
	VerticesCount      int          // 材質に対応する面(頂点)数 (必ず3の倍数になる)
	// contains filtered or unexported fields
}

func NewMaterial

func NewMaterial() *Material

func NewMaterialByName

func NewMaterialByName(name string) *Material

func (*Material) Copy

func (material *Material) Copy() core.IIndexNameModel

func (*Material) EnglishName

func (material *Material) EnglishName() string

func (*Material) Index

func (material *Material) Index() int

func (*Material) IsValid

func (material *Material) IsValid() bool

func (*Material) Name

func (material *Material) Name() string

func (*Material) SetEnglishName

func (material *Material) SetEnglishName(englishName string)

func (*Material) SetIndex

func (material *Material) SetIndex(index int)

func (*Material) SetName

func (material *Material) SetName(name string)

type MaterialMorphCalcMode

type MaterialMorphCalcMode int

MaterialMorphCalcMode 材質モーフ:計算モード

const (
	CALC_MODE_MULTIPLICATION MaterialMorphCalcMode = 0 // 乗算
	CALC_MODE_ADDITION       MaterialMorphCalcMode = 1 // 加算
)

type MaterialMorphOffset

type MaterialMorphOffset struct {
	MaterialIndex       int                   // 材質Index -> -1:全材質対象
	CalcMode            MaterialMorphCalcMode // 0:乗算, 1:加算
	Diffuse             *mmath.MVec4          // Diffuse (R,G,B,A)
	Specular            *mmath.MVec4          // SpecularColor (R,G,B, 係数)
	Ambient             *mmath.MVec3          // AmbientColor (R,G,B)
	Edge                *mmath.MVec4          // エッジ色 (R,G,B,A)
	EdgeSize            float64               // エッジサイズ
	TextureFactor       *mmath.MVec4          // テクスチャ係数 (R,G,B,A)
	SphereTextureFactor *mmath.MVec4          // スフィアテクスチャ係数 (R,G,B,A)
	ToonTextureFactor   *mmath.MVec4          // Toonテクスチャ係数 (R,G,B,A)
}

MaterialMorphOffset represents a material morph.

func NewMaterialMorphOffset

func NewMaterialMorphOffset(
	materialIndex int,
	calcMode MaterialMorphCalcMode,
	diffuse *mmath.MVec4,
	specular *mmath.MVec4,
	ambient *mmath.MVec3,
	edge *mmath.MVec4,
	edgeSize float64,
	textureFactor *mmath.MVec4,
	sphereTextureFactor *mmath.MVec4,
	toonTextureFactor *mmath.MVec4,
) *MaterialMorphOffset

func (*MaterialMorphOffset) Type

func (offset *MaterialMorphOffset) Type() int

type Materials

type Materials struct {
	*core.IndexNameModels[*Material]
	Vertices map[int][]int
	Faces    map[int][]int
}

材質リスト

func NewMaterials

func NewMaterials(capacity int) *Materials

func (*Materials) Setup

func (materials *Materials) Setup(vertices *Vertices, faces *Faces, textures *Textures)

type Morph

type Morph struct {
	Panel       MorphPanel     // モーフパネル
	MorphType   MorphType      // モーフ種類
	Offsets     []IMorphOffset // モーフオフセット
	DisplaySlot int            // 表示枠
	IsSystem    bool           // ツール側で追加したモーフ
	// contains filtered or unexported fields
}

Morph represents a morph.

func NewMorph

func NewMorph() *Morph

NewMorph

func (*Morph) Copy

func (morph *Morph) Copy() core.IIndexNameModel

func (*Morph) EnglishName

func (morph *Morph) EnglishName() string

func (*Morph) Index

func (morph *Morph) Index() int

func (*Morph) IsValid

func (morph *Morph) IsValid() bool

func (*Morph) Name

func (morph *Morph) Name() string

func (*Morph) SetEnglishName

func (morph *Morph) SetEnglishName(englishName string)

func (*Morph) SetIndex

func (morph *Morph) SetIndex(index int)

func (*Morph) SetName

func (morph *Morph) SetName(name string)

type MorphPanel

type MorphPanel byte

MorphPanel 操作パネル

const (
	MORPH_PANEL_SYSTEM             MorphPanel = 0 // システム予約
	MORPH_PANEL_EYEBROW_LOWER_LEFT MorphPanel = 1 // 眉(左下)
	MORPH_PANEL_EYE_UPPER_LEFT     MorphPanel = 2 // 目(左上)
	MORPH_PANEL_LIP_UPPER_RIGHT    MorphPanel = 3 // 口(右上)
	MORPH_PANEL_OTHER_LOWER_RIGHT  MorphPanel = 4 // その他(右下)
)

func (MorphPanel) PanelName

func (morphPanel MorphPanel) PanelName() string

PanelName returns the name of the operation panel.

type MorphType

type MorphType int

MorphType モーフ種類

const (
	MORPH_TYPE_GROUP        MorphType = 0 // グループ
	MORPH_TYPE_VERTEX       MorphType = 1 // 頂点
	MORPH_TYPE_BONE         MorphType = 2 // ボーン
	MORPH_TYPE_UV           MorphType = 3 // UV
	MORPH_TYPE_EXTENDED_UV1 MorphType = 4 // 追加UV1
	MORPH_TYPE_EXTENDED_UV2 MorphType = 5 // 追加UV2
	MORPH_TYPE_EXTENDED_UV3 MorphType = 6 // 追加UV3
	MORPH_TYPE_EXTENDED_UV4 MorphType = 7 // 追加UV4
	MORPH_TYPE_MATERIAL     MorphType = 8 // 材質
	MORPH_TYPE_AFTER_VERTEX MorphType = 9 // ボーン変形後頂点(システム独自)
)

type Morphs

type Morphs struct {
	*core.IndexNameModels[*Morph]
}

モーフリスト

func NewMorphs

func NewMorphs(capacity int) *Morphs

type PhysicsType

type PhysicsType int

剛体物理の計算モード

const (
	PHYSICS_TYPE_STATIC       PhysicsType = 0 // ボーン追従(static)
	PHYSICS_TYPE_DYNAMIC      PhysicsType = 1 // 物理演算(dynamic)
	PHYSICS_TYPE_DYNAMIC_BONE PhysicsType = 2 // 物理演算 + Bone位置合わせ
)

type PmxModel

type PmxModel struct {
	Signature          string
	Version            float64
	ExtendedUVCount    int
	VertexCountType    int
	TextureCountType   int
	MaterialCountType  int
	BoneCountType      int
	MorphCountType     int
	RigidBodyCountType int

	Comment        string
	EnglishComment string
	Vertices       *Vertices
	Faces          *Faces
	Textures       *Textures
	Materials      *Materials
	Bones          *Bones
	Morphs         *Morphs
	DisplaySlots   *DisplaySlots
	RigidBodies    *RigidBodies
	Joints         *Joints
	// contains filtered or unexported fields
}

func NewPmxModel

func NewPmxModel(path string) *PmxModel

func (*PmxModel) Copy added in v0.0.4

func (model *PmxModel) Copy() (*PmxModel, error)

func (*PmxModel) EnglishName

func (model *PmxModel) EnglishName() string

func (*PmxModel) Hash

func (model *PmxModel) Hash() string

func (*PmxModel) Index

func (model *PmxModel) Index() int

func (*PmxModel) InitializeDisplaySlots

func (model *PmxModel) InitializeDisplaySlots()

func (*PmxModel) Name

func (model *PmxModel) Name() string

func (*PmxModel) Path

func (model *PmxModel) Path() string

func (*PmxModel) SetEnglishName

func (model *PmxModel) SetEnglishName(name string)

func (*PmxModel) SetHash

func (model *PmxModel) SetHash(hash string)

func (*PmxModel) SetIndex

func (model *PmxModel) SetIndex(index int)

func (*PmxModel) SetName

func (model *PmxModel) SetName(name string)

func (*PmxModel) SetPath

func (model *PmxModel) SetPath(path string)

func (*PmxModel) SetRandHash

func (model *PmxModel) SetRandHash()

func (*PmxModel) Setup

func (model *PmxModel) Setup()

func (*PmxModel) UpdateHash

func (model *PmxModel) UpdateHash()

type Reference

type Reference struct {
	DisplayType  DisplayType // 要素対象 0:ボーン 1:モーフ
	DisplayIndex int         // ボーンIndex or モーフIndex
}

func NewDisplaySlotReference

func NewDisplaySlotReference() *Reference

func NewDisplaySlotReferenceByValues

func NewDisplaySlotReferenceByValues(displayType DisplayType, displayIndex int) *Reference

type RigidBodies

type RigidBodies struct {
	*core.IndexNameModels[*RigidBody]
}

剛体リスト

func NewRigidBodies

func NewRigidBodies(capacity int) *RigidBodies

type RigidBody

type RigidBody struct {
	BoneIndex               int             // 関連ボーンIndex
	CollisionGroup          byte            // グループ
	CollisionGroupMask      CollisionGroup  // 非衝突グループフラグ
	CollisionGroupMaskValue int             // 非衝突グループフラグ値
	ShapeType               Shape           // 形状
	Size                    *mmath.MVec3    // サイズ(x,y,z)
	Position                *mmath.MVec3    // 位置(x,y,z)
	Rotation                *mmath.MVec3    // 回転(x,y,z) -> ラジアン角
	RigidBodyParam          *RigidBodyParam // 剛体パラ
	PhysicsType             PhysicsType     // 剛体の物理演算
	XDirection              *mmath.MVec3    // X軸方向
	YDirection              *mmath.MVec3    // Y軸方向
	ZDirection              *mmath.MVec3    // Z軸方向
	IsSystem                bool            // システムで追加した剛体か
	Matrix                  *mmath.MMat4    // 剛体の行列
	Bone                    *Bone           // 繋がっているボーン
	// contains filtered or unexported fields
}

func NewRigidBody

func NewRigidBody() *RigidBody

NewRigidBody creates a new rigid body.

func (*RigidBody) Copy

func (rigidBody *RigidBody) Copy() core.IIndexNameModel

func (*RigidBody) EnglishName

func (rigidBody *RigidBody) EnglishName() string

func (*RigidBody) Index

func (rigidBody *RigidBody) Index() int

func (*RigidBody) IsValid

func (rigidBody *RigidBody) IsValid() bool

func (*RigidBody) Name

func (rigidBody *RigidBody) Name() string

func (*RigidBody) SetEnglishName

func (rigidBody *RigidBody) SetEnglishName(englishName string)

func (*RigidBody) SetIndex

func (rigidBody *RigidBody) SetIndex(index int)

func (*RigidBody) SetName

func (rigidBody *RigidBody) SetName(name string)

type RigidBodyParam

type RigidBodyParam struct {
	Mass           float64 // 質量
	LinearDamping  float64 // 移動減衰
	AngularDamping float64 // 回転減衰
	Restitution    float64 // 反発力
	Friction       float64 // 摩擦力
}

func NewRigidBodyParam

func NewRigidBodyParam() *RigidBodyParam

func (*RigidBodyParam) String added in v0.0.4

func (param *RigidBodyParam) String() string

type Sdef

type Sdef struct {
	SdefC  *mmath.MVec3
	SdefR0 *mmath.MVec3
	SdefR1 *mmath.MVec3
	// contains filtered or unexported fields
}

Sdef represents the SDEF deformation.

func NewSdef

func NewSdef(index0, index1 int, weight0 float64, sdefC, sdefR0, sdefR1 *mmath.MVec3) *Sdef

NewSdef creates a new Sdef instance.

func (*Sdef) Add

func (deform *Sdef) Add(boneIndex, separateIndex int, ratio float64)

Add ウェイトを分割して追加する(separateIndexのウェイトをratioで分割して追加)

func (*Sdef) Index

func (deform *Sdef) Index(boneIndex int) int

func (*Sdef) IndexWeight

func (deform *Sdef) IndexWeight(boneIndex int) float64

func (*Sdef) Indexes

func (deform *Sdef) Indexes() []int

func (*Sdef) IndexesByWeight

func (deform *Sdef) IndexesByWeight(weightThreshold float64) []int

Indexes ウェイト閾値以上のウェイトを持っているINDEXのみを取得する

func (*Sdef) Normalize

func (deform *Sdef) Normalize(align bool)

Normalize ウェイト正規化

func (*Sdef) Packed

func (sdef *Sdef) Packed() [8]float32

Packed 4つのボーンINDEXとウェイトを返す(合計8個) TODO: SDEFパラメーターの正規化

func (*Sdef) SetIndexes

func (deform *Sdef) SetIndexes(indexes []int)

func (*Sdef) SetWeights

func (deform *Sdef) SetWeights(weights []float64)

func (*Sdef) Weights

func (deform *Sdef) Weights() []float64

func (*Sdef) WeightsByWeight

func (deform *Sdef) WeightsByWeight(weightThreshold float64) []float64

Weights ウェイト閾値以上のウェイトを持っているウェイトのみを取得する

type Shape

type Shape int

剛体の形状

const (
	SHAPE_NONE    Shape = -1 // なし
	SHAPE_SPHERE  Shape = 0  // 球
	SHAPE_BOX     Shape = 1  // 箱
	SHAPE_CAPSULE Shape = 2  // カプセル
)

type SpecialFlag

type SpecialFlag int

特殊枠フラグ - 0:通常枠 1:特殊枠

const (
	SPECIAL_FLAG_OFF SpecialFlag = 0 // 通常枠
	SPECIAL_FLAG_ON  SpecialFlag = 1 // 特殊枠(Rootと表情)
)

type SphereMode

type SphereMode byte

スフィアモード

const (
	// 無効
	SPHERE_MODE_INVALID SphereMode = 0
	// 乗算(sph)
	SPHERE_MODE_MULTIPLICATION SphereMode = 1
	// 加算(spa)
	SPHERE_MODE_ADDITION SphereMode = 2
	// サブテクスチャ(追加UV1のx,yをUV参照して通常テクスチャ描画を行う)
	SPHERE_MODE_SUBTEXTURE SphereMode = 3
)

type StandardBoneName

type StandardBoneName string
const (
	ROOT           StandardBoneName = "全ての親"
	CENTER         StandardBoneName = "センター"
	GROOVE         StandardBoneName = "グルーブ"
	BODY_AXIS      StandardBoneName = "体軸"
	TRUNK_ROOT     StandardBoneName = "体幹中心"
	WAIST          StandardBoneName = "腰"
	LOWER_ROOT     StandardBoneName = "下半身根元"
	LOWER          StandardBoneName = "下半身"
	HIP            StandardBoneName = "{d}腰骨"
	LEG_CENTER     StandardBoneName = "足中心"
	UPPER_ROOT     StandardBoneName = "上半身根元"
	UPPER          StandardBoneName = "上半身"
	UPPER2         StandardBoneName = "上半身2"
	NECK_ROOT      StandardBoneName = "首根元"
	NECK           StandardBoneName = "首"
	HEAD           StandardBoneName = "頭"
	HEAD_TAIL      StandardBoneName = "頭先先"
	EYES           StandardBoneName = "両目"
	EYE            StandardBoneName = "{d}目"
	SHOULDER_ROOT  StandardBoneName = "{d}肩根元"
	SHOULDER_P     StandardBoneName = "{d}肩P"
	SHOULDER       StandardBoneName = "{d}肩"
	SHOULDER_C     StandardBoneName = "{d}肩C"
	ARM            StandardBoneName = "{d}腕"
	ARM_TWIST      StandardBoneName = "{d}腕捩"
	ARM_TWIST1     StandardBoneName = "{d}腕捩1"
	ARM_TWIST2     StandardBoneName = "{d}腕捩2"
	ARM_TWIST3     StandardBoneName = "{d}腕捩3"
	ELBOW          StandardBoneName = "{d}ひじ"
	WRIST_TWIST    StandardBoneName = "{d}手捩"
	WRIST_TWIST1   StandardBoneName = "{d}手捩1"
	WRIST_TWIST2   StandardBoneName = "{d}手捩2"
	WRIST_TWIST3   StandardBoneName = "{d}手捩3"
	WRIST          StandardBoneName = "{d}手首"
	WRIST_TAIL     StandardBoneName = "{d}手首先先"
	THUMB0         StandardBoneName = "{d}親指0"
	THUMB1         StandardBoneName = "{d}親指1"
	THUMB2         StandardBoneName = "{d}親指2"
	THUMB_TAIL     StandardBoneName = "{d}親指先先"
	INDEX1         StandardBoneName = "{d}人指1"
	INDEX2         StandardBoneName = "{d}人指2"
	INDEX3         StandardBoneName = "{d}人指3"
	INDEX_TAIL     StandardBoneName = "{d}人指先先"
	MIDDLE1        StandardBoneName = "{d}中指1"
	MIDDLE2        StandardBoneName = "{d}中指2"
	MIDDLE3        StandardBoneName = "{d}中指3"
	MIDDLE_TAIL    StandardBoneName = "{d}中指先先"
	RING1          StandardBoneName = "{d}薬指1"
	RING2          StandardBoneName = "{d}薬指2"
	RING3          StandardBoneName = "{d}薬指3"
	RING_TAIL      StandardBoneName = "{d}薬指先先"
	PINKY1         StandardBoneName = "{d}小指1"
	PINKY2         StandardBoneName = "{d}小指2"
	PINKY3         StandardBoneName = "{d}小指3"
	PINKY_TAIL     StandardBoneName = "{d}小指先先"
	WAIST_CANCEL   StandardBoneName = "腰キャンセル{d}"
	LEG_ROOT       StandardBoneName = "{d}足根元"
	LEG            StandardBoneName = "{d}足"
	KNEE           StandardBoneName = "{d}ひざ"
	ANKLE          StandardBoneName = "{d}足首"
	ANKLE_GROUND   StandardBoneName = "{d}足首地面"
	HEEL           StandardBoneName = "{d}かかと"
	TOE_T          StandardBoneName = "{d}つま先先"
	TOE_P          StandardBoneName = "{d}つま先親"
	TOE_C          StandardBoneName = "{d}つま先子"
	LEG_D          StandardBoneName = "{d}足D"
	KNEE_D         StandardBoneName = "{d}ひざD"
	HEEL_D         StandardBoneName = "{d}かかとD"
	ANKLE_D        StandardBoneName = "{d}足首D"
	ANKLE_D_GROUND StandardBoneName = "{d}足首地面D"
	TOE_T_D        StandardBoneName = "{d}つま先先D"
	TOE_P_D        StandardBoneName = "{d}つま先親D"
	TOE_C_D        StandardBoneName = "{d}つま先子D"
	TOE_EX         StandardBoneName = "{d}足先EX"
	LEG_IK_PARENT  StandardBoneName = "{d}足IK親"
	LEG_IK         StandardBoneName = "{d}足IK"
	TOE_IK         StandardBoneName = "{d}つま先IK"
)

func (StandardBoneName) Left

func (s StandardBoneName) Left() string

func (StandardBoneName) Right

func (s StandardBoneName) Right() string

func (StandardBoneName) String

func (s StandardBoneName) String() string

func (StandardBoneName) StringFromDirection

func (s StandardBoneName) StringFromDirection(direction BoneDirection) string

func (StandardBoneName) StringFromDirectionAndIdx

func (s StandardBoneName) StringFromDirectionAndIdx(direction BoneDirection, idx int) string

type Texture

type Texture struct {
	TextureType TextureType // テクスチャ種別
	// contains filtered or unexported fields
}

func NewTexture

func NewTexture() *Texture

func (*Texture) Copy

func (tex *Texture) Copy() core.IIndexModel

func (*Texture) EnglishName

func (tex *Texture) EnglishName() string

func (*Texture) Index

func (tex *Texture) Index() int

func (*Texture) IsValid

func (tex *Texture) IsValid() bool

func (*Texture) Name

func (tex *Texture) Name() string

func (*Texture) SetEnglishName

func (tex *Texture) SetEnglishName(englishName string)

func (*Texture) SetIndex

func (tex *Texture) SetIndex(index int)

func (*Texture) SetName

func (tex *Texture) SetName(name string)

func (*Texture) SetValid

func (tex *Texture) SetValid(valid bool)

type TextureType

type TextureType int

テクスチャ種別

const (
	TEXTURE_TYPE_TEXTURE TextureType = 0 // テクスチャ
	TEXTURE_TYPE_TOON    TextureType = 1 // Toonテクスチャ
	TEXTURE_TYPE_SPHERE  TextureType = 2 // スフィアテクスチャ
)

type Textures

type Textures struct {
	*core.IndexModels[*Texture]
}

テクスチャリスト

func NewTextures

func NewTextures(capacity int) *Textures

type ToonSharing

type ToonSharing byte

共有Toonフラグ

const (
	// 0:継続値は個別Toon
	TOON_SHARING_INDIVIDUAL ToonSharing = 0
	// 1:継続値は共有Toon
	TOON_SHARING_SHARING ToonSharing = 1
)

type ToonTextures

type ToonTextures struct {
	*core.IndexModels[*Texture]
}

共有テクスチャ辞書

func NewToonTextures

func NewToonTextures() *ToonTextures

type UvMorphOffset

type UvMorphOffset struct {
	VertexIndex int          // 頂点INDEX
	Uv          *mmath.MVec4 // UVオフセット量(x,y,z,w)
}

UvMorphOffset represents a UV morph.

func NewUvMorphOffset

func NewUvMorphOffset(vertexIndex int, uv *mmath.MVec4) *UvMorphOffset

func (*UvMorphOffset) Type

func (offset *UvMorphOffset) Type() int

type Vertex

type Vertex struct {
	Position        *mmath.MVec3   // 頂点位置
	Normal          *mmath.MVec3   // 頂点法線
	Uv              *mmath.MVec2   // UV
	ExtendedUvs     []*mmath.MVec4 // 追加UV
	DeformType      DeformType     // ウェイト変形方式
	Deform          IDeform        // デフォーム
	EdgeFactor      float64        // エッジ倍率
	MaterialIndexes []int          // 割り当て材質インデックス
	// contains filtered or unexported fields
}

func NewVertex

func NewVertex() *Vertex

func (*Vertex) Copy

func (vertex *Vertex) Copy() core.IIndexModel

func (*Vertex) Index

func (vertex *Vertex) Index() int

func (*Vertex) IsValid

func (vertex *Vertex) IsValid() bool

func (*Vertex) SetIndex

func (vertex *Vertex) SetIndex(index int)

type VertexMorphOffset

type VertexMorphOffset struct {
	VertexIndex int          // 頂点INDEX
	Position    *mmath.MVec3 // 座標オフセット量(x,y,z)
}

VertexMorphOffset represents a vertex morph.

func NewVertexMorphOffset

func NewVertexMorphOffset(vertexIndex int, position *mmath.MVec3) *VertexMorphOffset

func (*VertexMorphOffset) Type

func (offset *VertexMorphOffset) Type() int

type Vertices

type Vertices struct {
	*core.IndexModels[*Vertex]
	// contains filtered or unexported fields
}

頂点リスト

func NewVertices

func NewVertices(capacity int) *Vertices

func (*Vertices) Append

func (vertices *Vertices) Append(value *Vertex)

func (*Vertices) GetMapByBoneIndex

func (vertices *Vertices) GetMapByBoneIndex(weightThreshold float64) map[int][]*Vertex

GetMapByBoneIndex はボーンINDEXをキーとして、ウェイト閾値以上の頂点リストを取得します

Jump to

Keyboard shortcuts

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