1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 10:23:56 +00:00
openmw/components/nif/controlled.cpp

141 lines
3.6 KiB
C++
Raw Normal View History

#include "controlled.hpp"
#include "data.hpp"
namespace Nif
{
2022-09-22 18:26:05 +00:00
void NiSourceTexture::read(NIFStream* nif)
{
Named::read(nif);
2020-01-02 10:09:54 +00:00
external = nif->getChar() != 0;
2020-02-02 14:08:17 +00:00
bool internal = false;
if (external)
filename = nif->getString();
else
{
2022-09-22 18:26:05 +00:00
if (nif->getVersion() <= NIFStream::generateVersion(10, 0, 1, 3))
internal = nif->getChar();
2022-09-22 18:26:05 +00:00
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 0))
filename = nif->getString(); // Original file path of the internal texture
}
2022-09-22 18:26:05 +00:00
if (nif->getVersion() <= NIFStream::generateVersion(10, 0, 1, 3))
{
if (!external && internal)
data.read(nif);
}
else
{
data.read(nif);
}
2020-02-02 14:08:17 +00:00
pixel = nif->getUInt();
mipmap = nif->getUInt();
alpha = nif->getUInt();
// Renderer hints, typically of no use for us
2022-09-22 18:26:05 +00:00
/* bool mIsStatic = */ nif->getChar();
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 103))
/* bool mDirectRendering = */ nif->getBoolean();
if (nif->getVersion() >= NIFStream::generateVersion(20, 2, 0, 4))
/* bool mPersistRenderData = */ nif->getBoolean();
}
void NiSourceTexture::post(Reader& nif)
{
Named::post(nif);
data.post(nif);
}
2022-09-22 18:26:05 +00:00
void BSShaderTextureSet::read(NIFStream* nif)
{
nif->getSizedStrings(textures, nif->getUInt());
}
2022-09-22 18:26:05 +00:00
void NiParticleModifier::read(NIFStream* nif)
{
next.read(nif);
controller.read(nif);
}
void NiParticleModifier::post(Reader& nif)
{
next.post(nif);
controller.post(nif);
}
2022-09-22 18:26:05 +00:00
void NiParticleGrowFade::read(NIFStream* nif)
{
NiParticleModifier::read(nif);
growTime = nif->getFloat();
fadeTime = nif->getFloat();
}
2022-09-22 18:26:05 +00:00
void NiParticleColorModifier::read(NIFStream* nif)
{
NiParticleModifier::read(nif);
data.read(nif);
}
void NiParticleColorModifier::post(Reader& nif)
{
NiParticleModifier::post(nif);
data.post(nif);
}
2022-09-22 18:26:05 +00:00
void NiGravity::read(NIFStream* nif)
{
NiParticleModifier::read(nif);
mDecay = nif->getFloat();
mForce = nif->getFloat();
mType = nif->getUInt();
mPosition = nif->getVector3();
mDirection = nif->getVector3();
}
2022-09-22 18:26:05 +00:00
void NiParticleCollider::read(NIFStream* nif)
{
NiParticleModifier::read(nif);
mBounceFactor = nif->getFloat();
2022-09-22 18:26:05 +00:00
if (nif->getVersion() >= NIFStream::generateVersion(4, 2, 0, 2))
{
// Unused in NifSkope. Need to figure out what these do.
2022-09-22 18:26:05 +00:00
/*bool mSpawnOnCollision = */ nif->getBoolean();
/*bool mDieOnCollision = */ nif->getBoolean();
}
}
2022-09-22 18:26:05 +00:00
void NiPlanarCollider::read(NIFStream* nif)
{
NiParticleCollider::read(nif);
2022-04-03 20:05:01 +00:00
mExtents = nif->getVector2();
mPosition = nif->getVector3();
mXVector = nif->getVector3();
mYVector = nif->getVector3();
mPlaneNormal = nif->getVector3();
mPlaneDistance = nif->getFloat();
}
2022-09-22 18:26:05 +00:00
void NiParticleRotation::read(NIFStream* nif)
{
NiParticleModifier::read(nif);
2022-09-22 18:26:05 +00:00
/* bool mRandomInitialAxis = */ nif->getChar();
/* osg::Vec3f mInitialAxis = */ nif->getVector3();
/* float mRotationSpeed = */ nif->getFloat();
}
void NiSphericalCollider::read(NIFStream* nif)
{
NiParticleCollider::read(nif);
mRadius = nif->getFloat();
mCenter = nif->getVector3();
}
}