Threejs:创建矩阵

 

设置顶点创建矩形

const geometry3 = new THREE.BufferGeometry();
const vertices = new Float32Array([
  -1.0, -1.0, 1.0,
  1.0, -1.0, 1.0,
  1.0, 1.0, 1.0,
  // 第二个三角形
  1.0, 1.0, 1.0,
  -1.0, 1.0, 1.0,
  -1.0, -1.0, 1.0
]);
geometry3.setAttribute('position', new THREE.BufferAttribute(vertices, 3));
const material3 = new THREE.MeshBasicMaterial({ color: 0xff9900 });
const mesh = new THREE.Mesh(geometry3, material3);

scene.add(mesh);

 

posted on 2022-12-08 22:37  香香鲲  阅读(159)  评论(0编辑  收藏  举报