Skip to content

refactor(ww3d2): Remove the unused black and white shadow renderer - #3670

Draft
CryoTheRenegade wants to merge 1 commit into
TheSuperHackers:mainfrom
CryoTheRenegade:refactor/remove-bw-renderer
Draft

CryoTheRenegade wants to merge 1 commit into
TheSuperHackers:mainfrom
CryoTheRenegade:refactor/remove-bw-renderer

Conversation

@CryoTheRenegade

@CryoTheRenegade CryoTheRenegade commented Nov 10, 2026 •

Copy link
Copy Markdown

Found while looking for more type-punning casts after xezon's "Are there more of these?" on #3580. MeshModelClass::Shadow_Render packs Vector2 values over its Vector4 buffer through a reinterpret_cast, and passes the triangle indices to BWRenderClass as const unsigned long*. In Zero Hour the indices are Vector3i16, so that cast would read two 16-bit indices as one 32-bit index. The code never runs, though, so this PR removes it instead of fixing it.

The only place that sets SpecialRenderInfoClass::BWRenderer is inside an #if 0 block in TexProjectClass::Compute_Texture. BWRenderer is therefore always null, and Shadow_Render returns without drawing. Projected shadows use the hardware render target path above that block.

Removed, in both games where the code is per game:

  • bwrender.cpp and bwrender.h in Core, with their entries in the Core CMake list and the commented-out entries in the game lists.
  • The #if 0 block and the bwrender.h include in texproject.cpp.
  • SpecialRenderInfoClass::BWRenderer and its forward declaration.
  • MeshModelClass::Shadow_Render, its RENDER_SHADOW call in MeshClass::Special_Render, and the _TempTransformedVertexBuffer it used.
  • MeshGeometryClass::get_deformed_screenspace_vertices, which only Shadow_Render called.

RENDER_SHADOW itself stays, since W3DProjectedShadowManager still renders with it.

Evidence

  • Disassembly: I compared mesh.obj, meshmdl.obj, meshgeometry.obj, rinfo.obj, hlod.obj, texproject.obj and W3DProjectedShadow.obj for both games, with VS 2026 (ClangCL) and VC6 Release, against a build of main. Apart from the removed functions and the static initializer of the removed buffer:
    • MeshClass::Special_Render no longer calls Get_HTree and Shadow_Render for RENDER_SHADOW.
    • The SpecialRenderInfoClass constructor no longer stores BWRenderer, and W3DProjectedShadowManager::init allocates the class with 4 fewer bytes.
    • Other changes are renumbered labels and symbols only.

AI Disclosure

Claude Opus 5.5 was used to aid in implementation and to compare the disassembly.

TexProjectClass only rendered with BWRenderClass inside an #if 0 block, so
SpecialRenderInfoClass::BWRenderer was always null and
MeshModelClass::Shadow_Render returned without drawing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change removes the black-and-white triangle renderer and its mesh shadow-rendering integration from WW3D2. The active texproject render-target path remains unchanged.

Changes

BW renderer removal

Layer / File(s) Summary
Remove the BW renderer
Core/Libraries/Source/WWVegas/WW3D2/bwrender.*, Core/Libraries/Source/WWVegas/WW3D2/texproject.cpp, */Libraries/Source/WWVegas/WW3D2/CMakeLists.txt
The BWRenderClass implementation and declaration are deleted. The disabled renderer block in texproject.cpp and the related source-list references are removed.
Remove mesh shadow-rendering integration
Generals/Code/Libraries/Source/WWVegas/WW3D2/{mesh.cpp,meshgeometry.*,meshmdl.*,rinfo.*}, GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/{mesh.cpp,meshgeometry.*,meshmdl.*,rinfo.*}
Both variants remove the RENDER_SHADOW dispatch to MeshModelClass::Shadow_Render, the screen-space vertex helper, the method declaration and implementation, and the BWRenderer member and initialization. The associated temporary vertex buffer is also removed.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Suggested labels: Minor, Refactor, Rendering

Suggested reviewers: bobtista, xezon

Merge Risk: Minimal · up to 20d62

Projected shadows retain their active rendering path. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title clearly summarizes the main change: removal of the unused black-and-white shadow renderer.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description explains why the unused black-and-white shadow renderer is removed and lists the related code changes in both games.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a7695175-607e-491e-a2a1-74a386ca5ecf
Commits

Reviewing files that changed from the base of the PR and between 998f337 and 20d6253.

Files selected for processing: 20

  • Core/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt
  • Core/Libraries/Source/WWVegas/WW3D2/bwrender.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/bwrender.h
  • Core/Libraries/Source/WWVegas/WW3D2/texproject.cpp
  • Generals/Code/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt
  • Generals/Code/Libraries/Source/WWVegas/WW3D2/mesh.cpp
  • Generals/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.cpp
  • Generals/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.h
  • Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.cpp
  • Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.h
  • Generals/Code/Libraries/Source/WWVegas/WW3D2/rinfo.cpp
  • Generals/Code/Libraries/Source/WWVegas/WW3D2/rinfo.h
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mesh.cpp
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.cpp
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.h
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.cpp
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.h
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/rinfo.cpp
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/rinfo.h
Files with no reviewable changes: 18

  • Core/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt
  • Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.h
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.h
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.h
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt
  • Generals/Code/Libraries/Source/WWVegas/WW3D2/mesh.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/texproject.cpp
  • Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/bwrender.h
  • Generals/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.cpp
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.cpp
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.cpp
  • Generals/Code/Libraries/Source/WWVegas/WW3D2/rinfo.h
  • Core/Libraries/Source/WWVegas/WW3D2/bwrender.cpp
  • Generals/Code/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/rinfo.h
  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mesh.cpp
  • Generals/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.h

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant