mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 03:29:51 +02:00
fix: negative hard joint handling
This commit is contained in:
1 parent
6dfb727fa2
commit
062e6e9626
5 files changed
+20
-18
No files matched your search
@@ -58,7 +58,10 @@ export async function extractArmor(data: string, fileName: string) {
|
||||
|
||||
attributes.get(attribute)!.push(value);
|
||||
|
||||
if (attribute === VertexAttribute.HARD_JOINTINDEX) {
|
||||
if (
|
||||
attribute === VertexAttribute.HARD_JOINTINDEX &&
|
||||
value[0] !== -1
|
||||
) {
|
||||
hardJointIndices.add(value[0]);
|
||||
vertexHardJointIndices.set(index, value[0]);
|
||||
}
|
||||
@@ -99,17 +102,10 @@ export async function extractArmor(data: string, fileName: string) {
|
||||
.setType('SCALAR')
|
||||
.setArray(
|
||||
new Uint16Array(
|
||||
polygonGroup.indices.filter((index) => {
|
||||
if (!vertexHardJointIndices.has(index)) {
|
||||
throw new Error(
|
||||
`Missing vertex hard joint index for index ${index}`,
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
vertexHardJointIndices.get(index)! === hardJointIndex
|
||||
);
|
||||
}),
|
||||
polygonGroup.indices.filter(
|
||||
(index) =>
|
||||
vertexHardJointIndices.get(index) === hardJointIndex,
|
||||
),
|
||||
),
|
||||
)
|
||||
.setBuffer(buffer);
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
export function nameToArmorId(name: string) {
|
||||
const match = name.match(/.+_armor_(\d+)/);
|
||||
const group1 = match![1];
|
||||
|
||||
return parseInt(group1);
|
||||
}
|
||||
Reference in new issue
Block a user