mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 16:15:31 +00:00
Adjust NiPixelData loading
This commit is contained in:
parent
a08a9518c3
commit
5377e0491b
3 changed files with 19 additions and 10 deletions
|
@ -163,11 +163,8 @@ void NiPixelData::read(NIFStream *nif)
|
||||||
{
|
{
|
||||||
fmt = (Format)nif->getUInt();
|
fmt = (Format)nif->getUInt();
|
||||||
|
|
||||||
rmask = nif->getUInt(); // usually 0xff
|
for (unsigned int i = 0; i < 4; ++i)
|
||||||
gmask = nif->getUInt(); // usually 0xff00
|
colorMask[i] = nif->getUInt();
|
||||||
bmask = nif->getUInt(); // usually 0xff0000
|
|
||||||
amask = nif->getUInt(); // usually 0xff000000 or zero
|
|
||||||
|
|
||||||
bpp = nif->getUInt();
|
bpp = nif->getUInt();
|
||||||
|
|
||||||
// 8 bytes of "Old Fast Compare". Whatever that means.
|
// 8 bytes of "Old Fast Compare". Whatever that means.
|
||||||
|
@ -190,10 +187,9 @@ void NiPixelData::read(NIFStream *nif)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read the data
|
// Read the data
|
||||||
unsigned int dataSize = nif->getUInt();
|
unsigned int numPixels = nif->getUInt();
|
||||||
data.reserve(dataSize);
|
if (numPixels)
|
||||||
for (unsigned i=0; i<dataSize; ++i)
|
nif->getUChars(data, numPixels);
|
||||||
data.push_back((unsigned char)nif->getChar());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NiPixelData::post(NIFFile *nif)
|
void NiPixelData::post(NIFFile *nif)
|
||||||
|
|
|
@ -124,7 +124,8 @@ public:
|
||||||
};
|
};
|
||||||
Format fmt;
|
Format fmt;
|
||||||
|
|
||||||
unsigned int rmask, gmask, bmask, amask, bpp;
|
unsigned int colorMask[4];
|
||||||
|
unsigned int bpp;
|
||||||
|
|
||||||
NiPalettePtr palette;
|
NiPalettePtr palette;
|
||||||
unsigned int numberOfMipmaps;
|
unsigned int numberOfMipmaps;
|
||||||
|
|
|
@ -200,6 +200,18 @@ public:
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void getChars(std::vector<char> &vec, size_t size)
|
||||||
|
{
|
||||||
|
vec.resize(size);
|
||||||
|
readLittleEndianDynamicBufferOfType<char,char>(inp, vec.data(), size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void getUChars(std::vector<unsigned char> &vec, size_t size)
|
||||||
|
{
|
||||||
|
vec.resize(size);
|
||||||
|
readLittleEndianDynamicBufferOfType<unsigned char,unsigned char>(inp, vec.data(), size);
|
||||||
|
}
|
||||||
|
|
||||||
void getUShorts(std::vector<unsigned short> &vec, size_t size)
|
void getUShorts(std::vector<unsigned short> &vec, size_t size)
|
||||||
{
|
{
|
||||||
vec.resize(size);
|
vec.resize(size);
|
||||||
|
|
Loading…
Reference in a new issue