1
MeshPhongMaterial에 3 개의 js 텍스처를 추가하려고하는데, 어떤 이유로 든 불이 켜진 블랙 박스를 얻고 있습니다. 나는 이것에 잠시 붙어 있었고 그것을 이해하는 것처럼 보일 수 없다.Three.js MeshPhongMaterial 텍스처
//Creates the cube and lighting effect
function initCube() {
var loader = new THREE.TextureLoader();
var texture1 = loader.load("brick.jpg");
cubeTexture = loader.load
cube = new THREE.Mesh(new THREE.BoxGeometry(3,3,3), new
THREE.MeshPhongMaterial({color:0xffffff, map:texture1}));
scene.add(cube);
cube.scale.set(0.5, 0.5, 0.5);
cube.position.x = 0;
//Adds light
cubeLight = new THREE.PointLight(0xFF0000 , 30, 1);
cube.add(cubeLight);
cubeLight.position.set(-0.5,-1,0);
scene.add(cubeLight);
cubeLight.power =100;
map.cubeLight = {
light: cubeLight,
added: true
}
//Adds second light
cubeLight2 = new THREE.PointLight(0x6600ff , 1, 1);
cube.add(cubeLight2);
cubeLight2.position.set(0,1,0);
scene.add(cubeLight2);
cubeLight2.power =100;
map.cubeLight2 = {
light: cubeLight2,
added: true
}
}
웹 서버를 실행하고 있습니까, 아니면 브라우저에서 .html 파일을 직접 열려고합니까? 후자가 작동하지 않는 가장 일반적인 이유는 브라우저 콘솔에서 경고/오류가 표시되어야합니다. http://stackoverflow.com/questions/21151026/three-js-cant-load-texture-locally를 참조하십시오. –