Hi, I'm trying to create a spine runtime for rayblib (https://www.raylib.com/)
For that, I'm using the generic C libraries version 3.8 (https://github.com/EsotericSoftware/spine-runtimes/tree/3.8/spine-c)
Everything goes well except for 2 things:
- The animation is upside down.
- Any scale < 0 make the animation disappear.
The most important thing to solve for me is 1, but maybe this two problems are related.
My code is here:
https://github.com/WEREMSOFT/flecs_plus_raylib/tree/raylib-example
The meaningful code is here:
https://github.com/WEREMSOFT/flecs_plus_raylib/blob/raylib-example/src/spine/extension.c
in the function
engine_drawMesh
this is the meaningful code where I think is the problem:
void draw_vertex(Vertex vertex, Vector3 position){
rlTexCoord2f(vertex.u, vertex.v);
rlColor4f(vertex.r, vertex.g, vertex.b, vertex.a);
rlVertex3f( position.x + vertex.x, position.y + vertex.y, position.z);
}
void engine_drawMesh(Vertex* vertices, int numVertices, Texture* texture, Vector3 position){
Vertex vertex;
rlEnableTexture(texture->id);
rlPushMatrix();
{
rlBegin(RL_QUADS);
{
rlNormal3f(0.0f, 0.0f, 1.0f);
for (int i = 0; i < numVertices; i++){
if(i < 3 || i == 4){
vertex = vertices[i];
draw_vertex(vertex, position);
}
}
}rlEnd();
}rlPopMatrix();
rlDisableTexture();
}
What I've already tried:
Invert the normal when doing scaleY = -1 on the skeleton
Draw Vertices in inverse orden when scaleY = -1 on the skeleton
This is how it looks when loading the skeleton without any scale
This is how it looks with a scaleY of 0.25
This is how it looks with a scaleY -1
I have same results when I scale on X axis.
Thanks in advance