I am trying to implement a viewer for several types of formats, and I also would like to draw the edges of the meshes. It is working for OBJ, VTK, STL, but I am stuck with GLTF. It seems I am missing a transformation.
I have two models in the menu that can be used for testing: LitthestTokyo.glb and supekrmarine_spitfire.gltf and the problem is the same, when the option “Mesh” is checked.
but besides the edges being disconnected from all of the 3 plugs, it crashed miserably on mobiles. I designed the interface to run on mobiles, and a beautiful animation from a heart borrowed from body3d.eu also crashes on IOS:
Just for the records. Mobile devices do not support textures greater than 4k (4096 bytes). Reducing the sizes solves all problems (I used gltf-transform). However, this particular app needs to completely erase all buffers on the GPU to move on to the next model. I know this question has been asked many times before, but there is not a definitive answer. I understand that threejs cannot do that “automagically”, but again, if I need to, what should be done?
// Dispose material and its texture
function delMaterial(mat) {
if (mat) {
if (mat.map) {
mat.map.dispose();
}
if (mat.normalMap) {
mat.normalMap.dispose();
}
if (mat.envMap) {
mat.envMap.dispose();
}
mat.dispose();
}
}
if (object) {
scene.remove(object);
object.traverse(function (child) {
if (child.isMesh) {
child.geometry.dispose();
if (Array.isArray(child.material)) {
child.material.forEach((material) => {
delMaterial(material);
});
} else {
delMaterial(child.material);
}
}
});
object = undefined;
}
I am pretty sure this is not enough, but at least it is working for me…