I'm testing out spine right now and ran into an issue with trying to update bones. Currently I have my game running as a dll file which gets passed a giant (1gb) reserved memory block from the OS (Windows). I'm attempting to use this memory block to store all my game related data. Since my user implemented memory allocation system is not very sophisticated yet I've left spine's memory allocation functions and macro's (MALLOC, CALLOC, etc.) alone. My issue is if I just write the code below to allocate a spine skeleton
GameState->Atlas = spAtlas_createFromFile("data/spineboy.atlas", 0);
GameState->SkelJson = spSkeletonJson_create(GameState->Atlas);
GameState->SkelData = spSkeletonJson_readSkeletonDataFile(GameState->SkelJson, "data/spineboy-ess.json");
GameState->MySkeleton = spSkeleton_create(GameState->SkelData);
and later update that skeleton via
spSkeleton_updateWorldTransform(GameState->MySkeleton);
Everything renders properly and the bones are in their proper pose positions. However, If I instead try and memcpy the skeleton data over to my user implemented memory scheme:
GameState->MySkeleton = PushType(&GameState->Spine, spSkeleton, 1);
spSkeleton* temp{};
temp = spSkeleton_create(GameState->SkelData);
memcpy(GameState->MySkeleton, temp, sizeof(spSkeleton));
While everything still copies over fine and GameState->MySkeleton still contains all the correct data, my bones will not update their positions after the updateWorldTransform call and everything renders in the bottom left corner of my screen. When debugging I tracked down the issue to this line from inside the updateWorldTransform func:
_spSkeleton* internal = SUB_CAST(_spSkeleton, self);
as internal's 'updateCacheCount' and 'updateCacheCapacity' get set to 0, despite the skeleton being case having a bone count of 19, so no bones get updated. Not sure why casting to _spSkeleton would cause this issue?