Parses new material definition newmtl
(fields []string)
| 758 | // Parses new material definition |
| 759 | // newmtl <mat_name> |
| 760 | func (dec *Decoder) parseNewmtl(fields []string) error { |
| 761 | |
| 762 | if len(fields) < 1 { |
| 763 | return dec.formatError("newmtl with no fields") |
| 764 | } |
| 765 | // Checks if material has already been seen |
| 766 | name := fields[0] |
| 767 | mat := dec.Materials[name] |
| 768 | // Creates material descriptor |
| 769 | if mat == nil { |
| 770 | mat = new(Material) |
| 771 | mat.Name = name |
| 772 | dec.Materials[name] = mat |
| 773 | } |
| 774 | dec.matCurrent = mat |
| 775 | return nil |
| 776 | } |
| 777 | |
| 778 | // Parses the dissolve factor (opacity) |
| 779 | // d <factor> |
no test coverage detected