Ejemplo n.º 1
0
 public static void Initialize()
 {
     lock (LockObject) {
         if (_isInitialized)
         {
             return;
         }
         _instance      = new EffectManager11();
         _isInitialized = true;
     }
 }
Ejemplo n.º 2
0
        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);
        }