MCPcopy
hub / github.com/g3n/engine / decSource

Method decSource

loader/collada/common.go:114–151  ·  view source on GitHub ↗

decSource decodes the source from the specified mesh

(start xml.StartElement)

Source from the content-addressed store, hash-verified

112
113// decSource decodes the source from the specified mesh
114func (d *Decoder) decSource(start xml.StartElement) (*Source, error) {
115
116 // Create source and adds it to the mesh
117 source := new(Source)
118 source.Id = findAttrib(start, "id").Value
119 source.Name = findAttrib(start, "name").Value
120
121 // Decodes source children
122 for {
123 // Get next child
124 child, data, err := d.decNextChild(start)
125 if err != nil || child.Name.Local == "" {
126 return source, err
127 }
128 if child.Name.Local == "float_array" {
129 err = d.decFloatArray(child, data, source)
130 if err != nil {
131 return nil, err
132 }
133 continue
134 }
135 if child.Name.Local == "Name_array" {
136 err = d.decNameArray(child, data, source)
137 if err != nil {
138 return nil, err
139 }
140 continue
141 }
142 // Decodes technique_common which should contain an Acessor
143 if child.Name.Local == "technique_common" {
144 err = d.decSourceTechniqueCommon(child, source)
145 if err != nil {
146 return nil, err
147 }
148 continue
149 }
150 }
151}
152
153// decSource decodes the float array from the specified source
154func (d *Decoder) decFloatArray(start xml.StartElement, data []byte, source *Source) error {

Callers 2

decMeshMethod · 0.95
decAnimationMethod · 0.95

Calls 5

decNextChildMethod · 0.95
decFloatArrayMethod · 0.95
decNameArrayMethod · 0.95
findAttribFunction · 0.85

Tested by

no test coverage detected