Can anyone assist with why the texture is not loading?
I attempted to load the texture onto a separate mesh in obj file but it's not working, giving an error. Can someone explain why the material is applied but the texture is not loading?
var manager = new THREE.LoadingManager();
var loader = new THREE.ImageLoader(manager);
var textureBody = new THREE.Texture();
loader.load('tex/Base4.png', function(image) {
textureBody.image = image;
textureBody.needsUpdate = true;
});
var meshes = [];
var objLoader = new THREE.OBJLoader();
objLoader.load('models/bas.obj', function(object) {
console.log(object);
object.traverse(function(child) {
if (child instanceof THREE.Mesh) {
meshes.push(child);
}
});
var body = meshes[2];
body.position.y = 2;
scene.add(body);
var bumpMapBody = new THREE.TextureLoader().load('tex/untitled2-NM_u0_v0.tif');
body.material = new THREE.MeshPhonglMaterial({
map: textureBody
});
});
Encountering the error message:
Uncaught TypeError: THREE.MeshPhonglMaterial is not a constructor at mucode.js:77 "body.material = new THREE.MeshPhonglMaterial({"at Object.onLoad (OBJLoader.js:385) at XMLHttpRequest. (three.js:32008)
P.S. Can anyone advise on resizing the window and moving the canvas to a separate div?