Possible solution: Bone Animation sharing among instance objects
2 posters
Possible solution: Bone Animation sharing among instance objects
Hi,
I was playing around with the bone animation system and i found that if i do a softcopy of an object, than the animation won't play. Looking at the code of sio2ObjectRenderAction I found this:
This won't make the animation play because a softcopy, if I understood well, just makes a reference to the original geometry object with the _SIO2instance member. Unfortunately in my applications there will be many object on screen: hardcopy is not a choice for me. Trying to get the animations work on instances, I commented the lines above and modified this piece of code:
in this way:
I've done this because an instance doesn't have the geometry data inside it that are needed by the animation system. Doing this way instead i take the geometry from the original object. After this modifications I started my app and seen that the animation is playing correctly on the instance.
I wanted to share this with all of you and ask you if this is a good way for accomplish my need, or if I'm missing something.
Cheers.
I was playing around with the bone animation system and i found that if i do a softcopy of an object, than the animation won't play. Looking at the code of sio2ObjectRenderAction I found this:
- Code:
if( _SIO2object->_SIO2instance )
{ return; }
This won't make the animation play because a softcopy, if I understood well, just makes a reference to the original geometry object with the _SIO2instance member. Unfortunately in my applications there will be many object on screen: hardcopy is not a choice for me. Trying to get the animations work on instances, I commented the lines above and modified this piece of code:
- Code:
render:
if( _SIO2object->_SIO2objectanimation->_SIO2frame2->_SIO2framecallback )
{ _SIO2object->_SIO2objectanimation->_SIO2frame2->_SIO2framecallback( _SIO2object ); }
_SIO2object->buf = ( unsigned char * )sio2MapBuffer( _SIO2object->vbo, GL_ARRAY_BUFFER );
in this way:
- Code:
render:
if( _SIO2object->_SIO2objectanimation->_SIO2frame2->_SIO2framecallback )
{ _SIO2object->_SIO2objectanimation->_SIO2frame2->_SIO2framecallback( _SIO2object ); }
if(_SIO2object->_SIO2instance)
{
SIO2object* instanceof = static_cast<SIO2object*> (_SIO2object->_SIO2instance);
_SIO2object->buf = ( unsigned char * )sio2MapBuffer( instanceof->vbo, GL_ARRAY_BUFFER );
}
else {
_SIO2object->buf = ( unsigned char * )sio2MapBuffer( _SIO2object->vbo, GL_ARRAY_BUFFER );
}
I've done this because an instance doesn't have the geometry data inside it that are needed by the animation system. Doing this way instead i take the geometry from the original object. After this modifications I started my app and seen that the animation is playing correctly on the instance.
I wanted to share this with all of you and ask you if this is a good way for accomplish my need, or if I'm missing something.
Cheers.
william- Posts : 15
Join date : 2009-09-09
Re: Possible solution: Bone Animation sharing among instance objects
Update:
The code above works on simulator, but when I put it on the device as soon as the animation starts, the objects disappears. I will try debugging a little bit. Meanwhile I tried the hardcopy way and I think I found a little bug there: when the geometry data gets duplicate for the new object, the vbo is not created causing the animation system to crash. I added the code to create the vbo and all works well, even on device.
Anyway I'm really interested in bone animation on istances, so if there's a solution on the problem I have it would be great!
The code above works on simulator, but when I put it on the device as soon as the animation starts, the objects disappears. I will try debugging a little bit. Meanwhile I tried the hardcopy way and I think I found a little bug there: when the geometry data gets duplicate for the new object, the vbo is not created causing the animation system to crash. I added the code to create the vbo and all works well, even on device.
Anyway I'm really interested in bone animation on istances, so if there's a solution on the problem I have it would be great!
william- Posts : 15
Join date : 2009-09-09
Re: Possible solution: Bone Animation sharing among instance objects
Check the source code of meditation garden... I demonstrate the right way to do it... while using independent animation on a per mesh basis.
Cheers,
Cheers,
Similar topics
» SIO2 1.4 is around the corner...
» duplicating objects at runtime and changing textures on the duplicated objects
» Material sharing
» Max MD2 vs. max baked bone animation per scene
» Multi-Touch Handling
» duplicating objects at runtime and changing textures on the duplicated objects
» Material sharing
» Max MD2 vs. max baked bone animation per scene
» Multi-Touch Handling
Permissions in this forum:
You cannot reply to topics in this forum