2023-08-31 18:59:33 +03:00
|
|
|
#include "texture.hpp"
|
2015-02-23 21:06:10 +01:00
|
|
|
|
|
|
|
#include "data.hpp"
|
|
|
|
|
|
|
|
namespace Nif
|
|
|
|
{
|
|
|
|
|
|
|
|
void NiSourceTexture::read(NIFStream* nif)
|
|
|
|
{
|
2023-08-31 20:33:43 +03:00
|
|
|
NiTexture::read(nif);
|
2015-02-23 21:06:10 +01:00
|
|
|
|
2023-08-31 20:33:43 +03:00
|
|
|
nif->read(mExternal);
|
|
|
|
bool hasData = nif->getVersion() >= NIFStream::generateVersion(10, 0, 1, 4);
|
|
|
|
if (!hasData && !mExternal)
|
2023-09-04 23:51:38 +03:00
|
|
|
hasData = nif->get<uint8_t>() != 0;
|
|
|
|
|
|
|
|
if (mExternal || nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 0))
|
|
|
|
nif->read(mFile);
|
2023-08-31 20:33:43 +03:00
|
|
|
|
|
|
|
if (hasData)
|
|
|
|
mData.read(nif);
|
2015-02-23 21:06:10 +01:00
|
|
|
|
2023-08-31 20:33:43 +03:00
|
|
|
mPrefs.mPixelLayout = static_cast<PixelLayout>(nif->get<uint32_t>());
|
|
|
|
mPrefs.mUseMipMaps = static_cast<MipMapFormat>(nif->get<uint32_t>());
|
|
|
|
mPrefs.mAlphaFormat = static_cast<AlphaFormat>(nif->get<uint32_t>());
|
2015-02-23 21:06:10 +01:00
|
|
|
|
2023-08-31 20:33:43 +03:00
|
|
|
nif->read(mIsStatic);
|
2020-10-04 01:27:49 +03:00
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 103))
|
2023-08-31 20:33:43 +03:00
|
|
|
{
|
|
|
|
nif->read(mDirectRendering);
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(20, 2, 0, 4))
|
|
|
|
nif->read(mPersistRenderData);
|
|
|
|
}
|
2015-02-23 21:06:10 +01:00
|
|
|
}
|
|
|
|
|
2022-09-17 19:24:42 +02:00
|
|
|
void NiSourceTexture::post(Reader& nif)
|
2015-02-23 21:06:10 +01:00
|
|
|
{
|
2023-08-31 20:33:43 +03:00
|
|
|
NiTexture::post(nif);
|
|
|
|
mData.post(nif);
|
2015-02-23 21:06:10 +01:00
|
|
|
}
|
2020-12-13 02:35:57 +03:00
|
|
|
|
|
|
|
void BSShaderTextureSet::read(NIFStream* nif)
|
|
|
|
{
|
2023-08-31 20:33:43 +03:00
|
|
|
nif->getSizedStrings(mTextures, nif->get<uint32_t>());
|
2020-12-13 02:35:57 +03:00
|
|
|
}
|
2015-02-23 21:06:10 +01:00
|
|
|
|
|
|
|
}
|