Skip to content

Fix Threejs cube programming logos#4

Merged
rapha-pro merged 2 commits into
mainfrom
fix-overflow
Jul 11, 2026
Merged

Fix Threejs cube programming logos#4
rapha-pro merged 2 commits into
mainfrom
fix-overflow

Conversation

@rapha-pro

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings July 11, 2026 01:49
@vercel

vercel Bot commented Jul 11, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
portfolio Ready Ready Preview, Comment Jul 11, 2026 1:49am

@rapha-pro
rapha-pro merged commit 18df464 into main Jul 11, 2026
4 checks passed

Copilot AI 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.

Pull request overview

This PR fixes missing/blank programming logos on the Three.js skill cube by changing how face textures are created for SVG icons that lack intrinsic dimensions.

Changes:

  • Replaces TextureLoader face maps with a CanvasTexture pipeline that rasterizes SVG/raster icons onto an offscreen canvas.
  • Adds CORS handling via Image.crossOrigin = "anonymous" and keeps face materials white to preserve native logo brightness.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

* Rasterize any image URL (SVG or raster) into a fixed-size offscreen
* canvas, then wrap it as a CanvasTexture. This bypasses THREE.js's
* default TextureLoader path, which loads via an internal
* HTMLImageElement — and which silently produces a zero-size texture
const dh = ih * scale
ctx.drawImage(img, (TEX_SIZE - dw) / 2, (TEX_SIZE - dh) / 2, dw, dh)
} else {
// SVG reported zero intrinsic size — fill the target square
Comment on lines +66 to +70
useEffect(() => {
const el = mountRef.current
if (!el) return
// Wipe any previous canvas (Fast Refresh / StrictMode remounts).
el.innerHTML = ""
Comment on lines +139 to +142
img.onload = () => {
const pad = TEX_SIZE * PAD_RATIO
const target = TEX_SIZE - pad * 2
ctx.clearRect(0, 0, TEX_SIZE, TEX_SIZE)
Comment on lines +171 to +175
img.onerror = () => {
// Leave the face white — the accent glow still frames the cube.
// Log for diagnosis; the console will make failures obvious.
console.warn(`[SkillCube] Failed to load icon: ${iconUrl}`)
}
Comment on lines +238 to +240
return () => {
cancelAnimationFrame(rafId)
controls.dispose()
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.

2 participants