use instanceof instead of LoaderClass comparison in renderer

This commit is contained in:
James Smith committed 2026-01-14 13:03:01 +00:00
1 parent b4a8b32416
commit 99b3abb7a0
1 file changed
+4 -4
+4 -4
View File
@@ -116,17 +116,17 @@ export class OffscreenRenderer {
// Create loader
const loader = new LoaderClass()
// Set up DRACO loader for GLTF
if (LoaderClass === GLTFLoader) {
if (loader instanceof GLTFLoader) {
const dracoLoader = new DRACOLoader()
dracoLoader.setDecoderPath('https://www.gstatic.com/draco/versioned/decoders/1.5.7/')
loader.setDRACOLoader(dracoLoader)
} else if (LoaderClass === DRACOLoader) {
} else if (loader instanceof DRACOLoader) {
loader.setDecoderPath('https://www.gstatic.com/draco/versioned/decoders/1.5.7/')
} else if (LoaderClass === LDrawLoader) {
} else if (loader instanceof LDrawLoader) {
loader.setConditionalLineMaterial(LDrawConditionalLineMaterial)
loader.setPartsLibraryPath('https://raw.githubusercontent.com/gkjohnson/ldraw-parts-library/master/complete/ldraw/')
await loader.preloadMaterials('https://raw.githubusercontent.com/gkjohnson/ldraw-parts-library/master/complete/ldraw/LDConfig.ldr')
} else if (LoaderClass === Rhino3dmLoader) {
} else if (loader instanceof Rhino3dmLoader) {
loader.setLibraryPath('https://cdn.jsdelivr.net/npm/rhino3dm@8.17.0/')
}
// Load