collada

package
v0.0.0-...-47917a8 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2019 License: BSD-2-Clause Imports: 17 Imported by: 0

Documentation

Overview

Package collada

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpColorOrTexture

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

DumpColorOrTexture prints out information about the Color or Texture

func DumpFloatOrParam

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

DumpFloatOrParam prints out information about the Float or Param

Types

type Accessor

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

Accessor

func (*Accessor) Dump

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

Dump prints out information about the Accessor

type ActionFunc

type ActionFunc func(at *AnimationTarget, v float32)

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

type Ambient

type Ambient struct {
	Color LightColor
}

Ambient

func (*Ambient) Dump

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

Dump prints out information about the Ambient

type Animation

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

Animation

func (*Animation) Dump

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

Dump prints out information about the Animation

type AnimationTarget

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

AnimationTarget contains all animation channels for an specific target node

func (*AnimationTarget) Reset

func (at *AnimationTarget) Reset()

Reset resets the animation from the beginning

func (*AnimationTarget) SetLoop

func (at *AnimationTarget) SetLoop(loop bool)

SetLoop sets the state of the animation loop flag

func (*AnimationTarget) SetStart

func (at *AnimationTarget) SetStart(v float32)

SetStart sets the initial offset value

func (*AnimationTarget) Update

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

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

Asset

func (*Asset) Dump

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

Dump prints out information about the Asset

type Bind

type Bind struct {
	Semantic string
	Target   string
}

Bind

type BindMaterial

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

BindMaterial

func (*BindMaterial) Dump

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

Dump prints out information about the BindMaterial

type BindVertexInput

type BindVertexInput struct {
	Semantic      string
	InputSemantic string
	InputSet      uint
}

BindVertexInput

func (*BindVertexInput) Dump

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

Dump prints out information about the BindVertexInput

type Blinn

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

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

Dump prints out information about the Blinn

type Channel

type Channel struct {
	Source string
	Target string
}

Channel

func (*Channel) Dump

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

Dump prints out information about the Channel

type ChannelInstance

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

A ChannelInstance associates an animation parameter channel to an interpolation sampler

type Collada

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

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

Color

func (*Color) Dump

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

Dump prints out information about the Color

type Constant

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

Constant

type Contributor

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

Contributor

func (*Contributor) Dump

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

Dump prints out information about the Contributor

type Decoder

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

Decoder contains all decoded data from collada file

func Decode

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

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

func DecodeReader

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

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

func (*Decoder) Dump

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

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

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

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

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

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

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

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

NewScene returns a new collada empty scene

func (*Decoder) NewTexture2D

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

func (d *Decoder) SetDirImages(path string)

type Directional

type Directional struct {
	Color LightColor
}

Directional

func (*Directional) Dump

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

Dump prints out information about the Directional

type Effect

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

Effect

func (*Effect) Dump

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

Dump prints out information about the Effect

type Float

type Float struct {
	Sid  string
	Data float32
}

Float

func (*Float) Dump

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

Dump prints out information about the Float

type FloatArray

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

FloatArray

func (*FloatArray) Dump

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

Dump prints out information about the FloatArray

type FloatValue

type FloatValue struct {
	Sid   string
	Value float32
}

FloatValue

func (*FloatValue) Dump

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

Dump prints out information about the FloatValue

type Geometry

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

Geometry

func (*Geometry) Dump

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

Dump prints out information about the Geometry

type Image

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

Image

func (*Image) Dump

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

Dump prints out information about the Image

type InitFrom

type InitFrom struct {
	Uri string
}

InitFrom

func (*InitFrom) Dump

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

Dump prints out information about the InitFrom

type Input

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

Input

func (*Input) Dump

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

Dump prints out information about the Input

type InputShared

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

InputShared

func (*InputShared) Dump

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

Dump prints out information about the Tristrips

type InstanceEffect

type InstanceEffect struct {
	Sid  string
	Name string
	Url  string
}

InstanceEffect

func (*InstanceEffect) Dump

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

Dump prints out information about the InstanceEffect

type InstanceGeometry

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

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

Dump prints out information about the InstanceGeometry

type InstanceMaterial

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

InstanceMaterial

func (*InstanceMaterial) Dump

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

Dump prints out information about the InstanceMaterial

type InstanceVisualScene

type InstanceVisualScene struct {
	Sid  string
	Name string
	Url  string
}

InstanceVisualScene

func (*InstanceVisualScene) Dump

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

Dump prints out information about the InstanceVisualScene

type Lambert

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

Lambert

type LibraryAnimations

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

Library Animations

func (*LibraryAnimations) Dump

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

Dump prints out information about the LibraryAnimations

type LibraryEffects

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

LibraryEffects

func (*LibraryEffects) Dump

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

Dump prints out information about the LibraryEffects

type LibraryGeometries

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

LibraryGeometries

func (*LibraryGeometries) Dump

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

Dump prints out information about the LibraryGeometries

type LibraryImages

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

LibraryImages

func (*LibraryImages) Dump

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

Dump prints out information about the LibraryImages

type LibraryLights

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

LibraryLights

func (*LibraryLights) Dump

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

Dump prints out information about the LibraryLights

type LibraryMaterials

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

LibraryMaterials

func (*LibraryMaterials) Dump

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

Dump prints out information about the LibraryMaterials

type LibraryVisualScenes

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

LibraryVisualScenes

func (*LibraryVisualScenes) Dump

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

Dump prints out information about the LibraryVisualScenes

type Light

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

Light

func (*Light) Dump

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

Dump prints out information about the Light

type LightColor

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

LightColor

func (*LightColor) Dump

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

Dump prints out information about the LightColor

type LineStrips

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

LineStrips

type Lines

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

Lines

func (*Lines) Dump

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

Dump prints out information about the Lines

type Material

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

Material

func (*Material) Dump

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

Dump prints out information about the Material

type Matrix

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

Matrix

func (*Matrix) Dump

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

Dump prints out information about the Matrix

type Mesh

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

Mesh

func (*Mesh) Dump

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

Dump prints out information about the Mesh

type NameArray

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

NameArray

func (*NameArray) Dump

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

Dump prints out information about the NameArray

type Newparam

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

Newparam

func (*Newparam) Dump

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

Dump prints out information about the Newparam

type Node

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

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

Dump prints out information about the Node

type Param

type Param struct {
	Name string
	Type string
}

Param for <bind_material> and <accessor>

func (*Param) Dump

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

Dump prints out information about the Param

type Phong

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

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

Dump prints out information about the Phong

type Point

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

Point

func (*Point) Dump

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

Dump prints out information about the Point

type Polylist

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

Polylist

func (*Polylist) Dump

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

Dump prints out information about the Polylist

type ProfileCOMMON

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

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

Dump prints out information about the ProfileCOMMON

type Rotate

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

Rotate

func (*Rotate) Dump

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

Dump prints out information about the Rotate

type Sampler

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

}

Sampler

func (*Sampler) Dump

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

Dump prints out information about the Sampler

type Sampler2D

type Sampler2D struct {
	Source string
}

Sampler2D

func (*Sampler2D) Dump

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

Dump prints out information about the Sampler2D

type SamplerInstance

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

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

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

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

Scale

func (*Scale) Dump

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

Dump prints out information about the Scale

type Scene

type Scene struct {
	InstanceVisualScene *InstanceVisualScene
}

Scene

func (*Scene) Dump

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

Dump prints out information about the Scene

type Source

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

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

Dump prints out information about the Source

type Spot

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

Spot

func (*Spot) Dump

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

Dump prints out information about the Spot

type Surface

type Surface struct {
	Type string
	Init interface{}
}

Surface

func (*Surface) Dump

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

Dump prints out information about the Surface

type Texture

type Texture struct {
	Texture  string
	Texcoord string
}

Texture

func (*Texture) Dump

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

Dump prints out information about the Texture

type Translate

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

Translate

func (*Translate) Dump

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

Dump prints out information about the Translate

type Triangles

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

Triangles

type Trifans

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

Trifans

type Tristrips

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

Tristrips

type Vertices

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

Vertices

func (*Vertices) Dump

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

Dump prints out information about the Vertices

type VisualScene

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

VisualScene contains all the nodes of a visual scene

func (*VisualScene) Dump

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

Dump prints out information about the VisualScene

Jump to

Keyboard shortcuts

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