Skip to content

Lock envAtlas width and encoding for project#39

Merged
slimbuck merged 1 commit into
playcanvas:mainfrom
luo2430:main
Jun 15, 2026
Merged

Lock envAtlas width and encoding for project#39
slimbuck merged 1 commit into
playcanvas:mainfrom
luo2430:main

Conversation

@luo2430

@luo2430 luo2430 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@willeastcott willeastcott requested a review from slimbuck June 15, 2026 08:27
@willeastcott willeastcott added the enhancement New feature or request label Jun 15, 2026
@willeastcott

willeastcott commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

This fixes a UI bug in the texture reprojection panel (src/reproject-panel.ts) where the width and encoding fields remained editable even when the target projection is envAtlas, which requires a fixed atlas format.

Before

When envAtlas was selected, onTargetProjectionChanged set encoding.value = '2' (RGBP) and width.value = 512, but left both fields editable. A user could then change them afterwards and generate a malformed atlas, since the engine's atlas generation relies on a fixed 512px layout for correct shader UV sampling and mip-grid alignment.

After

The fields are now disabled for envAtlas, locking them to the engine-required values:

width.enabled    = !isEnvAtlas;   // locked for envAtlas
encoding.enabled = !isEnvAtlas;   // locked for envAtlas

Also included

  • Refactored the projection check (indexOf(...) === -1!...includes(...)) and extracted projection / isEnvAtlas locals for readability.
  • Removed a redundant trailing null argument from a new Asset(...) constructor call.

Net effect: when reprojecting a texture to an env-atlas, the width and encoding controls are greyed out and pinned to the values the engine expects (512px / RGBP), so they can no longer be overridden into an invalid state.

@slimbuck slimbuck left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested, works. thanks for the pr!

@slimbuck slimbuck merged commit 7dcf258 into playcanvas:main Jun 15, 2026
2 checks passed
@slimbuck slimbuck changed the title fix(reproject): lock envAtlas width and encoding Lock envAtlas width and encoding for project Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants