Javascript Three.js-Three.MeshLambertMaterial:';纹理';不是此材质的属性
该项目目前涉及一个旋转立方体。我希望使用包含MeshLambertMaterials的MultiMaterial向侧面添加骰子纹理 在这一点上,我有我的旋转立方体。 我使用这段代码加载了纹理(当它们显示在chrome inspector中时加载)。我的照片叫1.jpg,2.jpgJavascript Three.js-Three.MeshLambertMaterial:';纹理';不是此材质的属性,javascript,three.js,Javascript,Three.js,该项目目前涉及一个旋转立方体。我希望使用包含MeshLambertMaterials的MultiMaterial向侧面添加骰子纹理 在这一点上,我有我的旋转立方体。 我使用这段代码加载了纹理(当它们显示在chrome inspector中时加载)。我的照片叫1.jpg,2.jpg const loadTextures = () => { const textureLoader = new THREE.TextureLoader(); let materials = [];
const loadTextures = () => {
const textureLoader = new THREE.TextureLoader();
let materials = [];
for (let i = 0; i <= 5; i++) {
const texture = textureLoader.load('./assets/textures/' + (i + 1) + '.jpg');
materials[i] = new THREE.MeshLambertMaterial({ texture });
}
return materials;
}
然而,当我运行代码时,我得到的是这些警告,而不是错误:。而且纹理不会加载 所以,我自己发现了这个问题,但仍然想与有同样问题的人分享。我忘了为每个Meshlambert材质中的纹理添加“贴图”属性
materials[i] = new THREE.MeshLambertMaterial({ map:texture });
materials[i] = new THREE.MeshLambertMaterial({ map:texture });