Skip to content

Commit

Permalink
Merge pull request #251 from SkyLoaderr/patch-4
Browse files Browse the repository at this point in the history
Replaced D3DPT_TRIANGLEFAN with D3DPT_TRIANGLELIST in Portal class
  • Loading branch information
Xottab-DUTY committed Oct 10, 2018
2 parents 557aa5f + 859516b commit 523f754
Showing 1 changed file with 28 additions and 21 deletions.
49 changes: 28 additions & 21 deletions src/Layers/xrRender/r__sector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,40 +33,47 @@ void CPortal::OnRender()
{
VERIFY(poly.size());
// draw rect
static xr_vector<FVF::L> V;
V.resize(poly.size() + 2);
Fvector C = {0, 0, 0};
for (u32 k = 0; k < poly.size(); k++)
{
C.add(poly[k]);
V[k + 1].set(poly[k], 0x800000FF);
}
V.back().set(poly[0], 0x800000FF);
C.div((float)poly.size());
V[0].set(C, 0x800000FF);
xr_vector<FVF::L> V; V.resize(poly.size()*3);
Fvector vCenter = { 0.0f, 0.0f, 0.0f };
const u32 uPortalColor = 0x800000FF;
for (u32 k = 0; k < poly.size(); k++)
{
vCenter.add(poly[k]);

V[k*3+1].set(poly[k], uPortalColor);
if (k+1 == poly.size())
V[k*3+2].set(poly[0], uPortalColor);
else
V[k*3+2].set(poly[k+1], uPortalColor);
}
vCenter.div((float)poly.size());

for (u32 k = 0; k < poly.size(); k++)
V[k*3].set(vCenter, uPortalColor);

RCache.set_xform_world(Fidentity);
// draw solid
RCache.set_Shader(RImplementation.m_SelectionShader);
RCache.dbg_Draw(D3DPT_TRIANGLEFAN, &*V.begin(), V.size() - 2);
RCache.set_Shader (RImplementation.m_SelectionShader);
RCache.dbg_Draw (D3DPT_TRIANGLELIST,&*V.begin(),V.size()/3);

// draw wire
V.resize(poly.size()+1); //skyloader: change vertex array for wire
for (u32 k = 0; k < poly.size(); k++)
V[k].set(poly[k], uPortalColor);
V.back().set(poly[0], uPortalColor);

if (bDebug)
{
RImplementation.rmNear();
}
else
{
} else {
Device.SetNearer(TRUE);
}
RCache.set_Shader(RImplementation.m_WireShader);
RCache.dbg_Draw(D3DPT_LINESTRIP, &*(V.begin() + 1), V.size() - 2);
RCache.set_Shader (RImplementation.m_WireShader);
RCache.dbg_Draw (D3DPT_LINESTRIP,&*V.begin(),V.size()-1);
if (bDebug)
{
RImplementation.rmNormal();
}
else
{
} else {
Device.SetNearer(FALSE);
}
}
Expand Down

0 comments on commit 523f754

Please sign in to comment.