init
This commit is contained in:
5
expkg/src/Tex/Tex.cpp
Normal file
5
expkg/src/Tex/Tex.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
//
|
||||
// Created by sfd on 25-8-5.
|
||||
//
|
||||
|
||||
#include "Tex.h"
|
||||
32
expkg/src/Tex/Tex.h
Normal file
32
expkg/src/Tex/Tex.h
Normal file
@ -0,0 +1,32 @@
|
||||
//
|
||||
// Created by sfd on 25-8-5.
|
||||
//
|
||||
|
||||
#ifndef TEX_H
|
||||
#define TEX_H
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
#include "Entry.h"
|
||||
#include "TexImageContainer.h"
|
||||
|
||||
|
||||
namespace PKG
|
||||
{
|
||||
class Tex
|
||||
{
|
||||
public:
|
||||
std::string Magic1;
|
||||
std::string Magic2;
|
||||
TexHeader Header = {};
|
||||
TexImageContainer ImageContainer = {};
|
||||
|
||||
bool IsGif = false;
|
||||
bool IsVideoTexture = false;
|
||||
|
||||
// std::optional<TexFrameInfoContainer> FrameInfoContainer = {};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif //TEX_H
|
||||
88
expkg/src/Tex/TexImage.cpp
Normal file
88
expkg/src/Tex/TexImage.cpp
Normal file
@ -0,0 +1,88 @@
|
||||
//
|
||||
// Created by sfd on 25-8-5.
|
||||
//
|
||||
|
||||
#include "TexImage.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
std::string PKG::GetFileExtension(const MipmapFormat format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case MipmapFormat::ImageBMP:
|
||||
return "bmp";
|
||||
case MipmapFormat::ImageICO:
|
||||
return "ico";
|
||||
case MipmapFormat::ImageJPEG:
|
||||
return "jpg";
|
||||
case MipmapFormat::ImageJNG:
|
||||
return "jng";
|
||||
case MipmapFormat::ImageKOALA:
|
||||
return "koa";
|
||||
case MipmapFormat::ImageLBM:
|
||||
return "lbm";
|
||||
case MipmapFormat::ImageIFF:
|
||||
return "iff";
|
||||
case MipmapFormat::ImageMNG:
|
||||
return "mng";
|
||||
case MipmapFormat::ImagePBM:
|
||||
case MipmapFormat::ImagePBMRAW:
|
||||
return "pbm";
|
||||
case MipmapFormat::ImagePCD:
|
||||
return "pcd";
|
||||
case MipmapFormat::ImagePCX:
|
||||
return "pcx";
|
||||
case MipmapFormat::ImagePGM:
|
||||
case MipmapFormat::ImagePGMRAW:
|
||||
return "pgm";
|
||||
case MipmapFormat::ImagePNG:
|
||||
return "png";
|
||||
case MipmapFormat::ImagePPM:
|
||||
case MipmapFormat::ImagePPMRAW:
|
||||
return "ppm";
|
||||
case MipmapFormat::ImageRAS:
|
||||
return "ras";
|
||||
case MipmapFormat::ImageTARGA:
|
||||
return "tga";
|
||||
case MipmapFormat::ImageTIFF:
|
||||
return "tif";
|
||||
case MipmapFormat::ImageWBMP:
|
||||
return "wbmp";
|
||||
case MipmapFormat::ImagePSD:
|
||||
return "psd";
|
||||
case MipmapFormat::ImageCUT:
|
||||
return "cut";
|
||||
case MipmapFormat::ImageXBM:
|
||||
return "xbm";
|
||||
case MipmapFormat::ImageXPM:
|
||||
return "xpm";
|
||||
case MipmapFormat::ImageDDS:
|
||||
return "dds";
|
||||
case MipmapFormat::ImageGIF:
|
||||
return "gif";
|
||||
case MipmapFormat::ImageHDR:
|
||||
return "hdr";
|
||||
case MipmapFormat::ImageFAXG3:
|
||||
return "g3";
|
||||
case MipmapFormat::ImageSGI:
|
||||
return "sgi";
|
||||
case MipmapFormat::ImageEXR:
|
||||
return "exr";
|
||||
case MipmapFormat::ImageJ2K:
|
||||
return "j2k";
|
||||
case MipmapFormat::ImageJP2:
|
||||
return "jp2";
|
||||
case MipmapFormat::ImagePFM:
|
||||
return "pfm";
|
||||
case MipmapFormat::ImagePICT:
|
||||
return "pict";
|
||||
case MipmapFormat::ImageRAW:
|
||||
return "raw";
|
||||
case MipmapFormat::VideoMp4:
|
||||
return "mp4";
|
||||
}
|
||||
|
||||
std::cerr << "unknown file type" << std::endl;
|
||||
return ".unknown";
|
||||
}
|
||||
36
expkg/src/Tex/TexImage.h
Normal file
36
expkg/src/Tex/TexImage.h
Normal file
@ -0,0 +1,36 @@
|
||||
//
|
||||
// Created by sfd on 25-8-5.
|
||||
//
|
||||
|
||||
#ifndef TEXIMAGE_H
|
||||
#define TEXIMAGE_H
|
||||
#include <vector>
|
||||
|
||||
#include "../Entry.h"
|
||||
|
||||
namespace PKG
|
||||
{
|
||||
|
||||
std::string GetFileExtension(MipmapFormat format);
|
||||
|
||||
class TexMipMap
|
||||
{
|
||||
public:
|
||||
int Width;
|
||||
int Height;
|
||||
int DecompressedDataCount;
|
||||
bool IsZ4Compressed = false;
|
||||
|
||||
MipmapFormat Format;
|
||||
|
||||
std::vector<uint8_t> Data;
|
||||
};
|
||||
|
||||
|
||||
class TexImage
|
||||
{
|
||||
public:
|
||||
std::vector<TexMipMap> Mipmaps;
|
||||
};
|
||||
}
|
||||
#endif //TEXIMAGE_H
|
||||
6
expkg/src/Tex/TexImageContainer.cpp
Normal file
6
expkg/src/Tex/TexImageContainer.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
//
|
||||
// Created by sfd on 25-8-5.
|
||||
//
|
||||
|
||||
#include "TexImageContainer.h"
|
||||
|
||||
34
expkg/src/Tex/TexImageContainer.h
Normal file
34
expkg/src/Tex/TexImageContainer.h
Normal file
@ -0,0 +1,34 @@
|
||||
//
|
||||
// Created by sfd on 25-8-5.
|
||||
//
|
||||
|
||||
#ifndef TEXIMAGECONTAINER_H
|
||||
#define TEXIMAGECONTAINER_H
|
||||
#include <memory>
|
||||
|
||||
#include "../Entry.h"
|
||||
#include "TexImage.h"
|
||||
#include "BinaryOPT/BinaryReader.h"
|
||||
|
||||
namespace PKG
|
||||
{
|
||||
enum class ImageContainerVersion
|
||||
{
|
||||
VERSION1 = 1,
|
||||
VERSION2 = 2,
|
||||
VERSION3 = 3,
|
||||
VERSION4 = 4,
|
||||
};
|
||||
|
||||
class TexImageContainer
|
||||
{
|
||||
public:
|
||||
std::string Magic;
|
||||
FreeImageFormat ImageFormat{};
|
||||
ImageContainerVersion ImageContainerVersion;
|
||||
|
||||
std::vector<TexImage> Images;
|
||||
};
|
||||
}
|
||||
|
||||
#endif //TEXIMAGECONTAINER_H
|
||||
Reference in New Issue
Block a user