threejs3d可视化楼宇源码 threejs文档示例( 四 )


2.用npm安装轨道控制插件 npm install three-orbit-controls??
three-orbit-controls安装地址:
https://www.npmjs.com/package/three-orbit-controls
该插件引入之前确认three.js 库已经引入,OrbitControls = require(‘three-orbit-controls’)(THREE)
使用方法: controls = new OrbitControls(camera);
3.用npm安装加载.obj和.mtl文件的插件 npm i –save three-obj-mtl-loader
three-obj-mtl-loader安装地址 :
https://www.npmjs.com/package/three-obj-mtl-loader
该插件引入之前必须确认three.js库已经引入,该插件包括加载.obj和.mtl 文件的加载器
import {MTLLoader,OBJLoader} from ‘three-obj-mtl-loader’;
使用方法:mtlLoader = new MTLLoader(); objLoader = new OBJLoader();
注:单独使用three-mtl-loader 和 three-obj-loader两个插件时,会发生错误:
4.用npm安装three-css2drender插件,npm i –save three-css2drender
three-css2drender安装地址:
www.npmjs.com/package/three-css2drende
插件引入之前必须确认htree.js库已经引入
import {CSS2DRenderer,CSS2DObject} from ‘three-css2drenderer’;
使用方法:
labelRenderer = new CSS2DRenderer();
label = new CSS2DObject( text );

推荐阅读