Skip to content

package fbx

import "kaijuengine.com/rendering/loaders/fbx"

Constants

BinaryHeader

"Kaydara FBX Binary \x00\x1a\x00"

Variables

ErrASCIINotSupported

errors.New("ASCII FBX is not supported yet")

ErrInvalidHeader

errors.New("invalid FBX file")

Functions

SplitNameClass

func SplitNameClass(value string) (string, string)

ToLoadResult

func ToLoadResult(doc Document) (load_result.Result, error)

ToLoadResultWithPath

func ToLoadResultWithPath(doc Document, path string) (load_result.Result, error)

Types

Connection

struct

type Connection struct {
    Type     string
    Child    int64
    Parent   int64
    Property string
    Node     *Node
}

ConnectionIndex

struct

type ConnectionIndex struct {
    All              []Connection
    ChildrenByParent map[int64][]Connection
    ParentsByChild   map[int64][]Connection
    PropertiesByNode map[int64][]Connection
}

Definition

struct

type Definition struct {
    ObjectType string
    Count      int64
    Properties PropertyTable
    Node       *Node
}

DefinitionsIndex

struct

type DefinitionsIndex struct {
    ByObjectType map[string]*Definition
}

Document

struct

type Document struct {
    Version uint32
    Nodes   []Node
}

Parse

func Parse(data []byte) (Document, error)

GlobalSettings

struct

type GlobalSettings struct {
    UpAxis                  int
    UpAxisSign              int
    FrontAxis               int
    FrontAxisSign           int
    CoordAxis               int
    CoordAxisSign           int
    UnitScaleFactor         float64
    OriginalUnitScaleFactor float64
}

DefaultGlobalSettings

func DefaultGlobalSettings() GlobalSettings

GlobalSettings.IsKaijuCompatible

func (s GlobalSettings) IsKaijuCompatible() bool

Node

struct

type Node struct {
    Name          string
    Properties    []Property
    Children      []Node
    StartOffset   int64
    EndOffset     int64
    PropertyStart int64
    PropertyEnd   int64
}

Object

struct

type Object struct {
    ID         int64
    Name       string
    Class      string
    SubClass   string
    NodeClass  string
    Properties PropertyTable
    Node       *Node
}

ParseError

struct

type ParseError struct {
    Offset int64
    Reason string
}

ParseError.Error

func (e ParseError) Error() string

Property

struct

type Property struct {
    Type   byte
    Offset int64
    Value  any
}

Property70

struct

type Property70 struct {
    Name   string
    Type   string
    Label  string
    Flags  string
    Values []any
    Node   *Node
}

Property70.Bool

func (p Property70) Bool() (bool, bool)

Property70.Enum

func (p Property70) Enum() (int64, bool)

Property70.Int

func (p Property70) Int() (int64, bool)

Property70.Number

func (p Property70) Number() (float64, bool)

Property70.String

func (p Property70) String() (string, bool)

Property70.Vec2

func (p Property70) Vec2() ([2]float64, bool)

Property70.Vec3

func (p Property70) Vec3() ([3]float64, bool)

Property70.Vec4

func (p Property70) Vec4() ([4]float64, bool)

PropertyTable

struct

type PropertyTable struct {
    ByName map[string]Property70
    List   []Property70
}

ParseProperties70

func ParseProperties70(node *Node) PropertyTable

PropertyTable.Bool

func (t PropertyTable) Bool(name string) (bool, bool)

PropertyTable.Enum

func (t PropertyTable) Enum(name string) (int64, bool)

PropertyTable.Get

func (t PropertyTable) Get(name string) (Property70, bool)

PropertyTable.Int

func (t PropertyTable) Int(name string) (int64, bool)

PropertyTable.Number

func (t PropertyTable) Number(name string) (float64, bool)

PropertyTable.String

func (t PropertyTable) String(name string) (string, bool)

PropertyTable.Vec2

func (t PropertyTable) Vec2(name string) ([2]float64, bool)

PropertyTable.Vec3

func (t PropertyTable) Vec3(name string) ([3]float64, bool)

PropertyTable.Vec4

func (t PropertyTable) Vec4(name string) ([4]float64, bool)

SceneIndex

struct

type SceneIndex struct {
    Version        uint32
    Objects        map[int64]*Object
    ByClass        map[string]map[int64]*Object
    Geometry       map[int64]*Object
    Model          map[int64]*Object
    Material       map[int64]*Object
    Texture        map[int64]*Object
    Video          map[int64]*Object
    Deformer       map[int64]*Object
    Animation      map[int64]*Object
    Connections    ConnectionIndex
    Definitions    DefinitionsIndex
    GlobalSettings GlobalSettings
}

BuildSceneIndex

func BuildSceneIndex(doc Document) (SceneIndex, error)