|
|
@ -1081,12 +1081,18 @@ namespace NifOsg
|
|
|
|
const Nif::NiTriStripsData* data = triStrips->data.getPtr();
|
|
|
|
const Nif::NiTriStripsData* data = triStrips->data.getPtr();
|
|
|
|
vertexColorsPresent = !data->colors.empty();
|
|
|
|
vertexColorsPresent = !data->colors.empty();
|
|
|
|
triCommonToGeometry(geometry, data->vertices, data->normals, data->uvlist, data->colors, boundTextures, triStrips->name);
|
|
|
|
triCommonToGeometry(geometry, data->vertices, data->normals, data->uvlist, data->colors, boundTextures, triStrips->name);
|
|
|
|
// Can't make a triangle from less than three vertices. All strips have the same size.
|
|
|
|
if (!data->strips.empty())
|
|
|
|
if (!data->strips.empty() && data->strips[0].size() >= 3)
|
|
|
|
{
|
|
|
|
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.
|
|
|
|
|
|
|
|
if (strip.size() < 3)
|
|
|
|
|
|
|
|
continue;
|
|
|
|
geometry->addPrimitiveSet(new osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLE_STRIP, strip.size(),
|
|
|
|
geometry->addPrimitiveSet(new osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLE_STRIP, strip.size(),
|
|
|
|
(unsigned short*)strip.data()));
|
|
|
|
(unsigned short*)strip.data()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// osg::Material properties are handled here for two reasons:
|
|
|
|
// osg::Material properties are handled here for two reasons:
|
|
|
|
// - if there are no vertex colors, we need to disable colorMode.
|
|
|
|
// - if there are no vertex colors, we need to disable colorMode.
|
|
|
|