Example #1
0
        public WaterMapRenderer(
            AssetStore assetStore,
            GraphicsLoadContext graphicsLoadContext,
            GraphicsDevice graphicsDevice,
            GlobalShaderResources globalShaderResources)
        {
            _waterShaderResources = graphicsLoadContext.ShaderResources.Water;

            var _waterSets = assetStore.WaterSets;

            _waterTextureSet                 = new Dictionary <TimeOfDay, Texture>();
            _waterUvScrollSet                = new Dictionary <TimeOfDay, Vector2>();
            _waterDiffuseColorSet            = new Dictionary <TimeOfDay, ColorRgba>();
            _waterTransparentDiffuseColorSet = new Dictionary <TimeOfDay, ColorRgba>();

            foreach (var waterSet in _waterSets)
            {
                _waterTextureSet.Add(waterSet.TimeOfDay, waterSet.WaterTexture.Value.Texture);
                _waterUvScrollSet.Add(waterSet.TimeOfDay, new Vector2(waterSet.UScrollPerMS, waterSet.VScrollPerMS));
                _waterDiffuseColorSet.Add(waterSet.TimeOfDay, waterSet.DiffuseColor);
                _waterTransparentDiffuseColorSet.Add(waterSet.TimeOfDay, waterSet.TransparentDiffuseColor);
            }

            _bumpTexture = graphicsLoadContext.StandardGraphicsResources.SolidWhiteTexture;

            _waterConstantsPSBuffer = AddDisposable(new ConstantBuffer <GlobalShaderResources.WaterConstantsPS>(
                                                        graphicsDevice,
                                                        "WaterConstantsPS"));

            _uvOffset = Vector2.Zero;

            _transparentWaterDepth      = assetStore.WaterTransparency.Current.TransparentWaterDepth;
            _transparentWaterMinOpacity = assetStore.WaterTransparency.Current.TransparentWaterMinOpacity;
        }
Example #2
0
        public RenderPipeline(Game game)
        {
            _renderList = new RenderList();

            var graphicsDevice = game.GraphicsDevice;

            _globalShaderResources    = game.ContentManager.ShaderResources.Global;
            _globalShaderResourceData = AddDisposable(new GlobalShaderResourceData(game.GraphicsDevice, _globalShaderResources));

            _renderItemConstantsBufferVS = AddDisposable(new ConstantBuffer <MeshShaderResources.RenderItemConstantsVS>(graphicsDevice, "RenderItemConstantsVS"));
            _renderItemConstantsBufferPS = AddDisposable(new ConstantBuffer <MeshShaderResources.RenderItemConstantsPS>(graphicsDevice, "RenderItemConstantsPS"));

            _renderItemConstantsResourceSet = AddDisposable(graphicsDevice.ResourceFactory.CreateResourceSet(
                                                                new ResourceSetDescription(
                                                                    game.ContentManager.ShaderResources.Mesh.RenderItemConstantsResourceLayout,
                                                                    _renderItemConstantsBufferVS.Buffer,
                                                                    _renderItemConstantsBufferPS.Buffer)));

            _commandList = AddDisposable(graphicsDevice.ResourceFactory.CreateCommandList());

            _drawingContext = AddDisposable(new DrawingContext2D(
                                                game.ContentManager,
                                                BlendStateDescription.SingleAlphaBlend,
                                                GameOutputDescription));

            _shadowMapRenderer = AddDisposable(new ShadowMapRenderer(game.GraphicsDevice, game.ContentManager.ShaderResources.Global));

            _textureCopier = AddDisposable(new TextureCopier(
                                               game,
                                               game.Panel.OutputDescription));
        }
Example #3
0
        public RenderPipeline(Game game)
        {
            _renderList = new RenderList();

            var graphicsDevice = game.GraphicsDevice;

            _loadContext = game.GraphicsLoadContext;

            _globalShaderResources    = game.GraphicsLoadContext.ShaderResources.Global;
            _globalShaderResourceData = AddDisposable(new GlobalShaderResourceData(game.GraphicsDevice, _globalShaderResources, game.GraphicsLoadContext.StandardGraphicsResources));

            _commandList = AddDisposable(graphicsDevice.ResourceFactory.CreateCommandList());

            _drawingContext = AddDisposable(new DrawingContext2D(
                                                game.ContentManager,
                                                game.GraphicsLoadContext,
                                                BlendStateDescription.SingleAlphaBlend,
                                                GameOutputDescription));

            _shadowMapRenderer = AddDisposable(new ShadowMapRenderer(game.GraphicsDevice));
            _waterMapRenderer  = AddDisposable(new WaterMapRenderer(game.AssetStore, _loadContext, game.GraphicsDevice, game.GraphicsLoadContext.ShaderResources.Global));

            _textureCopier = AddDisposable(new TextureCopier(
                                               game,
                                               game.Panel.OutputDescription));
        }
Example #4
0
        public ShadowMapRenderer(
            GraphicsDevice graphicsDevice,
            GlobalShaderResources globalShaderResources)
        {
            _shadowFrustumCalculator = new ShadowFrustumCalculator();
            _lightFrustum            = new BoundingFrustum(Matrix4x4.Identity);

            _globalShaderResources = globalShaderResources;

            _shadowConstantsPSBuffer = AddDisposable(new ConstantBuffer <GlobalShaderResources.ShadowConstantsPS>(
                                                         graphicsDevice,
                                                         "ShadowConstantsPS"));
        }