Example #1
0
        private void SetContextStates()
        {
            InputElement[] inputElements =
            {
                new InputElement("POSITION", 0, Format.R32G32B32A32_Float,  0, 0),
                new InputElement("NORMAL",   0, Format.R32G32B32A32_Float, 16, 0)
            };

            layout = new InputLayout(device, ShaderProvider.GetSignatureFromShader("Shader/GoL.fx"), inputElements);

            deviceContext.InputAssembler.InputLayout       = layout;
            deviceContext.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;
            deviceContext.OutputMerger.BlendState          = States.Instance.blendDisabled;
            deviceContext.OutputMerger.DepthStencilState   = States.Instance.depthEnabledStencilDisabledWriteEnabled;
            deviceContext.Rasterizer.SetViewports(new Viewport(0, 0, RenderForm.ClientSize.Width, RenderForm.ClientSize.Height));
        }
Example #2
0
        public SpriteBatch()
        {
            ps = ShaderProvider.CompilePS("Shader/Sprite2D.fx");
            vs = ShaderProvider.CompileVS("Shader/Sprite2D.fx");

            InputElement[] inputElements =
            {
                new InputElement("POSITION", 0, Format.R32G32B32A32_Float,  0, 0),
                new InputElement("COLOR",    0, Format.R32G32B32A32_Float, 16, 0)
            };

            layoutSprite = new InputLayout(RenderFrame.Instance.device, ShaderProvider.GetSignatureFromShader("Shader/Sprite2D.fx"), inputElements);

            tex        = Texture2D.FromFile(RenderFrame.Instance.device, @".\Content\Font.png");
            res        = new ShaderResourceView(RenderFrame.Instance.device, tex);
            textVS     = ShaderProvider.CompileVS("Shader/Font.fx");
            textPS     = ShaderProvider.CompilePS("Shader/Font.fx");
            layoutFont = new InputLayout(RenderFrame.Instance.device, ShaderProvider.GetSignatureFromShader("Shader/Font.fx"), inputElements);
        }