Documentation
¶
Index ¶
- func Save(doc *Document, path string) error
- func SaveMQOZ(doc *Document, path string) error
- func UpdateBoneRef(bones []*BoneOld)
- func WriteMQX(mqo *Document, w io.Writer, mqoName string) error
- type Bone
- type BoneIK
- type BoneObj
- type BoneOld
- type BonePlugin
- type BonePose
- type BoneRef
- type BoneSet
- type BoneSet2
- type BoneWeight
- type BoneWeight2
- type Document
- func (doc *Document) ApplyTransform(transform *Matrix4)
- func (doc *Document) BoneAdjustX(baseBone *Bone)
- func (doc *Document) BoneTransform(baseBone *Bone, transform func(v *Vector3), boneFn func(b *Bone))
- func (doc *Document) FixNames()
- func (doc *Document) FixObjectID()
- func (doc *Document) GetObjectByID(id int) *Object
- func (doc *Document) GetPlugins() []Plugin
- func (doc *Document) GetWorldTransforms() map[*Object]*Matrix4
- type Face
- type MQXDoc
- type Material
- type MaterialEx2
- type Matrix4
- type MorphPlugin
- type MorphSet
- type MorphTarget
- type MorphTargetList
- type Object
- func (o *Object) ApplyTransform(transform *Matrix4)
- func (o *Object) Clone() *Object
- func (obj *Object) FixhNormals()
- func (o *Object) GetLocalTransform() *geom.Matrix4
- func (o *Object) GetRotation() *geom.Quaternion
- func (obj *Object) GetSmoothNormals() []Vector3
- func (o *Object) GetVertexIndexByID(uid int) int
- func (o *Object) SetLocalTransform(mat *geom.Matrix4)
- func (o *Object) SetRotation(r *geom.Quaternion)
- func (o *Object) Triangulate()
- type Parser
- type PhysicsBody
- type PhysicsJointConstraint
- type PhysicsPlugin
- type PhysicsShape
- type Plugin
- type PoseSet
- type Scene
- type SharedGeometryHint
- type Vector2
- type Vector3
- type Vector3Attr
- type Vector3XmlAttr
- type Vector4
- type VertexWeight
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UpdateBoneRef ¶
func UpdateBoneRef(bones []*BoneOld)
Types ¶
type Bone ¶
type Bone struct {
ID int `xml:"id,attr"`
Name string `xml:"name,attr"`
Group int `xml:"group,attr,omitempty"`
Parent int `xml:"parent,attr,omitempty"`
Pos Vector3Attr `xml:"pos,attr,omitempty"`
Movable int `xml:"movable,attr,omitempty"`
Hide int `xml:"hide,attr,omitempty"`
Dummy int `xml:"dummy,attr,omitempty"`
Color string `xml:"color,attr,omitempty"`
UpVector *Vector3Attr `xml:"upVector,attr,omitempty"`
Rotate *Vector3Attr `xml:"rotate,attr,omitempty"`
IK *BoneIK `xml:"IK,omitempty"`
Weights []*BoneWeight2 `xml:"W"`
// internal use
RotationOffset Vector3 `xml:"-"`
// contains filtered or unexported fields
}
func (*Bone) SetVertexWeight ¶
func (b *Bone) SetVertexWeight(objectID, vertID int, weight float32) *VertexWeight
type BoneOld ¶
type BoneOld struct {
ID int `xml:"id,attr"`
Name string `xml:"name,attr"`
Group int `xml:"group,attr"`
IsDummy int `xml:"isDummy,attr"`
RtX float32 `xml:"rtX,attr"`
RtY float32 `xml:"rtY,attr"`
RtZ float32 `xml:"rtZ,attr"`
TpX float32 `xml:"tpX,attr"`
TpY float32 `xml:"tpY,attr"`
TpZ float32 `xml:"tpZ,attr"`
MvX float32 `xml:"mvX,attr"`
MvY float32 `xml:"mvY,attr"`
MvZ float32 `xml:"mvZ,attr"`
RotB float32 `xml:"rotB,attr"`
RotH float32 `xml:"rotH,attr"`
RotP float32 `xml:"rotP,attr"`
Sc float32 `xml:"sc,attr"`
MaxAngB float32 `xml:"maxAngB,attr"`
MaxAngH float32 `xml:"maxAngH,attr"`
MaxAngP float32 `xml:"maxAngP,attr"`
MinAngB float32 `xml:"minAngB,attr"`
MinAngH float32 `xml:"minAngH,attr"`
MinAngP float32 `xml:"minAngP,attr"`
Parent BoneRef `xml:"P"`
Children []*BoneRef `xml:"C"`
Weights []*BoneWeight `xml:"W"`
}
type BonePlugin ¶
type BonePlugin struct {
XMLName xml.Name `xml:"Plugin.56A31D20.71F282AB"`
Name string `xml:"name,attr"`
BoneSet BoneSet
BoneSet2 BoneSet2
PoseSet PoseSet `xml:"Poses"`
Obj []BoneObj
}
func GetBonePlugin ¶
func GetBonePlugin(mqo *Document) *BonePlugin
func (*BonePlugin) AddBone ¶
func (p *BonePlugin) AddBone(b *Bone)
func (*BonePlugin) ApplyTransform ¶ added in v0.3.3
func (p *BonePlugin) ApplyTransform(transform *Matrix4)
func (*BonePlugin) Bones ¶
func (p *BonePlugin) Bones() []*Bone
func (*BonePlugin) PostDeserialize ¶
func (p *BonePlugin) PostDeserialize(mqo *Document)
func (*BonePlugin) PreSerialize ¶
func (p *BonePlugin) PreSerialize(mqo *Document)
func (*BonePlugin) SetBones ¶
func (p *BonePlugin) SetBones(bones []*Bone)
type BonePose ¶
type BonePose struct {
// oneof
ID int `xml:"id,attr"`
Name string `xml:"name,attr"`
// Translation
MvX float32 `xml:"mvX,attr"`
MvY float32 `xml:"mvY,attr"`
MvZ float32 `xml:"mvZ,attr"`
// Rotation
RotB float32 `xml:"rotB,attr"`
RotH float32 `xml:"rotH,attr"`
RotP float32 `xml:"rotP,attr"`
// Scale
ScB float32 `xml:"scB,attr"`
ScH float32 `xml:"scH,attr"`
ScP float32 `xml:"scP,attr"`
}
type BoneWeight ¶
type BoneWeight2 ¶
type BoneWeight2 struct {
ObjectID int `xml:"obj,attr"`
Vertexes []*VertexWeight `xml:"V"`
}
type Document ¶ added in v0.2.1
func NewDocument ¶
func NewDocument() *Document
func (*Document) ApplyTransform ¶ added in v0.3.3
Transform all objects and plugins
func (*Document) BoneAdjustX ¶ added in v0.2.2
for T-Pose adjustment TODO: more generic function.
func (*Document) BoneTransform ¶ added in v0.2.3
func (*Document) FixObjectID ¶ added in v0.2.1
func (doc *Document) FixObjectID()
func (*Document) GetObjectByID ¶ added in v0.2.2
func (*Document) GetPlugins ¶ added in v0.2.1
func (*Document) GetWorldTransforms ¶ added in v0.3.5
type MQXDoc ¶
type Material ¶
type Material struct {
Name string
UID int
Color Vector4
Diffuse float32
Ambient float32
Emission float32
Specular float32
Power float32
Texture string
BumpTexture string
AlphaTexture string
EmissionColor *Vector3
DoubleSided bool
Shader int
Ex2 *MaterialEx2
}
func (*Material) GetShaderName ¶ added in v0.3.0
type MaterialEx2 ¶
type MaterialEx2 struct {
ShaderType string
ShaderName string
ShaderParams map[string]interface{}
ShaderMappingParams map[string]map[string]interface{}
}
func (*MaterialEx2) FloatParam ¶ added in v0.2.1
func (m *MaterialEx2) FloatParam(name string) float64
func (*MaterialEx2) IntParam ¶ added in v0.2.1
func (m *MaterialEx2) IntParam(name string) int
func (*MaterialEx2) StringParam ¶ added in v0.2.1
func (m *MaterialEx2) StringParam(name string) string
type MorphPlugin ¶
type MorphPlugin struct {
XMLName xml.Name `xml:"Plugin.56A31D20.C452C6DB"`
Name string `xml:"name,attr"`
MorphSet MorphSet
}
func GetMorphPlugin ¶
func GetMorphPlugin(mqo *Document) *MorphPlugin
func (*MorphPlugin) Morphs ¶ added in v0.2.0
func (p *MorphPlugin) Morphs() []*MorphTargetList
func (*MorphPlugin) PostDeserialize ¶
func (p *MorphPlugin) PostDeserialize(mqo *Document)
func (*MorphPlugin) PreSerialize ¶
func (p *MorphPlugin) PreSerialize(mqo *Document)
type MorphSet ¶
type MorphSet struct {
Targets []*MorphTargetList `xml:"TargetList"`
}
type MorphTarget ¶
type MorphTargetList ¶
type MorphTargetList struct {
Base string `xml:"base,attr"`
Target []*MorphTarget
}
type Object ¶
type Object struct {
UID int
Name string
Vertexes []*Vector3
Faces []*Face
Visible bool
Locked bool
Depth int
Folding bool
Shading int
Facet float32
Patch int
PatchSegment int
Mirror int
MirrorDis float32
Scale *Vector3
Rotation *Vector3 // TODO: EulerAngles
Translation *Vector3
Color *Vector3
VertexByUID map[int]int
SharedGeometryHint *SharedGeometryHint
}
func (*Object) ApplyTransform ¶ added in v0.3.3
Transform object
func (*Object) FixhNormals ¶ added in v0.3.2
func (obj *Object) FixhNormals()
func (*Object) GetLocalTransform ¶ added in v0.3.5
func (*Object) GetRotation ¶ added in v0.3.5
func (o *Object) GetRotation() *geom.Quaternion
func (*Object) GetSmoothNormals ¶ added in v0.2.3
func (*Object) GetVertexIndexByID ¶ added in v0.2.1
func (*Object) SetLocalTransform ¶ added in v0.3.5
func (*Object) SetRotation ¶ added in v0.3.5
func (o *Object) SetRotation(r *geom.Quaternion)
func (*Object) Triangulate ¶ added in v0.3.2
func (o *Object) Triangulate()
type Parser ¶
type Parser struct {
Open func(name string) (io.ReadCloser, error)
// contains filtered or unexported fields
}
Parser for mqo file.
type PhysicsBody ¶ added in v0.3.5
type PhysicsBody struct {
Shapes []*PhysicsShape `xml:"Shapes>Shape"`
Mass float32 `xml:"mass,attr"`
Kinematic bool `xml:"kinematic,attr,omitempty"`
CollisionGroup int
CollisionMask int
// TODO: PhysicsMaterial
Restitution float32
Friction float32
LinearDamping float32
AngularDamping float32
// optional
Name string `xml:"name,attr,omitempty"`
TargetBoneID int `xml:"targetBone,attr,omitempty"`
TargetObjID int `xml:"targetObj,attr,omitempty"`
}
type PhysicsJointConstraint ¶ added in v0.3.5
type PhysicsJointConstraint struct {
Type string `xml:"type,attr,omitempty"`
Body1 int `xml:"body1,attr,omitempty"`
Body2 int `xml:"body2,attr,omitempty"`
Name string `xml:"name,attr,omitempty"` // optional
// Spring joint
Position Vector3XmlAttr
Rotation Vector3XmlAttr
LinerSpring Vector3XmlAttr
AngulerSpring Vector3XmlAttr
}
type PhysicsPlugin ¶ added in v0.3.5
type PhysicsPlugin struct {
XMLName xml.Name `xml:"Plugin.7A6E6962.43594850"`
Name string `xml:"name,attr"`
Bodies []*PhysicsBody `xml:"Bodies>Body"`
Constraints []*PhysicsJointConstraint `xml:"Constraints>Joint"`
}
Fake plugin for keeping physics params
func GetPhysicsPlugin ¶ added in v0.3.5
func GetPhysicsPlugin(mqo *Document) *PhysicsPlugin
func (*PhysicsPlugin) ApplyTransform ¶ added in v0.3.5
func (p *PhysicsPlugin) ApplyTransform(transform *Matrix4)
func (*PhysicsPlugin) PostDeserialize ¶ added in v0.3.5
func (p *PhysicsPlugin) PostDeserialize(mqo *Document)
func (*PhysicsPlugin) PreSerialize ¶ added in v0.3.5
func (p *PhysicsPlugin) PreSerialize(mqo *Document)
type PhysicsShape ¶ added in v0.3.5
type PhysicsShape struct {
Type string `xml:"type,attr"` // BOX | SPHERE | CAPSULE | CYLINDER | MESH
Size Vector3XmlAttr
Position Vector3XmlAttr
Rotation Vector3XmlAttr
}
type SharedGeometryHint ¶ added in v0.3.3
type SharedGeometryHint struct {
}
type Vector3Attr ¶ added in v0.3.0
type Vector3Attr struct{ Vector3 }
func (*Vector3Attr) MarshalXMLAttr ¶ added in v0.3.0
func (*Vector3Attr) UnmarshalXMLAttr ¶ added in v0.3.0
func (v *Vector3Attr) UnmarshalXMLAttr(attr xml.Attr) error
type Vector3XmlAttr ¶ added in v0.3.5
type Vector3XmlAttr struct {
X geom.Element `xml:"x,attr"`
Y geom.Element `xml:"y,attr"`
Z geom.Element `xml:"z,attr"`
}
func (*Vector3XmlAttr) Vec3 ¶ added in v0.3.5
func (v *Vector3XmlAttr) Vec3() *Vector3
type VertexWeight ¶
Click to show internal directories.
Click to hide internal directories.