← ClaudeAtlas

threejs-loaderslisted

Loading three.js assets: glTF with Draco, meshopt and KTX2 compression, other model formats, textures, HDR and EXR environments, progress, caching, cloning and disposal. Use when loading 3D models, textures or environment maps, or managing loading progress, on WebGL or with WebGPU and TSL.
ahmedamin20/hmcv-ui-studio-public · ★ 0 · Web & Frontend · score 62
Install: claude install-skill ahmedamin20/hmcv-ui-studio-public
# Three.js Loaders Targets three.js r186. Examples use WebGLRenderer; the WebGPU and TSL section uses WebGPURenderer. ## Quick Start ```javascript import * as THREE from "three"; import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js"; import { RoomEnvironment } from "three/addons/environments/RoomEnvironment.js"; const renderer = new THREE.WebGLRenderer({ antialias: true }); renderer.setPixelRatio(window.devicePixelRatio); renderer.setSize(window.innerWidth, window.innerHeight); document.body.appendChild(renderer.domElement); const scene = new THREE.Scene(); scene.environment = new THREE.PMREMGenerator(renderer).fromScene(new RoomEnvironment(), 0.04).texture; // glTF PBR materials render black without lights or an environment const camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); camera.position.set(2, 1.5, 3); camera.lookAt(0, 0, 0); const gltf = await new GLTFLoader().loadAsync("model.glb"); scene.add(gltf.scene); function animate() { renderer.render(scene, camera); } renderer.setAnimationLoop(animate); ``` ## LoadingManager One manager coordinates several loaders and reports combined progress. `loadAsync` still rejects on failure; `manager.onError` fires as well. ```javascript import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js"; const manager = new THREE.LoadingManager(); manager.onStart = (url, loaded, total) => { console.log(`Started loading: ${url}`); }; manager.onProgress = (url, loaded,