Skip to content

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

Open
CryoTheRenegade wants to merge 3 commits into
TheSuperHackers:mainfrom
CryoTheRenegade:refactor/remove-bw-renderer
Open

CryoTheRenegade wants to merge 3 commits 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.
  • The RENDER_SHADOW exception in the hidden-mesh check at the top of MeshClass::Special_Render. It only let hidden meshes reach the removed Shadow_Render call.
  • Includes and forward declarations that only the removed code used: WWMath/matrix4.h, rinfo.h and camera.h in meshgeometry.cpp, RenderInfoClass in meshgeometry.h, and SpecialRenderInfoClass in meshmdl.h.

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, and returns early for hidden meshes without checking the render type.
    • 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.

Council review

Rounds: 2

Delegate Round 1 Round 2
Claude Opus 5.5 9/10 9.5/10
GPT-6.1 Sol 9.5/10 9.5/10
Gemini 4 Carbon 9/10 10/10

@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The change removes BWRenderClass, its disabled texture-projection rendering block, and the mesh shadow-rendering integration. The active render-target path remains unchanged.

Changes

BW renderer removal

Layer / File(s) Summary
Remove the BW renderer
Core/Libraries/Source/WWVegas/WW3D2/bwrender.h, Core/Libraries/Source/WWVegas/WW3D2/bwrender.cpp, Core/Libraries/Source/WWVegas/WW3D2/texproject.cpp, Core/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt, Generals/Code/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt, GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt
The BWRenderClass declaration and implementation, disabled texture-projection rendering block, and source-list references are removed.
Remove mesh shadow-rendering integration
Generals/Code/Libraries/Source/WWVegas/WW3D2/rinfo.*, GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/rinfo.*, Core/Libraries/Source/WWVegas/WW3D2/meshgeometry.*, Core/Libraries/Source/WWVegas/WW3D2/meshmdl.*, Core/Libraries/Source/WWVegas/WW3D2/mesh.cpp
The BWRenderer state, screen-space vertex transformation method, MeshModelClass::Shadow_Render, and RENDER_SHADOW dispatch are removed.

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

Change: Refactor

Suggested reviewers: bobtista, xezon

Merge Risk: Minimal · up to 982c6

This change removes the unused black-and-white shadow renderer and its mesh shadow-rendering integration. The path was already disabled, so no runtime behavior change is expected. No actionable merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title states the main change: removal of the unused black and white shadow renderer in the WW3D2 library. The raw summary confirms that bwrender files, BWRenderer members, and Shadow_Render are re…
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 states that the PR removes the unused BWRenderClass shadow renderer, the Shadow_Render method, and related includes and declarations. It also explains why the code is dead (BWRenderer …
Full details: Title check

Explanation

The title states the main change: removal of the unused black and white shadow renderer in the WW3D2 library. The raw summary confirms that bwrender files, BWRenderer members, and Shadow_Render are removed, so the title matches the changeset. The title is a single sentence, but it uses the conventional commit prefix 'refactor(ww3d2):', which is acceptable and does not make it vague.

Full details: Description check

Explanation

The description states that the PR removes the unused BWRenderClass shadow renderer, the Shadow_Render method, and related includes and declarations. It also explains why the code is dead (BWRenderer is only set inside an #if 0 block) and lists the evidence used. This matches the changeset described in the raw summary, so the description is clearly related to the changes.

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: 8b78ebdc-f7b2-489b-a98b-62293daf582a
Commits

Reviewing files that changed from the base of the PR and between 927cbfa and 982c6f2.

Files selected for processing: 4

  • Core/Libraries/Source/WWVegas/WW3D2/mesh.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/meshgeometry.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/meshgeometry.h
  • Core/Libraries/Source/WWVegas/WW3D2/meshmdl.h
Files with no reviewable changes: 3

  • Core/Libraries/Source/WWVegas/WW3D2/meshgeometry.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/meshgeometry.h
  • Core/Libraries/Source/WWVegas/WW3D2/meshmdl.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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T18:39:11.578671Z 982c6f2 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The reviewed changes appear safe to merge.

Summary

Removes the unused black-and-white shadow renderer and its supporting code from both games.

  • Projected shadows keep their hardware route as the old software renderer disappears.

No actionable issues found in the changes since the previous review.

Reviews (4) · Last reviewed commit: "style(ww3d2): Use Allman braces on the c..." · Reviewed by Greptile

@xezon

xezon commented Nov 15, 2026

Copy link
Copy Markdown

This needs a rebase.

@xezon xezon added Minor Severity: Minor < Major < Critical < Blocker Refactor Edits the code with insignificant behavior changes, is never user facing labels Nov 15, 2026
@CryoTheRenegade
CryoTheRenegade force-pushed the refactor/remove-bw-renderer branch from 20d6253 to 7a5b0e1 Compare November 16, 2026 00:09
@CryoTheRenegade

Copy link
Copy Markdown
Author

This needs a rebase.

Rebased

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>
@CryoTheRenegade
CryoTheRenegade force-pushed the refactor/remove-bw-renderer branch from 7a5b0e1 to 927cbfa Compare November 17, 2026 03:39
CryoTheRenegade and others added 2 commits November 16, 2026 21:04
…BW renderer removal

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Minor Severity: Minor < Major < Critical < Blocker Refactor Edits the code with insignificant behavior changes, is never user facing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants