fbx

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Ident tokenType = iota
	Number
	String
	BlockStart
	BlockEnd
	Comma
	Colon
	Asterisk
	EOL
)

Variables

This section is empty.

Functions

func Save

func Save(doc *Document, path string) error

func Write added in v0.3.4

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

Types

type Attribute

type Attribute struct {
	Value interface{}
}

func (Attribute) Len added in v0.3.4

func (p Attribute) Len() uint

func (*Attribute) String

func (p *Attribute) String() string

func (*Attribute) ToFloat32

func (p *Attribute) ToFloat32(defvalue float32) float32

func (*Attribute) ToFloat32Array

func (p *Attribute) ToFloat32Array() []float32

func (*Attribute) ToFloat64

func (p *Attribute) ToFloat64(defvalue float64) float64

func (*Attribute) ToInt

func (p *Attribute) ToInt(defvalue int) int

func (*Attribute) ToInt32Array

func (p *Attribute) ToInt32Array() []int32

func (*Attribute) ToInt64

func (p *Attribute) ToInt64(defvalue int64) int64

func (*Attribute) ToString

func (p *Attribute) ToString() string

type AttributeList

type AttributeList []*Attribute

func (AttributeList) Get

func (p AttributeList) Get(i int) *Attribute

func (AttributeList) ToFloat32

func (p AttributeList) ToFloat32(defvalue float32) float32

func (AttributeList) ToInt

func (p AttributeList) ToInt(defvalue int) int

func (AttributeList) ToString

func (p AttributeList) ToString() string

func (AttributeList) ToVector3

func (p AttributeList) ToVector3(x, y, z float32) *geom.Vector3

type Deformer

type Deformer struct {
	Obj
}

TODO: rename to SubDeformer

func (*Deformer) GetIndexes

func (d *Deformer) GetIndexes() []int32

func (*Deformer) GetShapes added in v0.3.2

func (d *Deformer) GetShapes() []*GeometryShape

func (*Deformer) GetTarget

func (d *Deformer) GetTarget() *Model

func (*Deformer) GetTransform added in v0.3.2

func (d *Deformer) GetTransform() *geom.Matrix4
func (d *Deformer) GetTransformLink() *geom.Matrix4

func (*Deformer) GetWeights

func (d *Deformer) GetWeights() []float32

type Document

type Document struct {
	FileId       []byte
	Creator      string
	CreationTime string

	GlobalSettings Object
	Scene          *Model

	Materials []*Material

	ObjectByID   map[int64]Object
	RawNode      *Node
	NextObjectID int64
}

func BuildDocument

func BuildDocument(root *Node) (*Document, error)

func Load

func Load(path string) (*Document, error)

func NewDocument added in v0.3.4

func NewDocument() *Document

func Parse added in v0.3.2

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

func (*Document) AddConnection added in v0.3.4

func (doc *Document) AddConnection(parent, child Object)

func (*Document) AddObject added in v0.3.4

func (doc *Document) AddObject(obj Object) int64

func (*Document) AddPropConnection added in v0.3.4

func (doc *Document) AddPropConnection(parent, child Object, prop string)

type Geometry

type Geometry struct {
	Obj
	Vertices           []*geom.Vector3
	Polygons           [][]int
	PolygonVertexCount int
}

func NewGeometry added in v0.3.4

func NewGeometry(name string, verts []*geom.Vector3, faces [][]int) *Geometry

func (*Geometry) GetDeformers

func (g *Geometry) GetDeformers() []*Deformer

func (*Geometry) GetLayerElement added in v0.3.2

func (g *Geometry) GetLayerElement(name string, arrayName string, indexName string) *LayerElement

func (*Geometry) GetLayerElementBinormal added in v0.3.2

func (g *Geometry) GetLayerElementBinormal() *LayerElement

func (*Geometry) GetLayerElementMaterial added in v0.3.2

func (g *Geometry) GetLayerElementMaterial() *LayerElement

func (*Geometry) GetLayerElementNormal added in v0.3.2

func (g *Geometry) GetLayerElementNormal() *LayerElement

func (*Geometry) GetLayerElementSmoothing added in v0.3.2

func (g *Geometry) GetLayerElementSmoothing() *LayerElement

func (*Geometry) GetLayerElementTangent added in v0.3.2

func (g *Geometry) GetLayerElementTangent() *LayerElement

func (*Geometry) GetLayerElementUV added in v0.3.2

func (g *Geometry) GetLayerElementUV() *LayerElement

func (*Geometry) GetShapes

func (g *Geometry) GetShapes() []*GeometryShape

func (*Geometry) GetVertices

func (g *Geometry) GetVertices() []*geom.Vector3

func (*Geometry) Init added in v0.3.4

func (g *Geometry) Init()

func (*Geometry) SetLayerElementMaterialIndex added in v0.3.4

func (g *Geometry) SetLayerElementMaterialIndex(mat []int32, mappingType MappingType)

func (*Geometry) SetLayerElementNormal added in v0.3.4

func (g *Geometry) SetLayerElementNormal(normals []*geom.Vector3, mappingType MappingType)

func (*Geometry) SetLayerElementUVIndexed added in v0.3.4

func (g *Geometry) SetLayerElementUVIndexed(uv []*geom.Vector2, indices []int32, mappingType MappingType)

type GeometryShape

type GeometryShape struct {
	*Node
}

func (*GeometryShape) GetIndexes

func (s *GeometryShape) GetIndexes() []int32

func (*GeometryShape) GetNormals

func (s *GeometryShape) GetNormals() []*geom.Vector3

func (*GeometryShape) GetVertices

func (s *GeometryShape) GetVertices() []*geom.Vector3

func (*GeometryShape) Name

func (s *GeometryShape) Name() string

type LayerElement added in v0.3.2

type LayerElement struct {
	*Node
	Array     *Node
	IndexNode *Node
}

func (*LayerElement) GetIndexes added in v0.3.2

func (e *LayerElement) GetIndexes() []int32

func (*LayerElement) GetMappingInformationType added in v0.3.2

func (e *LayerElement) GetMappingInformationType() MappingType

func (*LayerElement) GetReferenceInformationType added in v0.3.2

func (e *LayerElement) GetReferenceInformationType() string

type MappingType added in v0.3.4

type MappingType string
const (
	AllSame         MappingType = "AllSame"
	ByPolygon       MappingType = "ByPolygon"
	ByVertice       MappingType = "ByVertice"
	ByPolygonVertex MappingType = "ByPolygonVertex"
	ByControlPoint  MappingType = "ByControlPoint"
)

type Material

type Material struct {
	Obj
}

func NewMaterial added in v0.3.4

func NewMaterial(name string) *Material

func (*Material) GetColor

func (m *Material) GetColor(name string, def *geom.Vector3) *geom.Vector3

func (*Material) GetFactor

func (m *Material) GetFactor(name string, def float32) float32

func (*Material) GetTexture

func (m *Material) GetTexture(name string) *Obj

func (*Material) SetColor added in v0.3.4

func (m *Material) SetColor(name string, c *geom.Vector3)

type Model

type Model struct {
	Obj
	Parent *Model
	// contains filtered or unexported fields
}

func NewModel added in v0.3.4

func NewModel(name, kind string) *Model

func (*Model) GetChildModels

func (m *Model) GetChildModels() []*Model

func (*Model) GetGeometry

func (m *Model) GetGeometry() *Geometry

func (*Model) GetMatrix

func (m *Model) GetMatrix() *geom.Matrix4

func (*Model) GetRotation added in v0.3.4

func (m *Model) GetRotation() *geom.Vector3

func (*Model) GetScaling added in v0.3.4

func (m *Model) GetScaling() *geom.Vector3

func (*Model) GetTranslation

func (m *Model) GetTranslation() *geom.Vector3

func (*Model) GetWorldMatrix

func (m *Model) GetWorldMatrix() *geom.Matrix4

func (*Model) SetRotation added in v0.3.4

func (m *Model) SetRotation(v *geom.Vector3)

func (*Model) SetScaling added in v0.3.4

func (m *Model) SetScaling(v *geom.Vector3)

func (*Model) SetTranslation added in v0.3.4

func (m *Model) SetTranslation(v *geom.Vector3)

func (*Model) UpdateMatrix

func (m *Model) UpdateMatrix()

type Node

type Node struct {
	Name       string
	Attributes AttributeList
	Children   []*Node
}

func NewNode added in v0.3.4

func NewNode(name string, values ...interface{}) *Node

func (*Node) AddChild

func (n *Node) AddChild(node *Node)

func (*Node) Attr

func (n *Node) Attr(i int) *Attribute

func (*Node) Dump

func (n *Node) Dump(w io.Writer, d int, full bool)

Dump node as fbx ASCII format.

func (*Node) FindChild

func (n *Node) FindChild(name string) *Node

func (*Node) GetChildren

func (n *Node) GetChildren() []*Node

func (*Node) GetFloat32

func (n *Node) GetFloat32(defvalue float32) float32

func (*Node) GetFloat32Array

func (n *Node) GetFloat32Array() []float32

func (*Node) GetInt

func (n *Node) GetInt(defvalue int) int

func (*Node) GetInt32Array

func (n *Node) GetInt32Array() []int32

func (*Node) GetInt64

func (n *Node) GetInt64(defvalue int64) int64

func (*Node) GetString

func (n *Node) GetString() string

func (*Node) GetVec2Array

func (n *Node) GetVec2Array() []*geom.Vector2

func (*Node) GetVec3Array

func (n *Node) GetVec3Array() []*geom.Vector3

func (*Node) RemoveChild

func (n *Node) RemoveChild(node *Node) bool

type Obj

type Obj struct {
	*Node
	Template *Obj
	Refs     []Object
	// contains filtered or unexported fields
}

func (*Obj) AddOrReplaceChild added in v0.3.4

func (o *Obj) AddOrReplaceChild(node *Node) bool

func (*Obj) AddRef

func (o *Obj) AddRef(ref Object)

func (*Obj) FindRefs

func (o *Obj) FindRefs(typ string) []Object

func (*Obj) GetNode added in v0.3.4

func (o *Obj) GetNode() *Node

func (*Obj) GetProperty added in v0.3.4

func (o *Obj) GetProperty(name string) *Property

func (*Obj) ID

func (o *Obj) ID() int64

func (*Obj) Kind

func (o *Obj) Kind() string

func (*Obj) Name

func (o *Obj) Name() string

func (*Obj) NodeName

func (o *Obj) NodeName() string

func (*Obj) SetColorProperty added in v0.3.4

func (o *Obj) SetColorProperty(name string, r, g, b float32) *Property

func (*Obj) SetFloatProperty added in v0.3.4

func (o *Obj) SetFloatProperty(name string, v float64) *Property

func (*Obj) SetIntProperty added in v0.3.4

func (o *Obj) SetIntProperty(name string, v int) *Property

func (*Obj) SetProperty added in v0.3.4

func (o *Obj) SetProperty(name string, prop *Property) *Property

func (*Obj) SetStringProperty added in v0.3.4

func (o *Obj) SetStringProperty(name string, v string) *Property

type Object

type Object interface {
	GetNode() *Node
	NodeName() string
	ID() int64
	Name() string
	Kind() string
	GetProperty(name string) *Property
	SetProperty(name string, prop *Property) *Property
	FindRefs(name string) []Object
	AddRef(o Object)
}

type Property added in v0.3.4

type Property struct {
	AttributeList
	Type  string
	Label string
	Flag  string
}

Jump to

Keyboard shortcuts

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