vrm

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: May 11, 2021 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const ExtensionName = "VRM"

Variables

View Source
var ExporterVersion = "modelconv-v0.2"

ExporterVersion

View Source
var RequiredBones = []string{
	"hips", "spine", "chest", "neck", "head",
	"leftUpperArm", "leftLowerArm", "leftHand",
	"rightUpperArm", "rightLowerArm", "rightHand",
	"leftUpperLeg", "leftLowerLeg", "leftFoot",
	"rightUpperLeg", "rightLowerLeg", "rightFoot",
}

RequiredBones for Humanoid

Functions

func Unmarshal

func Unmarshal(data []byte) (interface{}, error)

func Write

func Write(doc *Document, w io.Writer, path string) error

Write vrm file

Types

type BlendShapeBind added in v0.2.4

type BlendShapeBind struct {
	Mesh   uint32  `json:"mesh"`
	Index  int     `json:"index"`
	Weight float64 `json:"weight"`
}

type BlendShapeGroup

type BlendShapeGroup struct {
	Name           string                     `json:"name"`
	PresetName     string                     `json:"presetName"`
	Binds          []*BlendShapeBind          `json:"binds"`
	MaterialValues []*BlendShapeMaterialValue `json:"materialValues,omitempty"`
}

type BlendShapeMaster

type BlendShapeMaster struct {
	BlendShapeGroups []*BlendShapeGroup `json:"blendShapeGroups"`
}

type BlendShapeMaterialValue added in v0.2.4

type BlendShapeMaterialValue struct {
	MaterialName string    `json:"materialName"`
	PropertyName string    `json:"propertyName"`
	TargetValue  []float64 `json:"targetValue"`
}

type Bone

type Bone struct {
	Bone             string `json:"bone"`
	Node             int    `json:"node"`
	UseDefaultValues bool   `json:"useDefaultValues"`

	Min        *[3]float32 `json:"min,omitempty"`
	Max        *[3]float32 `json:"max,omitempty"`
	Center     *[3]float32 `json:"center,omitempty"`
	AxisLength float32     `json:"axisLength,omitempty"`
}

type Document added in v0.2.1

type Document gltf.Document

func Parse

func Parse(r io.Reader, path string) (*Document, error)

Parse vrm data

func (*Document) FixJointComponentType added in v0.2.1

func (doc *Document) FixJointComponentType()

func (*Document) FixJointMatrix added in v0.2.1

func (doc *Document) FixJointMatrix()

func (*Document) IsExtentionUsed added in v0.2.1

func (doc *Document) IsExtentionUsed(extname string) bool

func (*Document) VRM added in v0.2.1

func (doc *Document) VRM() *VRM

func (*Document) ValidateBones added in v0.2.1

func (doc *Document) ValidateBones() error

type FirstPerson

type FirstPerson struct {
	FirstPersonBone       int                `json:"firstPersonBone,omitempty"`
	FirstPersonBoneOffset map[string]float64 `json:"firstPersonBoneOffset,omitempty"`

	MeshAnnotations []interface{} `json:"meshAnnotations,omitempty"`

	LookAtTypeName        string                 `json:"lookAtTypeName,omitempty"`
	LookAtHorizontalInner map[string]interface{} `json:"lookAtHorizontalInner,omitempty"`
	LookAtHorizontalOuter map[string]interface{} `json:"lookAtHorizontalOuter,omitempty"`
	LookAtVerticalDown    map[string]interface{} `json:"lookAtVerticalDown,omitempty"`
	LookAtVerticalUp      map[string]interface{} `json:"lookAtVerticalUp,omitempty"`
}

type Humanoid

type Humanoid struct {
	Bones []*Bone `json:"humanBones"`
}

type MaterialProperty

type MaterialProperty struct {
	Name              string               `json:"name"`
	Shader            string               `json:"shader"`
	RenderQueue       int                  `json:"renderQueue"`
	FloatProperties   map[string]float64   `json:"floatProperties"`
	VectorProperties  map[string][]float64 `json:"vectorProperties"`
	TextureProperties map[string]uint32    `json:"textureProperties"`
	KeywordMap        map[string]bool      `json:"keywordMap"`
	TagMap            map[string]string    `json:"tagMap"`
}

func NewMaterialProperty added in v0.2.4

func NewMaterialProperty(name string) *MaterialProperty

type Metadata

type Metadata struct {
	Title   string `json:"title"`
	Version string `json:"version"`
	Author  string `json:"author"`
	Contact string `json:"contactInformation"`
	Texture *int   `json:"texture,omitempty"`

	AllowedUserName      string `json:"allowedUserName,omitempty"`
	ViolentUssageName    string `json:"violentUssageName,omitempty"`
	SexualUssageName     string `json:"sexualUssageName,omitempty"`
	CommercialUssageName string `json:"commercialUssageName,omitempty"`

	OtherPermissionURL string `json:"otherPermissionUrl,omitempty"`

	LicenseName     string `json:"licenseName"`
	OtherLicenseURL string `json:"otherLicenseUrl"`
}

type Q

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

type SecondaryAnimation

type SecondaryAnimation struct {
	BoneGroups     []*SecondaryAnimationBoneGroup     `json:"boneGroups,omitempty"`
	ColliderGroups []*SecondaryAnimationColliderGroup `json:"colliderGroups,omitempty"`
}

type SecondaryAnimationBoneGroup

type SecondaryAnimationBoneGroup struct {
	Comment        string             `json:"comment"`
	Stiffiness     float64            `json:"stiffiness"`
	GravityPower   float64            `json:"gravityPower"`
	GravityDir     map[string]float64 `json:"gravityDir,omitempty"`
	DragForce      float64            `json:"dragForce"`
	HitRadius      float64            `json:"hitRadius"`
	Center         int                `json:"center"`
	Bones          []int              `json:"bones"`
	ColliderGroups []int              `json:"colliderGroups,omitempty"`
}

type SecondaryAnimationCollider added in v0.2.4

type SecondaryAnimationCollider struct {
	Radius float64            `json:"radius"`
	Offset map[string]float64 `json:"offset"`
}

type SecondaryAnimationColliderGroup added in v0.2.4

type SecondaryAnimationColliderGroup struct {
	Node      uint32                        `json:"node"`
	Colliders []*SecondaryAnimationCollider `json:"colliders"`
}

type VRM added in v0.2.1

type VRM struct {
	Meta     Metadata `json:"meta"`
	Humanoid Humanoid `json:"humanoid"`

	FirstPerson        *FirstPerson        `json:"firstPerson,omitempty"`
	BlendShapeMaster   BlendShapeMaster    `json:"blendShapeMaster,omitempty"`
	SecondaryAnimation *SecondaryAnimation `json:"secondaryAnimation,omitempty"`
	MaterialProperties []*MaterialProperty `json:"materialProperties"`

	ExporterVersion string `json:"exporterVersion"`
}

func NewVRM added in v0.2.1

func NewVRM() *VRM

func (*VRM) Author added in v0.2.1

func (v *VRM) Author() string

func (*VRM) CheckRequiredBones added in v0.2.1

func (v *VRM) CheckRequiredBones() []string

func (*VRM) Title added in v0.2.1

func (v *VRM) Title() string

Jump to

Keyboard shortcuts

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