From f146d534eee76b7a530ce9a5e7a9254963ded4b5 Mon Sep 17 00:00:00 2001 From: fallenoak Date: Thu, 8 Feb 2024 17:06:29 -0700 Subject: [PATCH] chore(model): use new bone flags --- src/lib/model/skeleton.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/lib/model/skeleton.ts b/src/lib/model/skeleton.ts index 9204953..2f7cee7 100644 --- a/src/lib/model/skeleton.ts +++ b/src/lib/model/skeleton.ts @@ -1,4 +1,5 @@ import * as THREE from 'three'; +import { M2_BONE_FLAG } from '@wowserhq/format'; import ModelBone from './ModelBone.js'; const _boneTranslation = new THREE.Vector3(); @@ -79,13 +80,13 @@ const billboardBone = (bone: ModelBone) => { _transformedPivot.set(bone.pivot.x, bone.pivot.y, bone.pivot.z, 1.0).applyMatrix4(bone.matrix); // Spherical billboard - if (bone.flags & 0x8) { + if (bone.flags & M2_BONE_FLAG.FLAG_SPHERICAL_BILLBOARD) { applySphericalBillboard(bone); - } else if (bone.flags & 0x10) { + } else if (bone.flags & M2_BONE_FLAG.FLAG_CYLINDRICAL_BILLBOARD_X) { // TODO - } else if (bone.flags & 0x20) { + } else if (bone.flags & M2_BONE_FLAG.FLAG_CYLINDRICAL_BILLBOARD_Y) { // TODO - } else if (bone.flags & 0x40) { + } else if (bone.flags & M2_BONE_FLAG.FLAG_CYLINDRICAL_BILLBOARD_Z) { // TODO } @@ -117,7 +118,7 @@ const updateBone = (root: THREE.Object3D, bone: ModelBone) => { bone.matrix.copy(parentMatrix); } - if (bone.flags & (0x8 | 0x10 | 0x20 | 0x40)) { + if (bone.flags & M2_BONE_FLAG.FLAG_BILLBOARD) { billboardBone(bone); } };