我有一个 .obj 文件
v 1 2 3
v 4 5 6
v 7 8 9
vt 0 1
vt 1 0
vn 0 0 1
vn 0 1 0
vn 0 0 1
f 1/1/1 2/2/2 3/3/3
f 1/1/2 2/2/3 1/2/3
我需要创建 THREE.Mesh。我愿意
var geometry = new THREE.BufferGeometry();
geometry.addAttribute('position', new THREE.BufferAttribute(vertices, 3));
geometry.addAttribute('normal', new THREE.BufferAttribute(normals, 3));
geometry.addAttribute('uv', new THREE.BufferAttribute(uvs, 2));
geometry.setIndex(new THREE.BufferAttribute(indices, 1));
var mesh = new THREE.Mesh(geometry, material);
我想我需要在数组中有以下数据:
var vertices = [1, 2, 3, 4, 5, 6, 7, 8, 9];
var normals = [0, 0, 1, 0, 1, 0, 0, 0, 1];
var uvs = [0, 1, 1, 0]
var indices = // ... ?
我不明白我需要在索引数组中存储什么?