mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
Make sure strips have valid size
This commit is contained in:
parent
6599a28ecf
commit
b4f54651f8
2 changed files with 5 additions and 1 deletions
|
@ -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…
Reference in a new issue