コード例 #1
0
ファイル: D3DApp11.cs プロジェクト: tgzihg/noire_history
        protected override void Dispose(bool disposing)
        {
            if (IsDisposed)
            {
                return;
            }

            if (disposing)
            {
                Utilities.Dispose(ref _renderTarget);
                TextureLoader.Dispose();
                EffectManager11.Instance?.Dispose();
                TextureManager11.Instance?.Dispose();
                InputLayouts.DisposeAll();
                RenderStates11.Destroy();
                Utilities.Dispose(ref _factory);
                Utilities.Dispose(ref _immediateContext);
                Utilities.Dispose(ref _swapChain);
                Utilities.Dispose(ref _d3dDevice);
                Utilities.Dispose(ref _dxgiDevice);
            }
            base.Dispose(disposing);
        }
コード例 #2
0
ファイル: D3DApp11.cs プロジェクト: tgzihg/noire_history
        protected override void InitializeInternal()
        {
            base.InitializeInternal();

            var clientSize = ControlWindow.ClientSize;

            _swapChainDescription = new SwapChainDescription()
            {
                BufferCount       = 1,
                ModeDescription   = new ModeDescription(clientSize.Width, clientSize.Height, new Rational(60, 1), Format.B8G8R8A8_UNorm),
                IsWindowed        = true,
                OutputHandle      = ControlWindow.Handle,
                SampleDescription = new SampleDescription(1, 0),
                SwapEffect        = SwapEffect.Discard,
                Usage             = Usage.RenderTargetOutput
            };
            SharpDX.Direct3D11.Device.CreateWithSwapChain(DriverType.Hardware, DeviceCreationFlags.None, _swapChainDescription, out _d3dDevice, out _swapChain);
            _immediateContext = _d3dDevice.ImmediateContext;
            _factory          = _swapChain.GetParent <Factory>();

            RenderStates11.Initialize(_d3dDevice);
            EffectManager11.Initialize();
            EffectManager11.Instance?.InitializeAllEffects(_d3dDevice);
            TextureLoader.Initialize();
            InputLayouts.InitializeAll(_d3dDevice);
            TextureManager11.Initialize(_d3dDevice);

            _renderTarget = new RenderTarget11(this, this);
            _renderTarget.Initialize();
            ChildComponents.Add(_renderTarget);
            _skybox            = new Skybox(this, this, 5000);
            _skybox.CubeMapSRV = TextureManager11.Instance.QuickCreateCubeMap("snowfield");
            _skybox.Initialize();
            ChildComponents.Add(_skybox);

            ResetSurface(this);
        }