コード例 #1
0
        protected override void InitializationProcess()
        {
            MainFramebuffer = CreateWindowFramebuffer(8, PixelInformation.RGBA_HDR, true);
            _postBuffer     = CreateWindowFramebuffer(0, PixelInformation.RGB_HDR, false);
            Framebuffers.Add(_postBuffer);

            _bloom = new BloomEffect(true, true)
            {
                Radius    = 20,
                AmountMap = new Texture(new System.Drawing.Bitmap("bloom_amountMap.png"))
            };
            PostProcessEffects.Add(_bloom);

            _vittage = new STPostProcessEffect(Program.portal.DrawNodes.Find(a => a.Variables.ContainsKey("_ViewportSize")))
            {
                Arguments =
                {
                    { "CheckSize",    10f },
                    { "Strength",    .25f },
                    { "TargetSize",    5f },
                    { "Move",       3.33f }
                }
            };
            PostProcessEffects.Add(_vittage);
        }
コード例 #2
0
        private void SetupPostProcessing()
        {
            GuiController.Instance.CustomRenderEnabled = true;

            Device d3dDevice = GuiController.Instance.D3dDevice;

            // Define un quad que cubre toda la pantalla, para hacer post-procesamiento
            CustomVertex.PositionTextured[] screenVertices = new CustomVertex.PositionTextured[]
            {
                new CustomVertex.PositionTextured(-1, 1, 1, 0, 0),
                new CustomVertex.PositionTextured(1, 1, 1, 1, 0),
                new CustomVertex.PositionTextured(-1, -1, 1, 0, 1),
                new CustomVertex.PositionTextured(1, -1, 1, 1, 1)
            };

            vbPostProcessMesh = new VertexBuffer(
                typeof(CustomVertex.PositionTextured), 4, d3dDevice, Usage.Dynamic | Usage.WriteOnly,
                CustomVertex.PositionTextured.Format, Pool.Default);

            vbPostProcessMesh.SetData(screenVertices, 0, LockFlags.None);

            // Textura donde se renderea la escena en el paso 1.
            preTargetTexture = new Texture(
                d3dDevice, d3dDevice.PresentationParameters.BackBufferWidth,
                d3dDevice.PresentationParameters.BackBufferHeight, 1, Usage.RenderTarget,
                Format.X8R8G8B8, Pool.Default);

            // Depth stencil usado en el pre-rendering. No tiene multisampling.
            preDepthStencil = d3dDevice.CreateDepthStencilSurface(
                d3dDevice.PresentationParameters.BackBufferWidth, d3dDevice.PresentationParameters.BackBufferHeight,
                DepthFormat.D24S8, MultiSampleType.None, 0, true);

            postProcessEffect = TgcShaders.loadEffect(
                GuiController.Instance.AlumnoEjemplosMediaDir + "CEGA\\Shaders\\PostProcess.fx");

            PostProcessing = new PostProcessEffects();
            PostProcessing.LensDistortion = false;
            PostProcessing.LensRadius     = 0.3f;

            GuiController.Instance.Modifiers.addFloat(CHROMATIC_ABERRANCE_FACTOR_MOD,
                                                      0.0f, 6.0f, 1.0f);

            GuiController.Instance.Modifiers.addFloat(BLUE_TINT_FACTOR_MOD,
                                                      0.0f, 6.0f, 1.0f);

            GuiController.Instance.Modifiers.addFloat(LENS_DISTORTION_K_MOD,
                                                      -4.0f, 4.0f, 2.0f);

            GuiController.Instance.Modifiers.addFloat(LENS_DISTORTION_KCUBE_MOD,
                                                      -4.0f, 4.0f, 2.0f);
        }
コード例 #3
0
ファイル: Snipers.cs プロジェクト: javs/Snipers-CEGA
        private void SetupPostProcessing()
        {
            GuiController.Instance.CustomRenderEnabled = true;

            Device d3dDevice = GuiController.Instance.D3dDevice;

            // Define un quad que cubre toda la pantalla, para hacer post-procesamiento
            CustomVertex.PositionTextured[] screenVertices = new CustomVertex.PositionTextured[]
            {
                new CustomVertex.PositionTextured(-1, 1, 1, 0, 0),
                new CustomVertex.PositionTextured( 1, 1, 1, 1, 0),
                new CustomVertex.PositionTextured(-1,-1, 1, 0, 1),
                new CustomVertex.PositionTextured( 1,-1, 1, 1, 1)
            };

            vbPostProcessMesh = new VertexBuffer(
                typeof(CustomVertex.PositionTextured), 4, d3dDevice, Usage.Dynamic | Usage.WriteOnly,
                CustomVertex.PositionTextured.Format, Pool.Default);

            vbPostProcessMesh.SetData(screenVertices, 0, LockFlags.None);

            // Textura donde se renderea la escena en el paso 1.
            preTargetTexture = new Texture(
                d3dDevice, d3dDevice.PresentationParameters.BackBufferWidth,
                d3dDevice.PresentationParameters.BackBufferHeight, 1, Usage.RenderTarget,
                Format.X8R8G8B8, Pool.Default);

            // Depth stencil usado en el pre-rendering. No tiene multisampling.
            preDepthStencil = d3dDevice.CreateDepthStencilSurface(
                d3dDevice.PresentationParameters.BackBufferWidth, d3dDevice.PresentationParameters.BackBufferHeight,
                DepthFormat.D24S8, MultiSampleType.None, 0, true);

            postProcessEffect = TgcShaders.loadEffect(
                GuiController.Instance.AlumnoEjemplosMediaDir + "CEGA\\Shaders\\PostProcess.fx");

            PostProcessing = new PostProcessEffects();
            PostProcessing.LensDistortion = false;
            PostProcessing.LensRadius = 0.3f;

            GuiController.Instance.Modifiers.addFloat(CHROMATIC_ABERRANCE_FACTOR_MOD,
                0.0f, 6.0f, 1.0f);

            GuiController.Instance.Modifiers.addFloat(BLUE_TINT_FACTOR_MOD,
                0.0f, 6.0f, 1.0f);

            GuiController.Instance.Modifiers.addFloat(LENS_DISTORTION_K_MOD,
                -4.0f, 4.0f, 2.0f);

            GuiController.Instance.Modifiers.addFloat(LENS_DISTORTION_KCUBE_MOD,
                -4.0f, 4.0f, 2.0f);
        }