• Runtimes
  • [spine-ts] New 'transformer' function parameter in draw()?

When porting over 4.2 spine-ts for the C3 Spine addon, I noticed the additional transformer input for the renderer.draw() function.

I can see that it allows for additional changes to vertices,

transformer(clippedVertices, clippedVertices.length, vertexSize);

What were the thoughts about how it would be used in terms of an example application.

Thanks,
Mikal

Related Discussions
...

The transformer function parameter in the draw() method of the spine-ts renderer is designed to allow for custom transformations of the vertices before they are rendered. This could be used for various purposes, such as applying custom effects, modifying the geometry in real-time, or integrating with specific rendering pipelines that require vertices to be transformed in a certain way.

For example, in a game engine integration where you might want to apply a global effect to all Spine animations, such as a distortion effect or a global scaling based on game logic, you could use the transformer function to modify the vertices accordingly before they are passed to the GPU for rendering. This provides a flexible way to inject custom logic directly into the rendering process without having to modify the underlying Spine runtime or the assets themselves.

Another potential use case could be in an environment where the rendering system or the game engine requires vertices to be in a specific format or coordinate system that is different from what Spine exports. The transformer function could be used to convert the Spine vertices to the required format on-the-fly during rendering.

In summary, the transformer function parameter provides a powerful tool for developers to customize and extend the rendering capabilities of Spine animations within their applications, offering a way to apply custom vertex transformations easily and efficiently.

    Spinebot

    Woah, nice, an AI response and it makes sense!

    While Spinebot is spot on, the actual reason for this additional parameter is spine-phaser, where we need to do some transforms to get rendering to work in the Phaser environment.

    Sticking up for Spinebot 🙂 it did mention that usage also:

    or integrating with specific rendering pipelines that require vertices to be transformed in a certain way.

    Outsmarted by a bot!