FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Possible solution: Bone Animation sharing among instance objects

2 posters

Go down

Possible solution: Bone Animation sharing among instance objects Empty Possible solution: Bone Animation sharing among instance objects

Post  william Tue Oct 06, 2009 6:47 pm

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:

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

Back to top Go down

Possible solution: Bone Animation sharing among instance objects Empty Re: Possible solution: Bone Animation sharing among instance objects

Post  william Wed Oct 07, 2009 2:12 am

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!

william

Posts : 15
Join date : 2009-09-09

Back to top Go down

Possible solution: Bone Animation sharing among instance objects Empty Re: Possible solution: Bone Animation sharing among instance objects

Post  sio2interactive Wed Oct 07, 2009 5:45 am

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,
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Possible solution: Bone Animation sharing among instance objects Empty Re: Possible solution: Bone Animation sharing among instance objects

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum