首页 > 其他分享 >Threejs:创建矩阵

Threejs:创建矩阵

时间:2022-12-08 22:45:46浏览次数:49  
标签:Threejs 1.0 创建 矩阵 THREE new geometry3 const

 

设置顶点创建矩形

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);

 

标签:Threejs,1.0,创建,矩阵,THREE,new,geometry3,const
From: https://www.cnblogs.com/LIXI-/p/16967626.html

相关文章