예제 #1
0
        public void initializeEnviroment()
        {
            //Acceso a Device de DirectX.
            Microsoft.DirectX.Direct3D.Device d3dDevice = GuiController.Instance.D3dDevice;
            totalTime = 0;

            //OCEAN
            ocean = new TgcEditableLand();
            ocean.setTexture(TgcTexture.createTexture(GuiController.Instance.AlumnoEjemplosMediaDir + "Textures\\environment\\water_texture.jpg"));
            ocean.Position = oceanPosition;
            ocean.Scale    = new Vector3(20, 20, 20);


            //SUN
            sun        = new TgcSphere();
            sun.Radius = 20;
            sun.setColor(Color.Yellow);
            sun.setTexture(TgcTexture.createTexture(d3dDevice, GuiController.Instance.AlumnoEjemplosMediaDir + "Textures\\environment\\sun.jpg"));
            sun.Position      = new Vector3(0, 300, 0);
            sun.LevelOfDetail = 4;
            sun.updateValues();

            //SKY
            TgcTexture skyTexture = TgcTexture.createTexture(d3dDevice, GuiController.Instance.AlumnoEjemplosMediaDir + "Textures\\environment\\sky_patten.jpg");

            skyBox        = new TgcSphere();
            skyBox.Radius = (int)GuiController.Instance.Modifiers["skyRadius"];
            skyBox.setTexture(skyTexture);
            skyBox.Position      = (Vector3)GuiController.Instance.Modifiers["skyPosition"];
            skyBox.LevelOfDetail = 4;
            skyBox.updateValues();
        }
예제 #2
0
        /// <summary>
        /// Actualiza los parámetros de la caja en base a lo cargado por el usuario
        /// </summary>
        private void updateSphere()
        {
            Device d3dDevice = GuiController.Instance.D3dDevice;

            municion.RenderEdges = false;
            municion.Inflate     = true;
            municion.BasePoly    = TgcSphere.eBasePoly.ICOSAHEDRON;

            mass           = (float)GuiController.Instance.Modifiers.getValue("mass");
            municion.Scale = new Vector3(mass, mass, mass);
            //municion.Position = position;

            //Textura
            municion.setTexture(TgcTexture.createTexture(d3dDevice, GuiController.Instance.ExamplesDir + "Transformations\\SistemaSolar\\SunTexture.jpg"));

            //Radio, posición y color
            municion.Radius        = 2;
            municion.LevelOfDetail = 2;

            //Rotación, converitr a radianes
            Vector3 rotation = new Vector3(0, 0, 0);

            municion.Rotation = new Vector3(Geometry.DegreeToRadian(rotation.X), Geometry.DegreeToRadian(rotation.Y), Geometry.DegreeToRadian(rotation.Z));

            //Offset de textura
            municion.UVOffset = new Vector2(0, 0);

            //Tiling de textura
            municion.UVTiling = new Vector2(1, 1);

            //Actualizar valores en la caja.
            municion.updateValues();
        }
예제 #3
0
        public Pelota CrearPelota(string pathRecursos)
        {
            int radio = 10;

            //Crear esfera
            TgcSphere sphere = new TgcSphere();
            sphere.setTexture(TgcTexture.createTexture(pathRecursos + Settings.Default.textureBall));
            sphere.Radius = radio;
            sphere.Position = new Vector3(50, 25, 0);
            sphere.updateValues();

            return new Pelota(sphere);
        }
예제 #4
0
        public Pelota CrearPelota(string pathRecursos)
        {
            int radio = 10;

            //Crear esfera
            TgcSphere sphere = new TgcSphere();

            sphere.setTexture(TgcTexture.createTexture(pathRecursos + Settings.Default.textureBall));
            sphere.Radius   = radio;
            sphere.Position = new Vector3(50, 25, 0);
            sphere.updateValues();

            return(new Pelota(sphere));
        }
예제 #5
0
        /// <summary>
        /// Iniciar la creacion
        /// </summary>
        public override void initCreation(Vector3 gridPoint)
        {
            initSelectionPoint = gridPoint;

            //Crear caja inicial
            TgcTexture sphereTexture = TgcTexture.createTexture(Control.getCreationTexturePath());

            mesh = new TgcSphere();

            mesh.setTexture(sphereTexture);
            // mesh.BoundingSphere.setRenderColor(MeshCreatorUtils.UNSELECTED_OBJECT_COLOR);
            bb.setRenderColor(MeshCreatorUtils.UNSELECTED_OBJECT_COLOR);
            this.Layer = Control.CurrentLayer;
        }
예제 #6
0
        /// <summary>
        /// Actualiza los parámetros de la caja en base a lo cargado por el usuario
        /// </summary>
        private void updateSphere()
        {
            Device d3dDevice = GuiController.Instance.D3dDevice;
            bool   bTexture  = (bool)GuiController.Instance.Modifiers["Use texture"];
            Color  color     = (Color)GuiController.Instance.Modifiers["color"];

            sphere.RenderEdges = (bool)GuiController.Instance.Modifiers["edges"];
            sphere.Inflate     = (bool)GuiController.Instance.Modifiers["inflate"];
            sphere.BasePoly    = (TgcSphere.eBasePoly)GuiController.Instance.Modifiers.getValue("base");

            if (bTexture)
            {
                //Cambiar textura
                string texturePath = (string)GuiController.Instance.Modifiers["texture"];
                if (texturePath != currentTexture || !useTexture || (sphere.RenderEdges && sphere.Color != color))
                {
                    currentTexture = texturePath;
                    sphere.setColor(color);
                    sphere.setTexture(TgcTexture.createTexture(d3dDevice, currentTexture));
                }
            }
            else
            {
                sphere.setColor(color);
            }


            useTexture = bTexture;

            //Radio, posición y color
            sphere.Radius        = (float)GuiController.Instance.Modifiers["radius"];
            sphere.Position      = (Vector3)GuiController.Instance.Modifiers["position"];
            sphere.LevelOfDetail = (int)GuiController.Instance.Modifiers["level of detail"];


            //Rotación, converitr a radianes
            Vector3 rotation = (Vector3)GuiController.Instance.Modifiers["rotation"];

            sphere.Rotation = new Vector3(Geometry.DegreeToRadian(rotation.X), Geometry.DegreeToRadian(rotation.Y), Geometry.DegreeToRadian(rotation.Z));

            //Offset de textura
            sphere.UVOffset = (Vector2)GuiController.Instance.Modifiers["offset"];

            //Tiling de textura
            sphere.UVTiling = (Vector2)GuiController.Instance.Modifiers["tiling"];

            //Actualizar valores en la caja.
            sphere.updateValues();
        }
예제 #7
0
        public TgcSphere CrearPelota(string pathRecursos, Vector3 position, TgcTexture texturaPelota)
        {
            float radio = 1;

            //Crear esfera
            TgcSphere sphere = new TgcSphere();

            //TODO cambiar por matrices
            sphere.AutoTransformEnable = true;
            sphere.setTexture(texturaPelota);
            sphere.Radius   = radio;
            sphere.Position = position;
            sphere.updateValues();

            return(sphere);
        }
예제 #8
0
        public TgcSphere CrearPelota(string pathRecursos, Vector3 position, TgcTexture texturaPelota)
        {
            float radio = 1;

            //Crear esfera
            TgcSphere sphere = new TgcSphere();
            //TODO cambiar por matrices
            sphere.AutoTransformEnable = true;
            sphere.setTexture(texturaPelota);
            sphere.Radius = radio;
            sphere.Position = position;
            sphere.updateValues();

            return sphere;
        }
예제 #9
0
 public override void setTexture(TgcTexture texture, int slot)
 {
     mesh.setTexture(texture);
 }