欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

vue加载obj插件

程序员文章站 2022-03-26 16:01:06
...

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 threejs obj