mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 06:35:30 +00:00
Make sure strips have valid size
This commit is contained in:
parent
6599a28ecf
commit
b4f54651f8
@ -63,7 +63,7 @@ void fillTriangleMeshWithTransform(btTriangleMesh& mesh, const Nif::NiTriStripsD
|
||||
|
||||
// Assume every strip has the same size
|
||||
const int singleStripSize = static_cast<int>(strips[0].size());
|
||||
// Can't make a triangle from 2 vertices or less.
|
||||
// Can't make a triangle from less than three vertices.
|
||||
if (singleStripSize < 3)
|
||||
return;
|
||||
|
||||
|
@ -1128,6 +1128,10 @@ namespace NifOsg
|
||||
{
|
||||
for (const std::vector<unsigned short>& strip : data->strips)
|
||||
{
|
||||
// Can't make a triangle from less than three vertices.
|
||||
// All strips have the same size.
|
||||
if (strip.size() < 3)
|
||||
break;
|
||||
geometry->addPrimitiveSet(new osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLE_STRIP,
|
||||
strip.size(), (unsigned short*)strip.data()));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user