NewGroup creates and returns a group containing as children meshes with all the decoded objects. A group is returned even if there is only one object decoded.
()
| 218 | // with all the decoded objects. |
| 219 | // A group is returned even if there is only one object decoded. |
| 220 | func (dec *Decoder) NewGroup() (*core.Node, error) { |
| 221 | |
| 222 | group := core.NewNode() |
| 223 | for i := 0; i < len(dec.Objects); i++ { |
| 224 | mesh, err := dec.NewMesh(&dec.Objects[i]) |
| 225 | if err != nil { |
| 226 | return nil, err |
| 227 | } |
| 228 | group.Add(mesh) |
| 229 | } |
| 230 | return group, nil |
| 231 | } |
| 232 | |
| 233 | // NewMesh creates and returns a mesh from an specified decoded object. |
| 234 | func (dec *Decoder) NewMesh(obj *Object) (*graphic.Mesh, error) { |