I am trying to display the wireframe of an object file loaded with OBJLoader()
. This is the part of the code I am using:
var loader = new THREE.OBJLoader();
loader.load( filePath, function ( object ) {
object.traverse( function ( child ) {
if ( child instanceof THREE.Mesh ){
var geometry = child.geometry;
materialMesh = child.material;
mesh = new THREE.Mesh(geometry, materialMesh);
var useWireFrame = true;
if (useWireFrame) {
mesh.traverse(function (child) {
if (child instanceof THREE.Mesh)
{
child.material.wireframe = true;
hild.material.color = new THREE.Color( 0xff0000 );
}
});
}
}// end if
scene.add( object );
});
});
In the following picture it's the result I would like to get:
However, this is what I get with my code:
There are diagonals on each cell! Can anyone tell me what I should modify to obtain a result equivalent to the first picture ?
Thank you!