fix overflow visual shape in COLLADA .dae file importer.
This commit is contained in:
@@ -28,6 +28,7 @@ subject to the following restrictions:
|
||||
#include "btMatrix4x4.h"
|
||||
|
||||
|
||||
#define MAX_VISUAL_SHAPES 512
|
||||
|
||||
|
||||
struct VertexSource
|
||||
@@ -288,6 +289,8 @@ void readLibraryGeometries(TiXmlDocument& doc, btAlignedObjectArray<GLInstanceGr
|
||||
}//for each mesh
|
||||
|
||||
int shapeIndex = visualShapes.size();
|
||||
if (shapeIndex<MAX_VISUAL_SHAPES)
|
||||
{
|
||||
GLInstanceGraphicsShape& visualShape = visualShapes.expand();
|
||||
{
|
||||
visualShape.m_vertices = new b3AlignedObjectArray<GLInstanceVertex>;
|
||||
@@ -323,7 +326,10 @@ void readLibraryGeometries(TiXmlDocument& doc, btAlignedObjectArray<GLInstanceGr
|
||||
}
|
||||
//b3Printf("geometry name=%s\n",geometryName);
|
||||
name2Shape.insert(geometryName,shapeIndex);
|
||||
|
||||
} else
|
||||
{
|
||||
b3Warning("DAE exceeds number of visual shapes (%d/%d)",shapeIndex, MAX_VISUAL_SHAPES);
|
||||
}
|
||||
|
||||
}//for each geometry
|
||||
}
|
||||
@@ -557,7 +563,7 @@ void LoadMeshFromCollada(const char* relativeFileName, btAlignedObjectArray<GLIn
|
||||
// GLInstanceGraphicsShape* instance = 0;
|
||||
|
||||
//usually COLLADA files don't have that many visual geometries/shapes
|
||||
visualShapes.reserve(32);
|
||||
visualShapes.reserve(MAX_VISUAL_SHAPES);
|
||||
|
||||
float extraScaling = 1;//0.01;
|
||||
btHashMap<btHashString, int> name2ShapeIndex;
|
||||
|
||||
Reference in New Issue
Block a user