mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-14 22:50:45 +00:00
Fixed scissor clipping issues of regular surfaces like light flares #651
This commit is contained in:
parent
28c3ea9804
commit
8c464de83d
3 changed files with 18 additions and 8 deletions
|
@ -369,6 +369,8 @@ void idGuiModel::EmitImGui( ImDrawData* drawData )
|
|||
|
||||
idVec2 scaleToVirtual( ( float )renderSystem->GetVirtualWidth() / sysWidth, ( float )renderSystem->GetVirtualHeight() / sysHeight );
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
for( int a = 0; a < drawData->CmdListsCount; a++ )
|
||||
{
|
||||
const ImDrawList* cmd_list = drawData->CmdLists[a];
|
||||
|
@ -389,8 +391,16 @@ void idGuiModel::EmitImGui( ImDrawData* drawData )
|
|||
mat = ( const idMaterial* )pcmd->TextureId;
|
||||
}
|
||||
|
||||
// RB: (0, 0) starts in the upper left corner compared to GL!
|
||||
idScreenRect clipRect = { static_cast<short>( pcmd->ClipRect.x ), static_cast<short>( pcmd->ClipRect.y ), static_cast<short>( pcmd->ClipRect.z ), static_cast<short>( pcmd->ClipRect.w ), 0.0f, 1.0f };
|
||||
// RB: convert from upper left corner to bottom left (0, 0) like in GL!
|
||||
idScreenRect clipRect =
|
||||
{
|
||||
static_cast<short>( pcmd->ClipRect.x ),
|
||||
io.DisplaySize.y - static_cast<short>( pcmd->ClipRect.w ),
|
||||
static_cast<short>( pcmd->ClipRect.z ),
|
||||
io.DisplaySize.y - static_cast<short>( pcmd->ClipRect.y ),
|
||||
0.0f,
|
||||
1.0f
|
||||
};
|
||||
|
||||
idDrawVert* verts = AllocTris( numVerts, indexBufferOffset, numIndexes, mat, tr.currentGLState, STEREO_DEPTH_TYPE_NONE, clipRect );
|
||||
if( verts == NULL )
|
||||
|
|
|
@ -92,7 +92,7 @@ void idRenderBackend::DBG_SimpleSurfaceSetup( const drawSurf_t* drawSurf )
|
|||
if( !currentScissor.Equals( drawSurf->scissorRect ) && r_useScissor.GetBool() )
|
||||
{
|
||||
GL_Scissor( viewDef->viewport.x1 + drawSurf->scissorRect.x1,
|
||||
viewDef->viewport.y1 + drawSurf->scissorRect.y1,
|
||||
viewDef->viewport.y2 - drawSurf->scissorRect.y2,
|
||||
drawSurf->scissorRect.x2 + 1 - drawSurf->scissorRect.x1,
|
||||
drawSurf->scissorRect.y2 + 1 - drawSurf->scissorRect.y1 );
|
||||
|
||||
|
@ -113,8 +113,9 @@ void idRenderBackend::DBG_SimpleWorldSetup()
|
|||
RB_SetMVP( viewDef->worldSpace.mvp );
|
||||
// RB end
|
||||
|
||||
// RB: (0, 0) starts in the upper left corner compared to OpenGL!
|
||||
GL_Scissor( viewDef->viewport.x1 + viewDef->scissor.x1,
|
||||
viewDef->viewport.y1 + viewDef->scissor.y1,
|
||||
viewDef->viewport.y2 - viewDef->scissor.y2,
|
||||
viewDef->scissor.x2 + 1 - viewDef->scissor.x1,
|
||||
viewDef->scissor.y2 + 1 - viewDef->scissor.y1 );
|
||||
|
||||
|
@ -433,7 +434,7 @@ void idRenderBackend::DBG_RenderDrawSurfListWithFunction( drawSurf_t** drawSurfs
|
|||
currentScissor = drawSurf->scissorRect;
|
||||
|
||||
GL_Scissor( viewDef->viewport.x1 + currentScissor.x1,
|
||||
viewDef->viewport.y1 + currentScissor.y1,
|
||||
viewDef->viewport.y2 - currentScissor.y2,
|
||||
currentScissor.x2 + 1 - currentScissor.x1,
|
||||
currentScissor.y2 + 1 - currentScissor.y1 );
|
||||
}
|
||||
|
|
|
@ -3976,10 +3976,9 @@ int idRenderBackend::DrawShaderPasses( const drawSurf_t* const* const drawSurfs,
|
|||
// change the scissor if needed
|
||||
if( !currentScissor.Equals( surf->scissorRect ) && r_useScissor.GetBool() )
|
||||
{
|
||||
// RB: (0, 0) starts in the upper left corner compared to GL!
|
||||
// this is only used by the Imgui scissors which start at the top left corner
|
||||
// RB: (0, 0) starts in the upper left corner compared to OpenGL!
|
||||
GL_Scissor( viewDef->viewport.x1 + surf->scissorRect.x1,
|
||||
viewDef->viewport.y1 + surf->scissorRect.y1,
|
||||
viewDef->viewport.y2 - surf->scissorRect.y2,
|
||||
surf->scissorRect.x2 + 1 - surf->scissorRect.x1,
|
||||
surf->scissorRect.y2 + 1 - surf->scissorRect.y1 );
|
||||
|
||||
|
|
Loading…
Reference in a new issue