Esempio n. 1
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. 2
0
        public void render()
        {
            bullet.render();

            sombra.Effect.SetValue("height", EjemploAlumno.Instance.heightOlas);
            sombra.Effect.SetValue("time", EjemploAlumno.Instance.time);
            //sombra.Effect.SetValue("radioBala", bullet.Radius);
            //sombra.Effect.SetValue("posBalaX", posicion.X);
            //sombra.Effect.SetValue("posBalaZ", posicion.Z);

            //salpicadura.Effect.SetValue("height", EjemploAlumno.Instance.heightOlas);
            salpicadura.Effect.SetValue("time", tiempo);//EjemploAlumno.Instance.time);
            //EjemploAlumno.Instance.cargarEfectoLuz(salpicadura.Effect);
            if (EjemploAlumno.Instance.lloviendo)
            {
                salpicadura.Effect.SetValue("fvLightPosition", TgcParserUtils.vector3ToFloat3Array(EjemploAlumno.Instance.lightMesh.Position));
                salpicadura.Effect.SetValue("fvEyePosition", TgcParserUtils.vector3ToFloat3Array(GuiController.Instance.ThirdPersonCamera.getPosition()));
                salpicadura.Effect.SetValue("k_la", 0.3f);
                salpicadura.Effect.SetValue("k_ld", 0.3f);
                salpicadura.Effect.SetValue("k_ls", 0f);
                salpicadura.Effect.SetValue("fSpecularPower", 250);
            }
            else
            {
                salpicadura.Effect.SetValue("fvLightPosition", TgcParserUtils.vector3ToFloat3Array(EjemploAlumno.Instance.lightMesh.Position));
                salpicadura.Effect.SetValue("fvEyePosition", TgcParserUtils.vector3ToFloat3Array(GuiController.Instance.ThirdPersonCamera.getPosition()));
                salpicadura.Effect.SetValue("k_la", 4f);
                salpicadura.Effect.SetValue("k_ld", 5f);
                salpicadura.Effect.SetValue("k_ls", 2.5f);
                salpicadura.Effect.SetValue("fSpecularPower", 60);
            }

            if (sombraActiva)
            {
                sombra.render();
            }
            else
            {
                salpicadura.render();
            }
        }
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();
            }
        }