MCPcopy Index your code
hub / github.com/g3n/engine / parseNewmtl

Method parseNewmtl

loader/obj/obj.go:760–776  ·  view source on GitHub ↗

Parses new material definition newmtl

(fields []string)

Source from the content-addressed store, hash-verified

758// Parses new material definition
759// newmtl <mat_name>
760func (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>

Callers 1

parseMtlLineMethod · 0.95

Calls 1

formatErrorMethod · 0.95

Tested by

no test coverage detected