Skip to content

Optimize cached OBJ model cloning - #935

Open
huangse199 wants to merge 1 commit into
tscircuit:mainfrom
huangse199:cherrycashpilot/issue-93-model-loading-cache
Open

Optimize cached OBJ model cloning#935
huangse199 wants to merge 1 commit into
tscircuit:mainfrom
huangse199:cherrycashpilot/issue-93-model-loading-cache

Conversation

@huangse199

Copy link
Copy Markdown

/claim #93

Summary

  • Keep using the global OBJ/WRL loader cache, but clone cached objects through a helper that reuses immutable geometry buffers.
  • Clone material instances per model clone so translucency and hover/emissive updates remain isolated between duplicate model instances.
  • Tighten the cache promise type from any to Object3D | Error.

Validation

  • ./node_modules/.bin/biome format src/hooks/use-global-obj-loader.ts --write
  • ./node_modules/.bin/tsc --noEmit
  • npm run build
  • git diff --check

Note: bun install crashes locally with an internal Bun assertion on Windows, so I used npm install --legacy-peer-deps --ignore-scripts --no-audit --no-fund for validation dependencies.

Share cached geometry buffers between cloned model instances while cloning materials per instance, reducing duplicate model memory/work without leaking hover or translucency state.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
3d-viewer Ready Ready Preview, Comment Jun 1, 2026 12:59pm

Request Review

@MikeGarciaAGM MikeGarciaAGM left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks good. Cloning OBJ models with shared geometry and cloned materials is a sensible performance fix, and the change stays tightly scoped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants