Skip to content

Commit

Permalink
chore(model): use new bone flags
Browse files Browse the repository at this point in the history
  • Loading branch information
fallenoak committed Feb 9, 2024
1 parent d80ef81 commit f146d53
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/lib/model/skeleton.ts
Original file line number Diff line number Diff line change
@@ -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();
Expand Down Expand Up @@ -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
}

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

0 comments on commit f146d53

Please sign in to comment.