Skip to content

feat(EN-039): drawModelTransform — immediate draws can finally pitch and roll#100

Merged
proggeramlug merged 1 commit into
mainfrom
feat/en-039-draw-model-transform
Jul 15, 2026
Merged

feat(EN-039): drawModelTransform — immediate draws can finally pitch and roll#100
proggeramlug merged 1 commit into
mainfrom
feat/en-039-draw-model-transform

Conversation

@proggeramlug

Copy link
Copy Markdown
Contributor

drawModelRotated takes a single Y rotation, so an immediate-mode draw could not
pitch or roll. The shooter's weapon stayed level while the camera looked up or
down
; any held prop, thrown object or debris chunk hits the same wall.

drawModelTransform(model, m16, tint) takes a full column-major 4×4 — the
immediate-mode twin of bloom_scene_set_transform16.

The ticket's premise was wrong, in a useful way

EN-039 proposed routing the matrix through the mesh scratch because "Perry can't
pass 16 f64 args"
. It canbloom_scene_set_transform16 already passes 17
and has worked all along. So this spells the matrix out as scalars and stays
stateless: no scratch to reset, no ordering hazard between a reset and a
draw. That's the same reasoning already recorded on the scene twin.

Notes

  • Downstream is the cached scene pipeline exactly as drawModelRotated uses it
    (alpha cutout, normal/MR maps, foliage wind, cutout shadows, planar
    reflections). Only the matrix composition is skipped.
  • Skinned models are a deliberate no-op: their joint matrices already bake
    world orientation, so a caller-supplied model matrix double-transforms them.
    drawModelRotated has the same carve-out.
  • Registered in the package.json native manifest. Perry silently no-ops an
    undeclared native — for a draw call that means the model just quietly stops
    rendering, with no error. (Requires a .perry-cache/ clear on consumers.)

Acceptance — shooter SH-027 v2, "the gun points where the camera points"

Verified in-game via the engine's own F12 capture. With only the camera pitch
changed
(0.30 → 1.15 rad) the weapon visibly re-orients; under
drawModelRotated those two frames were identical by construction. The
shooter feeds it the same forward vector the muzzle, tracer and shot ray already
use — so the gun and the bullet now agree by construction rather than by
coincidence.

Pairs with the shooter PR that consumes it.

https://claude.ai/code/session_01J1UWgMcrTNvwWeXcJ1T3Fp

…and roll

drawModelRotated takes a single Y rotation, so an immediate-mode draw could not
pitch or roll: the shooter's weapon stayed level while the camera looked up or
down, and any held prop, thrown object or debris chunk hit the same wall.

drawModelTransform(model, m16, tint) takes a full column-major 4x4 — the
immediate-mode twin of bloom_scene_set_transform16.

The ticket proposed routing the matrix through the mesh scratch, on the grounds
that "Perry can't pass 16 f64 args". It can: bloom_scene_set_transform16 already
passes 17 and has worked all along. So this spells the matrix out as scalars and
stays STATELESS — no scratch to reset, no ordering hazard between a reset and a
draw — which is the same reasoning already recorded on the scene twin.

Everything downstream is the cached scene pipeline exactly as drawModelRotated
uses it (alpha cutout, normal/MR maps, foliage wind, cutout shadows, planar
reflections); only the matrix composition is skipped.

SKINNED models are a deliberate no-op: their joint matrices already bake world
orientation, so a caller-supplied model matrix would double-transform them.
drawModelRotated has the same carve-out (it ignores rot_y when skinned).

Registered in the package.json native manifest — Perry SILENTLY no-ops a native
that isn't declared there, which for a draw call means the model just quietly
stops rendering.

Acceptance (shooter SH-027 v2) verified in-game: with only the camera pitch
changed (0.30 -> 1.15 rad) the weapon visibly re-orients. Under drawModelRotated
those two frames were identical by construction.

Claude-Session: https://claude.ai/code/session_01J1UWgMcrTNvwWeXcJ1T3Fp
@proggeramlug proggeramlug merged commit 1fdf691 into main Jul 15, 2026
@proggeramlug proggeramlug deleted the feat/en-039-draw-model-transform branch July 15, 2026 16:17
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@proggeramlug, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 12 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 605fe0c9-9885-4f7f-a615-c52843400450

📥 Commits

Reviewing files that changed from the base of the PR and between 671c914 and 178ba7c.

📒 Files selected for processing (5)
  • native/shared/src/ffi_core/models.rs
  • native/shared/src/renderer/model_draw.rs
  • package.json
  • src/index.ts
  • src/models/index.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/en-039-draw-model-transform

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

Comment @coderabbitai help to get the list of available commands.

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