From adf8a1949f78f4207612c84691d73c4fe4a23ea1 Mon Sep 17 00:00:00 2001 From: Adnane Belmadiaf Date: Sun, 15 Dec 2024 22:28:58 +0100 Subject: [PATCH] fix(GLTFImporter): fix GLTF Draco normals fix #3192 --- Sources/IO/Geometry/GLTFImporter/Extensions.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Sources/IO/Geometry/GLTFImporter/Extensions.js b/Sources/IO/Geometry/GLTFImporter/Extensions.js index 3075fcc8187..6b85c6b4c6e 100644 --- a/Sources/IO/Geometry/GLTFImporter/Extensions.js +++ b/Sources/IO/Geometry/GLTFImporter/Extensions.js @@ -2,6 +2,7 @@ import macro from 'vtk.js/Sources/macros'; import * as vtkMath from 'vtk.js/Sources/Common/Core/Math'; import vtkDracoReader from 'vtk.js/Sources/IO/Geometry/DracoReader'; import vtkLight from 'vtk.js/Sources/Rendering/Core/Light'; +import vtkPolyDataNormals from 'vtk.js/Sources/Filters/Core/PolyDataNormals'; import { MIN_LIGHT_ATTENUATION } from 'vtk.js/Sources/IO/Geometry/GLTFImporter/Constants'; @@ -89,7 +90,10 @@ export function handleKHRLightsPunctual(extension, transformMatrix, model) { export async function handleKHRDracoMeshCompression(extension) { const reader = vtkDracoReader.newInstance(); reader.parse(extension.bufferView); - return reader.getOutputData(); + const pdn = vtkPolyDataNormals.newInstance(); + pdn.setInputConnection(reader.getOutputPort()); + pdn.setComputePointNormals(true); + return pdn.getOutputData(); } /**