Exemplo n.º 1
0
        /*
        public override Vect3D getDirection(ShadeRec sr)
        {
            //Ambient light has no direction
            return new Vect3D(0, 0, 0);
        }
        */
        public static AmbientLight LoadAmbient(XmlElement lightRoot)
        {
            AmbientLight toReturn = new AmbientLight();

            XmlNode node_intensity = lightRoot.SelectSingleNode("intensity");
            if (node_intensity != null)
            {
                string str_intensity = ((XmlText)node_intensity.FirstChild).Data;
                float intensity = Convert.ToSingle(str_intensity);
                toReturn.setIntensity(intensity);
            }

            XmlNode node_color = lightRoot.SelectSingleNode("color");
            if (node_color != null)
            {
                string str_color = ((XmlText)node_color.FirstChild).Data;
                RGBColor color = new RGBColor(System.Drawing.ColorTranslator.FromHtml(str_color));
                toReturn.Color = color;
            }
            return toReturn;
        }