Skip to content

Commit

Permalink
Only render circles at the intersections of poly lines when SmoothLin…
Browse files Browse the repository at this point in the history
…es is off. Enable multisampling in d3d when SmoothLines is enabled if supported by the hardware.
  • Loading branch information
xwidghet committed Mar 11, 2017
1 parent e9c891e commit df8a577
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
13 changes: 8 additions & 5 deletions src/RageDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,9 @@ void RageDisplay::DrawPolyLines( const RageSpriteVertex v[], int iNumVerts, floa
nv[3].p.x += xdist;
nv[3].p.y -= ydist;

for (int i = 0; i < 4; i++)
for (int j = 0; j < 4; j++)
{
batchVerts.push_back(nv[i]);
batchVerts.push_back(nv[j]);
}
}

Expand All @@ -284,9 +284,12 @@ void RageDisplay::DrawLineStripInternal( const RageSpriteVertex v[], int iNumVer
* lines. */
DrawPolyLines( v, iNumVerts, LineWidth );

// Join the lines with circles so we get rounded corners.
for ( int i = 0; i < iNumVerts; ++i )
DrawCircle( v[i], LineWidth / 2 );
// Join the lines with circles so we get rounded corners when SmoothLines is off.
if (!PREFSMAN->m_bSmoothLines)
{
for (int i = 0; i < iNumVerts; ++i)
DrawCircle(v[i], LineWidth / 2);
}
}

void RageDisplay::DrawCircleInternal( const RageSpriteVertex &p, float radius )
Expand Down
14 changes: 12 additions & 2 deletions src/RageDisplay_D3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,12 +478,22 @@ static bool D3DReduceParams( D3DPRESENT_PARAMETERS *pp )
static void SetPresentParametersFromVideoModeParams( const VideoModeParams &p, D3DPRESENT_PARAMETERS *pD3Dpp )
{
ZERO( *pD3Dpp );
D3DFORMAT displayFormat = FindBackBufferType(p.windowed, p.bpp);
bool enableMultiSampling = false;

if ( p.bSmoothLines &&
SUCCEEDED(g_pd3d->CheckDeviceMultiSampleType(D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL, displayFormat, p.windowed,
D3DMULTISAMPLE_8_SAMPLES, NULL)) )
{
enableMultiSampling = true;
}

pD3Dpp->BackBufferWidth = p.width;
pD3Dpp->BackBufferHeight = p.height;
pD3Dpp->BackBufferFormat = FindBackBufferType( p.windowed, p.bpp );
pD3Dpp->BackBufferFormat = displayFormat;
pD3Dpp->BackBufferCount = 1;
pD3Dpp->MultiSampleType = D3DMULTISAMPLE_NONE;
pD3Dpp->MultiSampleType = enableMultiSampling ? D3DMULTISAMPLE_8_SAMPLES : D3DMULTISAMPLE_NONE;
pD3Dpp->SwapEffect = D3DSWAPEFFECT_DISCARD;
pD3Dpp->hDeviceWindow = GraphicsWindow::GetHwnd();
pD3Dpp->Windowed = p.windowed;
Expand Down

0 comments on commit df8a577

Please sign in to comment.