From 26bd3ff1a5fd636910acb16717efd55f4f9a13fd Mon Sep 17 00:00:00 2001 From: Raphael Date: Mon, 1 Jul 2024 13:46:21 +0200 Subject: [PATCH] Fault tolerance for model inconsitency --- .../vitrivr/cineast/core/data/m3d/texturemodel/Mesh.java | 2 +- .../core/extraction/decode/m3d/TextureModelDecoder.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cineast-core/src/main/java/org/vitrivr/cineast/core/data/m3d/texturemodel/Mesh.java b/cineast-core/src/main/java/org/vitrivr/cineast/core/data/m3d/texturemodel/Mesh.java index ba7ac15c4..9beeee9ab 100644 --- a/cineast-core/src/main/java/org/vitrivr/cineast/core/data/m3d/texturemodel/Mesh.java +++ b/cineast-core/src/main/java/org/vitrivr/cineast/core/data/m3d/texturemodel/Mesh.java @@ -110,7 +110,7 @@ public Mesh(float[] positions, float[] normals, float[] tangents, float[] bitang // Calculate face normals // ic increments by 3 because a face is defined by 3 vertices - for (var ic = 0; ic < this.idx.length; ic += 3) { + for (var ic = 0; ic < this.idx.length-2; ic += 3) { if (normals == null || normals.length == 0) { // Add zero vector if there are no vertex normals this.facenormals.add(new Vector3f(0f, 0f, 0f)); diff --git a/cineast-core/src/main/java/org/vitrivr/cineast/core/extraction/decode/m3d/TextureModelDecoder.java b/cineast-core/src/main/java/org/vitrivr/cineast/core/extraction/decode/m3d/TextureModelDecoder.java index ef662b0a3..29dd84542 100644 --- a/cineast-core/src/main/java/org/vitrivr/cineast/core/extraction/decode/m3d/TextureModelDecoder.java +++ b/cineast-core/src/main/java/org/vitrivr/cineast/core/extraction/decode/m3d/TextureModelDecoder.java @@ -71,16 +71,16 @@ public Model getNext() { try { model = ModelLoader.loadModel(this.inputFile.toString(), this.inputFile.toString()); } catch (NumberFormatException e) { - LOGGER.error("Could not decode OBJ file {} because one of the tokens could not be converted to a valid number.", this.inputFile.toString()); + LOGGER.error("Could not decode file {} because one of the tokens could not be converted to a valid number.", this.inputFile.toString()); model = null; } catch (ArrayIndexOutOfBoundsException e) { - LOGGER.error("Could not decode OBJ file {} because one of the faces points to invalid vertex indices.", this.inputFile.toString()); + LOGGER.error("Could not decode file {} because one of the faces points to invalid vertex indices.", this.inputFile.toString()); model = null; } catch (TextureLoadException e) { - LOGGER.error("Could not decode OBJ file {} because one of the faces points to invalid vertex indices.", this.inputFile.toString()); + LOGGER.error("Could not decode file {} because one of the faces points to invalid vertex indices.", this.inputFile.toString()); model = null; } catch (Exception e) { - LOGGER.error("Could not decode OBJ file {} because an unexpected error occurred.", this.inputFile.toString(), e); + LOGGER.error("Could not decode file {} because an unexpected error occurred.", this.inputFile.toString(), e); model = null; } finally {