Skip to content

Commit

Permalink
Finishing touches (#478)
Browse files Browse the repository at this point in the history
* Fixed Neptune lighting issue. Further testing needed.

* - Disabled MSAA if mesh flag 0x20 in use to avoid "edge glow". Testing needed to verify desired outcome.

* - Enabled first 32 charters to support special fonts.
  • Loading branch information
jarmonik authored Aug 16, 2024
1 parent e9bb333 commit d709860
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 deletions.
3 changes: 2 additions & 1 deletion OVP/D3D9Client/AtmoControls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ ScatterParams::ScatterParams() :
wboost ( 0.0 ),
zcolor (1.0f, 1.0f, 0.9f),
hcolor (1.0f, 0.7f, 0.0f),
acolor (0.9f, 0.9f, 1.0f)
acolor (0.9f, 0.9f, 1.0f),
suni (1.0)
{
}

Expand Down
2 changes: 1 addition & 1 deletion OVP/D3D9Client/D3D9TextMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ D3D9Text::D3D9Text(LPDIRECT3DDEVICE9 pDevice) :
rotation (),
scaling (1.0f),
charset (ANSI_CHARSET),
first (32),
first (0),
halign (),
valign (),
pDev (pDevice),
Expand Down
23 changes: 23 additions & 0 deletions OVP/D3D9Client/Mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1927,10 +1927,21 @@ void D3D9Mesh::Render(const LPD3DXMATRIX pW, int iTech, LPDIRECT3DCUBETEXTURE9 *
pDev->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);
}

DWORD dwMSAA;

if (bOIT) {
pDev->GetRenderState(D3DRS_MULTISAMPLEANTIALIAS, &dwMSAA);
pDev->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, 0);
}

pDev->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, Grp[g].VertOff, 0, Grp[g].nVert, Grp[g].IdexOff, Grp[g].nFace);

Grp[g].bRendered = true;

if (bOIT && dwMSAA) {
pDev->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, dwMSAA);
}

if (Grp[g].bDualSided) {
pDev->SetRenderState(D3DRS_ZWRITEENABLE, 1);
}
Expand Down Expand Up @@ -2189,8 +2200,20 @@ void D3D9Mesh::RenderSimplified(const LPD3DXMATRIX pW, LPDIRECT3DCUBETEXTURE9 *p
// Start rendering -------------------------------------------------------------------------------------------
//
FX->CommitChanges();

DWORD dwMSAA = 0;

if (bOIT) {
pDev->GetRenderState(D3DRS_MULTISAMPLEANTIALIAS, &dwMSAA);
pDev->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, 0);
}

pDev->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, Grp[g].VertOff, 0, Grp[g].nVert, Grp[g].IdexOff, Grp[g].nFace);
Grp[g].bRendered = true;

if (bOIT && dwMSAA) {
pDev->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, dwMSAA);
}
}

if (CurrentShader != 0xFFFF) HR(FX->EndPass());
Expand Down
2 changes: 1 addition & 1 deletion OVP/D3D9Client/VPlanet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@ bool vPlanet::Render(LPDIRECT3DDEVICE9 dev)

SetupEclipse();

if (surfmgr2 && scn->GetRenderPass() == RENDERPASS_MAINSCENE) UpdateScatter();
if (scn->GetRenderPass() == RENDERPASS_MAINSCENE) UpdateScatter();

if (ringmgr) {
ringmgr->Render(dev, mWorld, false);
Expand Down
2 changes: 1 addition & 1 deletion OVP/D3D9Client/VPlanetAtmo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ void vPlanet::UpdateScatter()

dwSctFrame = scn->GetFrameId();

if (HasAtmosphere())
if (HasAtmosphere() && surfmgr2)
{
if (!pSunColor) D3DXCreateTexture(pDev, 4*Qc, Qc/2, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A16B16G16R16F, D3DPOOL_DEFAULT, &pSunColor);
if (!pRaySkyView) D3DXCreateTexture(pDev, Qc * 2, Qc, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A16B16G16R16F, D3DPOOL_DEFAULT, &pRaySkyView);
Expand Down

0 comments on commit d709860

Please sign in to comment.