three模型贴图
作者:互联网
1、给three模型贴图,例子:展示一个太阳在宇宙中心
2、思路:在添加模型的时候给模型贴上图片
创建贴图
//贴图 let textureLoader = new THREE.TextureLoader(); let road = require("./assets/004.jpg"); let texture = textureLoader.load(road); texture.wrapS = THREE.RepeatWrapping; texture.wrapT = THREE.RepeatWrapping; //设置贴图重复比例; texture.repeat.set(2, 2);
插入材质
//材质对象Material let planeMat = new THREE.MeshBasicMaterial({ map: texture, // 设置纹理贴图 side: THREE.DoubleSide, });
跟模型一起加入场景
let scene = new THREE.Scene(); //创建平板 let planeGeo = new THREE.PlaneGeometry(1000, 1000, 10, 10); let planeMesh = new THREE.Mesh(planeGeo, planeMat); scene.add(planeMesh);
3、实例:
标签:贴图,模型,three,texture,THREE,let,new 来源: https://www.cnblogs.com/lovewhatIlove/p/16409966.html