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

Method decFloatArray

loader/collada/common.go:154–171  ·  view source on GitHub ↗

decSource decodes the float array from the specified source

(start xml.StartElement, data []byte, source *Source)

Source from the content-addressed store, hash-verified

152
153// decSource decodes the float array from the specified source
154func (d *Decoder) decFloatArray(start xml.StartElement, data []byte, source *Source) error {
155
156 // Create float array and associates it to the parent source
157 farray := &FloatArray{}
158 farray.Id = findAttrib(start, "id").Value
159 farray.Count, _ = strconv.Atoi(findAttrib(start, "count").Value)
160 source.ArrayElement = farray
161
162 // Allocates memory for array
163 farray.Data = make([]float32, farray.Count, farray.Count)
164
165 // Reads the numbers from the data
166 err := decFloat32Sequence(data, farray.Data)
167 if err != nil {
168 return err
169 }
170 return nil
171}
172
173func (d *Decoder) decNameArray(start xml.StartElement, data []byte, source *Source) error {
174

Callers 1

decSourceMethod · 0.95

Calls 2

findAttribFunction · 0.85
decFloat32SequenceFunction · 0.85

Tested by

no test coverage detected