diff --git a/BUILD.md b/BUILD.md index e2eba2b..c150543 100644 --- a/BUILD.md +++ b/BUILD.md @@ -191,7 +191,7 @@ press again before concluding a key is broken. | Key | State | |-----|-------| -| **Alt+W** wireframe | **Live.** Reimplemented on D3D9 as a per-frame `D3DRS_FILLMODE` (`gWireframe`, [MUNGA_L4/L4VIDEO.cpp](MUNGA_L4/L4VIDEO.cpp)). The sky dome and the 2D pass (gunsight, cam-ship HUD) are held solid; particles are wireframed with everything else. | +| **Alt+W** wireframe | **Live.** Reimplemented on D3D9 as a per-frame `D3DRS_FILLMODE` (`gWireframe`, [MUNGA_L4/L4VIDEO.cpp](MUNGA_L4/L4VIDEO.cpp)). The view clears to black and the sky pass is skipped, so the edges stand on their own — with the lit dome in place the far half of the scene is unreadable. The 2D pass (gunsight, cam-ship HUD) is held solid; particles are wireframed with everything else. Fog still applies, so distant edges tint toward the fog colour rather than staying white. | | **Alt+E** event-queue dump | **Live.** Reaches `GeneralEventQueue::DumpEventQueue`. | | Alt+V predator vision | Inert. | | Alt+F frame dump | Inert. | diff --git a/MUNGA_L4/L4VIDEO.cpp b/MUNGA_L4/L4VIDEO.cpp index f0df866..ffc8253 100644 --- a/MUNGA_L4/L4VIDEO.cpp +++ b/MUNGA_L4/L4VIDEO.cpp @@ -6411,15 +6411,25 @@ void DPLRenderer::ExecuteImplementation(RendererComplexity, RendererOrigin::Inte DWORD currentFog; mDevice->GetRenderState(D3DRS_FOGCOLOR, ¤tFog); - hr = mDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, currentFog, 1.0f, 0); + // + // The frame is normally cleared to the fog colour so the horizon has + // nothing to hide. Under Alt+W it clears to BLACK instead, and the sky + // pass is skipped entirely (below) - so what backs the wireframe is + // black rather than a lit dome, which is the whole point of asking for + // wireframe. Nothing on the solid path changes. + // + hr = mDevice->Clear( + 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, + gWireframe ? D3DCOLOR_XRGB(0, 0, 0) : currentFog, + 1.0f, 0 + ); hr = mDevice->BeginScene(); // // Alt+W wireframe. Set every frame from the flag rather than once at - // toggle time - see gWireframe. It is turned back off for the sky pass - // and again for the 2D pass below; everything between here and there - // draws as edges. + // toggle time - see gWireframe. It is turned back off for the 2D pass + // below; everything between here and there draws as edges. // mDevice->SetRenderState( D3DRS_FILLMODE, @@ -6503,33 +6513,27 @@ void DPLRenderer::ExecuteImplementation(RendererComplexity, RendererOrigin::Inte mDevice->SetTransform(D3DTS_PROJECTION, &mProjectionMatrix); // - // The sky stays solid under Alt+W. Wireframing the dome fills the top - // of the screen with its own tessellation and buries the geometry you - // turned wireframe on to look at; a solid sky gives the edges something - // to read against. + // The sky is not drawn at all under Alt+W - the black clear above + // stands in for it. Drawing it solid lights the top of the screen and + // drowns the edges you turned wireframe on to look at; drawing it in + // wireframe is worse, filling the same area with the dome's own + // tessellation. Skipping it costs nothing: the dome only ever covers + // pixels the clear already owns. // - if (gWireframe) + if (!gWireframe) { - mDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID); - } - - - if (!l4_application->IsDead()) - { - std::list::const_iterator iter; - - for (iter = this->mConsolidatedStaticObjects.begin(); iter != this->mConsolidatedStaticObjects.end(); ++iter) + if (!l4_application->IsDead()) { - (*iter)->Draw(PASS_SKY, &viewTransform, mTargetRenderTime); + std::list::const_iterator iter; + + for (iter = this->mConsolidatedStaticObjects.begin(); iter != this->mConsolidatedStaticObjects.end(); ++iter) + { + (*iter)->Draw(PASS_SKY, &viewTransform, mTargetRenderTime); + } } - } - for (d3d_OBJECT *obj = mRenderLists[PASS_SKY]; obj != NULL; obj = obj->GetNext(PASS_SKY)) - obj->Draw(PASS_SKY, &viewTransform, mTargetRenderTime); - - if (gWireframe) - { - mDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME); + for (d3d_OBJECT *obj = mRenderLists[PASS_SKY]; obj != NULL; obj = obj->GetNext(PASS_SKY)) + obj->Draw(PASS_SKY, &viewTransform, mTargetRenderTime); } //Reactivate fog diff --git a/RP_L4/RPL4ENVIRON.cpp b/RP_L4/RPL4ENVIRON.cpp index 3974cdc..9e5ea08 100644 --- a/RP_L4/RPL4ENVIRON.cpp +++ b/RP_L4/RPL4ENVIRON.cpp @@ -411,9 +411,9 @@ namespace "# ---- Developer / testing ----------------------------------------------------\n" "\n" "# Nonzero arms the debug keys. Two of them do something in this build:\n" -"# Alt+W wireframe. The sky dome stays solid so the edges have\n" -"# something to read against, and the gunsight and cam-ship\n" -"# HUD stay solid too.\n" +"# Alt+W wireframe. The sky is not drawn and the view clears to\n" +"# black, so the edges stand on their own; the gunsight and\n" +"# cam-ship HUD stay solid.\n" "# Alt+E write the event queue to the log.\n" "# The others are stubs the 2007 DPL->Direct3D port left behind and do\n" "# nothing at all. They are named here so a dead key is not mistaken for\n"