首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >获取错误“请求的模块”./三-csg.js‘不提供名为'CSG’的导出。

获取错误“请求的模块”./三-csg.js‘不提供名为'CSG’的导出。
EN

Stack Overflow用户
提问于 2021-08-17 07:45:31
回答 1查看 110关注 0票数 0

我正在对多维数据集和球面做一些简单的CSG操作。为此,我使用了三个csg.js库表单"https://github.com/manthrax/THREE-CSGMesh“,在给出操作后,我得到了诸如”uncaughtcsg.js“这样的错误。/3-csg.js‘不提供名为'CSG’的导出。

按如下所示编码,并根据需要添加了另外两个库(CSG-lib.js,csg-lib.js)

代码语言:javascript
复制
import { CSG } from "./three-csg.js";

// -----------------------------------------------------(scene, camera, renderer are defined)

const cubegeometry = new THREE.BoxGeometry( 0.02, 0.02, 0.02 );
const cubematerial = new THREE.MeshBasicMaterial( {color: 0x00ff00,} );
const cube = new THREE.Mesh( cubegeometry, cubematerial );
const cubegeometry = new THREE.BoxGeometry( 0.02, 0.02, 0.02 );
const cubematerial = new THREE.MeshBasicMaterial( {color: 0x00ff00,} );
const cube = new THREE.Mesh( cubegeometry, cubematerial );
const cubeCSG   = CSG.fromMesh(cube);
const sphereCSG = CSG.fromMesh(sphere);
const resultCSG = cubeCSG.subtract(sphereCSG); 
const CSGmaterial = new THREE.MeshBasicMaterial( { color: 0xff0000 } );
const meshCSG = CSG.toMesh( resultCSG );
meshCSG.material = CSGmaterial;

scene.add( meshCSG );
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-08-17 19:28:22

你看过演示的源代码了吗?你所需要做的就是拆下花括号

代码语言:javascript
复制
import CSG from "./three-csg.js";
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68813472

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档