/// <summary>
        /// Método que maneja la lógica de crear nuevos objetos
        /// </summary>
        /// <param name="scene"></param>
        /// <param name="key"></param>
        protected static void CreateInput(Scene.Scene scene, byte key)
        {
            if (key == 't')
                scene.FigureToCreate = FigureEnum.Triangle;
            else if (key == 's')
                scene.FigureToCreate = FigureEnum.Sphere;
            else if (key == ENTER)
            {
                if (scene.FigureToCreate == FigureEnum.Triangle)
                {
                    Triangle triangle = new Triangle();
                    scene.AddFigure(triangle);
                    scene.SelectFigure(triangle);
                    scene.sceneState = SceneState.Free;
                    scene.FigureToCreate = FigureEnum.None;

                }
                else if (scene.FigureToCreate == FigureEnum.Sphere)
                {
                    Sphere sphere = new Sphere();
                    scene.AddFigure(sphere);
                    scene.SelectFigure(sphere);
                    scene.sceneState = SceneState.Free;
                    scene.FigureToCreate = FigureEnum.None;
                }

            }
            if (key == ESCAPE)
            {
                scene.FigureToCreate = FigureEnum.None;
                scene.sceneState = SceneState.Free;
            }
        }
Beispiel #2
0
        protected void LoadSphere(XElement xmlSphere)
        {
            float radius = LoadFloat(xmlSphere, "radius");
            // TODO: Material
            Vector position = LoadXYZDouble(xmlSphere.Elements("position").First());
            Vector rotation = LoadXYZDouble(xmlSphere.Elements("rotation").First());
            Vector scale = LoadXYZDouble(xmlSphere.Elements("scale").First());
            Vector center = LoadXYZDouble(xmlSphere.Elements("center").First());

            Sphere sphere = new Sphere(center: center, Radius: radius);
            sphere.Traslation = position;
            sphere.Rotation = rotation;
            sphere.Scaling = scale;

            // Cargamos la esfera a la escena
            //SceneFigures.Add(sphere);
            AddFigure(sphere);
        }