예제 #1
0
        public override void init()
        {
            Device d3dDevice = GuiController.Instance.D3dDevice;

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

            //Modifiers para vararis sus parametros
            GuiController.Instance.Modifiers.addEnum("base", typeof(TgcSphere.eBasePoly), TgcSphere.eBasePoly.ICOSAHEDRON);
            GuiController.Instance.Modifiers.addBoolean("inflate", "yes", true);
            GuiController.Instance.Modifiers.addInterval("level of detail", new object[] { 0, 1, 2, 3, 4 }, 2);
            GuiController.Instance.Modifiers.addBoolean("edges", "show", false);
            GuiController.Instance.Modifiers.addFloat("radius", 0, 100, 10);
            GuiController.Instance.Modifiers.addVertex3f("position", new Vector3(-100, -100, -100), new Vector3(100, 100, 100), new Vector3(0, 0, 0));
            GuiController.Instance.Modifiers.addVertex3f("rotation", new Vector3(-180, -180, -180), new Vector3(180, 180, 180), new Vector3(0, 0, 0));
            GuiController.Instance.Modifiers.addBoolean("Use texture", "yes", true);
            GuiController.Instance.Modifiers.addTexture("texture", GuiController.Instance.ExamplesMediaDir + "\\Texturas\\madera.jpg");
            GuiController.Instance.Modifiers.addVertex2f("offset", new Vector2(-0.5f, -0.5f), new Vector2(0.9f, 0.9f), new Vector2(0, 0));
            GuiController.Instance.Modifiers.addVertex2f("tiling", new Vector2(0.1f, 0.1f), new Vector2(4, 4), new Vector2(1, 1));
           
            GuiController.Instance.Modifiers.addColor("color", Color.White);
            GuiController.Instance.Modifiers.addBoolean("boundingsphere", "show", false);

            GuiController.Instance.UserVars.addVar("Vertices");
            GuiController.Instance.UserVars.addVar("Triangulos");

            GuiController.Instance.RotCamera.CameraDistance = 50;
        }
예제 #2
0
 public Explosion(Vector3 position)
 {
     esfera = new TgcSphere();
     esfera.Position = position;
     esfera.Radius = 0;
     esfera.AlphaBlendEnable = true;
     esfera.setTexture(getTexture());
     esfera.updateValues();
 }
예제 #3
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;
        }
예제 #4
0
파일: Sol.cs 프로젝트: aniPerezG/barbalpha
        public Sol(Effect efecto)
        {
            posicionSol = new Vector3(0, 1000, 1000);
            sol = new TgcSphere();
            sol.setColor(Color.Yellow);
            sol.Radius = 100;
            sol.BasePoly = TgcSphere.eBasePoly.CUBE;
            sol.Position = posicionSol;
            effect = efecto;
            //sol.Effect = efecto;
            //sol.Technique = "LightTechnique";
            sol.updateValues();

            CameraPos = GuiController.Instance.CurrentCamera.getPosition();
        }
예제 #5
0
파일: Gota.cs 프로젝트: aniPerezG/barbalpha
        public Gota(Vector3 posicion, float anchoGota, float altoGota, Lluvia tremendaLluvia) 
        {
            posicion_inicial = posicion;


            gotita = new TgcSphere();
            gotita.BasePoly = TgcSphere.eBasePoly.CUBE;
            gotita.Radius =  anchoGota / 2;
            gotita.Inflate = false;
            gotita.setColor(Color.AliceBlue);
            gotita.updateValues();

            velocidad_caida.Y = -generador.Next(20);

            lluvia = tremendaLluvia;
        }
예제 #6
0
        /// <summary>
        /// Crear un nuevo TgcSphere igual a este
        /// </summary>
        /// <returns>Sphere clonado</returns>
        public virtual TgcSphere clone()
        {
            TgcSphere cloneSphere = new TgcSphere(radius, color, translation);

            if (this.texture != null)
            {
                cloneSphere.setTexture(this.texture.clone());
            }

            cloneSphere.autoTransformEnable = this.autoTransformEnable;
            cloneSphere.transform           = this.transform;
            cloneSphere.rotation            = this.rotation;
            cloneSphere.alphaBlendEnable    = this.alphaBlendEnable;
            cloneSphere.uvOffset            = this.uvOffset;

            cloneSphere.updateValues();

            return(cloneSphere);
        }
예제 #7
0
        public Bala(Vector3 pos, float anguloRotacion, float anguloElevacion, Canion canion, bool soyPlayer, float velBala, float g)
        {
            bullet = new TgcSphere();
            bullet.setColor(Color.Black);
            bullet.Radius = RADIO;
            bullet.Position = pos;
            posicion = pos;
            bullet.LevelOfDetail = 1;
            this.anguloRotacion = anguloRotacion;
            this.anguloElevacion = anguloElevacion;
            this.speed = velBala;
            this.verticalAcceleration = g;
            bullet.updateValues();
            bullet.AutoTransformEnable = false;
            this.canion = canion;
            canion.agregarBalaEnElAire(this);

            sombra = new TgcSphere(RADIO, Color.Black, new Vector3(pos.X, EjemploAlumno.Instance.alturaOla(pos), pos.Z));
            sombra.updateValues();
            sombra.AutoTransformEnable = false;
            sombra.Effect = EjemploAlumno.Instance.efectoSombra;
            sombra.Technique = "SombraBala";
            //sombra.AlphaBlendEnable = true;

            salpicadura = new TgcCylinder(pos, RADIO, 10);
            salpicadura.Color = Color.White;
            salpicadura.UseTexture = true;
            salpicadura.setTexture(TgcTexture.createTexture(GuiController.Instance.AlumnoEjemplosMediaDir + "4141-diffuse.jpg"));//"el-agua-cae-textura-del-fondo-11558332.jpg"));
            salpicadura.updateValues();
            salpicadura.AutoTransformEnable = false;
            salpicadura.Effect = TgcShaders.loadEffect(GuiController.Instance.AlumnoEjemplosMediaDir + "shader agua.fx");
            salpicadura.Technique = "SalpicaduraBala";

            this.soyPlayer = soyPlayer;

            verticalSpeed = speed * (float)Math.Sin(anguloElevacion);
        }
예제 #8
0
        public Misil(Barco barcoDuenio, Barco barcoEnemigo)
        {
            //habria que inyectarlo por parametro
            Microsoft.DirectX.Direct3D.Device d3dDevice = GuiController.Instance.D3dDevice;

            TgcSceneLoader loader = new TgcSceneLoader();
            //TgcScene escena = loader.loadSceneFromFile(GuiController.Instance.ExamplesMediaDir + "MeshCreator\\Meshes\\Objetos\\BarrilPolvora\\BarrilPolvora-TgcScene.xml");
            //this.mesh = escena.Meshes[0];

            mesh = new TgcSphere();
            mesh.BasePoly = TgcSphere.eBasePoly.CUBE;
            mesh.setColor(Color.Black);
            mesh.Radius = 10;
            mesh.Position = new Vector3(0, 2, 0);
            mesh.Inflate = true;
            mesh.LevelOfDetail = 4;
            mesh.updateValues();

            string texturePath = (string)GuiController.Instance.AlumnoEjemplosMediaDir + "\\Textures\\metalOscuro.jpg";
            mesh.setTexture(TgcTexture.createTexture(d3dDevice, texturePath));

            this.barco = barcoDuenio;
            this.enemigo = barcoEnemigo;
        }
예제 #9
0
        /// <summary>
        /// Crear un nuevo TgcSphere igual a este
        /// </summary>
        /// <returns>Sphere clonado</returns>
        public virtual TgcSphere clone()
        {
            TgcSphere cloneSphere = new TgcSphere(radius, color, translation);

            if (this.texture != null) cloneSphere.setTexture(this.texture.clone());

            cloneSphere.autoTransformEnable = this.autoTransformEnable;
            cloneSphere.transform = this.transform;
            cloneSphere.rotation = this.rotation;
            cloneSphere.alphaBlendEnable = this.alphaBlendEnable;
            cloneSphere.uvOffset = this.uvOffset;

            cloneSphere.updateValues();

            return cloneSphere;
        }