本文主要是介绍【three.js案例一】智慧星球,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
直接附上源码:
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.
这篇关于【three.js案例一】智慧星球的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!