Skip to content

Commit

Permalink
Merge pull request #514 from KhronosGroup/fix/brokenJoints
Browse files Browse the repository at this point in the history
Fix broken joints attribute
  • Loading branch information
UX3D-haertl authored Dec 5, 2023
2 parents c285921 + ea586ba commit e696769
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions source/gltf/primitive.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ class gltfPrimitive extends GltfObject
}
}

if (this.attributes.TANGENT === undefined)
// Generate tangents with Mikktspace which needs normals and texcoords as inputs
if (this.attributes.TANGENT === undefined && this.attributes.NORMAL && this.attributes.TEXCOORD_0)
{
console.info("Generating tangents using the MikkTSpace algorithm.");
console.time("Tangent generation");
Expand Down Expand Up @@ -777,7 +778,8 @@ class gltfPrimitive extends GltfObject
const componentCount = accessor.getComponentCount(accessor.type);

const weldedAttribute = accessor.getDeinterlacedView(gltf);
const unweldedAttribute = new Float32Array(gltf.accessors[this.indices].count * componentCount);
// Create new array with same type as weldedAttribute
const unweldedAttribute = new weldedAttribute.constructor(gltf.accessors[this.indices].count * componentCount);

// Apply the index mapping.
for (let i = 0; i < typedIndexView.length; i++) {
Expand Down

0 comments on commit e696769

Please sign in to comment.