mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-03 13:39:40 +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
|
// Assume every strip has the same size
|
||||||
const int singleStripSize = static_cast<int>(strips[0].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)
|
if (singleStripSize < 3)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -1128,6 +1128,10 @@ namespace NifOsg
|
||||||
{
|
{
|
||||||
for (const std::vector<unsigned short>& strip : data->strips)
|
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,
|
geometry->addPrimitiveSet(new osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLE_STRIP,
|
||||||
strip.size(), (unsigned short*)strip.data()));
|
strip.size(), (unsigned short*)strip.data()));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue