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.

_SIO2vertexgroup?

3 posters

Go down

_SIO2vertexgroup? Empty _SIO2vertexgroup?

Post  iphoniac Sat Dec 13, 2008 10:23 am

I have a stupid question. What is SIO2object->_SIO2vertexgroup and why itīs not duplicated when you use sio2ObjectDuplicate?

Thanks in advance.

Note: vbo and vbo_offset arenīt duplicated neither.

iphoniac

Posts : 62
Join date : 2008-12-11

http://thecaveaniphonegame.blogspot.com/

Back to top Go down

_SIO2vertexgroup? Empty Re: _SIO2vertexgroup?

Post  matt Sat Dec 13, 2008 2:09 pm

An object can have one to many vertex groups. Vertex groups contain the geometry (i.e. vertices and indices) of your mesh along with a material per group. If you duplicate an object, there's no need to duplicate the geometry as well, so the two objects share the data. Only attributes like transformation are required per object.

Best,
Matt

matt

Posts : 155
Join date : 2008-09-30

http://elfrun.net

Back to top Go down

_SIO2vertexgroup? Empty Re: _SIO2vertexgroup?

Post  meteors Sat Dec 13, 2008 3:10 pm

I'm having trouble getting sio2ObjectDuplicate to work.

Do I need to assign a vertex group and material to an object created with this function?

When I call it, and then call sio2ObjectRender on the new object, nothing seems to be rendered.


Thanks!!!
-joshua
meteors
meteors

Posts : 241
Join date : 2008-11-08
Location : Sunny Florida

Back to top Go down

_SIO2vertexgroup? Empty Re: _SIO2vertexgroup?

Post  meteors Sat Dec 13, 2008 3:21 pm

Ok, I figured out how to display the duplicates by doing this:

mini_1->pos->x = 0.0;
mini_1->pos->y = 0.0;
mini_1->pos->z = 0.0;
sio2ObjectBindMatrix( mini_1 );

Sorry if this is a stupid question, but why does the duplicate not copy the same position as the original?


Best,
-joshua


PS - COME INTO THE IRC CHANNEL!!!
meteors
meteors

Posts : 241
Join date : 2008-11-08
Location : Sunny Florida

Back to top Go down

_SIO2vertexgroup? Empty Re: _SIO2vertexgroup?

Post  matt Sat Dec 13, 2008 3:33 pm

meteors wrote:Sorry if this is a stupid question, but why does the duplicate not copy the same position as the original?
It does. A good idea to figure out things is to look at the code:

Code:
SIO2object *sio2ObjectDuplicate( SIO2object *_SIO2object,
                         char      *_name )
{
   SIO2object *dup = sio2ObjectInit( _name );

   memcpy( dup->pos, _SIO2object->pos, 12 ); // Position is copied here

You probably didn't recognize any difference because the duplicate was rendered on the original.

Best,
Matt

matt

Posts : 155
Join date : 2008-09-30

http://elfrun.net

Back to top Go down

_SIO2vertexgroup? Empty Re: _SIO2vertexgroup?

Post  meteors Sat Dec 13, 2008 3:45 pm

Thanks matt!

-j
meteors
meteors

Posts : 241
Join date : 2008-11-08
Location : Sunny Florida

Back to top Go down

_SIO2vertexgroup? Empty Re: _SIO2vertexgroup?

Post  iphoniac Sat Dec 13, 2008 6:16 pm

My problem is with collision detection. Some duplicated objects doesn't detect collisions. I follow the process as described in the forum. I'm still trying to figure out what's happening.

iphoniac

Posts : 62
Join date : 2008-12-11

http://thecaveaniphonegame.blogspot.com/

Back to top Go down

_SIO2vertexgroup? Empty Re: _SIO2vertexgroup?

Post  meteors Sun Dec 14, 2008 7:13 pm

What is the best practice for duplicating an SIOvertexgroup when duplicating an object?

I want my duplicate objects to be sovereign, deep copies.


Thanks!!
-joshua
meteors
meteors

Posts : 241
Join date : 2008-11-08
Location : Sunny Florida

Back to top Go down

_SIO2vertexgroup? Empty Re: _SIO2vertexgroup?

Post  iphoniac Mon Dec 15, 2008 4:29 pm

Iīve found the source of my problem, but not the solution. Sad

Some duplicated objects (set to ACTIVE_TAG when I create it) changes to status DISABLE_SIMULATION in a random point of the execution. Iīve traced the code and found the point where status is changed, in Bulletīs btCollisionWorld::updateAabbs():

Code:
   BT_PROFILE("updateAabbs");

   btTransform predictedTrans;
   for ( int i=0;i<m_collisionObjects.size();i++)
   {
      btCollisionObject* colObj = m_collisionObjects[i];

      //only update aabb of active objects
      if (colObj->isActive())
      {
         btVector3 minAabb,maxAabb;
         colObj->getCollisionShape()->getAabb(colObj->getWorldTransform(), minAabb,maxAabb);
         //need to increase the aabb for contact thresholds
         btVector3 contactThreshold(gContactBreakingThreshold,gContactBreakingThreshold,gContactBreakingThreshold);
         minAabb -= contactThreshold;
         maxAabb += contactThreshold;

         btBroadphaseInterface* bp = (btBroadphaseInterface*)m_broadphasePairCache;

         //moving objects should be moderately sized, probably something wrong if not
         if ( colObj->isStaticObject() || ((maxAabb-minAabb).length2() < btScalar(1e12)))
         {
            bp->setAabb(colObj->getBroadphaseHandle(),minAabb,maxAabb, m_dispatcher1);
         } else
         {
            //something went wrong, investigate
            //this assert is unwanted in 3D modelers (danger of loosing work)
            colObj->setActivationState(DISABLE_SIMULATION);                                  <- This is the place

            static bool reportMe = true;
            if (reportMe && m_debugDrawer)
            {
               reportMe = false;
               m_debugDrawer->reportErrorWarning("Overflow in AABB, object removed from simulation");
               m_debugDrawer->reportErrorWarning("If you can reproduce this, please email bugs@continuousphysics.com\n");
               m_debugDrawer->reportErrorWarning("Please include above information, your Platform, version of OS.\n");
               m_debugDrawer->reportErrorWarning("Thanks.\n");
            }
         }
      }
   }

Iīm looking for memory leaks in my code that could cause a problem but any help will be much appreciated, Iīm stuck in this problem some days and canīt get it Crying or Very sad

iphoniac

Posts : 62
Join date : 2008-12-11

http://thecaveaniphonegame.blogspot.com/

Back to top Go down

_SIO2vertexgroup? Empty Re: _SIO2vertexgroup?

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