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
    PGDCE Developer Carver413's Avatar
    Join Date
    Jun 2010
    Location
    Spokane,WA,Usa
    Posts
    206
    I am working on some simular stuff for 3d for the explorer project. sort of a gijo kind of setup.

  2. #2
    hi, thanks for bringing this spine tool to my attention. I have made a complete pascal runtime port for it. I still need to kill all the memory leaks but that may take a couple of days at most.
    unlike the existing runtimes for spine I did not bind it to any one graphics framework, so anyone can use it with their favorite pascal framework.
    I have attached a small demo rendered using my g2mp game framework.
    Attached Files Attached Files

  3. #3
    Awesome news Dan!

    Thanks a lot for creating the runtime! I can't wait to test it! =)

    Your example works like a charm! =)

  4. #4
    you are welcome, I will upload the runtime some time this weekend. if anyone knows of similar tools that enhance the game development I would be happy to create pascal support for it.

  5. #5
    ok here it is: http://gen2gdk.com/files/SpinePascal.rar
    if anyone is interested I can make the demos with pure opnegl and direct3d. at the moment there is only one demo that uses g2mp.
    Here is how much code I had to write to make it work with g2mp:
    Code:
    TG2SpineTexture = class (TSpineTexture)
      public
        Texture: TG2Texture2D;
        constructor Create(const TextureName: AnsiString);
        destructor Destroy; override;
        function GetWidth: Integer; override;
        function GetHeight: Integer; override;
      end;
    
      TG2SpineTextureLoader = class (TSpineTextureLoader)
      public
        function LoadTexture(const TextureName: AnsiString): TSpineTexture; override;
      end;
    
      TG2SpineRender = class (TSpineRender)
      public
        procedure Render(const Texture: TSpineTexture; const Vertices: PSpineVertexArray); override;
      end;
    
    ...
    
    //TG2SpineTexture BEGIN
    constructor TG2SpineTexture.Create(const TextureName: AnsiString);
    begin
      inherited Create;
      Texture := TG2Texture2D.Create;
      Texture.Load(TextureName);
    end;
    
    destructor TG2SpineTexture.Destroy;
    begin
      Texture.Free;
      inherited Destroy;
    end;
    
    function TG2SpineTexture.GetWidth: Integer;
    begin
      Result := Texture.RealWidth;
    end;
    
    function TG2SpineTexture.GetHeight: Integer;
    begin
      Result := Texture.RealHeight;
    end;
    //TG2SpineTexture END
    
    //TG2SpineTextureLoader BEGIN
    function TG2SpineTextureLoader.LoadTexture(const TextureName: AnsiString): TSpineTexture;
    begin
      Result := TG2SpineTexture.Create(TextureName);
    end;
    //TG2SpineTextureLoader END
    
    //TG2SpineRender BEGIN
    procedure TG2SpineRender.Render(const Texture: TSpineTexture; const Vertices: PSpineVertexArray);
      var pv: PSpineVertexArray absolute Vertices;
    begin
      g2.PicQuadCol(
        pv^[0].x, pv^[0].y, pv^[1].x, pv^[1].y,
        pv^[3].x, pv^[3].y, pv^[2].x, pv^[2].y,
        pv^[0].u, pv^[0].v, pv^[1].u, pv^[1].v,
        pv^[3].u, pv^[3].v, pv^[2].u, pv^[2].v,
        G2Color(Round(pv^[0].r * $ff), Round(pv^[0].g * $ff), Round(pv^[0].b * $ff), Round(pv^[0].a * $ff)),
        G2Color(Round(pv^[1].r * $ff), Round(pv^[1].g * $ff), Round(pv^[1].b * $ff), Round(pv^[1].a * $ff)),
        G2Color(Round(pv^[3].r * $ff), Round(pv^[3].g * $ff), Round(pv^[3].b * $ff), Round(pv^[3].a * $ff)),
        G2Color(Round(pv^[2].r * $ff), Round(pv^[2].g * $ff), Round(pv^[2].b * $ff), Round(pv^[2].a * $ff)),
        TG2SpineTexture(Texture).Texture, bmNormal, tfLinear
      );
    end;
    //TG2SpineRender END
    as you can see it's almost nothing compared to the size of the runtime code itself (~2700 lines).

    I have only tested the runtime with the fpc. I think it should work with delphi as well, but if you have any problems please let me know.
    I will later make a runtime for the smart mobile studio.

  6. #6
    Thanks a lot Dan! =)... I will try to use it with ZenGL Engine. I will post the code here as soon I get it working!

    It would be interesting to post about it on official forum, http://esotericsoftware.com/forum/viewforum.php?f=3, and if possible put it on https://github.com/!

  7. #7
    There is some incompatibilities with Delphi 2010.

    - Overloaded methods should explicitly use the overload clause.
    - I had to add .Items in some places, by example need to change SpineTextures.[i] to SpineTextures.Items[i]
    - Incompatible type Char and AnsiChar on lines like these one : _Chars[i] := Chr(b); I fixed it using _Chars[i] := AnsiChar(Chr(b)); but I don't know for sure if this is correct! =)

    Everything else seems to be working well on Delphi 2010!

    Everything else but the draw routine is working with ZenGL already! I'm not 100% sure but It seems ZenGL does not have a function to draw a array of vertices, but only to draw triangles pr2d_TriList. I think I will also need to use tess_Triangulate to convert from vertices to triangles but all of this mess with my head, probably I will need some help from Andrey! =)

  8. #8
    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.

  9. #9
    I realize this is old thread, but I've found this tool: http://www.kickstarter.com/projects/...gration-system - it's free and (I think, but not sure) open source. But you should support them by giving them some of your $$$. I knew about it earlier from TIGSource thread, but was in development then yet, so didn't post here. Anyway from what I've played with the tool is very usable although exporting isn't there yet.

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
  •