Ignore:
Timestamp:
Jul 2, 2012, 12:58:25 PM (11 years ago)
Author:
sam
Message:

test: use lol::mat4 instead of Bullet matrices.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/BtPhysTest.cpp

    r1556 r1562  
    229229        for(int i=0;i<gNumObjects;i++)
    230230        {
    231                 btScalar        m[16];
    232                 btMatrix3x3     rot;rot.setIdentity();
    233                 btCollisionObject*      colObj=m_bt_world->getCollisionObjectArray()[i];
    234                 btRigidBody*            body=btRigidBody::upcast(colObj);
    235                 if(body&&body->getMotionState())
     231                mat4 m(1.0f);
     232                btMatrix3x3     rot; rot.setIdentity();
     233                btCollisionObject*      colObj = m_bt_world->getCollisionObjectArray()[i];
     234                btRigidBody*            body = btRigidBody::upcast(colObj);
     235                if(body && body->getMotionState())
    236236                {
    237237                        btDefaultMotionState* myMotionState = (btDefaultMotionState*)body->getMotionState();
    238                         myMotionState->m_graphicsWorldTrans.getOpenGLMatrix(m);
    239                         rot=myMotionState->m_graphicsWorldTrans.getBasis();
     238                        myMotionState->m_graphicsWorldTrans.getOpenGLMatrix(&m[0][0]);
     239                        rot = myMotionState->m_graphicsWorldTrans.getBasis();
    240240                }
    241241                else
    242242                {
    243                         colObj->getWorldTransform().getOpenGLMatrix(m);
    244                         rot=colObj->getWorldTransform().getBasis();
    245                 }
    246                 mat4 NewMx = mat4(1.0f);
    247                 for (int i = 0; i < 16; ++i)
    248                         NewMx[i / 4][i % 4] = (float)m[i];
    249                 m_rigid_mesh.Render(NewMx);
     243                        colObj->getWorldTransform().getOpenGLMatrix(&m[0][0]);
     244                        rot = colObj->getWorldTransform().getBasis();
     245                }
     246                m_rigid_mesh.Render(m);
    250247        }
    251248}
     
    259256                //cleanup in the reverse order of creation/initialization
    260257                //remove the rigidbodies from the dynamics world and delete them
    261                 int i;
    262                 for (i = m_bt_world->getNumCollisionObjects() - 1; i >= 0 ;i--)
     258                for (int i = m_bt_world->getNumCollisionObjects() - 1; i >= 0 ;i--)
    263259                {
    264260                        btCollisionObject* obj = m_bt_world->getCollisionObjectArray()[i];
     
    280276
    281277                delete m_bt_world;
    282        
    283278                delete m_bt_solver;
    284        
    285279                delete m_bt_broadphase;
    286        
    287280                delete m_bt_dispatcher;
    288 
    289281                delete m_bt_collision_config;
    290282        }
Note: See TracChangeset for help on using the changeset viewer.