Hey all,
I am currently looking into integrating Spine animation runtime with our custom WebGL renderer. I wrote a small demo covering the essentials (skeleton and textures handling), however have two questions, for which I can't find much in the codebase or docs:
- Looking at the .atlas files generated by Spine, I can't understand what the
offsets field is doing. I get bounds, that would be the image subregion within the sprite atlas, but don't get how does it relate and affects bounds.
Right now I am taking only bounds into account when displaying my spritesheets and my textures are clearly wrong. Is it something like this:

Where the black borders are bounds, yet the red borders are offsets?
- How to use the bones
a, b, c, d, worldX and worldY properties to construct a proper 3x3 world transform matrix.
Looking at your threejs integrations I saw you are calculating the quads world positions via attachment.computeWorldVertices method + doing batch rendering and directly batching the world space position vertices as floats.
However my engine has a proper scene graph, that I'd like to utilise and not do lower level vertices arrays manipulation. Here is my current update method:
public update(dt: number): void {
this.state.update(dt);
this.state.apply(this.skeleton);
this.skeleton.updateWorldTransform();
const skeleton = this.skeleton;
const worldMatrix = Matrix3.create();
for (let i = 0; i < skeleton.drawOrder.length; i++) {
const node = this.children[i];
if (!node) {
continue;
}
const slot = skeleton.drawOrder[i];
Matrix3.set(
worldMatrix,
slot.bone.a,
slot.bone.b,
slot.bone.c,
slot.bone.d,
slot.bone.worldX,
slot.bone.worldY
);
Matrix3.copy(worldMatrix, node.transform);
}
}
At init time I have created a bunch of Node elements that correspond to each Bone and as you can see, in the update I construct a 3x3 matrix out of a, b, c, d, worldX and worldY elements. This almost works, however my model appears inverted:

Is there a better way to go about this? Looking at the Bone class, I don't see a 3x3 matrix that I can use exposed and am not sure how to construct one out of these fields.
Thanks for the great software, I am really excited to get this running! ๐