public ColorF(ColorRgbF rgb, float a) { A = a; R = rgb.R; G = rgb.G; B = rgb.B; }
public Material() { AmbientColor = new ColorRgbF(0.1f, 0.1f, 0.1f); DiffuseColor = ColorsRgbF.White; SpecularColor = ColorsRgbF.White; Shininess = 16; Transparency = 1; }
public override void Parse(ParserContext context, Scene scene, string[] words) { // "f" red green blue Kd Ks Shine T index_of_refraction float r = float.Parse(words[1]); float g = float.Parse(words[2]); float b = float.Parse(words[3]); float kd = float.Parse(words[4]); float ks = float.Parse(words[5]); float shine = float.Parse(words[6]); ColorRgbF color = new ColorRgbF(r, g, b); Material material = new Material { DiffuseColor = color * kd, SpecularColor = color * ks, Shininess = (int)shine }; scene.Materials.Add(material); context.CurrentMaterial = material; }