vue加载obj插件

install

npm i --save three-obj-mtl-loader

usage

import * as THREE from 'three'
import {MTLLoader, OBJLoader} from 'three-obj-mtl-loader'
 
let scene = new THREE.Scene()
 
let mtlLoader = new MTLLoader();
 
let objLoader = new OBJLoader();
 
mtlLoader.load('./test.mtl', (materials) => {
  materials.preload()
  objLoader.setMaterials(materials)
  objLoader.load('./test.obj', (object) => {
    scene.add(object)
  })
})

你可能感兴趣的:(Vue)