Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/editor/src/components/editor/export-manager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type { Mesh, Object3D } from 'three'
import { GLTFExporter } from 'three/examples/jsm/exporters/GLTFExporter.js'
import { OBJExporter } from 'three/examples/jsm/exporters/OBJExporter.js'
import { STLExporter } from 'three/examples/jsm/exporters/STLExporter.js'
import * as WebGPUTextureUtils from 'three/examples/jsm/utils/WebGPUTextureUtils.js'

export function ExportManager() {
const scene = useThree((state) => state.scene)
Expand Down Expand Up @@ -43,6 +44,18 @@ export function ExportManager() {
// Default: GLB export (existing behavior)
const exporter = new GLTFExporter()

// Compressed (KTX2/basis) textures must be decompressed during export or
// three r184's GLTFExporter throws "setTextureUtils() must be called".
// The app renders with WebGPURenderer, so use the WebGPU texture utils.
// We intentionally do NOT pass the live renderer: decompress() resizes
// whatever renderer it's given (and never restores it), which would
// corrupt the visible canvas. Omitting it lets three spin up and dispose
// its own throwaway renderer for the blit instead.
exporter.setTextureUtils({
decompress: (texture, maxTextureSize) =>
WebGPUTextureUtils.decompress(texture, maxTextureSize),
})
Comment thread
cursor[bot] marked this conversation as resolved.

return new Promise<void>((resolve, reject) => {
exporter.parse(
exportScene,
Expand Down
Loading