Restructured Img and FontAtlas.

This commit is contained in:
Arron David Nelson 2024-01-23 17:26:27 -08:00
parent 039ab8cc0f
commit 897d3b9120
13 changed files with 502 additions and 452 deletions

View File

@ -239,22 +239,22 @@ namespace ehs
static void Rename_8(const Str_8& filePath, const Str_8& newName); static void Rename_8(const Str_8& filePath, const Str_8& newName);
static Str_32 ProcessFullName_32(const Str_32& filePath); static Str_32 ParseFullName_32(const Str_32& filePath);
static Str_16 ProcessFullName_16(const Str_16& filePath); static Str_16 ParseFullName_16(const Str_16& filePath);
static Str_8 ProcessFullName_8(const Str_8& filePath); static Str_8 ParseFullName_8(const Str_8& filePath);
static Str_32 ProcessName_32(const Str_32& filePath); static Str_32 ParseName_32(const Str_32& filePath);
static Str_16 ProcessName_16(const Str_16& filePath); static Str_16 ParseName_16(const Str_16& filePath);
static Str_8 ProcessName_8(const Str_8& filePath); static Str_8 ParseName_8(const Str_8& filePath);
static Str_32 ProcessExt_32(const Str_32& filePath); static Str_32 ParseExt_32(const Str_32& filePath);
static Str_16 ProcessExt_16(const Str_16& filePath); static Str_16 ParseExt_16(const Str_16& filePath);
static Str_8 ProcessExt_8(const Str_8& filePath); static Str_8 ParseExt_8(const Str_8& filePath);
}; };
} }

View File

@ -10,13 +10,20 @@
namespace ehs namespace ehs
{ {
class FontAtlas : public Img class FontAtlas : public BaseObj
{ {
private: private:
UInt_64 hashId;
Str_8 id;
UInt_64 glyphScale; UInt_64 glyphScale;
Array<Glyph> glyphs; Array<Glyph> glyphs;
Vec2_u64 resolution;
UInt_64 size;
Byte* atlas;
public: public:
~FontAtlas() override;
FontAtlas(); FontAtlas();
FontAtlas(const Str_8& filePath); FontAtlas(const Str_8& filePath);
@ -29,10 +36,24 @@ namespace ehs
FontAtlas& operator=(const FontAtlas& fa); FontAtlas& operator=(const FontAtlas& fa);
operator Byte*() const;
void Release();
UInt_64 GetHashId() const;
Str_8 GetId() const;
UInt_64 GetGlyphScale() const; UInt_64 GetGlyphScale() const;
Glyph GetGlyph(Char_32 code) const; Glyph GetGlyph(Char_32 code) const;
Vec2_u64 GetResolution() const;
UInt_64 GetSize() const;
bool IsValid() const;
Vec2_f CalculateSize(const Str_8& text) const; Vec2_f CalculateSize(const Str_8& text) const;
float CalculateWidth(const Str_8& text) const; float CalculateWidth(const Str_8& text) const;

View File

@ -21,10 +21,9 @@ namespace ehs
protected: protected:
UInt_64 hashId; UInt_64 hashId;
Str_8 id; Str_8 id;
UInt_8 bitDepth; UInt_8 byteDepth;
UInt_8 channels; UInt_8 channels;
UInt_64 width; Vec2_u64 resolution;
UInt_64 height;
UInt_64 size; UInt_64 size;
Byte* data; Byte* data;
@ -39,15 +38,15 @@ namespace ehs
static const ImgCodec* GetCodec(const Str_8& ext); static const ImgCodec* GetCodec(const Str_8& ext);
~Img(); ~Img() override;
Img(); Img();
Img(Str_8 id); Img(Str_8 id);
Img(Str_8 id, UInt_8 bitDepth, UInt_8 channels, UInt_64 width, UInt_64 height, const Byte* data); Img(Str_8 id, UInt_8 byteDepth, UInt_8 channels, const Vec2_u64& resolution, const Byte* data);
Img(Str_8 id, UInt_8 bitDepth, UInt_8 channels, UInt_64 width, UInt_64 height); Img(Str_8 id, UInt_8 byteDepth, UInt_8 channels, const Vec2_u64& resolution);
Img(Img&& img) noexcept; Img(Img&& img) noexcept;
@ -69,15 +68,15 @@ namespace ehs
Str_8 GetId() const; Str_8 GetId() const;
UInt_8 BitDepth() const; UInt_8 GetByteDepth() const;
UInt_8 Channels() const; UInt_8 GetBitDepth() const;
UInt_64 Width() const; UInt_8 GetChannels() const;
UInt_64 Height() const; Vec2_u64 GetResolution() const;
UInt_64 Size() const; UInt_64 GetSize() const;
void SetPixel(UInt_64 index, const Byte* pixel); void SetPixel(UInt_64 index, const Byte* pixel);
@ -87,9 +86,9 @@ namespace ehs
void GetPixel(UInt_64 x, UInt_64 y, Byte* pixel) const; void GetPixel(UInt_64 x, UInt_64 y, Byte* pixel) const;
void Resize(Resampling method, UInt_64 newWidth, UInt_64 newHeight); void Resize(Resampling method, const Vec2_u64& newResolution);
Img GetResized(Resampling method, UInt_64 newWidth, UInt_64 newHeight) const; Img GetResized(Resampling method, const Vec2_u64& newResolution) const;
void ToRGBA(); void ToRGBA();
@ -134,9 +133,9 @@ namespace ehs
static Img FromData(Str_8 id, const Str_8& ext, Serializer<UInt_64>& data); static Img FromData(Str_8 id, const Str_8& ext, Serializer<UInt_64>& data);
private: private:
Img GetNearestNeighbor(UInt_64 newWidth, UInt_64 newHeight) const; Img GetNearestNeighbor(const Vec2_u64& newResolution) const;
void NearestNeighbor(UInt_64 newWidth, UInt_64 newHeight); void NearestNeighbor(const Vec2_u64& newResolution);
void RGB_To_RGBA(UInt_64 newSize, Byte* buffer) const; void RGB_To_RGBA(UInt_64 newSize, Byte* buffer) const;

View File

@ -20,7 +20,7 @@ namespace ehs
public: public:
Bone(); Bone();
Bone(Str_8 name, const UInt_8 id, const Mat4_f& localBindTrans, const Mat4_f& invBindTrans); Bone(Str_8 name, UInt_8 id, const Mat4_f& localBindTrans, const Mat4_f& invBindTrans);
Bone(Bone&& bone) noexcept; Bone(Bone&& bone) noexcept;
@ -50,21 +50,21 @@ namespace ehs
UInt_8 GetBoneCount() const; UInt_8 GetBoneCount() const;
bool HasBone(const UInt_64 hashName, const UInt_8 id) const; bool HasBone(UInt_64 hashName, UInt_8 id) const;
bool HasBone(const UInt_64 hashName) const; bool HasBone(UInt_64 hashName) const;
bool HasBone(const UInt_8 id) const; bool HasBone(UInt_8 id) const;
bool AddBone(Bone child); bool AddBone(Bone child);
const Bone* GetBone(const UInt_64 hashName) const; const Bone* GetBone(UInt_64 hashName) const;
Bone* GetBone(const UInt_64 hashName); Bone* GetBone(UInt_64 hashName);
const Bone* GetBone(const UInt_8 id) const; const Bone* GetBone(UInt_8 id) const;
Bone* GetBone(const UInt_8 id); Bone* GetBone(UInt_8 id);
const Array<Bone>& GetChildren() const; const Array<Bone>& GetChildren() const;

View File

@ -7,38 +7,6 @@
namespace ehs namespace ehs
{ {
const Array<Vertex_f> portraitGuiVerts({
{{0.0f, 0.0f, 1.0f}, {0.0f, 0.0f, -1.0f}, {0.0f, 0.0f}},
{{0.0f, 1.0f, 1.0f}, {0.0f, 0.0f, -1.0f}, {0.0f, 1.0f}},
{{1.0f, 0.0f, 1.0f}, {0.0f, 0.0f, -1.0f}, {1.0f, 0.0f}},
{{1.0f, 1.0f, 1.0f}, {0.0f, 0.0f, -1.0f}, {1.0f, 1.0f}}
});
const Array<UInt_32> portraitGuiIndices({
0,
1,
2,
3,
2,
1
});
const Array<Vertex_f> portraitVerts({
{{-0.5f, -0.5f, 0.0f}, {0.0f, 0.0f, -1.0f}, {0.0f, 0.0f}},
{{-0.5f, 0.5f, 0.0f}, {0.0f, 0.0f, -1.0f}, {0.0f, 1.0f}},
{{0.5f, -0.5f, 0.0f}, {0.0f, 0.0f, -1.0f}, {1.0f, 0.0f}},
{{0.5f, 0.5f, 0.0f}, {0.0f, 0.0f, -1.0f}, {1.0f, 1.0f}}
});
const Array<UInt_32> portraitIndices({
0,
1,
2,
3,
2,
1
});
class Mesh final : public BaseObj class Mesh final : public BaseObj
{ {
protected: protected:
@ -89,4 +57,24 @@ namespace ehs
private: private:
static void Calculate(Vertex_f& vert1, Vertex_f& vert2, Vertex_f& vert3); static void Calculate(Vertex_f& vert1, Vertex_f& vert2, Vertex_f& vert3);
}; };
const Mesh portraitGui("PortraitGui",
{
{{0.0f, 0.0f, 1.0f}, {0.0f, 0.0f, -1.0f}, {0.0f, 0.0f}},
{{0.0f, 1.0f, 1.0f}, {0.0f, 0.0f, -1.0f}, {0.0f, 1.0f}},
{{1.0f, 0.0f, 1.0f}, {0.0f, 0.0f, -1.0f}, {1.0f, 0.0f}},
{{1.0f, 1.0f, 1.0f}, {0.0f, 0.0f, -1.0f}, {1.0f, 1.0f}}
},
{0, 1, 2, 3, 2, 1}
);
const Mesh portrait("Portrait",
{
{{-0.5f, -0.5f, 0.0f}, {0.0f, 0.0f, -1.0f}, {0.0f, 0.0f}},
{{-0.5f, 0.5f, 0.0f}, {0.0f, 0.0f, -1.0f}, {0.0f, 1.0f}},
{{0.5f, -0.5f, 0.0f}, {0.0f, 0.0f, -1.0f}, {1.0f, 0.0f}},
{{0.5f, 0.5f, 0.0f}, {0.0f, 0.0f, -1.0f}, {1.0f, 1.0f}}
},
{0, 1, 2, 3, 2, 1}
);
} }

View File

@ -50,7 +50,7 @@ namespace ehs
Str_8 GetId() const; Str_8 GetId() const;
Array<Mesh> GetMeshes() const; const Array<Mesh>& GetMeshes() const;
Array<Mesh>& GetMeshes(); Array<Mesh>& GetMeshes();
@ -58,13 +58,13 @@ namespace ehs
Mesh* GetMesh(const Str_8& inId); Mesh* GetMesh(const Str_8& inId);
Bone GetSkeleton() const; const Bone& GetSkeleton() const;
Bone& GetSkeleton(); Bone& GetSkeleton();
Animation* GetAnimation(UInt_64 inHashId); Animation* GetAnimation(UInt_64 inHashId);
Array<Animation> GetAnimations() const; const Array<Animation>& GetAnimations() const;
Array<Animation>& GetAnimations(); Array<Animation>& GetAnimations();

View File

@ -329,7 +329,7 @@ namespace ehs
else if (colorType == 6) else if (colorType == 6)
channels = 4; channels = 4;
*out = Img(out->GetId(), bitDepth, channels, width, height); *out = Img(out->GetId(), bitDepth, channels, {width, height});
UInt_8 compression = ihdrData->Read<UInt_8>(); UInt_8 compression = ihdrData->Read<UInt_8>();
if (compression) if (compression)
@ -419,11 +419,10 @@ namespace ehs
bool EncodeQOI(const ehs::ImgCodec* const codec, ehs::Serializer<ehs::UInt_64>& out, const ehs::Img* in) bool EncodeQOI(const ehs::ImgCodec* const codec, ehs::Serializer<ehs::UInt_64>& out, const ehs::Img* in)
{ {
UInt_8 channels = in->Channels(); UInt_8 channels = in->GetChannels();
UInt_64 width = in->Width(); Vec2_u64 resolution = in->GetResolution();
UInt_64 height = in->Height();
UInt_32 px_len = width * height * channels; UInt_32 px_len = resolution.x * resolution.y * channels;
UInt_32 px_end = px_len - channels; UInt_32 px_end = px_len - channels;
Byte index[256]; Byte index[256];
@ -433,15 +432,15 @@ namespace ehs
Byte prevPixel[4] = {0, 0, 0, 255}; Byte prevPixel[4] = {0, 0, 0, 255};
Byte pixel[4] = {0, 0, 0, 255}; Byte pixel[4] = {0, 0, 0, 255};
Serializer<UInt_32> result(Endianness::BE, width * height * (channels + 1) + 22); Serializer<UInt_32> result(Endianness::BE, resolution.x * resolution.y * (channels + 1) + 22);
result.Write('q'); result.Write('q');
result.Write('o'); result.Write('o');
result.Write('i'); result.Write('i');
result.Write('f'); result.Write('f');
result.Write<UInt_32>(width); result.Write<UInt_32>(resolution.x);
result.Write<UInt_32>(height); result.Write<UInt_32>(resolution.y);
result.Write(in->Channels()); result.Write(in->GetChannels());
result.Write(1); result.Write(1);
for (UInt_32 px_pos = 0, run = 0; px_pos < px_len; px_pos += channels) for (UInt_32 px_pos = 0, run = 0; px_pos < px_len; px_pos += channels)
@ -555,7 +554,7 @@ namespace ehs
UInt_64 size = width * channels * height; UInt_64 size = width * channels * height;
*out = Img(out->GetId(), bitDepth, channels, width, height); *out = Img(out->GetId(), bitDepth, channels, {width, height});
Byte prevPixel[4] = {0, 0, 0, 255}; Byte prevPixel[4] = {0, 0, 0, 255};

View File

@ -8,8 +8,8 @@ namespace ehs
} }
BaseFile::BaseFile(const Str_8& filePath, const Mode mode, const Disposition disposition) BaseFile::BaseFile(const Str_8& filePath, const Mode mode, const Disposition disposition)
: path(filePath), fullName(ProcessFullName_8(filePath)), : path(filePath), fullName(ParseFullName_8(filePath)),
name(ProcessName_8(fullName)), extension(ProcessExt_8(fullName)), name(ParseName_8(fullName)), extension(ParseExt_8(fullName)),
mode(mode), disposition(disposition) mode(mode), disposition(disposition)
{ {
} }
@ -506,7 +506,7 @@ namespace ehs
{ {
} }
Str_32 BaseFile::ProcessFullName_32(const Str_32& filePath) Str_32 BaseFile::ParseFullName_32(const Str_32& filePath)
{ {
UInt_64 index = 0; UInt_64 index = 0;
@ -516,7 +516,7 @@ namespace ehs
return filePath.Sub(index); return filePath.Sub(index);
} }
Str_16 BaseFile::ProcessFullName_16(const Str_16& filePath) Str_16 BaseFile::ParseFullName_16(const Str_16& filePath)
{ {
UInt_64 index = 0; UInt_64 index = 0;
@ -526,7 +526,7 @@ namespace ehs
return filePath.Sub(index); return filePath.Sub(index);
} }
Str_8 BaseFile::ProcessFullName_8(const Str_8& filePath) Str_8 BaseFile::ParseFullName_8(const Str_8& filePath)
{ {
UInt_64 index = 0; UInt_64 index = 0;
@ -536,7 +536,7 @@ namespace ehs
return filePath.Sub(index); return filePath.Sub(index);
} }
Str_32 BaseFile::ProcessName_32(const Str_32& filePath) Str_32 BaseFile::ParseName_32(const Str_32& filePath)
{ {
UInt_64 index; UInt_64 index;
Str_32 file = filePath; Str_32 file = filePath;
@ -550,7 +550,7 @@ namespace ehs
return file.Sub(0, index - 1); return file.Sub(0, index - 1);
} }
Str_16 BaseFile::ProcessName_16(const Str_16& filePath) Str_16 BaseFile::ParseName_16(const Str_16& filePath)
{ {
UInt_64 index; UInt_64 index;
Str_16 file = filePath; Str_16 file = filePath;
@ -564,7 +564,7 @@ namespace ehs
return file.Sub(0, index - 1); return file.Sub(0, index - 1);
} }
Str_8 BaseFile::ProcessName_8(const Str_8& filePath) Str_8 BaseFile::ParseName_8(const Str_8& filePath)
{ {
UInt_64 index; UInt_64 index;
Str_8 file = filePath; Str_8 file = filePath;
@ -578,7 +578,7 @@ namespace ehs
return file.Sub(0, index - 1); return file.Sub(0, index - 1);
} }
Str_32 BaseFile::ProcessExt_32(const Str_32& filePath) Str_32 BaseFile::ParseExt_32(const Str_32& filePath)
{ {
UInt_64 index = 0; UInt_64 index = 0;
@ -587,7 +587,7 @@ namespace ehs
return filePath.Sub(index); return filePath.Sub(index);
} }
Str_16 BaseFile::ProcessExt_16(const Str_16& filePath) Str_16 BaseFile::ParseExt_16(const Str_16& filePath)
{ {
UInt_64 index = 0; UInt_64 index = 0;
@ -596,7 +596,7 @@ namespace ehs
return filePath.Sub(index); return filePath.Sub(index);
} }
Str_8 BaseFile::ProcessExt_8(const Str_8& filePath) Str_8 BaseFile::ParseExt_8(const Str_8& filePath)
{ {
UInt_64 index = 0; UInt_64 index = 0;

View File

@ -4,13 +4,17 @@
namespace ehs namespace ehs
{ {
FontAtlas::~FontAtlas()
{
delete[] atlas;
}
FontAtlas::FontAtlas() FontAtlas::FontAtlas()
: glyphScale(0) : hashId(0), glyphScale(0), size(0), atlas(nullptr)
{ {
} }
FontAtlas::FontAtlas(const Str_8& filePath) FontAtlas::FontAtlas(const Str_8& filePath)
: glyphScale(0)
{ {
File fontFile(filePath, Mode::READ, Disposition::OPEN); File fontFile(filePath, Mode::READ, Disposition::OPEN);
@ -35,23 +39,28 @@ namespace ehs
for (UInt_64 i = 0; i < glyphs.Size(); ++i) for (UInt_64 i = 0; i < glyphs.Size(); ++i)
glyphs[i] = Glyph(fData); glyphs[i] = Glyph(fData);
bitDepth = 8; resolution = fData.ReadVec2<UInt_64>();
channels = 1; size = resolution.x * resolution.y;
width = fData.Read<UInt_64>(); atlas = new Byte[size];
height = fData.Read<UInt_64>(); fData.ReadArray(atlas, &size);
data = new Byte[width * height * (bitDepth / 8) * channels];
fData.ReadArray(data, &size);
} }
FontAtlas::FontAtlas(FontAtlas&& fa) noexcept FontAtlas::FontAtlas(FontAtlas&& fa) noexcept
: Img(std::move(fa)), glyphScale(fa.glyphScale), glyphs(std::move(fa.glyphs)) : BaseObj(std::move(fa)), hashId(fa.hashId), id((Str_8&&)fa.id), glyphScale(fa.glyphScale),
glyphs((Array<Glyph>&&)fa.glyphs), resolution(fa.resolution), size(fa.size), atlas(fa.atlas)
{ {
fa.hashId = 0;
fa.glyphScale = 0; fa.glyphScale = 0;
fa.resolution = {};
fa.size = 0;
fa.atlas = nullptr;
} }
FontAtlas::FontAtlas(const FontAtlas& fa) FontAtlas::FontAtlas(const FontAtlas& fa)
: Img(fa), glyphScale(0) : BaseObj(fa), hashId(fa.hashId), id(fa.id), glyphScale(fa.glyphScale), glyphs(fa.glyphs),
resolution(fa.resolution), size(fa.size), atlas(new Byte[fa.size])
{ {
Util::Copy(atlas, fa.atlas, fa.size);
} }
FontAtlas& FontAtlas::operator=(FontAtlas&& fa) noexcept FontAtlas& FontAtlas::operator=(FontAtlas&& fa) noexcept
@ -59,12 +68,22 @@ namespace ehs
if (this == &fa) if (this == &fa)
return *this; return *this;
Img::operator=(std::move(fa)); BaseObj::operator=(std::move(fa));
hashId = fa.hashId;
id = (Str_8&&)fa.id;
glyphScale = fa.glyphScale; glyphScale = fa.glyphScale;
glyphs = std::move(fa.glyphs); glyphs = (Array<Glyph>&&)fa.glyphs;
resolution = fa.resolution;
size = fa.size;
delete[] atlas;
atlas = fa.atlas;
fa.hashId = 0;
fa.glyphScale = 0; fa.glyphScale = 0;
fa.resolution = {};
fa.size = 0;
fa.atlas = nullptr;
return *this; return *this;
} }
@ -74,14 +93,49 @@ namespace ehs
if (this == &fa) if (this == &fa)
return *this; return *this;
Img::operator=(fa); BaseObj::operator=(fa);
glyphScale = 0; hashId = fa.hashId;
glyphs = Array<Glyph>(); id = fa.id;
glyphScale = fa.glyphScale;
glyphs = fa.glyphs;
resolution = {};
size = fa.size;
delete[] atlas;
atlas = new Byte[fa.size];
Util::Copy(atlas, fa.atlas, fa.size);
return *this; return *this;
} }
FontAtlas::operator Byte *() const
{
return atlas;
}
void FontAtlas::Release()
{
hashId = 0;
id = {};
glyphScale = 0;
glyphs.Clear();
resolution = {0, 0};
size = 0;
delete[] atlas;
atlas = nullptr;
}
UInt_64 FontAtlas::GetHashId() const
{
return hashId;
}
Str_8 FontAtlas::GetId() const
{
return id;
}
UInt_64 FontAtlas::GetGlyphScale() const UInt_64 FontAtlas::GetGlyphScale() const
{ {
return glyphScale; return glyphScale;
@ -96,63 +150,78 @@ namespace ehs
return glyphs[0]; return glyphs[0];
} }
Vec2_u64 FontAtlas::GetResolution() const
{
return resolution;
}
UInt_64 FontAtlas::GetSize() const
{
return size;
}
bool FontAtlas::IsValid() const
{
return size;
}
Vec2_f FontAtlas::CalculateSize(const Str_8& text) const Vec2_f FontAtlas::CalculateSize(const Str_8& text) const
{ {
Vec2_f size; Vec2_f result;
for (UInt_64 i = 0; i < text.Size(); ++i) for (UInt_64 i = 0; i < text.Size(); ++i)
{ {
Glyph glyph = GetGlyph(text[i]); Glyph glyph = GetGlyph(text[i]);
size.x += (float)glyph.GetAdvance().x; result.x += (float)glyph.GetAdvance().x;
if ((float)glyph.GetScale().y > size.y) if ((float)glyph.GetScale().y > result.y)
size.y = (float)glyph.GetScale().y; result.y = (float)glyph.GetScale().y;
} }
return size; return result;
} }
float FontAtlas::CalculateWidth(const Str_8 &text) const float FontAtlas::CalculateWidth(const Str_8 &text) const
{ {
float width = 0.0f; float result = 0.0f;
for (UInt_64 i = 0; i < text.Size(); ++i) for (UInt_64 i = 0; i < text.Size(); ++i)
{ {
Glyph glyph = GetGlyph(text[i]); Glyph glyph = GetGlyph(text[i]);
width += (float)glyph.GetAdvance().x; result += (float)glyph.GetAdvance().x;
} }
return width; return result;
} }
float FontAtlas::CalculateHeight(const Str_8& text) const float FontAtlas::CalculateHeight(const Str_8& text) const
{ {
float height = 0.0f; float result = 0.0f;
for (UInt_64 i = 0; i < text.Size(); ++i) for (UInt_64 i = 0; i < text.Size(); ++i)
{ {
Glyph glyph = GetGlyph(text[i]); Glyph glyph = GetGlyph(text[i]);
if ((float)glyph.GetScale().y > height) if ((float)glyph.GetScale().y > result)
height = (float)glyph.GetScale().y; result = (float)glyph.GetScale().y;
} }
return height; return result;
} }
UInt_64 FontAtlas::CalculateIndexAtPoint(const Str_8& text, const Vec2_f& point) const UInt_64 FontAtlas::CalculateIndexAtPoint(const Str_8& text, const Vec2_f& point) const
{ {
float width = 0.0f; float result = 0.0f;
for (UInt_64 i = 0; i < text.Size(); ++i) for (UInt_64 i = 0; i < text.Size(); ++i)
{ {
Glyph glyph = GetGlyph(text[i]); Glyph glyph = GetGlyph(text[i]);
float temp = width + (float)glyph.GetAdvance().x; float temp = result + (float)glyph.GetAdvance().x;
if (point.x > temp) if (point.x > temp)
width += (float)glyph.GetAdvance().x; result += (float)glyph.GetAdvance().x;
else if (point.x <= temp) else if (point.x <= temp)
return i; return i;
} }
@ -225,6 +294,6 @@ namespace ehs
pos.x += (float)glyph.GetAdvance().x; pos.x += (float)glyph.GetAdvance().x;
} }
return {id, std::move(verts), std::move(indices)}; return {id, (Array<Vertex_f>&&)verts, (Array<UInt_32>&&)indices};
} }
} }

View File

@ -877,7 +877,7 @@ namespace ehs
bool Audio::ToFile(const Str_8& filePath) const bool Audio::ToFile(const Str_8& filePath) const
{ {
Str_8 ext = File::ProcessExt_8(filePath); Str_8 ext = File::ParseExt_8(filePath);
const AudioCodec* codec = GetCodec(ext); const AudioCodec* codec = GetCodec(ext);
if (!codec) if (!codec)

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,7 @@ namespace ehs
PNG::PNG(const Str_8& filePath) PNG::PNG(const Str_8& filePath)
{ {
id = File::ProcessName_8(filePath); id = File::ParseName_8(filePath);
hashId = id.Hash_64(); hashId = id.Hash_64();
File file(filePath, Mode::READ, Disposition::OPEN); File file(filePath, Mode::READ, Disposition::OPEN);

View File

@ -89,7 +89,7 @@ namespace ehs
return id; return id;
} }
Array<Mesh> Model::GetMeshes() const const Array<Mesh>& Model::GetMeshes() const
{ {
return meshes; return meshes;
} }
@ -113,7 +113,7 @@ namespace ehs
return GetMesh(inId.Hash_64()); return GetMesh(inId.Hash_64());
} }
Bone Model::GetSkeleton() const const Bone& Model::GetSkeleton() const
{ {
return skeleton; return skeleton;
} }
@ -132,7 +132,7 @@ namespace ehs
return nullptr; return nullptr;
} }
Array<Animation> Model::GetAnimations() const const Array<Animation>& Model::GetAnimations() const
{ {
return animations; return animations;
} }