我使用three.js库将图像绘制到屏幕上。当我创建我的plainGeometry类型记录时,它说particles.geometry.vertices中不存在顶点,但是当我运行我的模块时,所有的东西都会加载和响应,而且它会给我这个错误--说顶点不存在,如果它们不存在,我就不会绘制那个映像。
几何学有一个叫做顶点的属性,当我通过three.point(几何学,材料)创建物体粒子时,我从几何学中得到所有的顶点并通过this.particles.geometry.vertices来访问它们,但是类型记录说即使它工作,这个属性也不存在于几何学中。
这是显示错误
性质‘顶点’在‘Plane几何学’型上不存在。
下面是我did.Can u的代码,请帮我解决这个问题。
代码: https://stackblitz.com/edit/angular-threejs-demo-basic-hhtztu
发布于 2021-10-26 10:49:19
由于r125,所有像PlaneGeometry这样的几何生成器都是从BufferGeometry派生出来的。在同一版本中,Geometry已经被删除,这意味着BufferGeometry现在是处理几何数据的唯一方法。
这意味着您不能再访问vertices属性了。实现简单顶点置换(如代码中的顶点)的通常方法是:
const positionAttribute = geometry.getAttribute('position');
for (let i = 0; i < positionAttribute.count; i ++) {
vertex.fromBufferAttribute(positionAttribute, i);
const waveX1 = 0.25 * Math.sin(v.x * 2 + t * 3)
const waveX2 = 0.125 * Math.sin(v.x * 3 + t * 2)
const waveY1 = 0.1 * Math.sin(v.y * 5 + t * 0.5)
vertex.z = (waveX1 + waveX2 + waveY1);
positionAttribute.setZ(i, vertex.z);
}
positionAttribute.needsUpdate = true;https://stackoverflow.com/questions/69720682
复制相似问题