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

Method decGeometry

loader/collada/library_geometries.go:263–287  ·  view source on GitHub ↗

decGeometry receives the start element of a geometry and decodes all its children and appends the decoded geometry to the specified slice.

(start xml.StartElement, lg *LibraryGeometries)

Source from the content-addressed store, hash-verified

261// decodes all its children and appends the decoded geometry
262// to the specified slice.
263func (d *Decoder) decGeometry(start xml.StartElement, lg *LibraryGeometries) error {
264
265 // Get geometry id and name attributes
266 geom := &Geometry{}
267 geom.Id = findAttrib(start, "id").Value
268 geom.Name = findAttrib(start, "name").Value
269 lg.Geometry = append(lg.Geometry, geom)
270
271 // Decodes geometry children
272 for {
273 // Get next child
274 child, _, err := d.decNextChild(start)
275 if err != nil || child.Name.Local == "" {
276 return err
277 }
278 // Decode mesh
279 if child.Name.Local == "mesh" {
280 err = d.decMesh(child, geom)
281 if err != nil {
282 return err
283 }
284 continue
285 }
286 }
287}
288
289// decMesh decodes the mesh from the specified geometry
290func (d *Decoder) decMesh(start xml.StartElement, geom *Geometry) error {

Callers 1

decLibraryGeometriesMethod · 0.95

Calls 3

decNextChildMethod · 0.95
decMeshMethod · 0.95
findAttribFunction · 0.85

Tested by

no test coverage detected