Answer the question
In order to leave comments, you need to log in
How to set conditions for displaying models in different formats in threejs?
Good afternoon everyone, I can’t figure out how to implement display by formats, each format has its own controllers.
The glb format has such an output, I can’t find how to set conditions if the format is glb, then it is output by glb, if the format is stl, then another, and so on
const ktx2Loader = new KTX2Loader()
.setTranscoderPath( 'threejs_3d/examples/js/libs/basis/' )
.detectSupport( renderer );
const loader = new GLTFLoader().setPath( 'models/gltf/' );
loader.setKTX2Loader( ktx2Loader );
loader.setMeshoptDecoder( MeshoptDecoder );
loader.load( 'coffeemat.glb', function ( gltf ) {
// coffeemat.glb was produced from the source scene using gltfpack:
// gltfpack -i coffeemat/scene.gltf -o coffeemat.glb -cc -tc
// The resulting model uses EXT_meshopt_compression (for geometry) and KHR_texture_basisu (for texture compression using ETC1S/BasisLZ)
gltf.scene.position.y = 8;
scene.add( gltf.scene );
render();
} );
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question