Exemplo n.º 1
0
        //-----------------------------------------------------------------------------
        // Name: RenderFullScreenQuad()
        // Desc: Render a quad at the specified tranformed depth
        //-----------------------------------------------------------------------------
        private void RenderFullScreenQuad(float fDepth)
        {
            ScreenVertex[] aVertices = new ScreenVertex[4];

            SurfaceDescription pBackBufferSurfaceDesc = device.GetBackBuffer(0, 0, BackBufferType.Mono).Description;

            aVertices[0].pos = new Vector4(-0.5f, -0.5f, fDepth, fDepth);
            aVertices[1].pos = new Vector4((float)pBackBufferSurfaceDesc.Width - 0.5f, -0.5f, fDepth, fDepth);
            aVertices[2].pos = new Vector4(-0.5f, (float)pBackBufferSurfaceDesc.Height - 0.5f, fDepth, fDepth);
            aVertices[3].pos = new Vector4((float)pBackBufferSurfaceDesc.Width - 0.5f, (float)pBackBufferSurfaceDesc.Height - 0.5f, fDepth, fDepth);

            aVertices[0].tCurr = new Vector2(0.0f, 0.0f);
            aVertices[1].tCurr = new Vector2(1.0f, 0.0f);
            aVertices[2].tCurr = new Vector2(0.0f, 1.0f);
            aVertices[3].tCurr = new Vector2(1.0f, 1.0f);

            for (int i = 0; i < 4; i++)
            {
                aVertices[i].tBack    = aVertices[i].tCurr;
                aVertices[i].tBack.X += (1.0f / (float)pBackBufferSurfaceDesc.Width);
                aVertices[i].tBack.Y += (1.0f / (float)pBackBufferSurfaceDesc.Height);
                aVertices[i].fSize    = 0.0f;
            }

            device.VertexFormat = ScreenVertexFormat;
            device.DrawUserPrimitives(PrimitiveType.TriangleStrip, 2, aVertices);
        }
Exemplo n.º 2
0
 public void WriteScreenVertex(ScreenVertex v)
 {
     _stream.WriteFloat2(v.Position);
     _stream.WriteFloat2(v.Texcoord);
     _stream.WriteColor(v.Color);
 }
Exemplo n.º 3
0
        private void RenderFullScreenQuad(float fDepth)
        {
            ScreenVertex[] aVertices = new ScreenVertex[4];

            SurfaceDescription pBackBufferSurfaceDesc = device.GetBackBuffer(0, 0, BackBufferType.Left).Description;

            aVertices[0].pos = new Vector4(-0.5f, -0.5f, fDepth, fDepth);
            aVertices[1].pos = new Vector4(pBackBufferSurfaceDesc.Width - 0.5f, -0.5f, fDepth, fDepth);
            aVertices[2].pos = new Vector4(-0.5f, pBackBufferSurfaceDesc.Height - 0.5f, fDepth, fDepth);
            aVertices[3].pos = new Vector4(pBackBufferSurfaceDesc.Width - 0.5f, pBackBufferSurfaceDesc.Height - 0.5f, fDepth, fDepth);

            aVertices[0].tCurr = new Vector2(0.0f, 0.0f);
            aVertices[1].tCurr = new Vector2(1.0f, 0.0f);
            aVertices[2].tCurr = new Vector2(0.0f, 1.0f);
            aVertices[3].tCurr = new Vector2(1.0f, 1.0f);

            for (int i = 0; i < 4; i++)
            {
                aVertices[i].tBack = aVertices[i].tCurr;
                aVertices[i].tBack.X += (1.0f / pBackBufferSurfaceDesc.Width);
                aVertices[i].tBack.Y += (1.0f / pBackBufferSurfaceDesc.Height);
                aVertices[i].fSize = 0.0f;
            }

            device.VertexFormat = ScreenVertexFormat;
            device.DrawUserPrimitives(PrimitiveType.TriangleStrip, 2, aVertices);
        }