1、纹理贴图
import * as THREE from 'three'
const loader = new THREE.TextureLoader(); //纹理加载器
const texture = loader.load('./earth.png');//// .load()方法加载图像,返回一个纹理对象Texture
const material = new THREE.MeshLambertMaterial({
map: texture
});
texture.colorSpace = THREE.SRGBColorSpace;//设置为SRGB颜色空间
const geometry = new THREE.SphereGeometry(100)
const mesh = new THREE.Mesh(geometry, material);
export default mesh
效果:把一个地球的图片贴到一个球体上
2、纹理对象阵列,实现地面效果。
主要使用的是设置阵列模式和uv两个方向纹理重复数量
texture.wrapS = THREE.RepeatWrapping;
texture.wrapT = THREE.RepeatWrapping;
texture.repeat.set(30, 30)
import * as THREE from 'three';
const geometry = new THREE.PlaneGeometry(100, 100);
const textureLoader = new THREE.TextureLoade