Exemplo n.º 1
0
        private void SetupClouds(GraphicsDevice device, int planeDistance)
        {
            CloudsPlaneEffect            = new AlphaTestEffect(device);
            CloudsPlaneEffect.Texture    = CloudTexture;
            CloudsPlaneEffect.FogEnabled = true;
            CloudsPlaneEffect.FogEnd     = 64 * 0.8f;
            CloudsPlaneEffect.FogStart   = 0f;
            //CloudsPlaneEffect.FogEnabled = false;
            //CloudsPlaneEffect.DiffuseColor
            //CloudsPlaneEffect.TextureEnabled = true;
            //CloudsPlaneEffect.Alpha = 0.5f;

            var cloudVertices = new[]
            {
                new VertexPositionTexture(new Vector3(-planeDistance, 0, -planeDistance), new Vector2(0, 0)),
                new VertexPositionTexture(new Vector3(planeDistance, 0, -planeDistance), new Vector2(1, 0)),
                new VertexPositionTexture(new Vector3(-planeDistance, 0, planeDistance), new Vector2(0, 1)),

                new VertexPositionTexture(new Vector3(planeDistance, 0, -planeDistance), new Vector2(1, 0)),
                new VertexPositionTexture(new Vector3(planeDistance, 0, planeDistance), new Vector2(1, 1)),
                new VertexPositionTexture(new Vector3(-planeDistance, 0, planeDistance), new Vector2(0, 1))
            };


            CloudsPlane = GpuResourceManager.GetBuffer(this, device, VertexPositionTexture.VertexDeclaration,
                                                       cloudVertices.Length, BufferUsage.WriteOnly);
            CloudsPlane.SetData <VertexPositionTexture>(cloudVertices);
        }
Exemplo n.º 2
0
        public void Dispose()
        {
            CloudsPlane?.MarkForDisposal();
            SkyPlane?.MarkForDisposal();
            CelestialPlane?.MarkForDisposal();
            MoonPlane?.MarkForDisposal();
            SunTexture?.MarkForDisposal();
            MoonTexture?.MarkForDisposal();
            CloudTexture?.MarkForDisposal();

            SkyPlaneEffect?.Dispose();
            CelestialPlaneEffect?.Dispose();
            CloudsPlaneEffect?.Dispose();
        }