Reputation: 3
I'm using three.js and I would like to migrate from r52 to r58 but I have problems with textures and geometry. Here is the part that I have a problem with: https://github.com/pasquelin/EnigmaCube/blob/dev/js/class/Three.Map.js#L255
Do you have an idea for my migration to keep my different textures on my different faces.
PS: I'm not super strong in 3D and I use google translate to communicate better lol.
Upvotes: 0
Views: 166
Reputation: 26
Migrating from r49 to r58, I had the same problem. When you're in front of this kind of problem, just take a look at the library's changelog (https://github.com/mrdoob/three.js/wiki/Migration#r52--r53) you'll notice that in the r53, the texture system was modified:
Geometry no longer has a materials property. MeshFaceMaterials usage is now like this: new THREE.Mesh( geometry, new THREE.MeshFaceMaterials( [ material1, material2 ] ) )
So,
var cube = new THREE.Mesh(new THREE.CubeGeometry(width, height, largeur, 1, 1, 1, materials), new THREE.MeshFaceMaterial());
become:
var cb = new THREE.CubeGeometry( width, height, largeur, 1, 1, 1 );
var cube = new THREE.Mesh( cb, new THREE.MeshFaceMaterial(faces) );
/!\ Take note that THREE.MeshFaceMaterial is singular, althought it is plural in the changelog
Upvotes: 1