Skip to content

feat(textures) Add composite texture loaders#3328

Merged
ibgreen merged 17 commits intomasterfrom
ib/texture-array-loaders
Mar 30, 2026
Merged

feat(textures) Add composite texture loaders#3328
ibgreen merged 17 commits intomasterfrom
ib/texture-array-loaders

Conversation

@ibgreen
Copy link
Copy Markdown
Collaborator

@ibgreen ibgreen commented Mar 23, 2026

Summary

Add manifest-driven composite image texture loaders to @loaders.gl/textures, deprecate the legacy helper APIs, and standardize composite-loader base URL handling around LoaderContext.

This PR introduces first-class loaders for image textures, texture arrays, cubemaps, and cube arrays, all backed by a shared composite-image parser/resolver. It also adds template-based mip expansion, aligns cubemap face naming with luma.gl conventions, and documents how composite loaders should forward base URLs and subloader lists.

Included Changes

  • Added new public loaders in @loaders.gl/textures:

    • ImageTextureLoader
    • ImageTextureArrayLoader
    • ImageTextureCubeLoader
    • ImageTextureCubeArrayLoader
  • Added JSON manifest support for:

    • single images
    • mip chains
    • texture arrays
    • cubemaps
    • cube arrays
  • Added template-based source expansion with strict validation:

    • supports mipLevels: "auto"
    • supports placeholders such as {lod}, {index}, {face}, {direction}, {axis}, {sign}
    • supports escaped braces via \{ and \}
  • Aligned cubemap manifest keys with luma.gl conventions:

    • canonical keys are +X, -X, +Y, -Y, +Z, -Z
    • legacy directional aliases like right, left, top, bottom, front, back are still accepted for compatibility
  • Reimplemented legacy loadImageTexture* helpers on top of the shared composite-image path and marked them @deprecated

  • Standardized relative URL resolution:

    • prefer context.baseUrl
    • use options.core.baseUrl only as a pre-context fallback
    • stop forwarding base URL state ad hoc between composite loaders
  • Updated composite member parsing so subresources use:

    • top-level fetch
    • top-level loader arrays in addition to ImageLoader
    • child context with the correct member url / baseUrl

Documentation

  • Added API docs for the new texture manifest loaders
  • Moved composite loader base URL guidance into the general composite loader developer guide
  • Removed legacy helper guidance from regular docs
  • Kept helper migration guidance in the upgrade guide only

Tests

Added coverage for:

  • manifest loading for image, array, cube, and cube-array loaders
  • relative URL resolution
  • core.baseUrl fallback for in-memory manifests
  • template-based mip expansion
  • escaped brace handling
  • template validation errors
  • top-level fetch reuse for member assets
  • top-level loader forwarding for composite members
  • loader auto-selection by manifest shape

Verification

  • ./node_modules/.bin/tsc -p modules/textures/tsconfig.json --noEmit

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 930892048f

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibgreen ibgreen merged commit 0d4b97c into master Mar 30, 2026
4 of 5 checks passed
@ibgreen ibgreen deleted the ib/texture-array-loaders branch March 30, 2026 14:06
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