three.js - Threejs中未显示的点
问题描述
我正在尝试在 threejs 中使用 Points 对象。我正在尝试显示一个点,但它没有显示出来。浏览器没有给出任何错误。让我知道需要做什么。谢谢
let pointGeometry:any = new BufferGeometry();
let positionAttribute = new BufferAttribute( new Float32Array([10,5,10]), 10 );
pointGeometry.setAttribute( 'position', positionAttribute );
pointGeometry.attributes.position.needsUpdate = true;
pointGeometry.setDrawRange(0,10);
let pointMaterial = new PointsMaterial( { color: 0x03F9E7, size: 10 } );
this.point = new Points( pointGeometry, pointMaterial );
this.point.name = 'point';
this.point.scale.copy( new Vector3(10,10,10) );
this.scene.add( this.point );
解决方案
的应该itemSize
是。BufferAttribute
3
let positionAttribute = new BufferAttribute( new Float32Array([10,5,10]), 3 );
pointGeometry.setAttribute( 'position', positionAttribute );
itemSize
-- 应该与特定顶点关联的数组值的数量。例如,如果此属性存储一个 3 分量向量(例如位置、法线或颜色),则 itemSize 应为 3。
另一个原因可能是相机看错了位置。如果你设置一个比例,10
点的最终位置会在[100,50,100]
。
推荐阅读
- angular - Angular2 Http请求将baseURL添加到POST请求
- flash-cs6 - 导出 swf 文件 Flash CS6
- memory-management - 如何初始化具有固定大小数组的结构作为成员元素?
- php - 绑定从视图提交到控制器的值
- java - 从 java 8 流中获取 N(3) 个列表(基于 ENUM 性别(男性、女性、其他))并基于 ENUM 过滤条件
- java - 如何降低此 O(n^3) 代码的时间复杂度
- python - 如何比较具有相同列但顺序不同(SQL 或 python)的两个表?
- laravel - Laravel,检查值是否在某个集合中(在刀片中)
- c# - 如何在两个浮点数之间随机化计时器持续时间
- javascript - 从反应路由器中排除路径