Ejemplo n.º 1
0
        private ViewPlane _viewPlane; // viewplane

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Constructor
        /// </summary>
        public World()
        {
            // give world a default viewplane and ambient light
            _viewPlane = new ViewPlane();
            _ambientLight = new AmbientLight();

            // set up scene lists
            _renderList = new List<RenderableObject>();
            _objectList = new List<RenderableObject>();
            _lightList = new List<Light>();
            _materialList = new List<Material>();
        }
Ejemplo n.º 2
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;
        }