Page 1 of 2 12 LastLast
Results 1 to 10 of 28

Thread: Spriter - Tool for making 2d animations easier

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    thanks for testing it with delphi, when I have the time I will try it as well.
    the rendering method is quite simple, the array always consists of 4 vertices and the vertex format is:
    Code:
    TSpineVertexData = packed record
      x, y, u, v, r, g, b, a: Single;
    end;
    so you really just need to draw a quadrangle or basically two triangles.

  2. #2
    Hummm... we are getting closer! =)

    Code:
    var
      pv: PSpineVertexArray absolute Vertices;
      p, t: array of zglTPoint2D;
    begin
      SetLength(p, 6);
      // first triangle
      p[0].x := pv^[0].x;
      p[0].y := pv^[0].y;
      p[1].x := pv^[1].x;
      p[1].y := pv^[1].y;
      p[2].x := pv^[2].x;
      p[2].y := pv^[2].y;
      // second triangle
      p[3].x := pv^[1].x;
      p[3].y := pv^[1].y;
      p[4].x := pv^[2].x;
      p[4].y := pv^[2].y;
      p[5].x := pv^[3].x;
      p[5].y := pv^[3].y;
      pr2d_TriList(@Texture, @p[0], nil, 0, length(p) - 1, $FFFFFF, 255, FX_BLEND or PR2D_FILL);
    
      SetLength(t, 6);
      // first triangle
      t[0].x := pv^[0].u;
      t[0].y := pv^[0].v;
      t[1].x := pv^[1].u;
      t[1].y := pv^[1].v;
      t[2].x := pv^[2].u;
      t[2].y := pv^[2].v;
      // second triangle
      t[3].x := pv^[1].u;
      t[3].y := pv^[1].v;
      t[4].x := pv^[2].u;
      t[4].y := pv^[2].v;
      t[5].x := pv^[3].u;
      t[5].y := pv^[3].v;
      pr2d_TriList(@Texture, @p[0], @t[0], 0, length(p) - 1, $FFFFFF, 255, FX_BLEND or PR2D_FILL);
    Attached Images Attached Images

  3. #3
    the second triangle should be 0,2,3 because the vertices are passed in clockwise order

  4. #4
    Thanks Dan! =)

    Ohh yes! It is working now! =)

    Code:
    var
      pv: PSpineVertexArray absolute Vertices;
      vert, text: array of zglTPoint2D;
    begin
      //Vertices
      SetLength(vert, 6);
      // first triangle
      vert[0].x := pv^[0].x;
      vert[0].y := pv^[0].y;
      vert[1].x := pv^[1].x;
      vert[1].y := pv^[1].y;
      vert[2].x := pv^[2].x;
      vert[2].y := pv^[2].y;
      // second triangle
      vert[3].x := pv^[0].x;
      vert[3].y := pv^[0].y;
      vert[4].x := pv^[2].x;
      vert[4].y := pv^[2].y;
      vert[5].x := pv^[3].x;
      vert[5].y := pv^[3].y;
    
      //Texture
      SetLength(text, 6);
      // first triangle
      text[0].x := pv^[0].u;
      text[0].y := 1-pv^[0].v;
      text[1].x := pv^[1].u;
      text[1].y := 1-pv^[1].v;
      text[2].x := pv^[2].u;
      text[2].y :=1- pv^[2].v;
      // second triangle
      text[3].x := pv^[0].u;
      text[3].y := 1-pv^[0].v;
      text[4].x := pv^[2].u;
      text[4].y := 1-pv^[2].v;
      text[5].x := pv^[3].u;
      text[5].y := 1-pv^[3].v;
    
      pr2d_TriList(nil, @vert[0], @text[0], 0, length(vert) - 1, $FFFFFF, 255, FX_BLEND);
      pr2d_TriList(TG2SpineTexture(Texture).Texture, @vert[0], @text[0], 0, length(vert) - 1, $FFFFFF, 255, FX_BLEND or PR2D_FILL);
    Attached Images Attached Images

  5. #5
    alright I have ported the runtime to smart mobile studio: http://gen2gdk.com/g2mp/spine/
    enjoy=)

  6. #6
    I have fixed all the delphi incompatibilities. the download link is still the same.

  7. #7
    Hi guys, Sorry for digging up this old thread.
    I am developing the tool Sprite DLight (in Lazarus), which generates normal maps for sprites automatically. This allows for pretty awesome dynamic lighting effects in 2D games and is even more awesome in combination with skeletal animation.
    There are some challenges when using Spine and Sprite DLight together, like rough joints and the need to recalculate the normals according to the bone rotation.
    I was excited to find out there was a Spine Runtime for Pascal and I am hoping to solve some of these with it, however all the old download links here and in the Spine Forum are dead and I can't seem to get in contact with Dan.
    So Dan, if you are around, or if anybody still has the old files somewhere, I would greatly appreciate them being made available for download again.

  8. #8
    What a nice tool, Dee. I hope you find the code you need.
    No signature provided yet.

  9. #9
    Quote Originally Posted by Dan View Post
    Code:
    TSpineVertexData = packed record
      x, y, u, v, r, g, b, a: Single;
    end;
    Is there any speed benefit in using single type for color channels? Because this takes 12 bytes less data per vertex:
    Code:
    TSpineVertexData = packed record
      x, y, u, v: Single;
      r, g, b, a: byte;
    end;

  10. #10
    manipulating floats is a lot faster than integer types in this case. suppose you want to multiply two colors with floats you can do just that multiply them, with bytes you'll need to convert them to floats, multiply and convert them back.
    also 12 bytes per vertex is not a major loss, since every attachment only has 4 vertices=)

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •