예제 #1
0
//--------------------------------------------------------------------------------------
// Render the help and statistics text. This function uses the ID3DXFont interface for 
// efficient text rendering.
//--------------------------------------------------------------------------------------
void RenderText()
{
    CDXUTTextHelper txtHelper( g_pFont, g_pTextSprite, 15 );

    // Output statistics
    txtHelper.Begin();
    txtHelper.SetInsertionPos( 5, 5 );
    txtHelper.SetForegroundColor( D3DXCOLOR( 1.0f, 1.0f, 0.0f, 1.0f ) );
    txtHelper.DrawTextLine( DXUTGetFrameStats( DXUTIsVsyncEnabled() ) );
    txtHelper.DrawTextLine( DXUTGetDeviceStats() );

    txtHelper.SetForegroundColor( D3DXCOLOR( 1.0f, 1.0f, 1.0f, 1.0f ) );

    // Draw help
    const D3DSURFACE_DESC* pd3dsdBackBuffer = DXUTGetD3D9BackBufferSurfaceDesc();
    txtHelper.SetInsertionPos( 10, pd3dsdBackBuffer->Height - 15 * 6 );
    txtHelper.SetForegroundColor( D3DXCOLOR( 1.0f, 0.75f, 0.0f, 1.0f ) );
    txtHelper.DrawTextLine( L"Controls:" );
    txtHelper.SetInsertionPos( 40, pd3dsdBackBuffer->Height - 15 * 5 );
    txtHelper.DrawTextLine( L"Rotate model: Left mouse button\n"
                            L"Rotate camera: Right mouse button\n"
                            L"Zoom camera: Mouse wheel scroll\n"
                            L"Quit: ESC" );
    txtHelper.End();
}
예제 #2
0
void RenderText()
{
    const D3DSURFACE_DESC* pd3dsdBackBuffer = DXUTGetD3D9BackBufferSurfaceDesc();
    CDXUTTextHelper txtHelper(g_pFont, g_pTextSprite, 15);

    // Output statistics
    txtHelper.Begin();
    txtHelper.SetInsertionPos(5, 5);
    txtHelper.SetForegroundColor(D3DXCOLOR(1.0f, 1.0f, 0.0f, 1.0f));
    txtHelper.DrawTextLine(DXUTGetFrameStats());
    txtHelper.DrawTextLine(DXUTGetDeviceStats());

    txtHelper.SetForegroundColor(D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f));
    txtHelper.DrawTextLine(L"Put whatever misc status here");

    if(g_bShowHelp)
    {
        txtHelper.SetInsertionPos(10, pd3dsdBackBuffer->Height - 15 * 6);
        txtHelper.SetForegroundColor(D3DXCOLOR(1.0f, 0.75f, 0.0f, 1.0f));
        txtHelper.DrawTextLine(L"Controls (F1 to hide):");

        txtHelper.SetInsertionPos(40, pd3dsdBackBuffer->Height - 15 * 5);
        txtHelper.DrawTextLine(L"Blah: X\n"
                                L"Quit: ESC");
    }
    else
    {
        txtHelper.SetInsertionPos(10, pd3dsdBackBuffer->Height - 15 * 2);
        txtHelper.SetForegroundColor(D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f));
        txtHelper.DrawTextLine(L"Press F1 for help");
    }
    txtHelper.End();
}
예제 #3
0
static void RenderText()
{
    CDXUTTextHelper txtHelper( g_pFont10, g_pSprite10, 15 );
    txtHelper.Begin();
    txtHelper.SetInsertionPos( 5, 5 );
    txtHelper.SetForegroundColor( D3DXCOLOR( 1.0f, 0.0f, 0.0f, 1.0f ) );
    txtHelper.DrawTextLine( DXUTGetFrameStats(true) );
    txtHelper.DrawTextLine( DXUTGetDeviceStats() );
	txtHelper.DrawTextLine( L"use W A S D Q E to move camera, uncheck MoveCamera and then use UP DOWN LEFT RIGHT R F to move light" );
    txtHelper.End();
}
예제 #4
0
//--------------------------------------------------------------------------------------
// Render the help and statistics text. This function uses the ID3DXFont interface for 
// efficient text rendering.
//--------------------------------------------------------------------------------------
void RenderText()
{
	static WCHAR buffer[255];
    CDXUTTextHelper txtHelper( g_pFont, g_pTextSprite, 15 );

    // Output statistics
    txtHelper.Begin();
    txtHelper.SetInsertionPos(5, 5);
    txtHelper.SetForegroundColor(D3DXCOLOR( 1.0f, 1.0f, 0.0f, 1.0f ));
    txtHelper.DrawTextLine(DXUTGetFrameStats(true));
    txtHelper.DrawTextLine(DXUTGetDeviceStats());
//	swprintf_s(buffer, 256, L"window I= %d, J= %d", g_CurrPatch.GetI(), g_CurrPatch.GetJ());
//	txtHelper.DrawTextLine(buffer);
    txtHelper.End();
}
예제 #5
0
//--------------------------------------------------------------------------------------
// Render the help and statistics text. This function uses the ID3DXFont interface for 
// efficient text rendering.
//--------------------------------------------------------------------------------------
void RenderText(double fTime)
{
	// The helper object simply helps keep track of text position, and color
	// and then it calls pFont->DrawText(m_pSprite, strMsg, -1, &rc, DT_NOCLIP, m_clr);
	// If NULL is passed in as the sprite object, then it will work fine however the 
	// pFont->DrawText() will not be batched together.  Batching calls will improves perf.
	CDXUTTextHelper txtHelper(g_pFont, g_pSprite, 15);

	// Output statistics
	txtHelper.Begin();
	txtHelper.SetInsertionPos(2, 0);
	txtHelper.SetForegroundColor(D3DXCOLOR(1.0f, 1.0f, 0.0f, 1.0f));
	txtHelper.DrawTextLine(DXUTGetFrameStats(DXUTIsVsyncEnabled()));
	txtHelper.End();
}
예제 #6
0
파일: CustomUI.cpp 프로젝트: KNeal/Oculus
//--------------------------------------------------------------------------------------
// Render the help and statistics text. This function uses the ID3DXFont interface for 
// efficient text rendering.
//--------------------------------------------------------------------------------------
void RenderText()
{
    CDXUTTextHelper txtHelper( g_pFont, g_pTextSprite, 15 );

    // Output statistics
    txtHelper.Begin();
    txtHelper.SetInsertionPos( 5, 5 );
    txtHelper.SetForegroundColor( D3DXCOLOR( 1.0f, 1.0f, 0.0f, 1.0f ) );
    txtHelper.DrawTextLine( DXUTGetFrameStats( DXUTIsVsyncEnabled() ) );
    txtHelper.DrawTextLine( DXUTGetDeviceStats() );
    txtHelper.SetForegroundColor( D3DXCOLOR( 1.0f, 1.0f, 1.0f, 1.0f ) );
    txtHelper.SetForegroundColor( D3DXCOLOR( 1.0f, 1.0f, 1.0f, 1.0f ) );
    txtHelper.DrawTextLine( L"Press ESC to quit" );
    txtHelper.End();
}
void RenderText( IDirect3DDevice9Ex* pDev )
{
    // The helper object simply helps keep track of text position, and color
    // and then it calls pFont->DrawText( m_pSprite, strMsg, -1, &rc, DT_NOCLIP, m_clr );
    // If NULL is passed in as the sprite object, then it will work fine however the 
    // pFont->DrawText() will not be batched together.  Batching calls will improves perf.
    CTextHelper txtHelper( g_pFont, g_pSprite, 15 );

    // Output statistics
    txtHelper.Begin();
    txtHelper.SetInsertionPos( 2, 0 );
    txtHelper.SetForegroundColor( D3DXCOLOR( 1.0f, 1.0f, 0.0f, 1.0f ) );
    txtHelper.DrawTextLine( L"This sample demonstrates rendering a cursor indepedently of geometry." );
    txtHelper.DrawTextLine( L"The scene (cubes in this case) is drawn by a D3D9Ex device that runs" );
    txtHelper.DrawTextLine( L"in a lower priority background thread.  The image is copied to a shared" );
    txtHelper.DrawTextLine( L"surface.  The main application thread contains a D3D9Ex device as well." );
    txtHelper.DrawTextLine( L"This thread runs at a higher priority and composites the shared image" );
    txtHelper.DrawTextLine( L"with a D3D9Ex drawn cursor and text in real time.  This allows for" );
    txtHelper.DrawTextLine( L"fluid cursor and text updates even when the scene is too complex to be" );
    txtHelper.DrawTextLine( L"handled in real-time." );

    txtHelper.SetForegroundColor( D3DXCOLOR( 1.0f, 0.0f, 0.0f, 1.0f ) );
    txtHelper.DrawTextLine( L"" );
    txtHelper.DrawTextLine( L"Press the UP arrow key to increase the scene complexity." );
    txtHelper.DrawTextLine( L"Press the DOWN arrow key to decrease the scene complexity." );
    txtHelper.DrawTextLine( L"" );
    txtHelper.DrawTextLine( L"Try increasing the Number of Cubes to a very high number.  The cubes will" );
    txtHelper.DrawTextLine( L"update slowly, but the cursor will still be responsive." );
    txtHelper.SetForegroundColor( D3DXCOLOR( 1.0f, 1.0f, 1.0f, 1.0f ) );
    txtHelper.DrawTextLine( L"" );
    txtHelper.DrawFormattedTextLine( L"Number of Cubes: %d", g_cubeCount*g_cubeCount );

    // get stats from the background thread
    float FPS = GetFPS();
    txtHelper.SetForegroundColor( D3DXCOLOR( 0.0f, 1.0f, 0.0f, 1.0f ) );
    txtHelper.DrawTextLine( L"" );
    txtHelper.DrawTextLine( L"Background Thread:" );
    txtHelper.DrawFormattedTextLine( L"FPS: %0.2f", FPS );
    txtHelper.DrawTextLine( L"" );
    txtHelper.DrawTextLine( L"Foreground Thread:" );
    txtHelper.DrawFormattedTextLine( L"FPS: %0.2f", 1.0f / g_fLastFrameTime );
    txtHelper.DrawFormattedTextLine( L"Present Count: %d", g_PresentStats.PresentCount );
    txtHelper.DrawFormattedTextLine( L"Present Refresh Count: %d", g_PresentStats.PresentRefreshCount );
    txtHelper.DrawFormattedTextLine( L"Sync Refresh Count: %d", g_PresentStats.SyncRefreshCount );

    txtHelper.End();
}
예제 #8
0
void MyRenderText(WCHAR ** StrList, int NumStr)
{
//    const D3DSURFACE_DESC* pd3dsdBackBuffer = DXUTGetBackBufferSurfaceDesc();
    CDXUTTextHelper txtHelper( g_pFont, g_pTextSprite, 15 );

    // Output statistics
    txtHelper.Begin();
    txtHelper.SetForegroundColor( D3DXCOLOR( 1.0f, 1.0f, 0.0f, 1.0f ) );

	for (int i = 0; i < NumStr; i++)
	{
		txtHelper.SetInsertionPos( 5, 5 + i * 15);
		txtHelper.DrawTextLine( *(StrList++) );
	}

	txtHelper.End();
}
예제 #9
0
//--------------------------------------------------------------------------------------
// Render the help and statistics text. This function uses the ID3DXFont interface for 
// efficient text rendering.
//--------------------------------------------------------------------------------------
void RenderText()
{
    // The helper object simply helps keep track of text position, and color
    // and then it calls pFont->DrawText( m_pSprite, strMsg, -1, &rc, DT_NOCLIP, m_clr );
    // If NULL is passed in as the sprite object, then it will work however the 
    // pFont->DrawText() will not be batched together.  Batching calls will improves performance.
    CDXUTTextHelper txtHelper( g_pFont, g_pTextSprite, 15 );

    // Output statistics
    txtHelper.Begin();
    txtHelper.SetInsertionPos( 5, 5 );
    txtHelper.SetForegroundColor( D3DXCOLOR( 1.0f, 1.0f, 0.0f, 1.0f ) );
    txtHelper.DrawTextLine( DXUTGetFrameStats( DXUTIsVsyncEnabled() ) );
    txtHelper.DrawTextLine( DXUTGetDeviceStats() );

    txtHelper.SetForegroundColor( D3DXCOLOR( 1.0f, 1.0f, 1.0f, 1.0f ) );
    txtHelper.DrawTextLine( g_strFileSaveMessage );

    // Draw help
    if( g_bShowHelp )
    {
        const D3DSURFACE_DESC* pd3dsdBackBuffer = DXUTGetD3D9BackBufferSurfaceDesc();
        txtHelper.SetInsertionPos( 10, pd3dsdBackBuffer->Height - 15 * 5 );
        txtHelper.SetForegroundColor( D3DCOLOR_ARGB( 200, 50, 50, 50 ) );
        txtHelper.DrawTextLine( L"Controls (F1 to hide):" );

        txtHelper.SetInsertionPos( 20, pd3dsdBackBuffer->Height - 15 * 4 );
        txtHelper.DrawTextLine( L"Rotate model: Left mouse button\n"
                                L"Rotate camera: Right mouse button\n"
                                L"Zoom camera: Mouse wheel scroll\n" );

        txtHelper.SetInsertionPos( 250, pd3dsdBackBuffer->Height - 15 * 4 );
        txtHelper.DrawTextLine( L"Hide help: F1\n" );
        txtHelper.DrawTextLine( L"Quit: ESC\n" );
    }
    else
    {
        txtHelper.SetForegroundColor( D3DXCOLOR( 1.0f, 1.0f, 1.0f, 1.0f ) );
        txtHelper.DrawTextLine( L"Press F1 for help" );
    }

    txtHelper.End();
}
예제 #10
0
//--------------------------------------------------------------------------------------
// Render the help and statistics text. This function uses the ID3DXFont interface for 
// efficient text rendering.
//--------------------------------------------------------------------------------------
void RenderText()
{
    // The helper object simply helps keep track of text position, and color
    // and then it calls pFont->DrawText( m_pSprite, strMsg, -1, &rc, DT_NOCLIP, m_clr );
    // If NULL is passed in as the sprite object, then it will work however the 
    // pFont->DrawText() will not be batched together.  Batching calls will improves performance.
    const D3DSURFACE_DESC* pd3dsdBackBuffer = DXUTGetD3D9BackBufferSurfaceDesc();
    CDXUTTextHelper txtHelper( g_pFont, g_pTextSprite, 15 );

    // Output statistics
    txtHelper.Begin();
    txtHelper.SetInsertionPos( 5, 5 );
    txtHelper.SetForegroundColor( D3DXCOLOR( 1.0f, 1.0f, 0.0f, 1.0f ) );
    txtHelper.DrawTextLine( DXUTGetFrameStats( DXUTIsVsyncEnabled() ) );
    txtHelper.DrawTextLine( DXUTGetDeviceStats() );

    // Draw help
    if( g_bShowHelp )
    {
        txtHelper.SetInsertionPos( 10, pd3dsdBackBuffer->Height - 15 * 8 );
        txtHelper.SetForegroundColor( D3DXCOLOR( 1.0f, 0.75f, 0.0f, 1.0f ) );
        txtHelper.DrawTextLine( L"Controls (F1 to hide):" );

        txtHelper.SetInsertionPos( 40, pd3dsdBackBuffer->Height - 15 * 7 );
        txtHelper.DrawTextLine( L"Rotate Model: Left Mouse" );
        txtHelper.DrawTextLine( L"Rotate Light: Middle Mouse" );
        txtHelper.DrawTextLine( L"Rotate Camera and Model: Right Mouse" );
        txtHelper.DrawTextLine( L"Rotate Camera: Ctrl + Right Mouse" );
        txtHelper.DrawTextLine( L"Wireframe: W" );
        txtHelper.DrawTextLine( L"Quit: ESC" );
    }
    else
    {
        txtHelper.SetInsertionPos( 10, pd3dsdBackBuffer->Height - 15 * 2 );
        txtHelper.SetForegroundColor( D3DXCOLOR( 1.0f, 1.0f, 1.0f, 1.0f ) );
        txtHelper.DrawTextLine( L"Press F1 for help" );
    }
    txtHelper.End();
}
예제 #11
0
//--------------------------------------------------------------------------------------
//  DisplaySteps( )
//
//      DESC:
//          Part of the GUI in this application displays the four stages that make up
//          the post-processing stage of the HDR rendering pipeline. This function
//          is responsible for making sure that each stage is drawn as expected.
//
//      PARAMS:
//          pDevice     : The device to be drawn to.
//          pFont       : The font used to annotate the display
//          pTextSprite : Used to improve the performance of text rendering
//          pArrowTex   : Stores the 4 (up/down/left/right) icons used in the GUI
//
//      NOTES:
//          n/a
//
//--------------------------------------------------------------------------------------
HRESULT DisplaySteps( IDirect3DDevice9* pDevice, ID3DXFont* pFont, ID3DXSprite* pTextSprite,
                      IDirect3DTexture9* pArrowTex )
{

    // [ 0 ] COMMON INITIALIZATION
    //----------------------------

    LPDIRECT3DSURFACE9 pSurf = NULL;
    D3DSURFACE_DESC d;
    if( FAILED( pDevice->GetRenderTarget( 0, &pSurf ) ) )
    {

        // Couldn't get the current render target!
        OutputDebugString(
            L"PostProcess::DisplaySteps() - Could not get current render target to extract dimensions.\n" );
        return E_FAIL;

    }

    pSurf->GetDesc( &d );
    SAFE_RELEASE( pSurf );

    // Cache the dimensions as floats for later use
    float fW = static_cast< float >( d.Width );
    float fH = static_cast< float >( d.Height );

    float fCellW = ( fW - 48.0f ) / 4.0f;
    float fCellH = ( fH - 36.0f ) / 4.0f;

    // Fill out the basic TLQuad information - this
    // stuff doesn't change for each stage
    PostProcess::TLVertex v[4];
    v[0].t = D3DXVECTOR2( 0.0f, 0.0f );
    v[1].t = D3DXVECTOR2( 1.0f, 0.0f );
    v[2].t = D3DXVECTOR2( 0.0f, 1.0f );
    v[3].t = D3DXVECTOR2( 1.0f, 1.0f );

    // Configure the device for it's basic states
    pDevice->SetVertexShader( NULL );
    pDevice->SetFVF( FVF_TLVERTEX );
    pDevice->SetPixelShader( NULL );

    CDXUTTextHelper txtHelper( pFont, pTextSprite, 12 );
    txtHelper.SetForegroundColor( D3DXCOLOR( 1.0f, 0.5f, 0.0f, 1.0f ) );


    // [ 1 ] RENDER BRIGHT PASS STAGE
    //-------------------------------
    v[0].p = D3DXVECTOR4( 0.0f, 0.0f, 0.0f, 1.0f );
    v[1].p = D3DXVECTOR4( fCellW, 0.0f, 0.0f, 1.0f );
    v[2].p = D3DXVECTOR4( 0.0f, fCellH, 0.0f, 1.0f );
    v[3].p = D3DXVECTOR4( fCellW, fCellH, 0.0f, 1.0f );

    pDevice->SetTexture( 0, PostProcess::g_pBrightPassTex );
    pDevice->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, 2, v, sizeof( PostProcess::TLVertex ) );

    txtHelper.Begin();
    {
        txtHelper.SetInsertionPos( 5, static_cast< int >( fCellH - 25.0f ) );
        txtHelper.DrawTextLine( L"Bright-Pass" );

        D3DSURFACE_DESC d2;
        PostProcess::g_pBrightPassTex->GetLevelDesc( 0, &d2 );

        WCHAR str[100];
        swprintf_s( str, 100, L"%dx%d", d2.Width, d2.Height );
        txtHelper.DrawTextLine( str );
    }
    txtHelper.End();

    // [ 2 ] RENDER DOWNSAMPLED STAGE
    //-------------------------------
    v[0].p = D3DXVECTOR4( fCellW + 16.0f, 0.0f, 0.0f, 1.0f );
    v[1].p = D3DXVECTOR4( ( 2.0f * fCellW ) + 16.0f, 0.0f, 0.0f, 1.0f );
    v[2].p = D3DXVECTOR4( fCellW + 16.0f, fCellH, 0.0f, 1.0f );
    v[3].p = D3DXVECTOR4( ( 2.0f * fCellW ) + 16.0f, fCellH, 0.0f, 1.0f );

    pDevice->SetTexture( 0, PostProcess::g_pDownSampledTex );
    pDevice->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, 2, v, sizeof( PostProcess::TLVertex ) );

    txtHelper.Begin();
    {
        txtHelper.SetInsertionPos( static_cast< int >( fCellW + 16.0f ) + 5, static_cast< int >( fCellH - 25.0f ) );
        txtHelper.DrawTextLine( L"Down-Sampled" );

        D3DSURFACE_DESC d;
        PostProcess::g_pDownSampledTex->GetLevelDesc( 0, &d );

        WCHAR str[100];
        swprintf_s( str, 100, L"%dx%d", d.Width, d.Height );
        txtHelper.DrawTextLine( str );
    }
    txtHelper.End();

    // [ 3 ] RENDER HORIZONTAL BLUR STAGE
    //-----------------------------------
    v[0].p = D3DXVECTOR4( ( 2.0f * fCellW ) + 32.0f, 0.0f, 0.0f, 1.0f );
    v[1].p = D3DXVECTOR4( ( 3.0f * fCellW ) + 32.0f, 0.0f, 0.0f, 1.0f );
    v[2].p = D3DXVECTOR4( ( 2.0f * fCellW ) + 32.0f, fCellH, 0.0f, 1.0f );
    v[3].p = D3DXVECTOR4( ( 3.0f * fCellW ) + 32.0f, fCellH, 0.0f, 1.0f );

    pDevice->SetTexture( 0, PostProcess::g_pBloomHorizontal );
    pDevice->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, 2, v, sizeof( PostProcess::TLVertex ) );

    txtHelper.Begin();
    {
        txtHelper.SetInsertionPos( static_cast< int >( 2.0f * fCellW + 32.0f ) + 5,
                                   static_cast< int >( fCellH - 25.0f ) );
        txtHelper.DrawTextLine( L"Horizontal Blur" );

        D3DSURFACE_DESC d;
        PostProcess::g_pBloomHorizontal->GetLevelDesc( 0, &d );

        WCHAR str[100];
        swprintf_s( str, 100, L"%dx%d", d.Width, d.Height );
        txtHelper.DrawTextLine( str );
    }
    txtHelper.End();

    // [ 4 ] RENDER VERTICAL BLUR STAGE
    //---------------------------------
    v[0].p = D3DXVECTOR4( ( 3.0f * fCellW ) + 48.0f, 0.0f, 0.0f, 1.0f );
    v[1].p = D3DXVECTOR4( ( 4.0f * fCellW ) + 48.0f, 0.0f, 0.0f, 1.0f );
    v[2].p = D3DXVECTOR4( ( 3.0f * fCellW ) + 48.0f, fCellH, 0.0f, 1.0f );
    v[3].p = D3DXVECTOR4( ( 4.0f * fCellW ) + 48.0f, fCellH, 0.0f, 1.0f );

    pDevice->SetTexture( 0, PostProcess::g_pBloomVertical );
    pDevice->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, 2, v, sizeof( PostProcess::TLVertex ) );

    txtHelper.Begin();
    {
        txtHelper.SetInsertionPos( static_cast< int >( 3.0f * fCellW + 48.0f ) + 5,
                                   static_cast< int >( fCellH - 25.0f ) );
        txtHelper.DrawTextLine( L"Vertical Blur" );

        D3DSURFACE_DESC d;
        PostProcess::g_pDownSampledTex->GetLevelDesc( 0, &d );

        WCHAR str[100];
        swprintf_s( str, 100, L"%dx%d", d.Width, d.Height );
        txtHelper.DrawTextLine( str );
    }
    txtHelper.End();


    // [ 5 ] RENDER ARROWS
    //--------------------
    pDevice->SetTexture( 0, pArrowTex );

    // Locate the "Left" Arrow:

    v[0].t = D3DXVECTOR2( 0.25f, 0.0f );
    v[1].t = D3DXVECTOR2( 0.50f, 0.0f );
    v[2].t = D3DXVECTOR2( 0.25f, 1.0f );
    v[3].t = D3DXVECTOR2( 0.50f, 1.0f );

    // Bright-Pass -> Down Sampled:

    v[0].p = D3DXVECTOR4( fCellW, ( fCellH / 2.0f ) - 8.0f, 0.0f, 1.0f );
    v[1].p = D3DXVECTOR4( fCellW + 16.0f, ( fCellH / 2.0f ) - 8.0f, 0.0f, 1.0f );
    v[2].p = D3DXVECTOR4( fCellW, ( fCellH / 2.0f ) + 8.0f, 0.0f, 1.0f );
    v[3].p = D3DXVECTOR4( fCellW + 16.0f, ( fCellH / 2.0f ) + 8.0f, 0.0f, 1.0f );

    pDevice->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, 2, v, sizeof( PostProcess::TLVertex ) );

    // Down Sampled -> Horizontal Blur:

    v[0].p = D3DXVECTOR4( ( 2.0f * fCellW ) + 16.0f, ( fCellH / 2.0f ) - 8.0f, 0.0f, 1.0f );
    v[1].p = D3DXVECTOR4( ( 2.0f * fCellW ) + 32.0f, ( fCellH / 2.0f ) - 8.0f, 0.0f, 1.0f );
    v[2].p = D3DXVECTOR4( ( 2.0f * fCellW ) + 16.0f, ( fCellH / 2.0f ) + 8.0f, 0.0f, 1.0f );
    v[3].p = D3DXVECTOR4( ( 2.0f * fCellW ) + 32.0f, ( fCellH / 2.0f ) + 8.0f, 0.0f, 1.0f );

    pDevice->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, 2, v, sizeof( PostProcess::TLVertex ) );

    // Horizontal Blur -> Vertical Blur:

    v[0].p = D3DXVECTOR4( ( 3.0f * fCellW ) + 32.0f, ( fCellH / 2.0f ) - 8.0f, 0.0f, 1.0f );
    v[1].p = D3DXVECTOR4( ( 3.0f * fCellW ) + 48.0f, ( fCellH / 2.0f ) - 8.0f, 0.0f, 1.0f );
    v[2].p = D3DXVECTOR4( ( 3.0f * fCellW ) + 32.0f, ( fCellH / 2.0f ) + 8.0f, 0.0f, 1.0f );
    v[3].p = D3DXVECTOR4( ( 3.0f * fCellW ) + 48.0f, ( fCellH / 2.0f ) + 8.0f, 0.0f, 1.0f );

    pDevice->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, 2, v, sizeof( PostProcess::TLVertex ) );

    // Locate the "Down" arrow:

    v[0].t = D3DXVECTOR2( 0.50f, 0.0f );
    v[1].t = D3DXVECTOR2( 0.75f, 0.0f );
    v[2].t = D3DXVECTOR2( 0.50f, 1.0f );
    v[3].t = D3DXVECTOR2( 0.75f, 1.0f );

    // Vertical Blur -> Final Image Composition:

    v[0].p = D3DXVECTOR4( ( 3.5f * fCellW ) + 40.0f, fCellH, 0.0f, 1.0f );
    v[1].p = D3DXVECTOR4( ( 3.5f * fCellW ) + 56.0f, fCellH, 0.0f, 1.0f );
    v[2].p = D3DXVECTOR4( ( 3.5f * fCellW ) + 40.0f, fCellH + 16.0f, 0.0f, 1.0f );
    v[3].p = D3DXVECTOR4( ( 3.5f * fCellW ) + 56.0f, fCellH + 16.0f, 0.0f, 1.0f );

    pDevice->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, 2, v, sizeof( PostProcess::TLVertex ) );

    return S_OK;

}
예제 #12
0
파일: Luminance.cpp 프로젝트: KNeal/Oculus
//--------------------------------------------------------------------------------------
//  DisplayLuminance( )
//
//      DESC:
//          This function is for presentation purposes only - and isn't a *required*
//          part of the HDR rendering pipeline. It draws the 6 stages of the luminance
//          calculation to the appropriate part of the screen.
//
//      PARAMS:
//          pDevice     : The device to be rendered to.
//          pFont       : The font to use when adding the annotations
//          pTextSprite : Used to improve performance of the text rendering
//          pArrowTex   : Stores the 4 (up/down/left/right) icons used in the GUI
//
//      NOTES:
//          This code uses several hard-coded ratios to position the elements correctly
//          - as such, changing the underlying diagram may well break this code.
//
//--------------------------------------------------------------------------------------
HRESULT DisplayLuminance( IDirect3DDevice9* pDevice, ID3DXFont* pFont, ID3DXSprite* pTextSprite,
                          IDirect3DTexture9* pArrowTex )
{

    // [ 0 ] COMMON INITIALIZATION
    //----------------------------

    LPDIRECT3DSURFACE9 pSurf = NULL;
    D3DSURFACE_DESC d;

    if( FAILED( pDevice->GetRenderTarget( 0, &pSurf ) ) )
    {

        // Couldn't get the current render target!
        OutputDebugString(
            L"Luminance::DisplayLuminance() - Could not get current render target to extract dimensions.\n" );
        return E_FAIL;

    }

    pSurf->GetDesc( &d );
    SAFE_RELEASE( pSurf );

    // Cache the dimensions as floats for later use
    float fW = static_cast< float >( d.Width );
    float fH = static_cast< float >( d.Height );
    float fCellH = ( fH - 36.0f ) / 4.0f;
    float fCellW = ( fW - 48.0f ) / 4.0f;
    float fLumCellSize = ( ( fH - ( ( 2.0f * fCellH ) + 32.0f ) ) - 32.0f ) / 3.0f;
    float fLumStartX = ( fCellW + 16.0f ) - ( ( 2.0f * fLumCellSize ) + 32.0f );

    // Fill out the basic TLQuad information - this
    // stuff doesn't change for each stage
    Luminance::TLVertex v[4];
    v[0].t = D3DXVECTOR2( 0.0f, 0.0f );
    v[1].t = D3DXVECTOR2( 1.0f, 0.0f );
    v[2].t = D3DXVECTOR2( 0.0f, 1.0f );
    v[3].t = D3DXVECTOR2( 1.0f, 1.0f );

    // Configure the device for it's basic states
    pDevice->SetVertexShader( NULL );
    pDevice->SetFVF( FVF_TLVERTEX );
    pDevice->SetPixelShader( g_pLumDispPS );

    CDXUTTextHelper txtHelper( pFont, pTextSprite, 12 );
    txtHelper.SetForegroundColor( D3DXCOLOR( 1.0f, 0.5f, 0.0f, 1.0f ) );

    // [ 1 ] RENDER FIRST LEVEL
    //-------------------------
    v[0].p = D3DXVECTOR4( fLumStartX, ( 2.0f * fCellH ) + 32.0f, 0.0f, 1.0f );
    v[1].p = D3DXVECTOR4( fLumStartX + fLumCellSize, ( 2.0f * fCellH ) + 32.0f, 0.0f, 1.0f );
    v[2].p = D3DXVECTOR4( fLumStartX, ( 2.0f * fCellH ) + 32.0f + fLumCellSize, 0.0f, 1.0f );
    v[3].p = D3DXVECTOR4( fLumStartX + fLumCellSize, ( 2.0f * fCellH ) + 32.0f + fLumCellSize, 0.0f, 1.0f );

    pDevice->SetTexture( 0, Luminance::g_pTexLuminance[ 5 ] );
    pDevice->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, 2, v, sizeof( Luminance::TLVertex ) );

    txtHelper.Begin();
    {
        txtHelper.SetInsertionPos( static_cast< int >( fLumStartX ) + 2,
                                   static_cast< int >( ( 2.0f * fCellH ) + 32.0f + fLumCellSize ) - 24 );
        txtHelper.DrawTextLine( L"1st Luminance" );

        D3DSURFACE_DESC d2;
        Luminance::g_pTexLuminance[ 5 ]->GetLevelDesc( 0, &d2 );

        WCHAR str[100];
        swprintf_s( str, 100, L"%dx%d", d2.Width, d2.Height );
        txtHelper.DrawTextLine( str );
    }
    txtHelper.End();


    // [ 2 ] RENDER SECOND LEVEL
    //--------------------------
    v[0].p = D3DXVECTOR4( fLumStartX, ( 2.0f * fCellH ) + 48.0f + fLumCellSize, 0.0f, 1.0f );
    v[1].p = D3DXVECTOR4( fLumStartX + fLumCellSize, ( 2.0f * fCellH ) + 48.0f + fLumCellSize, 0.0f, 1.0f );
    v[2].p = D3DXVECTOR4( fLumStartX, ( 2.0f * fCellH ) + 48.0f + ( 2.0f * fLumCellSize ), 0.0f, 1.0f );
    v[3].p = D3DXVECTOR4( fLumStartX + fLumCellSize, ( 2.0f * fCellH ) + 48.0f + ( 2.0f * fLumCellSize ), 0.0f, 1.0f );

    pDevice->SetTexture( 0, Luminance::g_pTexLuminance[ 4 ] );
    pDevice->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, 2, v, sizeof( Luminance::TLVertex ) );

    txtHelper.Begin();
    {
        txtHelper.SetInsertionPos( static_cast< int >( fLumStartX ) + 2,
                                   static_cast< int >( ( 2.0f * fCellH ) + 48.0f + ( 2.0f * fLumCellSize ) ) - 24 );
        txtHelper.DrawTextLine( L"2nd Luminance" );

        D3DSURFACE_DESC d;
        Luminance::g_pTexLuminance[ 4 ]->GetLevelDesc( 0, &d );

        WCHAR str[100];
        swprintf_s( str, 100, L"%dx%d", d.Width, d.Height );
        txtHelper.DrawTextLine( str );
    }
    txtHelper.End();

    // [ 3 ] RENDER THIRD LEVEL
    //-------------------------
    v[0].p = D3DXVECTOR4( fLumStartX, ( 2.0f * fCellH ) + 64.0f + ( 2.0f * fLumCellSize ), 0.0f, 1.0f );
    v[1].p = D3DXVECTOR4( fLumStartX + fLumCellSize, ( 2.0f * fCellH ) + 64.0f + ( 2.0f * fLumCellSize ), 0.0f, 1.0f );
    v[2].p = D3DXVECTOR4( fLumStartX, ( 2.0f * fCellH ) + 64.0f + ( 3.0f * fLumCellSize ), 0.0f, 1.0f );
    v[3].p = D3DXVECTOR4( fLumStartX + fLumCellSize, ( 2.0f * fCellH ) + 64.0f + ( 3.0f * fLumCellSize ), 0.0f, 1.0f );

    pDevice->SetTexture( 0, Luminance::g_pTexLuminance[ 3 ] );
    pDevice->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, 2, v, sizeof( Luminance::TLVertex ) );

    txtHelper.Begin();
    {
        txtHelper.SetInsertionPos( static_cast< int >( fLumStartX ) + 2,
                                   static_cast< int >( ( 2.0f * fCellH ) + 64.0f + ( 3.0f * fLumCellSize ) ) - 24 );
        txtHelper.DrawTextLine( L"3rd Luminance" );

        D3DSURFACE_DESC d;
        Luminance::g_pTexLuminance[ 3 ]->GetLevelDesc( 0, &d );

        WCHAR str[100];
        swprintf_s( str, 100, L"%dx%d", d.Width, d.Height );
        txtHelper.DrawTextLine( str );
    }
    txtHelper.End();

    // [ 4 ] RENDER FOURTH LEVEL
    //--------------------------
    v[0].p = D3DXVECTOR4( fLumStartX + fLumCellSize + 16.0f, ( 2.0f * fCellH ) + 64.0f + ( 2.0f * fLumCellSize ), 0.0f,
                          1.0f );
    v[1].p = D3DXVECTOR4( fLumStartX + ( 2.0f * fLumCellSize ) + 16.0f, ( 2.0f * fCellH ) + 64.0f +
                          ( 2.0f * fLumCellSize ), 0.0f, 1.0f );
    v[2].p = D3DXVECTOR4( fLumStartX + fLumCellSize + 16.0f, ( 2.0f * fCellH ) + 64.0f + ( 3.0f * fLumCellSize ), 0.0f,
                          1.0f );
    v[3].p = D3DXVECTOR4( fLumStartX + ( 2.0f * fLumCellSize ) + 16.0f, ( 2.0f * fCellH ) + 64.0f +
                          ( 3.0f * fLumCellSize ), 0.0f, 1.0f );

    pDevice->SetTexture( 0, Luminance::g_pTexLuminance[ 2 ] );
    pDevice->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, 2, v, sizeof( Luminance::TLVertex ) );

    txtHelper.Begin();
    {
        txtHelper.SetInsertionPos( static_cast< int >( fLumStartX + fLumCellSize + 16.0f ) + 2,
                                   static_cast< int >( ( 2.0f * fCellH ) + 64.0f + ( 3.0f * fLumCellSize ) ) - 24 );
        txtHelper.DrawTextLine( L"4th Luminance" );

        D3DSURFACE_DESC d;
        Luminance::g_pTexLuminance[ 2 ]->GetLevelDesc( 0, &d );

        WCHAR str[100];
        swprintf_s( str, 100, L"%dx%d", d.Width, d.Height );
        txtHelper.DrawTextLine( str );
    }
    txtHelper.End();

    // [ 5 ] RENDER FIFTH LEVEL
    //--------------------------
    v[0].p = D3DXVECTOR4( fLumStartX + fLumCellSize + 16.0f, ( 2.0f * fCellH ) + 48.0f + ( 1.0f * fLumCellSize ), 0.0f,
                          1.0f );
    v[1].p = D3DXVECTOR4( fLumStartX + ( 2.0f * fLumCellSize ) + 16.0f, ( 2.0f * fCellH ) + 48.0f +
                          ( 1.0f * fLumCellSize ), 0.0f, 1.0f );
    v[2].p = D3DXVECTOR4( fLumStartX + fLumCellSize + 16.0f, ( 2.0f * fCellH ) + 48.0f + ( 2.0f * fLumCellSize ), 0.0f,
                          1.0f );
    v[3].p = D3DXVECTOR4( fLumStartX + ( 2.0f * fLumCellSize ) + 16.0f, ( 2.0f * fCellH ) + 48.0f +
                          ( 2.0f * fLumCellSize ), 0.0f, 1.0f );

    pDevice->SetTexture( 0, Luminance::g_pTexLuminance[ 1 ] );
    pDevice->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, 2, v, sizeof( Luminance::TLVertex ) );

    txtHelper.Begin();
    {
        txtHelper.SetInsertionPos( static_cast< int >( fLumStartX + fLumCellSize + 16.0f ) + 2,
                                   static_cast< int >( ( 2.0f * fCellH ) + 48.0f + ( 2.0f * fLumCellSize ) ) - 24 );
        txtHelper.DrawTextLine( L"5th Luminance" );

        D3DSURFACE_DESC d;
        Luminance::g_pTexLuminance[ 1 ]->GetLevelDesc( 0, &d );

        WCHAR str[100];
        swprintf_s( str, 100, L"%dx%d", d.Width, d.Height );
        txtHelper.DrawTextLine( str );
    }
    txtHelper.End();

    // [ 6 ] RENDER SIXTH LEVEL
    //--------------------------
    v[0].p = D3DXVECTOR4( fLumStartX + fLumCellSize + 16.0f, ( 2.0f * fCellH ) + 32.0f + ( 0.0f * fLumCellSize ), 0.0f,
                          1.0f );
    v[1].p = D3DXVECTOR4( fLumStartX + ( 2.0f * fLumCellSize ) + 16.0f, ( 2.0f * fCellH ) + 32.0f +
                          ( 0.0f * fLumCellSize ), 0.0f, 1.0f );
    v[2].p = D3DXVECTOR4( fLumStartX + fLumCellSize + 16.0f, ( 2.0f * fCellH ) + 32.0f + ( 1.0f * fLumCellSize ), 0.0f,
                          1.0f );
    v[3].p = D3DXVECTOR4( fLumStartX + ( 2.0f * fLumCellSize ) + 16.0f, ( 2.0f * fCellH ) + 32.0f +
                          ( 1.0f * fLumCellSize ), 0.0f, 1.0f );

    pDevice->SetTexture( 0, Luminance::g_pTexLuminance[ 0 ] );
    pDevice->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, 2, v, sizeof( Luminance::TLVertex ) );

    txtHelper.Begin();
    {
        txtHelper.SetInsertionPos( static_cast< int >( fLumStartX + fLumCellSize + 16.0f ) + 2,
                                   static_cast< int >( ( 2.0f * fCellH ) + 32.0f + ( 1.0f * fLumCellSize ) ) - 24 );
        txtHelper.DrawTextLine( L"6th Luminance" );

        D3DSURFACE_DESC d;
        Luminance::g_pTexLuminance[ 0 ]->GetLevelDesc( 0, &d );

        WCHAR str[100];
        swprintf_s( str, 100, L"%dx%d", d.Width, d.Height );
        txtHelper.DrawTextLine( str );
    }
    txtHelper.End();

    // [ 7 ] RENDER ARROWS
    //--------------------
    pDevice->SetPixelShader( NULL );
    pDevice->SetTexture( 0, pArrowTex );

    // Select the "down" arrow

    v[0].t = D3DXVECTOR2( 0.50f, 0.0f );
    v[1].t = D3DXVECTOR2( 0.75f, 0.0f );
    v[2].t = D3DXVECTOR2( 0.50f, 1.0f );
    v[3].t = D3DXVECTOR2( 0.75f, 1.0f );

    // From 1st down to 2nd

    v[0].p = D3DXVECTOR4( fLumStartX + ( fLumCellSize / 2.0f ) - 8.0f, ( 2.0f * fCellH ) + 32.0f +
                          ( 1.0f * fLumCellSize ), 0.0f, 1.0f );
    v[1].p = D3DXVECTOR4( fLumStartX + ( fLumCellSize / 2.0f ) + 8.0f, ( 2.0f * fCellH ) + 32.0f +
                          ( 1.0f * fLumCellSize ), 0.0f, 1.0f );
    v[2].p = D3DXVECTOR4( fLumStartX + ( fLumCellSize / 2.0f ) - 8.0f, ( 2.0f * fCellH ) + 48.0f +
                          ( 1.0f * fLumCellSize ), 0.0f, 1.0f );
    v[3].p = D3DXVECTOR4( fLumStartX + ( fLumCellSize / 2.0f ) + 8.0f, ( 2.0f * fCellH ) + 48.0f +
                          ( 1.0f * fLumCellSize ), 0.0f, 1.0f );

    pDevice->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, 2, v, sizeof( Luminance::TLVertex ) );

    // From 2nd down to 3rd

    v[0].p = D3DXVECTOR4( fLumStartX + ( fLumCellSize / 2.0f ) - 8.0f, ( 2.0f * fCellH ) + 48.0f +
                          ( 2.0f * fLumCellSize ), 0.0f, 1.0f );
    v[1].p = D3DXVECTOR4( fLumStartX + ( fLumCellSize / 2.0f ) + 8.0f, ( 2.0f * fCellH ) + 48.0f +
                          ( 2.0f * fLumCellSize ), 0.0f, 1.0f );
    v[2].p = D3DXVECTOR4( fLumStartX + ( fLumCellSize / 2.0f ) - 8.0f, ( 2.0f * fCellH ) + 64.0f +
                          ( 2.0f * fLumCellSize ), 0.0f, 1.0f );
    v[3].p = D3DXVECTOR4( fLumStartX + ( fLumCellSize / 2.0f ) + 8.0f, ( 2.0f * fCellH ) + 64.0f +
                          ( 2.0f * fLumCellSize ), 0.0f, 1.0f );

    pDevice->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, 2, v, sizeof( Luminance::TLVertex ) );

    // Select "right" arrow

    v[0].t = D3DXVECTOR2( 0.25f, 0.0f );
    v[1].t = D3DXVECTOR2( 0.50f, 0.0f );
    v[2].t = D3DXVECTOR2( 0.25f, 1.0f );
    v[3].t = D3DXVECTOR2( 0.50f, 1.0f );

    // Across from 3rd to 4th

    v[0].p = D3DXVECTOR4( fLumStartX + fLumCellSize, ( 2.0f * fCellH ) + 56.0f + ( 2.5f * fLumCellSize ), 0.0f, 1.0f );
    v[1].p = D3DXVECTOR4( fLumStartX + fLumCellSize + 16.0f, ( 2.0f * fCellH ) + 56.0f + ( 2.5f * fLumCellSize ), 0.0f,
                          1.0f );
    v[2].p = D3DXVECTOR4( fLumStartX + fLumCellSize, ( 2.0f * fCellH ) + 72.0f + ( 2.5f * fLumCellSize ), 0.0f, 1.0f );
    v[3].p = D3DXVECTOR4( fLumStartX + fLumCellSize + 16.0f, ( 2.0f * fCellH ) + 72.0f + ( 2.5f * fLumCellSize ), 0.0f,
                          1.0f );

    pDevice->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, 2, v, sizeof( Luminance::TLVertex ) );

    // Select "up" arrow

    v[0].t = D3DXVECTOR2( 0.00f, 0.0f );
    v[1].t = D3DXVECTOR2( 0.25f, 0.0f );
    v[2].t = D3DXVECTOR2( 0.00f, 1.0f );
    v[3].t = D3DXVECTOR2( 0.25f, 1.0f );

    // Up from 4th to 5th

    v[0].p = D3DXVECTOR4( fLumStartX + ( 1.5f * fLumCellSize ) + 8.0f, ( 2.0f * fCellH ) + 48.0f +
                          ( 2.0f * fLumCellSize ), 0.0f, 1.0f );
    v[1].p = D3DXVECTOR4( fLumStartX + ( 1.5f * fLumCellSize ) + 24.0f, ( 2.0f * fCellH ) + 48.0f +
                          ( 2.0f * fLumCellSize ), 0.0f, 1.0f );
    v[2].p = D3DXVECTOR4( fLumStartX + ( 1.5f * fLumCellSize ) + 8.0f, ( 2.0f * fCellH ) + 64.0f +
                          ( 2.0f * fLumCellSize ), 0.0f, 1.0f );
    v[3].p = D3DXVECTOR4( fLumStartX + ( 1.5f * fLumCellSize ) + 24.0f, ( 2.0f * fCellH ) + 64.0f +
                          ( 2.0f * fLumCellSize ), 0.0f, 1.0f );

    pDevice->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, 2, v, sizeof( Luminance::TLVertex ) );

    // Up from 5th to 6th

    v[0].p = D3DXVECTOR4( fLumStartX + ( 1.5f * fLumCellSize ) + 8.0f, ( 2.0f * fCellH ) + 32.0f +
                          ( 1.0f * fLumCellSize ), 0.0f, 1.0f );
    v[1].p = D3DXVECTOR4( fLumStartX + ( 1.5f * fLumCellSize ) + 24.0f, ( 2.0f * fCellH ) + 32.0f +
                          ( 1.0f * fLumCellSize ), 0.0f, 1.0f );
    v[2].p = D3DXVECTOR4( fLumStartX + ( 1.5f * fLumCellSize ) + 8.0f, ( 2.0f * fCellH ) + 48.0f +
                          ( 1.0f * fLumCellSize ), 0.0f, 1.0f );
    v[3].p = D3DXVECTOR4( fLumStartX + ( 1.5f * fLumCellSize ) + 24.0f, ( 2.0f * fCellH ) + 48.0f +
                          ( 1.0f * fLumCellSize ), 0.0f, 1.0f );

    pDevice->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, 2, v, sizeof( Luminance::TLVertex ) );

    // Select "right" arrow

    v[0].t = D3DXVECTOR2( 0.25f, 0.0f );
    v[1].t = D3DXVECTOR2( 0.50f, 0.0f );
    v[2].t = D3DXVECTOR2( 0.25f, 1.0f );
    v[3].t = D3DXVECTOR2( 0.50f, 1.0f );

    // From 6th to final image composition

    v[0].p = D3DXVECTOR4( fLumStartX + ( 2.0f * fLumCellSize ) + 16.0f, ( 2.0f * fCellH ) + 24.0f +
                          ( 0.5f * fLumCellSize ), 0.0f, 1.0f );
    v[1].p = D3DXVECTOR4( fLumStartX + ( 2.0f * fLumCellSize ) + 32.0f, ( 2.0f * fCellH ) + 24.0f +
                          ( 0.5f * fLumCellSize ), 0.0f, 1.0f );
    v[2].p = D3DXVECTOR4( fLumStartX + ( 2.0f * fLumCellSize ) + 16.0f, ( 2.0f * fCellH ) + 40.0f +
                          ( 0.5f * fLumCellSize ), 0.0f, 1.0f );
    v[3].p = D3DXVECTOR4( fLumStartX + ( 2.0f * fLumCellSize ) + 32.0f, ( 2.0f * fCellH ) + 40.0f +
                          ( 0.5f * fLumCellSize ), 0.0f, 1.0f );

    pDevice->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, 2, v, sizeof( Luminance::TLVertex ) );


    return S_OK;

}