直接附上源码:
import * as THREE from 'three';
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';//场景
const scene = new THREE.Scene();const geometry = new THREE.SphereGeometry(50,32,16);console.log('.postion',geometry.attributes.position);
console.log('.index',geometry.index);
const material = new THREE.MeshLambertMaterial({color: 0x00ffff, wireframe:true,
});
const mesh = new THREE.Mesh(geometry, material);
scene.add(mesh);//辅助观察的坐标系
const axesHelper = new THREE.AxesHelper(100);
// scene.add(axesHelper);//光源设置
const directionalLight = new THREE.DirectionalLight(0xffffff, 1);
directionalLight.position.set(100, 60, 50);
scene.add(directionalLight);
const ambient = new THREE.AmbientLight(0xffffff, 0.