首页 > 其他分享 >Threejs:创建纹理

Threejs:创建纹理

时间:2022-12-08 22:45:05浏览次数:52  
标签:Threejs const texture1 创建 THREE 纹理 mesh2 new

创建纹理

// 导入纹理
const loader = new THREE.TextureLoader();
// 加载所需要的纹理图片
const texture1 = loader.load('./dist/texture/sea.jpg')
const material5 = new THREE.MeshLambertMaterial({ map: texture1, side: THREE.DoubleSide, });
texture1.wrapS = THREE.RepeatWrapping;
texture1.wrapT = THREE.RepeatWrapping;
// uv两个方向纹理重复数量
texture1.repeat.set(1, 1);

// 添加物体
const geometry4 = new THREE.BoxGeometry(1, 1, 1);
// const material4 = new THREE.MeshBasicMaterial({color:0xfff888})
const mesh2 = new THREE.Mesh(geometry4, material5);
mesh2.position.z = 2;
scene.add(mesh2);

 

标签:Threejs,const,texture1,创建,THREE,纹理,mesh2,new
From: https://www.cnblogs.com/LIXI-/p/16967628.html

相关文章