I am seeking help with displaying the wireframe of a parallelepiped defined by vertexes in Json format using Three.js code. Here is the code snippet I am working with:
var testCube ={
"metadata":{
"version":json['version'],
"type":json['type'],
"uvs":json['n_uvs'],
"normals":json['n_normals'],
"faces":json['n_faces'],
"generator":"io_three",
"vertices":json['n_vertices'],
},
"faces":json['faces'],
"vertices":json['vertices'],
"normals":json['normals'],
"uvs":[],
"name":json['name']}
var loader = new THREE.JSONLoader();
var model = loader.parse( testCube );
meshBox = new THREE.Mesh( model.geometry, model.materials[ 0 ] );
var geo = new THREE.EdgesGeometry( meshBox.geometry );
var mat = new THREE.LineBasicMaterial( { color: 0xffffff, linewidth: 2 });
var wireframe = new THREE.LineSegments( geo, mat );
scene.add( wireframe );
Currently, the visualization produced by this code looks like this:
https://i.sstatic.net/UMB39.jpg
However, I would like to achieve a visualization where both the external and internal wireframes are visible, similar to this:
https://i.sstatic.net/50KCj.png
Question: Is there a way to modify the above Three.js code to achieve a full wireframe as shown in the second image?
Update: By utilizing the function WireframeGeometry
, you get the following result:
https://i.sstatic.net/8Vpxp.png
It appears that diagonals are present on each face of the mesh. Is there a different function available that does not produce these diagonals?
Thank you for any assistance provided!