Changed up how resources import/export files. Added Model codecs.
This commit is contained in:
@@ -42,7 +42,7 @@ namespace ehs
|
||||
|
||||
Img();
|
||||
|
||||
Img(Str_8 id);
|
||||
Img(const Str_8& filePath);
|
||||
|
||||
Img(Str_8 id, UInt_8 byteDepth, UInt_8 channels, const Vec2_u64& resolution, const Byte* data);
|
||||
|
||||
@@ -124,13 +124,7 @@ namespace ehs
|
||||
|
||||
bool IsValid() const;
|
||||
|
||||
bool ToFile(const Str_8& filePath) const;
|
||||
|
||||
static Img FromFile(const Str_8& filePath);
|
||||
|
||||
static Img* FromFile_Heap(const Str_8& filePath);
|
||||
|
||||
static Img FromData(Str_8 id, const Str_8& ext, Serializer<UInt_64>& data);
|
||||
bool Export(const Str_8& filePath) const;
|
||||
|
||||
private:
|
||||
Img GetNearestNeighbor(const Vec2_u64& newResolution) const;
|
||||
@@ -185,4 +179,10 @@ namespace ehs
|
||||
|
||||
void BD16_to_BD8(UInt_64 newSize, Byte* buffer) const;
|
||||
};
|
||||
|
||||
bool EncodeQOI(const ehs::ImgCodec* codec, ehs::Serializer<ehs::UInt_64>& out, const ehs::Img* in);
|
||||
|
||||
bool DecodeQOI(const ehs::ImgCodec* codec, ehs::Serializer<ehs::UInt_64>& in, ehs::Img* out);
|
||||
|
||||
bool DecodePNG(const ehs::ImgCodec* codec, ehs::Serializer<ehs::UInt_64>& in, ehs::Img* out);
|
||||
}
|
||||
|
@@ -7,6 +7,10 @@
|
||||
namespace ehs
|
||||
{
|
||||
class Img;
|
||||
class ImgCodec;
|
||||
|
||||
typedef bool (*EncodeImgCb)(const ImgCodec* const, Serializer<UInt_64>&, const Img*);
|
||||
typedef bool (*DecodeImgCb)(const ImgCodec* const, Serializer<UInt_64>&, Img*);
|
||||
|
||||
class ImgCodec
|
||||
{
|
||||
@@ -15,15 +19,13 @@ namespace ehs
|
||||
UInt_64 hashExt;
|
||||
Str_8 ext;
|
||||
Endianness endianness;
|
||||
bool (*encodeCb)(const ImgCodec* const, Serializer<UInt_64>&, const Img*);
|
||||
bool (*decodeCb)(const ImgCodec* const, Serializer<UInt_64>&, Img*);
|
||||
EncodeImgCb encoder;
|
||||
DecodeImgCb decoder;
|
||||
|
||||
public:
|
||||
ImgCodec();
|
||||
|
||||
ImgCodec(Str_8 id, Str_8 ext, const Endianness end,
|
||||
bool (*encodeCb)(const ImgCodec* const, Serializer<UInt_64>&, const Img*),
|
||||
bool (*decodeCb)(const ImgCodec* const, Serializer<UInt_64>&, Img*));
|
||||
ImgCodec(Str_8 id, Str_8 ext, Endianness end, EncodeImgCb encoder, DecodeImgCb decoder);
|
||||
|
||||
ImgCodec(ImgCodec&& codec) noexcept;
|
||||
|
||||
|
Reference in New Issue
Block a user