THREE.TextureLoader()를 사용하여 텍스처를 미리로드하고 있지만 쉐이더에 할당 할 수 없습니다.Three.js로 텍스처를 미리로드하려면 어떻게해야합니까?
if(assetsLoadedCount == totalAssetsCount)
{
// Create a sphere:
var sphere = new THREE.Mesh(
new THREE.SphereGeometry(100, 10, 10),
new THREE.MeshBasicMaterial({
map: textureLoader
})
);
scene.add(sphere);
}
을하지만 이것은 다음과 같은 오류가 발생합니다 : 다른 함수에서
var textureLoader = new THREE.TextureLoader();
textureLoader.load('img/texture.jpg', function(){
assetsLoadedCount++;
});
, 나는 장면을 초기화 assetsLoaded
을 확인
Uncaught TypeError: Cannot read property 'x' of undefined