mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-18 13:12:50 +00:00
Handle BSLODTriShape
Its levels of detail are currently not handled
This commit is contained in:
parent
8fd45d85ec
commit
42226533d8
@ -131,6 +131,7 @@ static std::map<std::string,RecordFactoryEntry> makeFactory()
|
||||
factory["NiTransformInterpolator"] = {&construct <NiTransformInterpolator> , RC_NiTransformInterpolator };
|
||||
factory["NiColorInterpolator"] = {&construct <NiColorInterpolator> , RC_NiColorInterpolator };
|
||||
factory["BSShaderTextureSet"] = {&construct <BSShaderTextureSet> , RC_BSShaderTextureSet };
|
||||
factory["BSLODTriShape"] = {&construct <BSLODTriShape> , RC_BSLODTriShape };
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
@ -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 { };
|
||||
|
@ -120,7 +120,8 @@ enum RecordType
|
||||
RC_NiBoolInterpolator,
|
||||
RC_NiTransformInterpolator,
|
||||
RC_NiColorInterpolator,
|
||||
RC_BSShaderTextureSet
|
||||
RC_BSShaderTextureSet,
|
||||
RC_BSLODTriShape
|
||||
};
|
||||
|
||||
/// Base class for all records
|
||||
|
@ -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<const Nif::NiTriShapeData&>(geometry->data.get()), transform);
|
||||
else if (geometry->recType == Nif::RC_NiTriStrips)
|
||||
fillTriangleMesh(mesh, static_cast<const Nif::NiTriStripsData&>(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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user