Repository navigation
refactor(w3ddevice): Write shadow volume vertex fields instead of casting Vector3 to VertexFormatXYZ - #3628
Conversation
…ng them to vectors W3DVolumetricShadow::constructVolumeVB read Vector3 positions as VertexFormatXYZ, and MeshModelClass::compose_deformed_vertex_buffer in Generals wrote Vector2 values over the u1 and u2 vertex fields. Assign the x, y and z or u and v fields one by one. compose_deformed_vertex_buffer still writes u2/v2 when there are no UVs, as before. The SV_DEBUG stores in W3DVolumetricShadow are not compiled and stay unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ertex field writes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…m Generals MeshClass::Compose_Deformed_Vertex_Buffer has no callers, and Zero Hour no longer has it or MeshModelClass::compose_deformed_vertex_buffer. Removing both also removes the Vector2 casts over the u1 and u2 vertex fields. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Write shadow-volume vertex positions Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp, GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp |
Each file adds setVertexXYZ and uses it to write generated shadow-volume vertex positions. The vertex coordinates and extrusion calculations remain unchanged. |
Deformed Vertex Buffer Removal
| Layer / File(s) | Summary |
|---|---|
Remove deformed vertex-buffer composition Generals/Code/Libraries/Source/WWVegas/WW3D2/mesh.h, Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.h, Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.cpp, Generals/Code/Libraries/Source/WWVegas/WW3D2/mesh.cpp |
Removes the MeshClass::Compose_Deformed_Vertex_Buffer declaration and definition, and the MeshModelClass::compose_deformed_vertex_buffer declaration and implementation. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Refactor
Possibly related PRs
- TheSuperHackers/GeneralsGameCode#3594: Removes the same deformed-vertex-buffer composition path in the WW3D2 sources.
- TheSuperHackers/GeneralsGameCode#3605: Replaces vector access through matrix data casts in
W3DVolumetricShadow.cpp. - TheSuperHackers/GeneralsGameCode#3580: Replaces
Vector3reference casts with explicit field copies in rendering code.
Suggested labels: Refactor, Minor
Suggested reviewers: xezon
Merge Risk: 
Minimal · up to aa058
-
No actionable merge-blocking risk remains in the reviewed changes.
Pre-merge checks: 
4
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Comment @coderabbitai help to get the list of available commands.
[Medium impact] This PR appears safe to merge; no actionable issues were found.
|
Follow-up to #3580, #3605 and #3617. The shadow volume code writes a
Vector3over aVertexFormatXYZthrough a pointer cast. Accessing an object through an unrelated type is undefined behavior, the same problem as #3521.W3DVolumetricShadow::constructVolumeVBin both games has 9 of these stores. A new file-staticsetVertexXYZcopies the three fields:Generals also had
Vector2reference casts over theu1andu2vertex fields inMeshModelClass::compose_deformed_vertex_buffer. Its only caller isMeshClass::Compose_Deformed_Vertex_Buffer, which nothing calls, and Zero Hour no longer has either function. This PR removes both from Generals instead of rewriting them.The
(Vector3 *)pvVerticesstores inW3DVolumetricShadow.cppare compiled only whenSV_DEBUGis defined, and it is commented out in both games, so I left them alone.Evidence
main. The float arithmetic is the same with both compilers.fxchreordering of the x87 stack.AI Disclosure
Claude Opus 5.5 was used to aid in implementation and to compare the disassembly.