Esempio n. 1
0
        public override void Render()
        {
            PreRender();

            var size     = sizeModifier.Value;
            var position = positionModifier.Value;
            var rotation = rotationModifier.Value;

            var texturePath = textureModifier.Value;

            if (texturePath != currentTexture)
            {
                currentTexture = texturePath;
                cylinder.setTexture(TgcTexture.createTexture(D3DDevice.Instance.Device, currentTexture));
            }

            cylinder.UseTexture = useTextureModifier.Value;

            cylinder.Position     = position;
            cylinder.Rotation     = rotation;
            cylinder.TopRadius    = size.X;
            cylinder.BottomRadius = size.Y;
            cylinder.Length       = size.Z;

            var alpha = alphaModifier.Value;
            var color = colorModifier.Value;

            cylinder.Color = Color.FromArgb(alpha, color);

            cylinder.updateValues();

            cylinder.Transform = TGCMatrix.Scaling(cylinder.Scale) * TGCMatrix.RotationYawPitchRoll(cylinder.Rotation.Y, cylinder.Rotation.X, cylinder.Rotation.Z) * TGCMatrix.Translation(cylinder.Position);

            if (boundingCylinderModifier.Value)
            {
                cylinder.BoundingCylinder.Render();
            }
            else
            {
                cylinder.Render();
            }

            PostRender();
        }
Esempio n. 2
0
        public override void Render()
        {
            PreRender();

            var modifiers = Modifiers;
            var size      = (Vector3)modifiers.getValue("size");
            var position  = (Vector3)modifiers.getValue("position");
            var rotation  = (Vector3)modifiers.getValue("rotation");

            var texturePath = (string)modifiers.getValue("texture");

            if (texturePath != currentTexture)
            {
                currentTexture = texturePath;
                cylinder.setTexture(TgcTexture.createTexture(D3DDevice.Instance.Device, currentTexture));
            }

            cylinder.UseTexture = (bool)modifiers.getValue("useTexture");

            cylinder.Position     = position;
            cylinder.Rotation     = rotation;
            cylinder.TopRadius    = size.X;
            cylinder.BottomRadius = size.Y;
            cylinder.Length       = size.Z;

            var alpha = (int)modifiers.getValue("alpha");
            var color = (Color)modifiers.getValue("color");

            cylinder.Color = Color.FromArgb(alpha, color);

            cylinder.updateValues();

            if ((bool)modifiers.getValue("boundingCylinder"))
            {
                cylinder.BoundingCylinder.render();
            }
            else
            {
                cylinder.render();
            }

            PostRender();
        }
Esempio n. 3
0
        public override void render(float elapsedTime)
        {
            TgcModifiers modifiers = GuiController.Instance.Modifiers;
            Vector3      size      = (Vector3)modifiers.getValue("size");
            Vector3      position  = (Vector3)modifiers.getValue("position");
            Vector3      rotation  = (Vector3)modifiers.getValue("rotation");

            string texturePath = (string)modifiers.getValue("texture");

            if (texturePath != currentTexture)
            {
                currentTexture = texturePath;
                cylinder.setTexture(TgcTexture.createTexture(GuiController.Instance.D3dDevice, currentTexture));
            }

            cylinder.UseTexture = (bool)modifiers.getValue("useTexture");

            cylinder.Position     = position;
            cylinder.Rotation     = rotation;
            cylinder.TopRadius    = size.X;
            cylinder.BottomRadius = size.Y;
            cylinder.Length       = size.Z;

            int   alpha = (int)modifiers.getValue("alpha");
            Color color = (Color)modifiers.getValue("color");

            cylinder.Color = Color.FromArgb(alpha, color);

            cylinder.updateValues();

            if ((bool)modifiers.getValue("boundingCylinder"))
            {
                cylinder.BoundingCylinder.render();
            }
            else
            {
                cylinder.render();
            }
        }
Esempio n. 4
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);
        }