decSource decodes the source from the specified mesh
(start xml.StartElement)
| 112 | |
| 113 | // decSource decodes the source from the specified mesh |
| 114 | func (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 |
| 154 | func (d *Decoder) decFloatArray(start xml.StartElement, data []byte, source *Source) error { |
no test coverage detected