I want to do something like this.
here is my code, and this is the result.
var mtlLoader = new THREE.MTLLoader();
var objLoader = new THREE.OBJLoader();
mtlLoader.setPath('./model/hd/');
objLoader.setPath('./model/hd/');
mtlLoader.load('hd.mtl', function(materials){
materials.preload();
objLoader.setMaterials(materials);
objLoader.load('hd.obj', function(obj){
var geom = new THREE.Geometry();
geom.fromBufferGeometry(obj.children[0].geometry); // BufferGeometry to Geometry
var faces = geom.faces;
var vertices = geom.vertices;
var material = new THREE.LineBasicMaterial( { color: 0x0000ff } );
faces.forEach(function(val, index){
var geometry = new THREE.Geometry();
geometry.vertices.push(vertices[val.a]);
geometry.vertices.push(vertices[val.b]);
var line = new THREE.Line(geometry, material.clone()); // line
scene.add(line)
}
})
})
But it will reduce the fps
because of so many line
in the scene
. Is there any better way to do this?