weremsoft

  • 15 січ 2020 р.
  • Приєднався 10 січ 2020 р.
  • Dear All

    The spine-raylib runtime provides functionality to load, manipulate and render Spine skeletal animation data using Raylib. spine-raylib is based on spine-c.

    One of the most amazing features of Raylib, besides the ease of use and its numerous ports to several languages and platforms, is the ability to compile to WebAssembly, allowing to show your games around the world with just a link.

    Home page of the project:
    https://github.com/WEREMSOFT/spine-raylib-runtimes

    Example 3D:
    https://htmlpreview.github.io/?https://github.com/WEREMSOFT/spine-raylib-runtimes/blob/master/html/example_3d/example_3d.html

    Example 2D:
    https://htmlpreview.github.io/?https://github.com/WEREMSOFT/spine-raylib-runtimes/blob/master/html/example_2d/example_2d.html

    Raylib homepage:
    https://www.raylib.com/


    • Змінено
  • Thanks @badlogic. It's not upside down anymore, but I have to flip it vertically in order to see the render.

    spBone_setYDown(true);
    skeleton = spSkeleton_create(skeletonData);
    skeleton->scaleX = -0.5; // Now I have to do this!
    skeleton->scaleY = 0.5;
    
    

    I'm having this problem flicking the model and I don't understand why. It's about the backface culling for sure.

    Do you have any idea about what else can I try to solve this flicking problem?

    This is what I have (the model is looking in the wrong direction)


    Ok, I have to disable the backface culling but this is a performance hit! I need to check if it's possible to disable backface culling only for the spine model.

    rlDisableBackfaceCulling(); // Disables the backface culling for the whole game!!!
    
  • 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:

    1. The animation is upside down.
    2. 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

    • Змінено