Exemplo n.º 1
0
 public ApplicationInformation()
 {
     Instance     = this;
     m_FPSRefresh = 500;
 }
Exemplo n.º 2
0
        private void Initialize(IntPtr handle)
        {
            m_SwapChainHelper = new SwapChainHelper(handle);
            Device            = m_SwapChainHelper.CreateDeviceWithSwapChain(DeviceCreationFlags.Debug);
            DeviceContext     = Device.ImmediateContext;

            MainRenderTarget = new RenderTarget
                               (
                m_SwapChainHelper.GetRenderTargetView(),
                Screen.Instance.Width,
                Screen.Instance.Height
                               );

            scene_ = new Scene(new Color4(0.0f, 0.2f, 0.7f, 1.0f));

            // On récupère le RenderTargetView généré par notre swapchain représentant
            // le backBuffer

            new LightManager();
            new ProjectorManager();
            new CollisionManager();
            new TimeHelper();
            new LayerManager();

            // Initialisation de la transparence
            RenderTargetBlendDescription desc = new RenderTargetBlendDescription()
            {
                AlphaBlendOperation = BlendOperation.Add,
                BlendOperation      = BlendOperation.Add,

                SourceAlphaBlend      = BlendOption.SourceAlpha,
                DestinationAlphaBlend = BlendOption.One,

                SourceBlend      = BlendOption.SourceAlpha,
                DestinationBlend = BlendOption.InverseSourceAlpha,

                IsBlendEnabled        = true,
                RenderTargetWriteMask = ColorWriteMaskFlags.All
            };

            BlendStateDescription blendStateDesc = new BlendStateDescription()
            {
                IndependentBlendEnable = false,        // DirectX peut utiliser 8 RenderTarget simultanément, chauqe renderTarget
                // peut être lié à un RenderTargetBlendDescription différent
                AlphaToCoverageEnable = false
            };

            blendStateDesc.RenderTarget[0] = desc;

            mainBlend = new BlendState(Device, blendStateDesc);

            DeviceContext.OutputMerger.BlendState = mainBlend;
            // Fin Transparence

            InitializeRasterState();

            new GlowingManager(Screen.Instance.Width, Screen.Instance.Height);
            m_ApplicationInformation = new ApplicationInformation();

            renderTex       = new RenderTexture(Screen.Instance.Width, Screen.Instance.Height);
            imageProcessing = new ImageProcessing(Screen.Instance.Width, Screen.Instance.Height, renderTex.SRV);
            //renderTarget.DepthStencil.SetDepthComparison( Comparison.LessEqual );
            MainRenderTarget.DepthStencil.SetDepthComparison(Comparison.LessEqual);
            new InputManager(m_renderForm);
        }