public static Tuple4 GetShadedColor(Tuple4 objectPoint, IMaterial material, Tuple4 white, Tuple4 lightDirection, double intensity, Tuple4 eyeVector, Tuple4 pointOnSurface, Tuple4 surfaceNormal) { Tuple4 color = material.GetColor(objectPoint); Lighting lighting = GetIntensity(material, lightDirection, intensity, eyeVector, pointOnSurface, surfaceNormal); var shadedColor = Tuple4.Add( Tuple4.Scale(color, lighting.intensity * lighting.diffuse), Tuple4.Scale(white, lighting.specular) ); return(shadedColor); }
public void Replace_material_color(string id, double ambient) { var f = figure[id]; IMaterial m = f.Material; f.Material = new SolidColorMaterial( m.GetColor(Tuple4.ZeroPoint), ambient, m.Diffuse, m.Specular, m.Shininess, m.Reflective, m.RefractiveIndex, m.Transparency); }
public static Tuple4 GetAmbientColor(Tuple4 objectPoint, IMaterial material) { return(Tuple4.Scale(material.GetColor(objectPoint), material.Ambient)); }