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

Method parseKs

loader/obj/obj.go:852–867  ·  view source on GitHub ↗

Parses specular reflectivity: Ks r g b

(fields []string)

Source from the content-addressed store, hash-verified

850// Parses specular reflectivity:
851// Ks r g b
852func (dec *Decoder) parseKs(fields []string) error {
853
854 if len(fields) < 3 {
855 return dec.formatError("'Ks' with less than 3 fields")
856 }
857 var colors [3]float32
858 for pos, f := range fields[:3] {
859 val, err := strconv.ParseFloat(f, 32)
860 if err != nil {
861 return err
862 }
863 colors[pos] = float32(val)
864 }
865 dec.matCurrent.Specular.Set(colors[0], colors[1], colors[2])
866 return nil
867}
868
869// Parses optical density, also known as index of refraction
870// Ni <optical_density>

Callers 1

parseMtlLineMethod · 0.95

Calls 2

formatErrorMethod · 0.95
SetMethod · 0.45

Tested by

no test coverage detected