engine: github.com/g3n/engine/loader/collada Index | Files

package collada

import "github.com/g3n/engine/loader/collada"

Package collada

Index

Package Files

animation.go collada.go common.go geometry.go library_animations.go library_effects.go library_geometries.go library_images.go library_lights.go library_materials.go library_visual_scenes.go logger.go material.go scene.go

func DumpColorOrTexture Uses

func DumpColorOrTexture(name string, v interface{}, out io.Writer, indent int)

DumpColorOrTexture prints out information about the Color or Texture

func DumpFloatOrParam Uses

func DumpFloatOrParam(name string, v interface{}, out io.Writer, indent int)

DumpFloatOrParam prints out information about the Float or Param

type Accessor Uses

type Accessor struct {
    Source string
    Count  int
    Stride int
    Params []Param
}

Accessor

func (*Accessor) Dump Uses

func (ac *Accessor) Dump(out io.Writer, indent int)

Dump prints out information about the Accessor

type ActionFunc Uses

type ActionFunc func(at *AnimationTarget, v float32)

ActionFunc is the type for all functions that execute an specific parameter animation

type Ambient Uses

type Ambient struct {
    Color LightColor
}

Ambient

func (*Ambient) Dump Uses

func (amb *Ambient) Dump(out io.Writer, indent int)

Dump prints out information about the Ambient

type Animation Uses

type Animation struct {
    Id        string
    Name      string
    Animation []*Animation
    Source    []*Source
    Sampler   []*Sampler
    Channel   []*Channel
}

Animation

func (*Animation) Dump Uses

func (an *Animation) Dump(out io.Writer, indent int)

Dump prints out information about the Animation

type AnimationTarget Uses

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

AnimationTarget contains all animation channels for an specific target node

func (*AnimationTarget) Reset Uses

func (at *AnimationTarget) Reset()

Reset resets the animation from the beginning

func (*AnimationTarget) SetLoop Uses

func (at *AnimationTarget) SetLoop(loop bool)

SetLoop sets the state of the animation loop flag

func (*AnimationTarget) SetStart Uses

func (at *AnimationTarget) SetStart(v float32)

SetStart sets the initial offset value

func (*AnimationTarget) Update Uses

func (at *AnimationTarget) Update(delta float32) bool

Update interpolates the specified input value for each animation target channel and executes its corresponding action function. Returns true if the input value is inside the key frames ranges or false otherwise.

type Asset Uses

type Asset struct {
    Contributor Contributor
    Created     string
    Modified    string
    UpAxis      string
}

Asset

func (*Asset) Dump Uses

func (a *Asset) Dump(out io.Writer, indent int)

Dump prints out information about the Asset

type Bind Uses

type Bind struct {
    Semantic string
    Target   string
}

Bind

type BindMaterial Uses

type BindMaterial struct {
    Params          []Param
    TechniqueCommon struct {
        InstanceMaterial []*InstanceMaterial
    }
}

BindMaterial

func (*BindMaterial) Dump Uses

func (bm *BindMaterial) Dump(out io.Writer, indent int)

Dump prints out information about the BindMaterial

type BindVertexInput Uses

type BindVertexInput struct {
    Semantic      string
    InputSemantic string
    InputSet      uint
}

BindVertexInput

func (*BindVertexInput) Dump Uses

func (bvi *BindVertexInput) Dump(out io.Writer, indent int)

Dump prints out information about the BindVertexInput

type Blinn Uses

type Blinn struct {
    Emission          interface{}
    Ambient           interface{}
    Diffuse           interface{}
    Specular          interface{}
    Shininess         interface{}
    Reflective        interface{}
    Reflectivity      interface{}
    Transparent       interface{}
    Transparency      interface{}
    IndexOfRefraction interface{}
}

Blinn

func (*Blinn) Dump Uses

func (bl *Blinn) Dump(out io.Writer, indent int)

Dump prints out information about the Blinn

type Channel Uses

type Channel struct {
    Source string
    Target string
}

Channel

func (*Channel) Dump Uses

func (ch *Channel) Dump(out io.Writer, indent int)

Dump prints out information about the Channel

type ChannelInstance Uses

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

A ChannelInstance associates an animation parameter channel to an interpolation sampler

type Collada Uses

type Collada struct {
    Version             string
    Asset               Asset
    LibraryAnimations   *LibraryAnimations
    LibraryImages       *LibraryImages
    LibraryLights       *LibraryLights
    LibraryEffects      *LibraryEffects
    LibraryMaterials    *LibraryMaterials
    LibraryGeometries   *LibraryGeometries
    LibraryVisualScenes *LibraryVisualScenes
    Scene               *Scene
}

Collada DOM root

type Color Uses

type Color struct {
    Sid  string
    Data [4]float32
}

Color

func (*Color) Dump Uses

func (c *Color) Dump(out io.Writer, indent int)

Dump prints out information about the Color

type Constant Uses

type Constant struct {
    Emission          interface{}
    Reflective        interface{}
    Reflectivity      interface{}
    Transparent       interface{}
    Transparency      interface{}
    IndexOfRefraction interface{}
}

Constant

type Contributor Uses

type Contributor struct {
    Author        string
    AuthorEmail   string
    AuthorWebsite string
    AuthoringTool string
    Comments      string
    Copyright     string
    SourceData    string
}

Contributor

func (*Contributor) Dump Uses

func (c *Contributor) Dump(out io.Writer, indent int)

Dump prints out information about the Contributor

type Decoder Uses

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

Decoder contains all decoded data from collada file

func Decode Uses

func Decode(filepath string) (*Decoder, error)

Decode decodes the specified collada file returning a decoder object and an error.

func DecodeReader Uses

func DecodeReader(f io.Reader) (*Decoder, error)

DecodeReader decodes the specified collada reader returning a decoder object and an error.

func (*Decoder) Dump Uses

func (d *Decoder) Dump(out io.Writer, indent int)

Dump writes to the specified writer a text dump of the decoded Collada DOM to aid debugging.

func (*Decoder) GetGeometry Uses

func (d *Decoder) GetGeometry(id string) (geometry.IGeometry, uint32, error)

GetGeometry returns a pointer to an instance of the geometry with the specified id in the Collada document, its primitive type and an error. If no previous instance of the geometry was found the geometry is created

func (*Decoder) GetMaterial Uses

func (d *Decoder) GetMaterial(id string) (material.IMaterial, error)

GetMaterial returns a pointer to an instance of the material with the specified id in the Collada document and an error. If no previous instance of the material was found it is created.

func (*Decoder) GetTexture2D Uses

func (d *Decoder) GetTexture2D(id string) (*texture.Texture2D, error)

GetTexture2D returns a pointer to an instance of the Texture2D with the specified id in the Collada document and an error. If no previous instance of the texture was found it is created.

func (*Decoder) NewAnimationTargets Uses

func (d *Decoder) NewAnimationTargets(scene core.INode) (map[string]*AnimationTarget, error)

NewAnimationTargets creates and returns a map of all animation targets contained in the decoded Collada document and for the previously decoded scene. The map is indexed by the node loaderID.

func (*Decoder) NewGeometry Uses

func (d *Decoder) NewGeometry(id string) (geometry.IGeometry, uint32, error)

NewGeometry creates and returns a pointer to a new instance of the geometry with the specified id in the Collada document, its primitive type and and error.

func (*Decoder) NewMaterial Uses

func (d *Decoder) NewMaterial(id string) (material.IMaterial, error)

NewMaterial creates and returns a pointer to a new material from the specified material id/url in the dom

func (*Decoder) NewScene Uses

func (d *Decoder) NewScene() (core.INode, error)

NewScene returns a new collada empty scene

func (*Decoder) NewTexture2D Uses

func (d *Decoder) NewTexture2D(id string) (*texture.Texture2D, error)

NewTexture2D creates and returns a pointer to a new Texture2D from the specified sampler2D id/url in the dom

func (*Decoder) SetDirImages Uses

func (d *Decoder) SetDirImages(path string)

type Directional Uses

type Directional struct {
    Color LightColor
}

Directional

func (*Directional) Dump Uses

func (dir *Directional) Dump(out io.Writer, indent int)

Dump prints out information about the Directional

type Effect Uses

type Effect struct {
    Id      string
    Name    string
    Asset   *Asset
    Profile []interface{}
}

Effect

func (*Effect) Dump Uses

func (ef *Effect) Dump(out io.Writer, indent int)

Dump prints out information about the Effect

type Float Uses

type Float struct {
    Sid  string
    Data float32
}

Float

func (*Float) Dump Uses

func (f *Float) Dump(out io.Writer, indent int)

Dump prints out information about the Float

type FloatArray Uses

type FloatArray struct {
    Id    string
    Count int
    Data  []float32
}

FloatArray

func (*FloatArray) Dump Uses

func (fa *FloatArray) Dump(out io.Writer, indent int)

Dump prints out information about the FloatArray

type FloatValue Uses

type FloatValue struct {
    Sid   string
    Value float32
}

FloatValue

func (*FloatValue) Dump Uses

func (fv *FloatValue) Dump(name string, out io.Writer, indent int)

Dump prints out information about the FloatValue

type Geometry Uses

type Geometry struct {
    Id               string      // Geometry id (optional)
    Name             string      // Geometry name (optional)
    GeometricElement interface{} // Geometry type object (Mesh|others)
}

Geometry

func (*Geometry) Dump Uses

func (g *Geometry) Dump(out io.Writer, indent int)

Dump prints out information about the Geometry

type Image Uses

type Image struct {
    Id          string
    Name        string
    Format      string
    Height      uint
    Width       uint
    Depth       uint
    ImageSource interface{}
}

Image

func (*Image) Dump Uses

func (img *Image) Dump(out io.Writer, indent int)

Dump prints out information about the Image

type InitFrom Uses

type InitFrom struct {
    Uri string
}

InitFrom

func (*InitFrom) Dump Uses

func (initf *InitFrom) Dump(out io.Writer, indent int)

Dump prints out information about the InitFrom

type Input Uses

type Input struct {
    Semantic string
    Source   string // source URL
}

Input

func (*Input) Dump Uses

func (i *Input) Dump(out io.Writer, indent int)

Dump prints out information about the Input

type InputShared Uses

type InputShared struct {
    Offset   int
    Semantic string
    Source   string // source URL
    Set      int
}

InputShared

func (*InputShared) Dump Uses

func (is *InputShared) Dump(out io.Writer, indent int)

Dump prints out information about the Tristrips

type InstanceEffect Uses

type InstanceEffect struct {
    Sid  string
    Name string
    Url  string
}

InstanceEffect

func (*InstanceEffect) Dump Uses

func (ie *InstanceEffect) Dump(out io.Writer, indent int)

Dump prints out information about the InstanceEffect

type InstanceGeometry Uses

type InstanceGeometry struct {
    Url          string // Geometry URL (required) references the ID of a Geometry
    Name         string // name of this element (optional)
    BindMaterial *BindMaterial
}

InstanceGeometry

func (*InstanceGeometry) Dump Uses

func (ig *InstanceGeometry) Dump(out io.Writer, indent int)

Dump prints out information about the InstanceGeometry

type InstanceMaterial Uses

type InstanceMaterial struct {
    Sid             string
    Name            string
    Target          string
    Symbol          string
    Bind            []Bind
    BindVertexInput []BindVertexInput
}

InstanceMaterial

func (*InstanceMaterial) Dump Uses

func (im *InstanceMaterial) Dump(out io.Writer, indent int)

Dump prints out information about the InstanceMaterial

type InstanceVisualScene Uses

type InstanceVisualScene struct {
    Sid  string
    Name string
    Url  string
}

InstanceVisualScene

func (*InstanceVisualScene) Dump Uses

func (ivs *InstanceVisualScene) Dump(out io.Writer, indent int)

Dump prints out information about the InstanceVisualScene

type Lambert Uses

type Lambert struct {
    Emission          interface{}
    Ambient           interface{}
    Diffuse           interface{}
    Reflective        interface{}
    Reflectivity      interface{}
    Transparent       interface{}
    Transparency      interface{}
    IndexOfRefraction interface{}
}

Lambert

type LibraryAnimations Uses

type LibraryAnimations struct {
    Id        string
    Name      string
    Asset     *Asset
    Animation []*Animation
}

Library Animations

func (*LibraryAnimations) Dump Uses

func (la *LibraryAnimations) Dump(out io.Writer, indent int)

Dump prints out information about the LibraryAnimations

type LibraryEffects Uses

type LibraryEffects struct {
    Id     string
    Name   string
    Asset  *Asset
    Effect []*Effect
}

LibraryEffects

func (*LibraryEffects) Dump Uses

func (le *LibraryEffects) Dump(out io.Writer, indent int)

Dump prints out information about the LibraryEffects

type LibraryGeometries Uses

type LibraryGeometries struct {
    Asset    *Asset
    Geometry []*Geometry
}

LibraryGeometries

func (*LibraryGeometries) Dump Uses

func (lg *LibraryGeometries) Dump(out io.Writer, indent int)

Dump prints out information about the LibraryGeometries

type LibraryImages Uses

type LibraryImages struct {
    Id    string
    Name  string
    Asset *Asset
    Image []*Image
}

LibraryImages

func (*LibraryImages) Dump Uses

func (li *LibraryImages) Dump(out io.Writer, indent int)

Dump prints out information about the LibraryImages

type LibraryLights Uses

type LibraryLights struct {
    Id    string
    Name  string
    Asset *Asset
    Light []*Light
}

LibraryLights

func (*LibraryLights) Dump Uses

func (ll *LibraryLights) Dump(out io.Writer, indent int)

Dump prints out information about the LibraryLights

type LibraryMaterials Uses

type LibraryMaterials struct {
    Id       string
    Name     string
    Asset    *Asset
    Material []*Material
}

LibraryMaterials

func (*LibraryMaterials) Dump Uses

func (lm *LibraryMaterials) Dump(out io.Writer, indent int)

Dump prints out information about the LibraryMaterials

type LibraryVisualScenes Uses

type LibraryVisualScenes struct {
    Asset       *Asset
    VisualScene []*VisualScene
}

LibraryVisualScenes

func (*LibraryVisualScenes) Dump Uses

func (lv *LibraryVisualScenes) Dump(out io.Writer, indent int)

Dump prints out information about the LibraryVisualScenes

type Light Uses

type Light struct {
    Id              string
    Name            string
    TechniqueCommon struct {
        Type interface{}
    }
}

Light

func (*Light) Dump Uses

func (li *Light) Dump(out io.Writer, indent int)

Dump prints out information about the Light

type LightColor Uses

type LightColor struct {
    Sid  string
    Data [3]float32
}

LightColor

func (*LightColor) Dump Uses

func (lc *LightColor) Dump(out io.Writer, indent int)

Dump prints out information about the LightColor

type LineStrips Uses

type LineStrips struct {
    Name     string
    Count    int
    Material string
    Input    []InputShared
    P        []int
}

LineStrips

type Lines Uses

type Lines struct {
    Name     string
    Count    int
    Material string
    Input    []InputShared
    P        []int
}

Lines

func (*Lines) Dump Uses

func (ln *Lines) Dump(out io.Writer, indent int)

Dump prints out information about the Lines

type Material Uses

type Material struct {
    Id             string
    Name           string
    Asset          *Asset
    InstanceEffect InstanceEffect
}

Material

func (*Material) Dump Uses

func (mat *Material) Dump(out io.Writer, indent int)

Dump prints out information about the Material

type Matrix Uses

type Matrix struct {
    Sid  string
    Data [16]float32
}

Matrix

func (*Matrix) Dump Uses

func (m *Matrix) Dump(out io.Writer, indent int)

Dump prints out information about the Matrix

type Mesh Uses

type Mesh struct {
    Source            []*Source     // One or more sources Sources
    Vertices          Vertices      // Vertices positions
    PrimitiveElements []interface{} // Geometry primitives (polylist|others)
}

Mesh

func (*Mesh) Dump Uses

func (m *Mesh) Dump(out io.Writer, indent int)

Dump prints out information about the Mesh

type NameArray Uses

type NameArray struct {
    Id    string
    Name  string
    Count int
    Data  []string
}

NameArray

func (*NameArray) Dump Uses

func (na *NameArray) Dump(out io.Writer, indent int)

Dump prints out information about the NameArray

type Newparam Uses

type Newparam struct {
    Sid           string
    Semantic      string
    ParameterType interface{}
}

Newparam

func (*Newparam) Dump Uses

func (np *Newparam) Dump(out io.Writer, indent int)

Dump prints out information about the Newparam

type Node Uses

type Node struct {
    Id                     string
    Name                   string
    Sid                    string
    Type                   string
    Layer                  []string
    TransformationElements []interface{} // Node instance type (may be nil)
    Instance               interface{}
    Node                   []*Node // Array of children nodes
}

Node is embedded in each node instance

func (*Node) Dump Uses

func (n *Node) Dump(out io.Writer, indent int)

Dump prints out information about the Node

type Param Uses

type Param struct {
    Name string
    Type string
}

Param for <bind_material> and <accessor>

func (*Param) Dump Uses

func (p *Param) Dump(out io.Writer, indent int)

Dump prints out information about the Param

type Phong Uses

type Phong struct {
    Emission          interface{}
    Ambient           interface{}
    Diffuse           interface{}
    Specular          interface{}
    Shininess         interface{}
    Reflective        interface{}
    Reflectivity      interface{}
    Transparent       interface{}
    Transparency      interface{}
    IndexOfRefraction interface{}
}

Phong

func (*Phong) Dump Uses

func (ph *Phong) Dump(out io.Writer, indent int)

Dump prints out information about the Phong

type Point Uses

type Point struct {
    Color                LightColor
    ConstantAttenuation  *FloatValue
    LinearAttenuation    *FloatValue
    QuadraticAttenuation *FloatValue
}

Point

func (*Point) Dump Uses

func (pl *Point) Dump(out io.Writer, indent int)

Dump prints out information about the Point

type Polylist Uses

type Polylist struct {
    Name     string
    Count    int
    Material string
    Input    []InputShared
    Vcount   []int
    P        []int
}

Polylist

func (*Polylist) Dump Uses

func (pl *Polylist) Dump(out io.Writer, indent int)

Dump prints out information about the Polylist

type ProfileCOMMON Uses

type ProfileCOMMON struct {
    Id        string
    Asset     *Asset
    Newparam  []*Newparam
    Technique struct {
        Id            string
        Sid           string
        Asset         *Asset
        ShaderElement interface{} // Blinn|Constant|Lambert|Phong
    }
}

ProfileCOMMON

func (*ProfileCOMMON) Dump Uses

func (pc *ProfileCOMMON) Dump(out io.Writer, indent int)

Dump prints out information about the ProfileCOMMON

type Rotate Uses

type Rotate struct {
    Sid  string
    Data [4]float32
}

Rotate

func (*Rotate) Dump Uses

func (r *Rotate) Dump(out io.Writer, indent int)

Dump prints out information about the Rotate

type Sampler Uses

type Sampler struct {
    Id    string
    Input []Input // One or more

}

Sampler

func (*Sampler) Dump Uses

func (sp *Sampler) Dump(out io.Writer, indent int)

Dump prints out information about the Sampler

type Sampler2D Uses

type Sampler2D struct {
    Source string
}

Sampler2D

func (*Sampler2D) Dump Uses

func (sp *Sampler2D) Dump(out io.Writer, indent int)

Dump prints out information about the Sampler2D

type SamplerInstance Uses

type SamplerInstance struct {
    Input      []float32 // Input keys (usually time)
    Output     []float32 // Outputs values for the keys
    Interp     []string  // Names of interpolation functions for each key frame
    InTangent  []float32 // Origin tangents for Bezier interpolation
    OutTangent []float32 // End tangents for Bezier interpolation
}

SamplerInstance specifies the input key frames, output values for these key frames and interpolation information. It can be shared by more than one animation

func NewSamplerInstance Uses

func NewSamplerInstance(ca *Animation, uri string) (*SamplerInstance, error)

NewSamplerInstance creates and returns a pointer to a new SamplerInstance built with data from the specified Collada animation and URI

func (*SamplerInstance) Interpolate Uses

func (si *SamplerInstance) Interpolate(inp float32) (float32, bool)

Interpolate returns the interpolated output and its validity for this sampler for the specified input.

type Scale Uses

type Scale struct {
    Sid  string
    Data [3]float32
}

Scale

func (*Scale) Dump Uses

func (s *Scale) Dump(out io.Writer, indent int)

Dump prints out information about the Scale

type Scene Uses

type Scene struct {
    InstanceVisualScene *InstanceVisualScene
}

Scene

func (*Scene) Dump Uses

func (s *Scene) Dump(out io.Writer, indent int)

Dump prints out information about the Scene

type Source Uses

type Source struct {
    Id              string      // Source id
    Name            string      // Source name
    ArrayElement    interface{} // Array element (FloatArray|others)
    TechniqueCommon struct {
        Accessor Accessor
    }
}

Source

func (*Source) Dump Uses

func (s *Source) Dump(out io.Writer, indent int)

Dump prints out information about the Source

type Spot Uses

type Spot struct {
    Color                LightColor
    ConstantAttenuation  *FloatValue
    LinearAttenuation    *FloatValue
    QuadraticAttenuation *FloatValue
    FalloffAngle         *FloatValue
    FalloffExponent      *FloatValue
}

Spot

func (*Spot) Dump Uses

func (sl *Spot) Dump(out io.Writer, indent int)

Dump prints out information about the Spot

type Surface Uses

type Surface struct {
    Type string
    Init interface{}
}

Surface

func (*Surface) Dump Uses

func (sf *Surface) Dump(out io.Writer, indent int)

Dump prints out information about the Surface

type Texture Uses

type Texture struct {
    Texture  string
    Texcoord string
}

Texture

func (*Texture) Dump Uses

func (t *Texture) Dump(out io.Writer, indent int)

Dump prints out information about the Texture

type Translate Uses

type Translate struct {
    Sid  string
    Data [3]float32
}

Translate

func (*Translate) Dump Uses

func (t *Translate) Dump(out io.Writer, indent int)

Dump prints out information about the Translate

type Triangles Uses

type Triangles struct {
    Name     string
    Count    int
    Material string
    Input    []InputShared
    P        []int
}

Triangles

type Trifans Uses

type Trifans struct {
    Name     string
    Count    int
    Material string
    Input    []InputShared
    P        []int
}

Trifans

type Tristrips Uses

type Tristrips struct {
    Name     string
    Count    int
    Material string
    Input    []InputShared
    P        []int
}

Tristrips

type Vertices Uses

type Vertices struct {
    Id    string
    Name  string
    Input []Input
}

Vertices

func (*Vertices) Dump Uses

func (v *Vertices) Dump(out io.Writer, indent int)

Dump prints out information about the Vertices

type VisualScene Uses

type VisualScene struct {
    Id   string
    Name string
    Node []*Node // Array of nodes
}

VisualScene contains all the nodes of a visual scene

func (*VisualScene) Dump Uses

func (vs *VisualScene) Dump(out io.Writer, indent int)

Dump prints out information about the VisualScene

Package collada imports 17 packages (graph) and is imported by 3 packages. Updated 2018-07-22. Refresh now. Tools for package owners.