diff --git a/components/nif/niffile.cpp b/components/nif/niffile.cpp index c96bf30d6..8aa0b6035 100644 --- a/components/nif/niffile.cpp +++ b/components/nif/niffile.cpp @@ -131,6 +131,7 @@ static std::map makeFactory() factory["NiTransformInterpolator"] = {&construct , RC_NiTransformInterpolator }; factory["NiColorInterpolator"] = {&construct , RC_NiColorInterpolator }; factory["BSShaderTextureSet"] = {&construct , RC_BSShaderTextureSet }; + factory["BSLODTriShape"] = {&construct , RC_BSLODTriShape }; return factory; } diff --git a/components/nif/node.hpp b/components/nif/node.hpp index 3106e368b..75041e187 100644 --- a/components/nif/node.hpp +++ b/components/nif/node.hpp @@ -300,6 +300,17 @@ struct NiGeometry : Node }; struct NiTriShape : NiGeometry {}; +struct BSLODTriShape : NiTriShape +{ + unsigned int lod0, lod1, lod2; + void read(NIFStream *nif) override + { + NiTriShape::read(nif); + lod0 = nif->getUInt(); + lod1 = nif->getUInt(); + lod2 = nif->getUInt(); + } +}; struct NiTriStrips : NiGeometry {}; struct NiLines : NiGeometry {}; struct NiParticles : NiGeometry { }; diff --git a/components/nif/record.hpp b/components/nif/record.hpp index 041122731..6834c554e 100644 --- a/components/nif/record.hpp +++ b/components/nif/record.hpp @@ -120,7 +120,8 @@ enum RecordType RC_NiBoolInterpolator, RC_NiTransformInterpolator, RC_NiColorInterpolator, - RC_BSShaderTextureSet + RC_BSShaderTextureSet, + RC_BSLODTriShape }; /// Base class for all records diff --git a/components/nifbullet/bulletnifloader.cpp b/components/nifbullet/bulletnifloader.cpp index a14672636..033cfcab6 100644 --- a/components/nifbullet/bulletnifloader.cpp +++ b/components/nifbullet/bulletnifloader.cpp @@ -101,7 +101,7 @@ void fillTriangleMesh(btTriangleMesh& mesh, const Nif::NiTriStripsData& data, co void fillTriangleMesh(btTriangleMesh& mesh, const Nif::NiGeometry* geometry, const osg::Matrixf &transform = osg::Matrixf()) { - if (geometry->recType == Nif::RC_NiTriShape) + if (geometry->recType == Nif::RC_NiTriShape || geometry->recType == Nif::RC_BSLODTriShape) fillTriangleMesh(mesh, static_cast(geometry->data.get()), transform); else if (geometry->recType == Nif::RC_NiTriStrips) fillTriangleMesh(mesh, static_cast(geometry->data.get()), transform); @@ -309,7 +309,9 @@ void BulletNifLoader::handleNode(const std::string& fileName, const Nif::Node *n // NOTE: a trishape with hasBounds=true, but no BBoxCollision flag should NOT go through handleNiTriShape! // It must be ignored completely. // (occurs in tr_ex_imp_wall_arch_04.nif) - if(!node->hasBounds && (node->recType == Nif::RC_NiTriShape || node->recType == Nif::RC_NiTriStrips)) + if(!node->hasBounds && (node->recType == Nif::RC_NiTriShape + || node->recType == Nif::RC_NiTriStrips + || node->recType == Nif::RC_BSLODTriShape)) { handleNiTriShape(node, flags, getWorldTransform(node), isAnimated, avoid); } @@ -342,7 +344,7 @@ void BulletNifLoader::handleNiTriShape(const Nif::Node *nifNode, int flags, cons if (niGeometry->data.empty() || niGeometry->data->vertices.empty()) return; - if (niGeometry->recType == Nif::RC_NiTriShape) + if (niGeometry->recType == Nif::RC_NiTriShape || niGeometry->recType == Nif::RC_BSLODTriShape) { if (niGeometry->data->recType != Nif::RC_NiTriShapeData) return; diff --git a/components/nifosg/nifloader.cpp b/components/nifosg/nifloader.cpp index 7ebb9bf8d..c3f4e50cf 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -67,6 +67,7 @@ namespace case Nif::RC_NiTriShape: case Nif::RC_NiTriStrips: case Nif::RC_NiLines: + case Nif::RC_BSLODTriShape: return true; } return false; @@ -1178,7 +1179,7 @@ namespace NifOsg return; const Nif::NiGeometryData* niGeometryData = niGeometry->data.getPtr(); - if (niGeometry->recType == Nif::RC_NiTriShape) + if (niGeometry->recType == Nif::RC_NiTriShape || nifNode->recType == Nif::RC_BSLODTriShape) { if (niGeometryData->recType != Nif::RC_NiTriShapeData) return;