コード例 #1
0
ファイル: RefractionManager.cs プロジェクト: wtfcolt/game
        /// <summary>
        /// Handles the actual drawing of the buffer to a <see cref="RenderTarget"/>.
        /// </summary>
        /// <param name="buffer">The <see cref="Image"/> of the buffer that is to be drawn to the <paramref name="target"/>.</param>
        /// <param name="sprite">The <see cref="SFML.Graphics.Sprite"/> set up to draw the <paramref name="buffer"/>.</param>
        /// <param name="target">The <see cref="RenderTarget"/> to draw the <paramref name="buffer"/> to.</param>
        /// <param name="camera">The <see cref="ICamera2D"/> that was used during the creation of the buffer.</param>
        protected override void HandleDrawBufferToTarget(Image buffer, SFML.Graphics.Sprite sprite, RenderTarget target,
                                                         ICamera2D camera)
        {
            // Set up the shader
            DrawToTargetShader.SetTexture("ColorMap", _colorMap);
            DrawToTargetShader.SetTexture("NoiseMap", buffer);

            // Draw to the target
            target.Draw(sprite, DrawToTargetShader);
        }
コード例 #2
0
        /// <summary>
        /// Handles the actual drawing of the buffer to a <see cref="RenderTarget"/>.
        /// </summary>
        /// <param name="buffer">The <see cref="Texture"/> of the buffer that is to be drawn to the <paramref name="target"/>.</param>
        /// <param name="sprite">The <see cref="SFML.Graphics.Sprite"/> set up to draw the <paramref name="buffer"/>.</param>
        /// <param name="target">The <see cref="RenderTarget"/> to draw the <paramref name="buffer"/> to.</param>
        /// <param name="camera">The <see cref="ICamera2D"/> that was used during the creation of the buffer.</param>
        protected override void HandleDrawBufferToTarget(Texture buffer, SFML.Graphics.Sprite sprite, RenderTarget target, ICamera2D camera, RenderStates renderStates)
        {
            renderStates.BlendMode = BlendMode.None;

            // Set up the shader
            DrawToTargetShader.SetParameter("ColorMap", _colorMap);
            DrawToTargetShader.SetParameter("NoiseMap", buffer);

            base.HandleDrawBufferToTarget(buffer, sprite, target, camera, renderStates);
        }