Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 28, 2011, 7:15:14 AM (13 years ago)
Author:
rgrieder
Message:

Merged kicklib2 branch back to trunk (includes former branches ois_update, mac_osx and kicklib).

Notes for updating

Linux:
You don't need an extra package for CEGUILua and Tolua, it's already shipped with CEGUI.
However you do need to make sure that the OgreRenderer is installed too with CEGUI 0.7 (may be a separate package).
Also, Orxonox now recognises if you install the CgProgramManager (a separate package available on newer Ubuntu on Debian systems).

Windows:
Download the new dependency packages versioned 6.0 and use these. If you have problems with that or if you don't like the in game console problem mentioned below, you can download the new 4.3 version of the packages (only available for Visual Studio 2005/2008).

Key new features:

  • *Support for Mac OS X*
  • Visual Studio 2010 support
  • Bullet library update to 2.77
  • OIS library update to 1.3
  • Support for CEGUI 0.7 —> Support for Arch Linux and even SuSE
  • Improved install target
  • Compiles now with GCC 4.6
  • Ogre Cg Shader plugin activated for Linux if available
  • And of course lots of bug fixes

There are also some regressions:

  • No support for CEGUI 0.5, Ogre 1.4 and boost 1.35 - 1.39 any more
  • In game console is not working in main menu for CEGUI 0.7
  • Tolua (just the C lib, not the application) and CEGUILua libraries are no longer in our repository. —> You will need to get these as well when compiling Orxonox
  • And of course lots of new bugs we don't yet know about
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btCompoundShape.cpp

    r5781 r8351  
    11/*
    22Bullet Continuous Collision Detection and Physics Library
    3 Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/
     3Copyright (c) 2003-2009 Erwin Coumans  http://bulletphysics.org
    44
    55This software is provided 'as-is', without any express or implied warranty.
     
    1717#include "btCollisionShape.h"
    1818#include "BulletCollision/BroadphaseCollision/btDbvt.h"
     19#include "LinearMath/btSerializer.h"
    1920
    2021btCompoundShape::btCompoundShape(bool enableDynamicAabbTree)
    21 : m_localAabbMin(btScalar(1e30),btScalar(1e30),btScalar(1e30)),
    22 m_localAabbMax(btScalar(-1e30),btScalar(-1e30),btScalar(-1e30)),
     22: m_localAabbMin(btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT)),
     23m_localAabbMax(btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT)),
     24m_dynamicAabbTree(0),
     25m_updateRevision(1),
    2326m_collisionMargin(btScalar(0.)),
    24 m_localScaling(btScalar(1.),btScalar(1.),btScalar(1.)),
    25 m_dynamicAabbTree(0),
    26 m_updateRevision(1)
     27m_localScaling(btScalar(1.),btScalar(1.),btScalar(1.))
    2728{
    2829        m_shapeType = COMPOUND_SHAPE_PROXYTYPE;
     
    5253        //m_childShapes.push_back(shape);
    5354        btCompoundShapeChild child;
     55        child.m_node = 0;
    5456        child.m_transform = localTransform;
    5557        child.m_childShape = shape;
     
    9496                m_children[childIndex].m_childShape->getAabb(newChildTransform,localAabbMin,localAabbMax);
    9597                ATTRIBUTE_ALIGNED16(btDbvtVolume)       bounds=btDbvtVolume::FromMM(localAabbMin,localAabbMax);
    96                 int index = m_children.size()-1;
     98                //int index = m_children.size()-1;
    9799                m_dynamicAabbTree->update(m_children[childIndex].m_node,bounds);
    98100        }
     
    110112        }
    111113        m_children.swap(childShapeIndex,m_children.size()-1);
     114    if (m_dynamicAabbTree)
     115                m_children[childShapeIndex].m_node->dataAsInt = childShapeIndex;
    112116        m_children.pop_back();
    113117
     
    125129                if(m_children[i].m_childShape == shape)
    126130                {
    127                         m_children.swap(i,m_children.size()-1);
    128                         m_children.pop_back();
    129                         //remove it from the m_dynamicAabbTree too
    130                         //@todo: this leads to problems due to caching in the btCompoundCollisionAlgorithm
    131                         //so effectively, removeChildShape is broken at the moment
    132                         //m_dynamicAabbTree->remove(m_aabbProxies[i]);
    133                         //m_aabbProxies.swap(i,m_children.size()-1);
    134                         //m_aabbProxies.pop_back();
     131                        removeChildShapeByIndex(i);
    135132                }
    136133        }
     
    146143        // Brute force, it iterates over all the shapes left.
    147144
    148         m_localAabbMin = btVector3(btScalar(1e30),btScalar(1e30),btScalar(1e30));
    149         m_localAabbMax = btVector3(btScalar(-1e30),btScalar(-1e30),btScalar(-1e30));
     145        m_localAabbMin = btVector3(btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT));
     146        m_localAabbMax = btVector3(btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT));
    150147
    151148        //extend the local aabbMin/aabbMax
     
    224221        for (k = 0; k < n; k++)
    225222        {
     223                btAssert(masses[k]>0);
    226224                center += m_children[k].m_transform.getOrigin() * masses[k];
    227225                totalMass += masses[k];
    228226        }
     227
     228        btAssert(totalMass>0);
     229
    229230        center /= totalMass;
    230231        principal.setOrigin(center);
     
    272273
    273274
     275void btCompoundShape::setLocalScaling(const btVector3& scaling)
     276{
     277
     278        for(int i = 0; i < m_children.size(); i++)
     279        {
     280                btTransform childTrans = getChildTransform(i);
     281                btVector3 childScale = m_children[i].m_childShape->getLocalScaling();
     282//              childScale = childScale * (childTrans.getBasis() * scaling);
     283                childScale = childScale * scaling / m_localScaling;
     284                m_children[i].m_childShape->setLocalScaling(childScale);
     285                childTrans.setOrigin((childTrans.getOrigin())*scaling);
     286                updateChildTransform(i, childTrans);
     287                recalculateLocalAabb();
     288        }
     289        m_localScaling = scaling;
     290}
     291
     292
     293void btCompoundShape::createAabbTreeFromChildren()
     294{
     295    if ( !m_dynamicAabbTree )
     296    {
     297        void* mem = btAlignedAlloc(sizeof(btDbvt),16);
     298        m_dynamicAabbTree = new(mem) btDbvt();
     299        btAssert(mem==m_dynamicAabbTree);
     300
     301        for ( int index = 0; index < m_children.size(); index++ )
     302        {
     303            btCompoundShapeChild &child = m_children[index];
     304
     305            //extend the local aabbMin/aabbMax
     306            btVector3 localAabbMin,localAabbMax;
     307            child.m_childShape->getAabb(child.m_transform,localAabbMin,localAabbMax);
     308
     309            const btDbvtVolume  bounds=btDbvtVolume::FromMM(localAabbMin,localAabbMax);
     310            child.m_node = m_dynamicAabbTree->insert(bounds,(void*)index);
     311        }
     312    }
     313}
     314
     315
     316///fills the dataBuffer and returns the struct name (and 0 on failure)
     317const char*     btCompoundShape::serialize(void* dataBuffer, btSerializer* serializer) const
     318{
     319
     320        btCompoundShapeData* shapeData = (btCompoundShapeData*) dataBuffer;
     321        btCollisionShape::serialize(&shapeData->m_collisionShapeData, serializer);
     322
     323        shapeData->m_collisionMargin = float(m_collisionMargin);
     324        shapeData->m_numChildShapes = m_children.size();
     325        shapeData->m_childShapePtr = 0;
     326        if (shapeData->m_numChildShapes)
     327        {
     328                btChunk* chunk = serializer->allocate(sizeof(btCompoundShapeChildData),shapeData->m_numChildShapes);
     329                btCompoundShapeChildData* memPtr = (btCompoundShapeChildData*)chunk->m_oldPtr;
     330                shapeData->m_childShapePtr = (btCompoundShapeChildData*)serializer->getUniquePointer(memPtr);
     331
     332                for (int i=0;i<shapeData->m_numChildShapes;i++,memPtr++)
     333                {
     334                        memPtr->m_childMargin = float(m_children[i].m_childMargin);
     335                        memPtr->m_childShape = (btCollisionShapeData*)serializer->getUniquePointer(m_children[i].m_childShape);
     336                        //don't serialize shapes that already have been serialized
     337                        if (!serializer->findPointer(m_children[i].m_childShape))
     338                        {
     339                                btChunk* chunk = serializer->allocate(m_children[i].m_childShape->calculateSerializeBufferSize(),1);
     340                                const char* structType = m_children[i].m_childShape->serialize(chunk->m_oldPtr,serializer);
     341                                serializer->finalizeChunk(chunk,structType,BT_SHAPE_CODE,m_children[i].m_childShape);
     342                        }
     343
     344                        memPtr->m_childShapeType = m_children[i].m_childShapeType;
     345                        m_children[i].m_transform.serializeFloat(memPtr->m_transform);
     346                }
     347                serializer->finalizeChunk(chunk,"btCompoundShapeChildData",BT_ARRAY_CODE,chunk->m_oldPtr);
     348        }
     349        return "btCompoundShapeData";
     350}
     351
Note: See TracChangeset for help on using the changeset viewer.