void copyOsgMatrixToLib3dsMatrix(Lib3dsMatrix lib3ds_matrix, const osg::Matrix& osg_matrix) { for(int row=0; row<4; ++row) { lib3ds_matrix[row][0] = osg_matrix.ptr()[row*4+0]; lib3ds_matrix[row][1] = osg_matrix.ptr()[row*4+1]; lib3ds_matrix[row][2] = osg_matrix.ptr()[row*4+2]; lib3ds_matrix[row][3] = osg_matrix.ptr()[row*4+3]; } }
void PhysXInterface::setMatrix( int id, const osg::Matrix& matrix ) { PxReal d[16]; for ( int i=0; i<16; ++i ) d[i] = *(matrix.ptr() + i); PxRigidActor* actor = _actors[id]; if ( actor ) actor->setGlobalPose( PxTransform(PxMat44(d)) ); }
Property::Property( const std::string& _name, const osg::Matrix& _v ) { name = normalize( _name ); std::stringstream ss; const osg::Matrix::value_type* p = _v.ptr(); for( int i=0; i<15; i++ ) ss << *p++ << " "; ss << *p; value = ss.str(); valid = true; }
// ================================================ // convertOSGMatrixToMPVMatrix // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv MPVCMNOSG_SPEC mpv::Mtx4 convertOSGMatrixToMPVMatrix( const osg::Matrix &osgMtx ) { mpv::Mtx4 result; // OSG matrices are stored "sideways", like OpenGL. // MPV matrices are stored like you learned in math class (except the subscript is // backwards; math class convention for refering to an element is Mcol,row). // They need to be transposed to convert between the two. result.pcset( osgMtx.ptr() ); return result; }
btTransform osgbCollision::asBtTransform( const osg::Matrix& m ) { const osg::Matrix::value_type* oPtr = m.ptr(); btScalar bPtr[ 16 ]; int idx; for (idx=0; idx<16; idx++) bPtr[ idx ] = oPtr[ idx ]; btTransform t; t.setFromOpenGLMatrix( bPtr ); return t; }
PxMat44 toPhysicsMatrix( const osg::Matrix& matrix ) { PxReal d[16]; for ( int i=0; i<16; ++i ) d[i] = *(matrix.ptr() + i); return PxMat44(d); }