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/btStridingMeshInterface.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.
     
    1515
    1616#include "btStridingMeshInterface.h"
     17#include "LinearMath/btSerializer.h"
    1718
    1819btStridingMeshInterface::~btStridingMeshInterface()
     
    3637        int gfxindex;
    3738        btVector3 triangle[3];
    38         btScalar* graphicsbase;
    3939
    4040        btVector3 meshScaling = getScaling();
     
    4646                numtotalphysicsverts+=numtriangles*3; //upper bound
    4747
    48                 switch (gfxindextype)
     48                ///unlike that developers want to pass in double-precision meshes in single-precision Bullet build
     49                ///so disable this feature by default
     50                ///see patch http://code.google.com/p/bullet/issues/detail?id=213
     51
     52                switch (type)
    4953                {
    50                 case PHY_INTEGER:
     54                case PHY_FLOAT:
     55                 {
     56
     57                         float* graphicsbase;
     58
     59                         switch (gfxindextype)
     60                         {
     61                         case PHY_INTEGER:
     62                                 {
     63                                         for (gfxindex=0;gfxindex<numtriangles;gfxindex++)
     64                                         {
     65                                                 unsigned int* tri_indices= (unsigned int*)(indexbase+gfxindex*indexstride);
     66                                                 graphicsbase = (float*)(vertexbase+tri_indices[0]*stride);
     67                                                 triangle[0].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(),graphicsbase[2]*meshScaling.getZ());
     68                                                 graphicsbase = (float*)(vertexbase+tri_indices[1]*stride);
     69                                                 triangle[1].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(),    graphicsbase[2]*meshScaling.getZ());
     70                                                 graphicsbase = (float*)(vertexbase+tri_indices[2]*stride);
     71                                                 triangle[2].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(),    graphicsbase[2]*meshScaling.getZ());
     72                                                 callback->internalProcessTriangleIndex(triangle,part,gfxindex);
     73                                         }
     74                                         break;
     75                                 }
     76                         case PHY_SHORT:
     77                                 {
     78                                         for (gfxindex=0;gfxindex<numtriangles;gfxindex++)
     79                                         {
     80                                                 unsigned short int* tri_indices= (unsigned short int*)(indexbase+gfxindex*indexstride);
     81                                                 graphicsbase = (float*)(vertexbase+tri_indices[0]*stride);
     82                                                 triangle[0].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(),graphicsbase[2]*meshScaling.getZ());
     83                                                 graphicsbase = (float*)(vertexbase+tri_indices[1]*stride);
     84                                                 triangle[1].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(),    graphicsbase[2]*meshScaling.getZ());
     85                                                 graphicsbase = (float*)(vertexbase+tri_indices[2]*stride);
     86                                                 triangle[2].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(),    graphicsbase[2]*meshScaling.getZ());
     87                                                 callback->internalProcessTriangleIndex(triangle,part,gfxindex);
     88                                         }
     89                                         break;
     90                                 }
     91                         default:
     92                                 btAssert((gfxindextype == PHY_INTEGER) || (gfxindextype == PHY_SHORT));
     93                         }
     94                         break;
     95                 }
     96
     97                case PHY_DOUBLE:
    5198                        {
    52                                 for (gfxindex=0;gfxindex<numtriangles;gfxindex++)
    53                                 {
    54                                         unsigned int* tri_indices= (unsigned int*)(indexbase+gfxindex*indexstride);
    55                                         graphicsbase = (btScalar*)(vertexbase+tri_indices[0]*stride);
    56                                         triangle[0].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(),graphicsbase[2]*meshScaling.getZ());
    57                                         graphicsbase = (btScalar*)(vertexbase+tri_indices[1]*stride);
    58                                         triangle[1].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(),     graphicsbase[2]*meshScaling.getZ());
    59                                         graphicsbase = (btScalar*)(vertexbase+tri_indices[2]*stride);
    60                                         triangle[2].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(),     graphicsbase[2]*meshScaling.getZ());
    61                                         callback->internalProcessTriangleIndex(triangle,part,gfxindex);
    62                                 }
    63                                 break;
    64                         }
    65                 case PHY_SHORT:
    66                         {
    67                                 for (gfxindex=0;gfxindex<numtriangles;gfxindex++)
    68                                 {
    69                                         unsigned short int* tri_indices= (unsigned short int*)(indexbase+gfxindex*indexstride);
    70                                         graphicsbase = (btScalar*)(vertexbase+tri_indices[0]*stride);
    71                                         triangle[0].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(),graphicsbase[2]*meshScaling.getZ());
    72                                         graphicsbase = (btScalar*)(vertexbase+tri_indices[1]*stride);
    73                                         triangle[1].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(),     graphicsbase[2]*meshScaling.getZ());
    74                                         graphicsbase = (btScalar*)(vertexbase+tri_indices[2]*stride);
    75                                         triangle[2].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(),     graphicsbase[2]*meshScaling.getZ());
    76                                         callback->internalProcessTriangleIndex(triangle,part,gfxindex);
     99                                double* graphicsbase;
     100
     101                                switch (gfxindextype)
     102                                {
     103                                case PHY_INTEGER:
     104                                        {
     105                                                for (gfxindex=0;gfxindex<numtriangles;gfxindex++)
     106                                                {
     107                                                        unsigned int* tri_indices= (unsigned int*)(indexbase+gfxindex*indexstride);
     108                                                        graphicsbase = (double*)(vertexbase+tri_indices[0]*stride);
     109                                                        triangle[0].setValue((btScalar)graphicsbase[0]*meshScaling.getX(),(btScalar)graphicsbase[1]*meshScaling.getY(),(btScalar)graphicsbase[2]*meshScaling.getZ());
     110                                                        graphicsbase = (double*)(vertexbase+tri_indices[1]*stride);
     111                                                        triangle[1].setValue((btScalar)graphicsbase[0]*meshScaling.getX(),(btScalar)graphicsbase[1]*meshScaling.getY(),  (btScalar)graphicsbase[2]*meshScaling.getZ());
     112                                                        graphicsbase = (double*)(vertexbase+tri_indices[2]*stride);
     113                                                        triangle[2].setValue((btScalar)graphicsbase[0]*meshScaling.getX(),(btScalar)graphicsbase[1]*meshScaling.getY(),  (btScalar)graphicsbase[2]*meshScaling.getZ());
     114                                                        callback->internalProcessTriangleIndex(triangle,part,gfxindex);
     115                                                }
     116                                                break;
     117                                        }
     118                                case PHY_SHORT:
     119                                        {
     120                                                for (gfxindex=0;gfxindex<numtriangles;gfxindex++)
     121                                                {
     122                                                        unsigned short int* tri_indices= (unsigned short int*)(indexbase+gfxindex*indexstride);
     123                                                        graphicsbase = (double*)(vertexbase+tri_indices[0]*stride);
     124                                                        triangle[0].setValue((btScalar)graphicsbase[0]*meshScaling.getX(),(btScalar)graphicsbase[1]*meshScaling.getY(),(btScalar)graphicsbase[2]*meshScaling.getZ());
     125                                                        graphicsbase = (double*)(vertexbase+tri_indices[1]*stride);
     126                                                        triangle[1].setValue((btScalar)graphicsbase[0]*meshScaling.getX(),(btScalar)graphicsbase[1]*meshScaling.getY(),  (btScalar)graphicsbase[2]*meshScaling.getZ());
     127                                                        graphicsbase = (double*)(vertexbase+tri_indices[2]*stride);
     128                                                        triangle[2].setValue((btScalar)graphicsbase[0]*meshScaling.getX(),(btScalar)graphicsbase[1]*meshScaling.getY(),  (btScalar)graphicsbase[2]*meshScaling.getZ());
     129                                                        callback->internalProcessTriangleIndex(triangle,part,gfxindex);
     130                                                }
     131                                                break;
     132                                        }
     133                                default:
     134                                        btAssert((gfxindextype == PHY_INTEGER) || (gfxindextype == PHY_SHORT));
    77135                                }
    78136                                break;
    79137                        }
    80138                default:
    81                         btAssert((gfxindextype == PHY_INTEGER) || (gfxindextype == PHY_SHORT));
     139                        btAssert((type == PHY_FLOAT) || (type == PHY_DOUBLE));
    82140                }
    83141
     
    96154                AabbCalculationCallback()
    97155                {
    98                         m_aabbMin.setValue(btScalar(1e30),btScalar(1e30),btScalar(1e30));
    99                         m_aabbMax.setValue(btScalar(-1e30),btScalar(-1e30),btScalar(-1e30));
     156                        m_aabbMin.setValue(btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT));
     157                        m_aabbMax.setValue(btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT));
    100158                }
    101159
     
    114172        };
    115173
    116                 //first calculate the total aabb for all triangles
     174        //first calculate the total aabb for all triangles
    117175        AabbCalculationCallback aabbCallback;
    118         aabbMin.setValue(btScalar(-1e30),btScalar(-1e30),btScalar(-1e30));
    119         aabbMax.setValue(btScalar(1e30),btScalar(1e30),btScalar(1e30));
     176        aabbMin.setValue(btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT));
     177        aabbMax.setValue(btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT));
    120178        InternalProcessAllTriangles(&aabbCallback,aabbMin,aabbMax);
    121179
     
    123181        aabbMax = aabbCallback.m_aabbMax;
    124182}
     183
     184
     185
     186///fills the dataBuffer and returns the struct name (and 0 on failure)
     187const char*     btStridingMeshInterface::serialize(void* dataBuffer, btSerializer* serializer) const
     188{
     189        btStridingMeshInterfaceData* trimeshData = (btStridingMeshInterfaceData*) dataBuffer;
     190
     191        trimeshData->m_numMeshParts = getNumSubParts();
     192
     193        //void* uniquePtr = 0;
     194
     195        trimeshData->m_meshPartsPtr = 0;
     196
     197        if (trimeshData->m_numMeshParts)
     198        {
     199                btChunk* chunk = serializer->allocate(sizeof(btMeshPartData),trimeshData->m_numMeshParts);
     200                btMeshPartData* memPtr = (btMeshPartData*)chunk->m_oldPtr;
     201                trimeshData->m_meshPartsPtr = (btMeshPartData *)serializer->getUniquePointer(memPtr);
     202
     203
     204        //      int numtotalphysicsverts = 0;
     205                int part,graphicssubparts = getNumSubParts();
     206                const unsigned char * vertexbase;
     207                const unsigned char * indexbase;
     208                int indexstride;
     209                PHY_ScalarType type;
     210                PHY_ScalarType gfxindextype;
     211                int stride,numverts,numtriangles;
     212                int gfxindex;
     213        //      btVector3 triangle[3];
     214
     215                btVector3 meshScaling = getScaling();
     216
     217                ///if the number of parts is big, the performance might drop due to the innerloop switch on indextype
     218                for (part=0;part<graphicssubparts ;part++,memPtr++)
     219                {
     220                        getLockedReadOnlyVertexIndexBase(&vertexbase,numverts,type,stride,&indexbase,indexstride,numtriangles,gfxindextype,part);
     221                        memPtr->m_numTriangles = numtriangles;//indices = 3*numtriangles
     222                        memPtr->m_numVertices = numverts;
     223                        memPtr->m_indices16 = 0;
     224                        memPtr->m_indices32 = 0;
     225                        memPtr->m_3indices16 = 0;
     226                        memPtr->m_vertices3f = 0;
     227                        memPtr->m_vertices3d = 0;
     228
     229                        switch (gfxindextype)
     230                        {
     231                        case PHY_INTEGER:
     232                                {
     233                                        int numindices = numtriangles*3;
     234                               
     235                                        if (numindices)
     236                                        {
     237                                                btChunk* chunk = serializer->allocate(sizeof(btIntIndexData),numindices);
     238                                                btIntIndexData* tmpIndices = (btIntIndexData*)chunk->m_oldPtr;
     239                                                memPtr->m_indices32 = (btIntIndexData*)serializer->getUniquePointer(tmpIndices);
     240                                                for (gfxindex=0;gfxindex<numtriangles;gfxindex++)
     241                                                {
     242                                                        unsigned int* tri_indices= (unsigned int*)(indexbase+gfxindex*indexstride);
     243                                                        tmpIndices[gfxindex*3].m_value = tri_indices[0];
     244                                                        tmpIndices[gfxindex*3+1].m_value = tri_indices[1];
     245                                                        tmpIndices[gfxindex*3+2].m_value = tri_indices[2];
     246                                                }
     247                                                serializer->finalizeChunk(chunk,"btIntIndexData",BT_ARRAY_CODE,(void*)chunk->m_oldPtr);
     248                                        }
     249                                        break;
     250                                }
     251                        case PHY_SHORT:
     252                                {
     253                                        if (numtriangles)
     254                                        {
     255                                                btChunk* chunk = serializer->allocate(sizeof(btShortIntIndexTripletData),numtriangles);
     256                                                btShortIntIndexTripletData* tmpIndices = (btShortIntIndexTripletData*)chunk->m_oldPtr;
     257                                                memPtr->m_3indices16 = (btShortIntIndexTripletData*) serializer->getUniquePointer(tmpIndices);
     258                                                for (gfxindex=0;gfxindex<numtriangles;gfxindex++)
     259                                                {
     260                                                        unsigned short int* tri_indices= (unsigned short int*)(indexbase+gfxindex*indexstride);
     261                                                        tmpIndices[gfxindex].m_values[0] = tri_indices[0];
     262                                                        tmpIndices[gfxindex].m_values[1] = tri_indices[1];
     263                                                        tmpIndices[gfxindex].m_values[2] = tri_indices[2];
     264                                                }
     265                                                serializer->finalizeChunk(chunk,"btShortIntIndexTripletData",BT_ARRAY_CODE,(void*)chunk->m_oldPtr);
     266                                        }
     267                                        break;
     268                                }
     269                        default:
     270                                {
     271                                        btAssert(0);
     272                                        //unknown index type
     273                                }
     274                        }
     275
     276                        switch (type)
     277                        {
     278                        case PHY_FLOAT:
     279                         {
     280                                 float* graphicsbase;
     281
     282                                 if (numverts)
     283                                 {
     284                                         btChunk* chunk = serializer->allocate(sizeof(btVector3FloatData),numverts);
     285                                         btVector3FloatData* tmpVertices = (btVector3FloatData*) chunk->m_oldPtr;
     286                                         memPtr->m_vertices3f = (btVector3FloatData *)serializer->getUniquePointer(tmpVertices);
     287                                         for (int i=0;i<numverts;i++)
     288                                         {
     289                                                 graphicsbase = (float*)(vertexbase+i*stride);
     290                                                 tmpVertices[i].m_floats[0] = graphicsbase[0];
     291                                                 tmpVertices[i].m_floats[1] = graphicsbase[1];
     292                                                 tmpVertices[i].m_floats[2] = graphicsbase[2];
     293                                         }
     294                                         serializer->finalizeChunk(chunk,"btVector3FloatData",BT_ARRAY_CODE,(void*)chunk->m_oldPtr);
     295                                 }
     296                                 break;
     297                                }
     298
     299                        case PHY_DOUBLE:
     300                                {
     301                                        if (numverts)
     302                                        {
     303                                                btChunk* chunk = serializer->allocate(sizeof(btVector3DoubleData),numverts);
     304                                                btVector3DoubleData* tmpVertices = (btVector3DoubleData*) chunk->m_oldPtr;
     305                                                memPtr->m_vertices3d = (btVector3DoubleData *) serializer->getUniquePointer(tmpVertices);
     306                                                for (int i=0;i<numverts;i++)
     307                                         {
     308                                                 double* graphicsbase = (double*)(vertexbase+i*stride);//for now convert to float, might leave it at double
     309                                                 tmpVertices[i].m_floats[0] = graphicsbase[0];
     310                                                 tmpVertices[i].m_floats[1] = graphicsbase[1];
     311                                                 tmpVertices[i].m_floats[2] = graphicsbase[2];
     312                                         }
     313                                                serializer->finalizeChunk(chunk,"btVector3DoubleData",BT_ARRAY_CODE,(void*)chunk->m_oldPtr);
     314                                        }
     315                                        break;
     316                                }
     317
     318                        default:
     319                                btAssert((type == PHY_FLOAT) || (type == PHY_DOUBLE));
     320                        }
     321
     322                        unLockReadOnlyVertexBase(part);
     323                }
     324
     325                serializer->finalizeChunk(chunk,"btMeshPartData",BT_ARRAY_CODE,chunk->m_oldPtr);
     326        }
     327
     328
     329        m_scaling.serializeFloat(trimeshData->m_scaling);
     330        return "btStridingMeshInterfaceData";
     331}
Note: See TracChangeset for help on using the changeset viewer.