三个 OBJ Loader 缺少 Blocks 中的几何面
THREE OBJ Loader missing geometry faces from Blocks
从 Google 块中加载一些 OBJ 我注意到一些面孔丢失了。我有平滑的阴影,但无法使缺失的面孔出现。想法?这是我当前的模板:
mtlLoader.load(mtlUrl, (materialLoader) => {
materialLoader.preload();
for (let material in materialLoader.materials) {
materialLoader.materials[material].side = THREE.DoubleSide;
}
let objLoader = new THREE.OBJLoader();
objLoader.setMaterials(materialLoader);
let onSuccess = function (object) {
var mesh = object.children[0];
mesh.geometry = new THREE.Geometry().fromBufferGeometry(mesh.geometry);
mesh.geometry.computeFaceNormals();
mesh.geometry.mergeVertices();
mesh.geometry.computeVertexNormals();
mesh.geometry.center();
this.group.add(object);
};
let onProgress = function (event) {
if (event.lengthComputable) {
let percentComplete = event.loaded / event.total * 100;
let output = 'Download of Object: ' + Math.round(percentComplete) + '%';
}
};
let onError = function (event) {
let output = 'Error of type "' + event.type + '" occurred when trying to load: ' + event.src;
};
objLoader.load(objUrl, onSuccess, onProgress, onError);
});
工件:
正确:
从 Google 块中加载一些 OBJ 我注意到一些面孔丢失了。我有平滑的阴影,但无法使缺失的面孔出现。想法?这是我当前的模板:
mtlLoader.load(mtlUrl, (materialLoader) => {
materialLoader.preload();
for (let material in materialLoader.materials) {
materialLoader.materials[material].side = THREE.DoubleSide;
}
let objLoader = new THREE.OBJLoader();
objLoader.setMaterials(materialLoader);
let onSuccess = function (object) {
var mesh = object.children[0];
mesh.geometry = new THREE.Geometry().fromBufferGeometry(mesh.geometry);
mesh.geometry.computeFaceNormals();
mesh.geometry.mergeVertices();
mesh.geometry.computeVertexNormals();
mesh.geometry.center();
this.group.add(object);
};
let onProgress = function (event) {
if (event.lengthComputable) {
let percentComplete = event.loaded / event.total * 100;
let output = 'Download of Object: ' + Math.round(percentComplete) + '%';
}
};
let onError = function (event) {
let output = 'Error of type "' + event.type + '" occurred when trying to load: ' + event.src;
};
objLoader.load(objUrl, onSuccess, onProgress, onError);
});
工件:
正确: