typescript - 为什么我不能在 ThreeJS Typescript 项目中创建 Face3

标签 typescript three.js geometry mesh face

我正在尝试使用 Face3 创建网格。我在 typescript 项目中使用 Threejs。我面临着几个问题。

const points = [
     new Face3(-1, 1, -1),//c
     new Face3(-1, -1, 1),//b
     new Face3(1, 1, 1),//a

     new Face3(1, 1, 1),//a
     new Face3(1, -1, -1),//d
     new Face3(-1, 1, -1),//c

     new Face3(-1, -1, 1),//b
     new Face3(1, -1, -1),//d
     new Face3(1, 1, 1),//a

     new Face3(-1, 1, -1),//c
     new Face3(1, -1, -1),//d
     new Face3(-1, -1, 1),//b
]
let geometry = new Geometry();
for (const point of points) {
     geometry.faces.push(point);
}

首先,我无法将这个几何体 添加到网格中。它给我的错误是它不是 BufferGeometry

enter image description here

如果我尝试从 Geomtery 创建一个新的 BufferGeometry,我找不到属性 fromGeometry

enter image description here

如果这些功能已被弃用,那么具体的替代方案是什么?为什么没有合适的指南或说明可用? 有没有人可以建议我更好的解决方案。

最佳答案

THREE.Geometry 类自 r125 以来已从核心中删除,并移至 examples/jsm/deprecated/Geometry.jsTHREE.Face 可以从同一个模块导入。

请注意,不建议再使用 THREE.Geometry。最好关注 THREE.BufferGeometrythree.js 论坛中的以下主题提供了更多背景信息:https://discourse.threejs.org/t/three-geometry-will-be-removed-from-core-with-r125/22401

关于typescript - 为什么我不能在 ThreeJS Typescript 项目中创建 Face3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67767491/

相关文章:

Angular ngrx : guards with side-effect

javascript - 在 Three.js 中加载多个 Blender 导出的对象/网格+ Material

three.js - 显示线框和纯色

c# - 合并多边形的高效算法

c++ - 如何渲染一个顶点尽可能少的圆?

angular - 如何从我的服务提供商的共享 HTTP 请求中捕获 401?

typescript - 如何在 Angular 2-Typescript 中设置可选的类参数?

typescript - 无法在 typescript 中初始化geofire对象

javascript - Three.js "indices of faces"是什么意思,它是如何工作的?

java - 如何使用 javaFx TriangleMesh 创建这样的形状?