Exemple #1
0
        public void End()
        {
            if (TextureSize == Vector2.Zero)
            {
                return;
            }
            DWRenderTarget.EndDraw();
            MutexD3D10.Release(0);
            MutexD3D11.Acquire(0, 100);
            ShaderResourceView srv            = new ShaderResourceView(DeviceManager.Device, TextureD3D11);
            BlendState         lastBlendState = DeviceManager.Context.OutputMerger.BlendState;

            Viewport[] lastViewports = DeviceManager.Context.Rasterizer.GetViewports();
            //WVP行列をエフェクトに渡す
            SpriteEffect.GetVariableBySemantic("WORLDVIEWPROJECTION")
            .AsMatrix()
            .SetMatrix(ViewMatrix * SpriteProjectionMatrix);
            SpriteEffect.GetVariableBySemantic("SPRITETEXTURE").AsResource().SetResource(srv);
            DeviceManager.Context.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(VertexBuffer, SpriteVertexLayout.SizeInBytes, 0));
            DeviceManager.Context.InputAssembler.InputLayout       = VertexInputLayout;
            DeviceManager.Context.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;
            DeviceManager.Context.OutputMerger.BlendState          = state;
            DeviceManager.Context.Rasterizer.SetViewports(spriteViewport);
            renderPass.Apply(DeviceManager.Context);
            DeviceManager.Context.Draw(6, 0);
            DeviceManager.Context.Rasterizer.SetViewports(lastViewports);
            DeviceManager.Context.OutputMerger.BlendState = lastBlendState;
            srv.Dispose();
            MutexD3D11.Release(0);
        }
Exemple #2
0
 public void Draw()
 {
     SpriteEffect.GetVariableBySemantic("WORLDVIEWPROJECTION")
     .AsMatrix()
     .SetMatrix(context.MatrixManager.makeWorldViewProjectionMatrix(this));
     SpriteEffect.GetVariableBySemantic("SPRITETEXTURE").AsResource().SetResource(_resView);
     context.DeviceManager.Context.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(VertexBuffer, SpriteVertexLayout.SizeInBytes, 0));
     context.DeviceManager.Context.InputAssembler.InputLayout       = VertexInputLayout;
     context.DeviceManager.Context.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;
     renderPass.Apply(context.DeviceManager.Context);
     context.DeviceManager.Context.Draw(12, 0);
 }
Exemple #3
0
        /// <summary>
        /// スプライトを描画する
        /// </summary>
        public void Draw()
        {
            BlendState lastBlendState = Context.DeviceManager.Context.OutputMerger.BlendState;

            Viewport[] lastViewports = Context.DeviceManager.Context.Rasterizer.GetViewports();
            //WVP行列をエフェクトに渡す
            SpriteEffect.GetVariableBySemantic("WORLDVIEWPROJECTION")
            .AsMatrix()
            .SetMatrix(ViewMatrix * SpriteProjectionMatrix);
            SpriteEffect.GetVariableBySemantic("TRANSCOLOR").AsVector().Set(TransparentColor);
            SpriteEffect.GetVariableBySemantic("SPRITETEXTURE").AsResource().SetResource(SpriteTexture);
            Context.DeviceManager.Context.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(VertexBuffer, SpriteVertexLayout.SizeInBytes, 0));
            Context.DeviceManager.Context.InputAssembler.InputLayout       = VertexInputLayout;
            Context.DeviceManager.Context.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;
            Context.DeviceManager.Context.OutputMerger.BlendState          = state;
            Context.DeviceManager.Context.Rasterizer.SetViewports(spriteViewport);
            renderPass.Apply(Context.DeviceManager.Context);
            Context.DeviceManager.Context.Draw(6, 0);
            Context.DeviceManager.Context.Rasterizer.SetViewports(lastViewports);
            Context.DeviceManager.Context.OutputMerger.BlendState = lastBlendState;
        }