Пример #1
0
        public Rectangle(D3D11 d3d, SelectionManager items, OrthogonalCamera camera)
        {
            //_models = items;
            _items  = items;
            _camera = camera;
            Device device = d3d.Device;

            //_color = new Vector4(0.0f, 0.0f, 0.0f, 0.1f);
            _color = new ColorVM(0.9f, 0.4f, 0.0f, 0.4f);
            //_color = new Vector4(0.9f, 0.4f, 0.0f, 0.4f);
            _isVisible = false;

            using (var bytecode = ShaderBytecodeExtension.CompileFromResource("pack://*****:*****@"Shader\Tools.Rectangle.hlsl", "VS", "vs_5_0", shaderFlags, EffectFlags.None))
            {
                _vertexShader = ToDispose(new VertexShader(device, bytecode));
                _inputLayout  = ToDispose(new InputLayout(device, bytecode, new[] { new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0, InputClassification.PerVertexData, 0) }));
            }
            using (var bytecode = ShaderBytecodeExtension.CompileFromResource("pack://*****:*****@"Shader\Tools.Rectangle.hlsl", "PS", "ps_5_0", shaderFlags, EffectFlags.None))
            {
                _pixelShader = ToDispose(new PixelShader(device, bytecode));
            }

            _globalBuffer = ToDispose(new Buffer(device, Matrix.SizeInBytes + Vector4.SizeInBytes, ResourceUsage.Dynamic, BindFlags.ConstantBuffer, CpuAccessFlags.Write, ResourceOptionFlags.None, 0));

            using (var dataStream = new DataStream(Vector3.SizeInBytes * 4, true, true))
            {
                dataStream.Write(new Vector3(0.0f, 0.0f, 1.0f));
                dataStream.Write(new Vector3(0.0f, 1.0f, 1.0f));
                dataStream.Write(new Vector3(1.0f, 1.0f, 1.0f));
                dataStream.Write(new Vector3(1.0f, 0.0f, 1.0f));

                dataStream.Position = 0;
                _buffer             = ToDispose(new Buffer(device, dataStream, Vector3.SizeInBytes * 4, ResourceUsage.Default, BindFlags.VertexBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0));
                _bufferBinding      = new VertexBufferBinding(_buffer, Vector3.SizeInBytes, 0);
            }
            using (var dataStream = new DataStream(sizeof(int) * 6, true, true))
            {
                dataStream.Write(0);
                dataStream.Write(1);
                dataStream.Write(2);
                dataStream.Write(2);
                dataStream.Write(3);
                dataStream.Write(0);
                dataStream.Position = 0;
                _indexBuffer        = ToDispose(new Buffer(device, dataStream, sizeof(int) * 6, ResourceUsage.Default, BindFlags.IndexBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0));
            }
        }
Пример #2
0
            public void Init(D3D11 d3d)
            {
                _device = d3d.Device;
                using (var bytecode = ShaderBytecodeExtension.CompileFromResource("pack://*****:*****@"Shader\Models.Polygon.hlsl", "VS", "vs_5_0", shaderFlags, EffectFlags.None))
                {
                    _vertexShader = ToDispose(new VertexShader(_device, bytecode));
                    _inputLayout  = ToDispose(new InputLayout(_device, bytecode, new[] { new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0, InputClassification.PerVertexData, 0) }));
                }
                //using (var bytecode = ShaderBytecode.CompileFromFile(@"Shader\Models.Polygon.hlsl", "PS", "ps_5_0", shaderFlags, EffectFlags.None))
                using (var bytecode = ShaderBytecodeExtension.CompileFromResource("pack://application:,,,/Shader/Models.Polygon.hlsl", "PS", "ps_5_0"))

                {
                    _pixelShader = ToDispose(new PixelShader(_device, bytecode));
                }

                _globalBuffer = ToDispose(new Buffer(_device, Matrix.SizeInBytes + Vector4.SizeInBytes, ResourceUsage.Dynamic, BindFlags.ConstantBuffer, CpuAccessFlags.Write, ResourceOptionFlags.None, 0));
            }
Пример #3
0
        public Background(Device device)
        {
            _color1   = new Vector4(0.6f, 0.6f, 0.6f, 1.0f);
            _color2   = new Vector4(0.8f, 0.8f, 0.8f, 1.0f);
            _tileSize = new Vector4(15.0f, 15.0f, 0.0f, 0.0f);
            using (var bytecode = ShaderBytecodeExtension.CompileFromResource("pack://*****:*****@"Shader\Visible\Background.hlsl", "VS", "vs_5_0", shaderFlags, EffectFlags.None))
            {
                _vertexShader = ToDispose(new VertexShader(device, bytecode));
                _inputLayout  = ToDispose(new InputLayout(device, bytecode, new[] { new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0, InputClassification.PerVertexData, 0) }));
            }
            using (var bytecode = ShaderBytecodeExtension.CompileFromResource("pack://*****:*****@"Shader\Visible\Background.hlsl", "PS", "ps_5_0", shaderFlags, EffectFlags.None))
            {
                _pixelShader = ToDispose(new PixelShader(device, bytecode));
            }

            _globalBuffer = ToDispose(new Buffer(device, Matrix.SizeInBytes + 2 * Vector4.SizeInBytes + Vector4.SizeInBytes, ResourceUsage.Dynamic, BindFlags.ConstantBuffer, CpuAccessFlags.Write, ResourceOptionFlags.None, 0));

            using (var dataStream = new DataStream(Vector3.SizeInBytes * 4, true, true))
            {
                dataStream.Write(new Vector3(-0.5f, -0.5f, 1.0f));
                dataStream.Write(new Vector3(-0.5f, 0.5f, 1.0f));
                dataStream.Write(new Vector3(0.5f, 0.5f, 1.0f));
                dataStream.Write(new Vector3(0.5f, -0.5f, 1.0f));

                dataStream.Position = 0;
                _buffer             = ToDispose(new Buffer(device, dataStream, Vector3.SizeInBytes * 4, ResourceUsage.Default, BindFlags.VertexBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0));
                _bufferBinding      = new VertexBufferBinding(_buffer, Vector3.SizeInBytes, 0);
            }
            using (var dataStream = new DataStream(sizeof(int) * 6, true, true))
            {
                dataStream.Write(0);
                dataStream.Write(1);
                dataStream.Write(2);
                dataStream.Write(2);
                dataStream.Write(3);
                dataStream.Write(0);
                dataStream.Position = 0;
                _indexBuffer        = ToDispose(new Buffer(device, dataStream, sizeof(int) * 6, ResourceUsage.Default, BindFlags.IndexBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0));
            }
        }
Пример #4
0
            public void Init(D3D11 d3d)
            {
                _device = d3d.Device;

                #region BoundingRect
                using (var bytecode = ShaderBytecodeExtension.CompileFromResource("pack://application:,,,/Shader/BaseModel/BoundingRect.hlsl", "VS", "vs_5_0"))
                {
                    _vertexShaderBoundingRect = ToDispose(new VertexShader(_device, bytecode));
                    _inputLayoutBoundingRect  = ToDispose(new InputLayout(_device, bytecode, new[] { new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0, InputClassification.PerVertexData, 0) }));
                }
                using (var bytecode = ShaderBytecodeExtension.CompileFromResource("pack://application:,,,/Shader/BaseModel/BoundingRect.hlsl", "PS", "ps_5_0"))

                {
                    _pixelShaderBoundingRect = ToDispose(new PixelShader(_device, bytecode));
                }

                _globalBufferBoundingRect = ToDispose(new Buffer(_device, Matrix.SizeInBytes + Vector4.SizeInBytes, ResourceUsage.Dynamic, BindFlags.ConstantBuffer, CpuAccessFlags.Write, ResourceOptionFlags.None, 0));

                _colorBoundingRect = new Vector4(100.0f / 255.0f, 149.0f / 255.0f, 237.0f / 255.0f, 1.0f);

                using (var dataStream = new DataStream(Vector3.SizeInBytes * 5, true, true))
                {
                    dataStream.Write(new Vector3(0.0f, 0.0f, 0.0f));
                    dataStream.Write(new Vector3(0.0f, 1.0f, 0.0f));
                    dataStream.Write(new Vector3(1.0f, 1.0f, 0.0f));
                    dataStream.Write(new Vector3(1.0f, 0.0f, 0.0f));
                    dataStream.Write(new Vector3(0.0f, 0.0f, 0.0f));
                    dataStream.Position        = 0;
                    _bufferBoundingRect        = ToDispose(new Buffer(_device, dataStream, Vector3.SizeInBytes * 5, ResourceUsage.Default, BindFlags.VertexBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0));
                    _bufferBindingBoundingRect = new VertexBufferBinding(_bufferBoundingRect, Vector3.SizeInBytes, 0);
                }
                #endregion
                #region Nodes

                _colorNodesBorders = new Vector4(100.0f / 255.0f, 149.0f / 255.0f, 237.0f / 255.0f, 1.0f);
                _colorNodesFill    = new Vector4(1.0f, 1.0f, 1.0f, 1.0f);
                using (var bytecode = ShaderBytecodeExtension.CompileFromResource("pack://application:,,,/Shader/BaseModel/BoundingNodes.hlsl", "VS", "vs_5_0"))
                {
                    _vertexShaderNodes = ToDispose(new VertexShader(_device, bytecode));
                    _inputLayoutNodes  = ToDispose(new InputLayout(_device, bytecode, new[] { new InputElement("POSITION", 0, Format.R32G32B32A32_Float, 0, 0, InputClassification.PerVertexData, 0) }));
                }
                using (var bytecode = ShaderBytecodeExtension.CompileFromResource("pack://application:,,,/Shader/BaseModel/BoundingNodes.hlsl", "PS", "ps_5_0"))

                {
                    _pixelShaderNodes = ToDispose(new PixelShader(_device, bytecode));
                }

                _globalBufferNodes = ToDispose(new Buffer(_device, 2 * Matrix.SizeInBytes + 3 * Vector4.SizeInBytes, ResourceUsage.Dynamic, BindFlags.ConstantBuffer, CpuAccessFlags.Write, ResourceOptionFlags.None, 0));

                using (var dataStream = new DataStream(Vector4.SizeInBytes * 32, true, true))
                {
                    dataStream.Write(new Vector4(-0.5f, -0.5f, -0.5f, -0.5f));
                    dataStream.Write(new Vector4(-0.5f, +0.5f, -0.5f, -0.5f));
                    dataStream.Write(new Vector4(+0.5f, +0.5f, -0.5f, -0.5f));
                    dataStream.Write(new Vector4(+0.5f, -0.5f, -0.5f, -0.5f));

                    dataStream.Write(new Vector4(-0.5f, -0.5f, 0.0f, -0.5f));
                    dataStream.Write(new Vector4(-0.5f, +0.5f, 0.0f, -0.5f));
                    dataStream.Write(new Vector4(+0.5f, +0.5f, 0.0f, -0.5f));
                    dataStream.Write(new Vector4(+0.5f, -0.5f, 0.0f, -0.5f));

                    dataStream.Write(new Vector4(-0.5f, -0.5f, 0.5f, -0.5f));
                    dataStream.Write(new Vector4(-0.5f, +0.5f, 0.5f, -0.5f));
                    dataStream.Write(new Vector4(+0.5f, +0.5f, 0.5f, -0.5f));
                    dataStream.Write(new Vector4(+0.5f, -0.5f, 0.5f, -0.5f));

                    dataStream.Write(new Vector4(-0.5f, -0.5f, -0.5f, 0.0f));
                    dataStream.Write(new Vector4(-0.5f, +0.5f, -0.5f, 0.0f));
                    dataStream.Write(new Vector4(+0.5f, +0.5f, -0.5f, 0.0f));
                    dataStream.Write(new Vector4(+0.5f, -0.5f, -0.5f, 0.0f));

                    dataStream.Write(new Vector4(-0.5f, -0.5f, 0.5f, 0.0f));
                    dataStream.Write(new Vector4(-0.5f, +0.5f, 0.5f, 0.0f));
                    dataStream.Write(new Vector4(+0.5f, +0.5f, 0.5f, 0.0f));
                    dataStream.Write(new Vector4(+0.5f, -0.5f, 0.5f, 0.0f));

                    dataStream.Write(new Vector4(-0.5f, -0.5f, -0.5f, +0.5f));
                    dataStream.Write(new Vector4(-0.5f, +0.5f, -0.5f, +0.5f));
                    dataStream.Write(new Vector4(+0.5f, +0.5f, -0.5f, +0.5f));
                    dataStream.Write(new Vector4(+0.5f, -0.5f, -0.5f, +0.5f));

                    dataStream.Write(new Vector4(-0.5f, -0.5f, 0.0f, +0.5f));
                    dataStream.Write(new Vector4(-0.5f, +0.5f, 0.0f, +0.5f));
                    dataStream.Write(new Vector4(+0.5f, +0.5f, 0.0f, +0.5f));
                    dataStream.Write(new Vector4(+0.5f, -0.5f, 0.0f, +0.5f));

                    dataStream.Write(new Vector4(-0.5f, -0.5f, 0.5f, +0.5f));
                    dataStream.Write(new Vector4(-0.5f, +0.5f, 0.5f, +0.5f));
                    dataStream.Write(new Vector4(+0.5f, +0.5f, 0.5f, +0.5f));
                    dataStream.Write(new Vector4(+0.5f, -0.5f, 0.5f, +0.5f));

                    dataStream.Position = 0;
                    _bufferNodes        = ToDispose(new Buffer(_device, dataStream, Vector4.SizeInBytes * 32, ResourceUsage.Default, BindFlags.VertexBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0));
                    _bufferBindingNodes = new VertexBufferBinding(_bufferNodes, Vector4.SizeInBytes, 0);
                }

                using (var dataStream = new DataStream(sizeof(int) * 64, true, true))
                {
                    dataStream.Write(0 + 0);
                    dataStream.Write(1 + 0);
                    dataStream.Write(1 + 0);
                    dataStream.Write(2 + 0);
                    dataStream.Write(2 + 0);
                    dataStream.Write(3 + 0);
                    dataStream.Write(3 + 0);
                    dataStream.Write(0 + 0);

                    dataStream.Write(0 + 4);
                    dataStream.Write(1 + 4);
                    dataStream.Write(1 + 4);
                    dataStream.Write(2 + 4);
                    dataStream.Write(2 + 4);
                    dataStream.Write(3 + 4);
                    dataStream.Write(3 + 4);
                    dataStream.Write(0 + 4);

                    dataStream.Write(0 + 8);
                    dataStream.Write(1 + 8);
                    dataStream.Write(1 + 8);
                    dataStream.Write(2 + 8);
                    dataStream.Write(2 + 8);
                    dataStream.Write(3 + 8);
                    dataStream.Write(3 + 8);
                    dataStream.Write(0 + 8);

                    dataStream.Write(0 + 12);
                    dataStream.Write(1 + 12);
                    dataStream.Write(1 + 12);
                    dataStream.Write(2 + 12);
                    dataStream.Write(2 + 12);
                    dataStream.Write(3 + 12);
                    dataStream.Write(3 + 12);
                    dataStream.Write(0 + 12);

                    dataStream.Write(0 + 16);
                    dataStream.Write(1 + 16);
                    dataStream.Write(1 + 16);
                    dataStream.Write(2 + 16);
                    dataStream.Write(2 + 16);
                    dataStream.Write(3 + 16);
                    dataStream.Write(3 + 16);
                    dataStream.Write(0 + 16);

                    dataStream.Write(0 + 20);
                    dataStream.Write(1 + 20);
                    dataStream.Write(1 + 20);
                    dataStream.Write(2 + 20);
                    dataStream.Write(2 + 20);
                    dataStream.Write(3 + 20);
                    dataStream.Write(3 + 20);
                    dataStream.Write(0 + 20);

                    dataStream.Write(0 + 24);
                    dataStream.Write(1 + 24);
                    dataStream.Write(1 + 24);
                    dataStream.Write(2 + 24);
                    dataStream.Write(2 + 24);
                    dataStream.Write(3 + 24);
                    dataStream.Write(3 + 24);
                    dataStream.Write(0 + 24);

                    dataStream.Write(0 + 28);
                    dataStream.Write(1 + 28);
                    dataStream.Write(1 + 28);
                    dataStream.Write(2 + 28);
                    dataStream.Write(2 + 28);
                    dataStream.Write(3 + 28);
                    dataStream.Write(3 + 28);
                    dataStream.Write(0 + 28);
                    dataStream.Position    = 0;
                    _indexBufferNodesLines = ToDispose(new Buffer(_device, dataStream, sizeof(int) * 64, ResourceUsage.Default, BindFlags.IndexBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0));
                }

                using (var dataStream = new DataStream(sizeof(int) * 6 * 8, true, true))
                {
                    dataStream.Write(0 + 0);
                    dataStream.Write(1 + 0);
                    dataStream.Write(2 + 0);
                    dataStream.Write(2 + 0);
                    dataStream.Write(3 + 0);
                    dataStream.Write(0 + 0);

                    dataStream.Write(0 + 4);
                    dataStream.Write(1 + 4);
                    dataStream.Write(2 + 4);
                    dataStream.Write(2 + 4);
                    dataStream.Write(3 + 4);
                    dataStream.Write(0 + 4);

                    dataStream.Write(0 + 8);
                    dataStream.Write(1 + 8);
                    dataStream.Write(2 + 8);
                    dataStream.Write(2 + 8);
                    dataStream.Write(3 + 8);
                    dataStream.Write(0 + 8);

                    dataStream.Write(0 + 12);
                    dataStream.Write(1 + 12);
                    dataStream.Write(2 + 12);
                    dataStream.Write(2 + 12);
                    dataStream.Write(3 + 12);
                    dataStream.Write(0 + 12);

                    dataStream.Write(0 + 16);
                    dataStream.Write(1 + 16);
                    dataStream.Write(2 + 16);
                    dataStream.Write(2 + 16);
                    dataStream.Write(3 + 16);
                    dataStream.Write(0 + 16);

                    dataStream.Write(0 + 20);
                    dataStream.Write(1 + 20);
                    dataStream.Write(2 + 20);
                    dataStream.Write(2 + 20);
                    dataStream.Write(3 + 20);
                    dataStream.Write(0 + 20);

                    dataStream.Write(0 + 24);
                    dataStream.Write(1 + 24);
                    dataStream.Write(2 + 24);
                    dataStream.Write(2 + 24);
                    dataStream.Write(3 + 24);
                    dataStream.Write(0 + 24);

                    dataStream.Write(0 + 28);
                    dataStream.Write(1 + 28);
                    dataStream.Write(2 + 28);
                    dataStream.Write(2 + 28);
                    dataStream.Write(3 + 28);
                    dataStream.Write(0 + 28);

                    dataStream.Position        = 0;
                    _indexBufferNodesTriangles = ToDispose(new Buffer(_device, dataStream, sizeof(int) * 6 * 8, ResourceUsage.Default, BindFlags.IndexBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0));
                }

                #endregion
            }
Пример #5
0
        //Font Font;
        //FontShader FontShader;


        #endregion

        public Neatline(Device device)
        {
            _color1Background   = new Vector4(1.0f, 1.0f, 1.0f, 0.8f);
            _color2Background   = new Vector4(0.7f, 0.7f, 0.7f, 0.8f);
            _colorScalaLines    = new Vector4(0.2f, 0.2f, 0.2f, 1.0f);
            _colorBoundaryLines = new Vector4(0.0f, 0.0f, 0.0f, 1.0f);
            _colorNumbers       = new Vector4(0.0f, 0.0f, 0.0f, 1.0f);
            #region BoundaryLines and Scala Lines
            //using (var bytecode = ShaderBytecode.CompileFromFile(@"Shader\Visible\Neatline.Background.hlsl", "VS", "vs_5_0", shaderFlags, EffectFlags.None))
            using (var bytecode = ShaderBytecodeExtension.CompileFromResource("pack://*****:*****@"Shader\Visible\Neatline.Lines.hlsl", "VS", "vs_5_0", shaderFlags, EffectFlags.None))
            using (var bytecode = ShaderBytecodeExtension.CompileFromResource("pack://*****:*****@"Shader\Visible\Neatline.Lines.hlsl", "PS", "ps_5_0", shaderFlags, EffectFlags.None))
            using (var bytecode = ShaderBytecodeExtension.CompileFromResource("pack://*****:*****@"Shader\Visible\Neatline.CursorLines.hlsl", "VS", "vs_5_0", shaderFlags, EffectFlags.None))
            {
                _vertexShaderCursorLines = ToDispose(new VertexShader(device, bytecode));
                _inputLayoutCursorLines  = ToDispose(new InputLayout(device, bytecode, new[] { new InputElement("POSITION", 0, Format.R32G32B32A32_Float, 0, 0, InputClassification.PerVertexData, 0) }));
            }
            //using (var bytecode = ShaderBytecode.CompileFromFile(@"Shader\Visible\Neatline.CursorLines.hlsl", "PS", "ps_5_0", shaderFlags, EffectFlags.None))
            using (var bytecode = ShaderBytecodeExtension.CompileFromResource("pack://application:,,,/Shader/Visible/Neatline.CursorLines.hlsl", "PS", "ps_5_0"))
            {
                _pixelShaderCursorLines = ToDispose(new PixelShader(device, bytecode));
            }

            _globalBufferCursorLines = ToDispose(new Buffer(device, Matrix.SizeInBytes + 2 * Vector4.SizeInBytes, ResourceUsage.Dynamic, BindFlags.ConstantBuffer, CpuAccessFlags.Write, ResourceOptionFlags.None, 0));
            using (var dataStream = new DataStream(Vector4.SizeInBytes * 4, true, true))
            {
                // Top Side
                dataStream.Write(new Vector4(0.0f, 0.0f, 1.0f, 0.0f));
                dataStream.Write(new Vector4(0.0f, 1.0f, 1.0f, 0.0f));
                // Left Side
                dataStream.Write(new Vector4(0.0f, 0.0f, 0.0f, 1.0f));
                dataStream.Write(new Vector4(1.0f, 0.0f, 0.0f, 1.0f));

                dataStream.Position       = 0;
                _bufferCursorLines        = ToDispose(new Buffer(device, dataStream, Vector4.SizeInBytes * 4, ResourceUsage.Default, BindFlags.VertexBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0));
                _bufferBindingCursorLines = new VertexBufferBinding(_bufferCursorLines, Vector4.SizeInBytes, 0);
            }
            #endregion

            _numbersRenderer = new Numbers();
            _numbersRenderer.Init(device);
        }
Пример #6
0
        public void Init(Device device)
        {
            _color = new Vector4(0.0f, 0.0f, 0.0f, 1.0f);
            using (Stream stream = Application.GetResourceStream(new Uri("pack://*****:*****@"Content\Images\numbers.png");
            using (var bytecode = ShaderBytecodeExtension.CompileFromResource("pack://*****:*****@"Shader\Visible\Neatline.Numbers.hlsl", "VS", "vs_5_0", shaderFlags, EffectFlags.None))
            {
                _vertexShader = ToDispose(new VertexShader(device, bytecode));
                _inputLayout  = ToDispose(new InputLayout(device, bytecode, new[] { new InputElement("POSITION", 0, Format.R32G32B32A32_Float, 0, 0, InputClassification.PerVertexData, 0) }));
            }
            using (var bytecode = ShaderBytecodeExtension.CompileFromResource("pack://*****:*****@"Shader\Visible\Neatline.Numbers.hlsl", "PS", "ps_5_0", shaderFlags, EffectFlags.None))
            {
                _pixelShader = ToDispose(new PixelShader(device, bytecode));
            }

            _globalBuffer = ToDispose(new Buffer(device, Matrix.SizeInBytes + 2 * Vector4.SizeInBytes, ResourceUsage.Dynamic, BindFlags.ConstantBuffer, CpuAccessFlags.Write, ResourceOptionFlags.None, 0));

            using (var dataStream = new DataStream(Vector4.SizeInBytes * 4, true, true))
            {
                dataStream.Write(new Vector4(0.0f, 0.0f, 0.0f, 1.0f));
                dataStream.Write(new Vector4(0.0f, 1.0f, 0.0f, 0.0f));
                dataStream.Write(new Vector4(1.0f, 1.0f, 1.0f, 0.0f));
                dataStream.Write(new Vector4(1.0f, 0.0f, 1.0f, 1.0f));

                dataStream.Position = 0;
                _buffer             = ToDispose(new Buffer(device, dataStream, Vector4.SizeInBytes * 4, ResourceUsage.Default, BindFlags.VertexBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0));
                _bufferBinding      = new VertexBufferBinding(_buffer, Vector4.SizeInBytes, 0);
            }
            using (var dataStream = new DataStream(sizeof(int) * 6, true, true))
            {
                dataStream.Write(0);
                dataStream.Write(1);
                dataStream.Write(2);
                dataStream.Write(2);
                dataStream.Write(3);
                dataStream.Write(0);
                dataStream.Position = 0;
                _indexBuffer        = ToDispose(new Buffer(device, dataStream, sizeof(int) * 6, ResourceUsage.Default, BindFlags.IndexBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0));
            }

            // Create a texture sampler state description.
            var samplerDesc = new SamplerStateDescription()
            {
                //Filter = Filter.MinMagMipLinear,
                Filter             = Filter.MinMagMipPoint,
                AddressU           = TextureAddressMode.Wrap,
                AddressV           = TextureAddressMode.Wrap,
                AddressW           = TextureAddressMode.Wrap,
                MipLodBias         = 0,
                MaximumAnisotropy  = 1,
                ComparisonFunction = Comparison.Always,
                BorderColor        = new Color4(0, 0, 0, 0),
                MinimumLod         = 0,
                MaximumLod         = 0
            };

            // Create the texture sampler state.
            _sampleState = new SamplerState(device, samplerDesc);
        }