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

Method parseKa

loader/obj/obj.go:795–810  ·  view source on GitHub ↗

Parses ambient reflectivity: Ka r g b

(fields []string)

Source from the content-addressed store, hash-verified

793// Parses ambient reflectivity:
794// Ka r g b
795func (dec *Decoder) parseKa(fields []string) error {
796
797 if len(fields) < 3 {
798 return dec.formatError("'Ka' with less than 3 fields")
799 }
800 var colors [3]float32
801 for pos, f := range fields[:3] {
802 val, err := strconv.ParseFloat(f, 32)
803 if err != nil {
804 return err
805 }
806 colors[pos] = float32(val)
807 }
808 dec.matCurrent.Ambient.Set(colors[0], colors[1], colors[2])
809 return nil
810}
811
812// Parses diffuse reflectivity:
813// Kd r g b

Callers 1

parseMtlLineMethod · 0.95

Calls 2

formatErrorMethod · 0.95
SetMethod · 0.45

Tested by

no test coverage detected