在 BufferGeometry 中,有没有一种方法可以访问面索引和法线而不转换为几何图形?
手头的几何体是由 Threejs 编辑器创建的 SphereBufferGeometry。
我只需要读取面部索引和法线,而不需要修改它们。
BufferGeometry
是“索引”或“非索引”。SphereGeometry
,源自BufferGeometry
,是索引类型。
您可以像这样访问几何数据结构中的面法线:
var normal = new THREE.Vector3(); // create once and reuse
...
// specify the desired face index
var faceIndex = 15; // [ 0 ... num_faces-1 ]
// specify which face vertex you want
var vertexNumber = 2; // [ 0, 1, or 2 ]
// compute the index where the data is stored
var index = geometry.index.array[ 3 * faceIndex + vertexNumber ];
// get the vertex normal from the attribute data
normal.fromBufferAttribute( geometry.attributes.normal, index );
console.log( normal );
三.js r.143
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)