Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 13, 2008, 11:45:51 PM (17 years ago)
Author:
rgrieder
Message:

Updated to Bullet 2.73 (first part).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/physics/src/bullet/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp

    r2192 r2430  
    144144                        {
    145145                                int graphicsindex = indicestype==PHY_SHORT?((unsigned short*)gfxbase)[j]:gfxbase[j];
    146 
    147                                 btScalar* graphicsbase = (btScalar*)(vertexbase+graphicsindex*stride);
    148 
    149                                 m_triangle[j] = btVector3(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(),graphicsbase[2]*meshScaling.getZ());           
     146                               
     147                                if (type == PHY_FLOAT)
     148                                {
     149                                        float* graphicsbase = (float*)(vertexbase+graphicsindex*stride);
     150                                       
     151                                        m_triangle[j] = btVector3(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(),graphicsbase[2]*meshScaling.getZ());           
     152                                }
     153                                else
     154                                {
     155                                        double* graphicsbase = (double*)(vertexbase+graphicsindex*stride);
     156                                       
     157                                        m_triangle[j] = btVector3(btScalar(graphicsbase[0])*meshScaling.getX(),btScalar(graphicsbase[1])*meshScaling.getY(),btScalar(graphicsbase[2])*meshScaling.getZ());             
     158                                }
    150159                        }
    151160
     
    205214                                int graphicsindex = indicestype==PHY_SHORT?((unsigned short*)gfxbase)[j]:gfxbase[j];
    206215
    207                                 btScalar* graphicsbase = (btScalar*)(vertexbase+graphicsindex*stride);
    208 
    209                                 m_triangle[j] = btVector3(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(),graphicsbase[2]*meshScaling.getZ());           
     216                                if (type == PHY_FLOAT)
     217                                {
     218                                        float* graphicsbase = (float*)(vertexbase+graphicsindex*stride);
     219
     220                                        m_triangle[j] = btVector3(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(),graphicsbase[2]*meshScaling.getZ());           
     221                                }
     222                                else
     223                                {
     224                                        double* graphicsbase = (double*)(vertexbase+graphicsindex*stride);
     225                                       
     226                                        m_triangle[j] = btVector3(btScalar(graphicsbase[0])*meshScaling.getX(),btScalar(graphicsbase[1])*meshScaling.getY(),btScalar(graphicsbase[2])*meshScaling.getZ());             
     227                                }
    210228                        }
    211229
     
    282300                                printf("%d ,",graphicsindex);
    283301#endif //DEBUG_TRIANGLE_MESH
    284                                 btScalar* graphicsbase = (btScalar*)(vertexbase+graphicsindex*stride);
    285 
    286                                 m_triangle[j] = btVector3(
    287                                         graphicsbase[0]*meshScaling.getX(),
    288                                         graphicsbase[1]*meshScaling.getY(),
    289                                         graphicsbase[2]*meshScaling.getZ());
     302                                if (type == PHY_FLOAT)
     303                                {
     304                                        float* graphicsbase = (float*)(vertexbase+graphicsindex*stride);
     305                                       
     306                                        m_triangle[j] = btVector3(
     307                                                                                                                                                graphicsbase[0]*meshScaling.getX(),
     308                                                                                                                                                graphicsbase[1]*meshScaling.getY(),
     309                                                                                                                                                graphicsbase[2]*meshScaling.getZ());
     310                                }
     311                                else
     312                                {
     313                                        double* graphicsbase = (double*)(vertexbase+graphicsindex*stride);
     314
     315                                        m_triangle[j] = btVector3(
     316                                                btScalar(graphicsbase[0])*meshScaling.getX(),
     317                                                btScalar(graphicsbase[1])*meshScaling.getY(),
     318                                                btScalar(graphicsbase[2])*meshScaling.getZ());
     319                                }
    290320#ifdef DEBUG_TRIANGLE_MESH
    291321                                printf("triangle vertices:%f,%f,%f\n",triangle[j].x(),triangle[j].y(),triangle[j].z());
Note: See TracChangeset for help on using the changeset viewer.