Shipwright/libultraship/libultraship/Texture.cpp
M4xw d24c8453db git subrepo clone https://github.com/HarbourMasters/libultraship.git
subrepo:
  subdir:   "libultraship"
  merged:   "a484cda98"
upstream:
  origin:   "https://github.com/HarbourMasters/libultraship.git"
  branch:   "main"
  commit:   "a484cda98"
git-subrepo:
  version:  "0.4.1"
  origin:   "???"
  commit:   "???"
2022-03-22 02:52:44 +01:00

23 lines
603 B
C++

#include "Texture.h"
namespace Ship
{
void TextureV0::ParseFileBinary(BinaryReader* reader, Resource* res)
{
Texture* tex = (Texture*)res;
ResourceFile::ParseFileBinary(reader, tex);
tex->texType = (TextureType)reader->ReadUInt32();
tex->width = reader->ReadUInt32();
tex->height = reader->ReadUInt32();
uint32_t dataSize = reader->ReadUInt32();
tex->imageDataSize = dataSize;
tex->imageData = new uint8_t[dataSize];
for (uint32_t i = 0; i < dataSize; i++)
tex->imageData[i] = reader->ReadUByte();
}
}