Пример #1
0
        /// <summary>
        /// Creates a reflection textureCube
        /// </summary>
        static TextureCube GetReflectCube()
        {
            if (reflectCube != null)
            {
                return(reflectCube);
            }

            Color[] cc = new Color[]
            {
                new Color(1, 0, 0), new Color(0.9f, 0, 0.1f),
                new Color(0.8f, 0, 0.2f), new Color(0.7f, 0, 0.3f),
                new Color(0.6f, 0, 0.4f), new Color(0.5f, 0, 0.5f),
                new Color(0.4f, 0, 0.6f), new Color(0.3f, 0, 0.7f),
                new Color(0.2f, 0, 0.8f), new Color(0.1f, 0, 0.9f),
                new Color(0.1f, 0, 0.9f), new Color(0.0f, 0, 1.0f),
            };

            reflectCube = new TextureCube(ShipGameGame.GetInstance().GraphicsDevice,
                                          8, true, SurfaceFormat.Color);

            Random rand = new Random();

            for (int s = 0; s < 6; s++)
            {
                Color[] sideData = new Color[reflectCube.Size * reflectCube.Size];
                for (int i = 0; i < sideData.Length; i++)
                {
                    sideData[i] = cc[rand.Next(cc.Length)];
                }
                reflectCube.SetData((CubeMapFace)s, sideData);
            }

            return(reflectCube);
        }
Пример #2
0
        /// <summary>
        /// Performs effect initialization, which is required in XNA 4.0
        /// </summary>
        /// <param name="model"></param>
        private void FixupShip(Model model, string path)
        {
            ShipGameGame game = ShipGameGame.GetInstance();

            foreach (ModelMesh mesh in model.Meshes)
            {
                // for each mesh part
                foreach (Effect effect in mesh.Effects)
                {
                    //effect.Parameters["Reflect"].SetValue(GetReflectCube());
                }
            }
        }