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)
|
|
|
|
{
|
|
|
|
Named::read(nif);
|
|
|
|
|
2020-01-02 13:09:54 +03:00
|
|
|
external = nif->getChar() != 0;
|
2020-02-02 17:08:17 +03:00
|
|
|
bool internal = false;
|
|
|
|
if (external)
|
2015-02-23 21:06:10 +01:00
|
|
|
filename = nif->getString();
|
|
|
|
else
|
2020-10-04 01:27:49 +03:00
|
|
|
{
|
|
|
|
if (nif->getVersion() <= NIFStream::generateVersion(10, 0, 1, 3))
|
|
|
|
internal = nif->getChar();
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 0))
|
|
|
|
filename = nif->getString(); // Original file path of the internal texture
|
|
|
|
}
|
|
|
|
if (nif->getVersion() <= NIFStream::generateVersion(10, 0, 1, 3))
|
|
|
|
{
|
|
|
|
if (!external && internal)
|
|
|
|
data.read(nif);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-02-23 21:06:10 +01:00
|
|
|
data.read(nif);
|
2020-10-04 01:27:49 +03:00
|
|
|
}
|
2015-02-23 21:06:10 +01:00
|
|
|
|
2020-02-02 17:08:17 +03:00
|
|
|
pixel = nif->getUInt();
|
|
|
|
mipmap = nif->getUInt();
|
|
|
|
alpha = nif->getUInt();
|
2015-02-23 21:06:10 +01:00
|
|
|
|
2022-04-03 22:35:29 +03:00
|
|
|
// Renderer hints, typically of no use for us
|
|
|
|
/* bool mIsStatic = */ nif->getChar();
|
2020-10-04 01:27:49 +03:00
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 103))
|
2022-04-03 22:35:29 +03:00
|
|
|
/* bool mDirectRendering = */ nif->getBoolean();
|
2020-10-04 01:27:49 +03:00
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(20, 2, 0, 4))
|
2022-04-03 22:35:29 +03:00
|
|
|
/* bool mPersistRenderData = */ nif->getBoolean();
|
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
|
|
|
{
|
|
|
|
Named::post(nif);
|
|
|
|
data.post(nif);
|
|
|
|
}
|
2020-12-13 02:35:57 +03:00
|
|
|
|
|
|
|
void BSShaderTextureSet::read(NIFStream* nif)
|
|
|
|
{
|
|
|
|
nif->getSizedStrings(textures, nif->getUInt());
|
|
|
|
}
|
2015-02-23 21:06:10 +01:00
|
|
|
|
|
|
|
}
|