- Modifié
Porting spine-lua to MOAI
- Modifié
Hi,
I have been using spine for a while, on the MOAI engine. I was able to port it to use the regions.
After the last upgrade in spine-lua that uses the mesh technique, I lost track of the upgrade.
I am trying to use corona-sdk meshes concept for openGL meshes in MOAI. I use the goblins atlas mesh example.
I receive the following error
.\spine.lua:330: attempt to perform arithmetic on field 'm00' (a nil value)
stack traceback:
.\spine.lua in function 'updateWorldTransform'
main.lua:49 in function <main.lua:42>
The m00, m01, m10, m11 fields are now called a, b, c, d.
Hi Nate,
Thanks for the help, now i am having another conversion problem. "worldScaleX", was that changed?
.\spine.lua:349: attempt to perform arithmetic on field 'worldScaleX' (a nil value)
stack traceback:
.\spine.lua in function 'updateWorldTransform'
main.lua:49 in function <main.lua:42>
Another question,
Do you plan on porting spine-lua soon?
Look at the source:
spine-runtimes/Bone.lua at master
There's no worldScaleX
but there is Bone getWorldScaleX
.
By porting spine-lua do you mean adding a MOAI runtime? I'm afraid we don't have any short term plans for that.
I guess the latest code is older than 2 years, I will have to check how this works.
Would there be any long term plans for the adding that runtime?
We currently have no plan to officially support MOAI, as it's community is tiny and it's unclear what MOAI's future is. I'd recommend checking out the love2d runtime, especially the PolygonBatcher. It should be very simple to replicate that in MOAI.
Thanks badlogic.
I took a look at the PolygonBatcher, though my problem is I have no knowledge of the mesh mechanism in love, but it looks like it is less complex than its counterpart in MOAI.
I will try converting it using your idea.
For what it's worth, I found this. Seems like MOAI meshes are only a tiny bit more complicated. Set up the vertex format (position, uvs, color), then just set the vertex buffer with vertices, and the index buffer with indices. When the texture or blend mode changes during drawing the attachments of a skeleton, create a new mesh, and presto!
Basically it uses openGL vertex system. in this case the z-coordinate is zero such it acts as 2D. Then uv mapping to set the position of the coordinates/indices along the texture.
However in the love engine, i am a bit confused.
Do the vertices represents a pair of {x, y} ordered in sequence?
I understand that the indices sequences acts the same
See spine-runtimes/spine.lua at master
The first two entries are the x/y coordinats
The next two entries are the u/v coordinates
The last four entries are r, g, b, a values (range 0-1) making up the color of the vertex.
These vertices come directly from the region or mesh attachment, see spine-runtimes/spine.lua at master and spine-runtimes/spine.lua at master.