Skip to content

Remove redundant CameraComponent.frameUpdate#8977

Merged
mvaligursky merged 1 commit into
mainfrom
mv-remove-camera-frameupdate
Jun 26, 2026
Merged

Remove redundant CameraComponent.frameUpdate#8977
mvaligursky merged 1 commit into
mainfrom
mv-remove-camera-frameupdate

Conversation

@mvaligursky

Copy link
Copy Markdown
Contributor

CameraComponent.frameUpdate(rt) eagerly recomputed the camera's aspect ratio for ASPECT_AUTO. That became redundant once #8633 made Camera.aspectRatio auto-refresh for ASPECT_AUTO on every read:

  • Renderer.updateCameraFrustum reads camera.projectionMatrix, and _evaluateProjectionMatrix reads this.aspectRatio — which recomputes from current inputs for ASPECT_AUTO. So culling and rendering already get an up-to-date frustum without the eager call.
  • The rt argument was moot: the getter recomputes from the camera's own render target on the next read (overwriting whatever frameUpdate set), and the sole caller passed camera.renderTarget anyway.

Changes:

  • Remove CameraComponent.frameUpdate (it was @ignore) and its only caller in Renderer.updateLightVisibility (which now just updates the camera frustum).
  • Drop the now-unused ASPECT_AUTO import in the camera component.
  • Keep CameraComponent.calculateAspectRatio (public).

No public API or behavior change.

`CameraComponent.frameUpdate(rt)` eagerly recomputed the camera's aspect
ratio for ASPECT_AUTO. That became redundant once #8633 made
`Camera.aspectRatio` auto-refresh for ASPECT_AUTO on every read: the
projection matrix (`_evaluateProjectionMatrix` reads `this.aspectRatio`)
already picks up the current aspect on access, so culling and rendering
get an up-to-date frustum without the eager call. Its `rt` argument was
also moot - the getter recomputes from the camera's own render target on
the next read, overwriting anything frameUpdate set, and the sole caller
passed `camera.renderTarget` anyway.

Remove the method (it was @ignore) and its only caller in
`Renderer.updateLightVisibility`, which now just updates the frustum.
`CameraComponent.calculateAspectRatio` (public) is kept.

No public API or behavior change.
@github-actions

Copy link
Copy Markdown

Build size report

This PR changes the size of the minified bundles.

Bundle Minified Gzip Brotli
playcanvas.min.js 2263.7 KB (−0.1 KB, −0.01%) 582.3 KB (−0.0 KB, −0.00%) 452.5 KB (−0.0 KB, −0.00%)
playcanvas.min.mjs 2261.1 KB (−0.1 KB, −0.01%) 581.4 KB (−0.0 KB, −0.01%) 452.2 KB (−0.2 KB, −0.05%)

@mvaligursky mvaligursky merged commit 8a524d8 into main Jun 26, 2026
10 checks passed
@mvaligursky mvaligursky deleted the mv-remove-camera-frameupdate branch June 26, 2026 15:41
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