tangramgis

Hi Nate,

We're evaluating Spine tool, great tool, using skeleton way can save us more than 50% storage space. :D

Currenly we need to translate our project from cocos2dx to my own new game engine, and the problem is my game engine doesn't use the vertex buffer thing in OpenGL to do rendering, but a software render library similar with GDI+ or cairo.

I think most of 2D software render library (gdi+, cairo, agg, .etc) have these APIs: Translate/Rotate/Scale/DrawClipImage.

I build a very simple sample codes using C# in the attachment (WRONG render result).
Following are the steps to run it:
1. Create a "Windows Form Application" project using Visual Studio. (I use VS2008)
2. Replace the generated file "Form1.cs" by the attachment file "Form1.txt", remember rename its extension to ".cs".
3. Reference "spine-csharp" library.
4. Copy sample data "data/spineboy.*" to the .EXE output folder. (I get these data from the project "spine-runtimes/spine-c/example" folder.)

Actually we don't need power functions, we just want to setup its position and do playback, that's all.

I'd spent 2 days in this issue with my poor matrix skeleton knowledge, but failed. :(

Could you help me to fix the character rendering issue?

Following are the render codes from the attachment Form1.cs file, if you want a quick preview. (WRONG render result):
private void DrawSkin(Graphics g)
{
foreach (Slot slot in skeleton.Slots)
{
if (slot.Attachment == null || slot.Attachment.GetType() != typeof(RegionAttachment))
continue;

RegionAttachment attach = (RegionAttachment)slot.Attachment;
AtlasRegion region = (AtlasRegion)attach.RendererObject;

g.ResetTransform();
g.TranslateTransform(charactorPosX, charactorPosY);

g.TranslateTransform(attach.X, attach.Y);
g.RotateTransform(attach.Rotation);

g.TranslateTransform(slot.Bone.WorldX, -slot.Bone.WorldY);
g.RotateTransform(slot.Bone.Rotation);
g.ScaleTransform(slot.Bone.ScaleX, slot.Bone.ScaleY);

Rectangle dstRC = new Rectangle(0, 0, region.width, region.height);
Rectangle srcRC = new Rectangle(region.x, region.y, region.width, region.height);
g.DrawImage((Image)region.page.rendererObject, dstRC, srcRC, GraphicsUnit.Pixel);

g.ResetTransform();
}
}
Nemaš dopuštenje za pregledavanje privit(a)ka dodan(og)ih postu.
tangramgis
  • Postovi: 2

Søren

This is way above my pay grade I'm afraid. But keep in mind that Spine doesn't use classical scaling. Take a look at this page http://www.isner.com/Transform/IsnerTransformManip_04.htm for more information. Nate will probably be able to help you out once he gets out under his rock ( hes currently working on the new features).
Avatar
Søren

Shiu
  • Postovi: 2444

tangramgis

Hi Shiu,

Thanks for your reply.

Currently we walk around this issue by hacking our rendering library, and still using the Vertex Buffer way that is almost the same way as in cocos2d-x, and works well now. :D
tangramgis
  • Postovi: 2

whp8844248

Did you solve this question, please tell me the way ,thanks
whp8844248
  • Postovi: 1


Natrag na Runtimes