Skip to content

Commit

Permalink
fix(GLTFImporter): fix GLTF Draco normals
Browse files Browse the repository at this point in the history
fix #3192
  • Loading branch information
daker committed Dec 15, 2024
1 parent 89758ed commit adf8a19
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Sources/IO/Geometry/GLTFImporter/Extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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();
}

/**
Expand Down

0 comments on commit adf8a19

Please sign in to comment.