| 599 | |
| 600 | |
| 601 | bool CTextureExplorerDebugMenuOption::OverrideDisplay() const |
| 602 | { |
| 603 | if( !mDisplayTexture ) |
| 604 | return false; |
| 605 | |
| 606 | CRefPtr<CNativeTexture> texture; |
| 607 | u32 texture_width = 32; |
| 608 | u32 texture_height = 32; |
| 609 | if( mSelectedIdx < mSnapshot.size() ) |
| 610 | { |
| 611 | texture = mSnapshot[ mSelectedIdx ].Texture; |
| 612 | |
| 613 | const TextureInfo & info = mSnapshot[ mSelectedIdx ].Info; |
| 614 | |
| 615 | texture_width = info.GetWidth(); |
| 616 | texture_height = info.GetHeight(); |
| 617 | } |
| 618 | |
| 619 | CGraphicsContext::Get()->BeginFrame(); |
| 620 | |
| 621 | sceGuDisable(GU_DEPTH_TEST); |
| 622 | sceGuDepthMask( GL_TRUE ); // GL_TRUE to disable z-writes |
| 623 | sceGuShadeModel( GU_FLAT ); |
| 624 | |
| 625 | sceGuTexFilter(GU_NEAREST,GU_NEAREST); |
| 626 | sceGuTexScale(1.0f,1.0f); |
| 627 | sceGuTexOffset(0.0f,0.0f); |
| 628 | sceGuDisable(GU_ALPHA_TEST); |
| 629 | sceGuTexFunc(GU_TFX_REPLACE,GU_TCC_RGBA); |
| 630 | |
| 631 | sceGuSetMatrix( GU_PROJECTION, reinterpret_cast< const ScePspFMatrix4 * >( &gMatrixIdentity ) ); |
| 632 | |
| 633 | const f32 screen_width( 480.0f ); |
| 634 | const f32 screen_height( 272.0f ); |
| 635 | |
| 636 | if ( mCheckerTexture != nullptr ) |
| 637 | { |
| 638 | u32 num_verts( 2 ); |
| 639 | TextureVtx* p_verts = (TextureVtx*)sceGuGetMemory(num_verts*sizeof(TextureVtx)); |
| 640 | |
| 641 | mCheckerTexture->InstallTexture(); |
| 642 | |
| 643 | sceGuDisable(GU_BLEND); |
| 644 | sceGuTexWrap(GU_REPEAT,GU_REPEAT); |
| 645 | |
| 646 | p_verts[0].pos = v3( 0.0f, 0.0f, 0.0f ); |
| 647 | p_verts[0].t0 = v2( 0.0f, 0.0f ); |
| 648 | |
| 649 | p_verts[1].pos = v3( screen_width, screen_height, 0.0f ); |
| 650 | p_verts[1].t0 = v2( screen_width, screen_height ); |
| 651 | |
| 652 | sceGuDrawArray(GU_SPRITES,TEXTURE_VERTEX_FLAGS|GU_TRANSFORM_2D,num_verts,nullptr,p_verts); |
| 653 | } |
| 654 | |
| 655 | if( texture != nullptr ) |
| 656 | { |
| 657 | u32 num_verts( 2 ); |
| 658 | TextureVtx* p_verts = (TextureVtx*)sceGuGetMemory(num_verts*sizeof(TextureVtx)); |
no test coverage detected