Restructured Img and FontAtlas.
This commit is contained in:
@@ -239,22 +239,22 @@ namespace ehs
|
||||
|
||||
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);
|
||||
};
|
||||
}
|
||||
|
@@ -10,13 +10,20 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class FontAtlas : public Img
|
||||
class FontAtlas : public BaseObj
|
||||
{
|
||||
private:
|
||||
UInt_64 hashId;
|
||||
Str_8 id;
|
||||
UInt_64 glyphScale;
|
||||
Array<Glyph> glyphs;
|
||||
Vec2_u64 resolution;
|
||||
UInt_64 size;
|
||||
Byte* atlas;
|
||||
|
||||
public:
|
||||
~FontAtlas() override;
|
||||
|
||||
FontAtlas();
|
||||
|
||||
FontAtlas(const Str_8& filePath);
|
||||
@@ -29,10 +36,24 @@ namespace ehs
|
||||
|
||||
FontAtlas& operator=(const FontAtlas& fa);
|
||||
|
||||
operator Byte*() const;
|
||||
|
||||
void Release();
|
||||
|
||||
UInt_64 GetHashId() const;
|
||||
|
||||
Str_8 GetId() const;
|
||||
|
||||
UInt_64 GetGlyphScale() 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;
|
||||
|
||||
float CalculateWidth(const Str_8& text) const;
|
||||
|
@@ -21,10 +21,9 @@ namespace ehs
|
||||
protected:
|
||||
UInt_64 hashId;
|
||||
Str_8 id;
|
||||
UInt_8 bitDepth;
|
||||
UInt_8 byteDepth;
|
||||
UInt_8 channels;
|
||||
UInt_64 width;
|
||||
UInt_64 height;
|
||||
Vec2_u64 resolution;
|
||||
UInt_64 size;
|
||||
Byte* data;
|
||||
|
||||
@@ -39,15 +38,15 @@ namespace ehs
|
||||
|
||||
static const ImgCodec* GetCodec(const Str_8& ext);
|
||||
|
||||
~Img();
|
||||
~Img() override;
|
||||
|
||||
Img();
|
||||
|
||||
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;
|
||||
|
||||
@@ -69,15 +68,15 @@ namespace ehs
|
||||
|
||||
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);
|
||||
|
||||
@@ -87,9 +86,9 @@ namespace ehs
|
||||
|
||||
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();
|
||||
|
||||
@@ -134,9 +133,9 @@ namespace ehs
|
||||
static Img FromData(Str_8 id, const Str_8& ext, Serializer<UInt_64>& data);
|
||||
|
||||
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;
|
||||
|
||||
|
@@ -20,7 +20,7 @@ namespace ehs
|
||||
public:
|
||||
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;
|
||||
|
||||
@@ -50,21 +50,21 @@ namespace ehs
|
||||
|
||||
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);
|
||||
|
||||
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;
|
||||
|
||||
|
@@ -7,38 +7,6 @@
|
||||
|
||||
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
|
||||
{
|
||||
protected:
|
||||
@@ -89,4 +57,24 @@ namespace ehs
|
||||
private:
|
||||
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}
|
||||
);
|
||||
}
|
@@ -50,7 +50,7 @@ namespace ehs
|
||||
|
||||
Str_8 GetId() const;
|
||||
|
||||
Array<Mesh> GetMeshes() const;
|
||||
const Array<Mesh>& GetMeshes() const;
|
||||
|
||||
Array<Mesh>& GetMeshes();
|
||||
|
||||
@@ -58,13 +58,13 @@ namespace ehs
|
||||
|
||||
Mesh* GetMesh(const Str_8& inId);
|
||||
|
||||
Bone GetSkeleton() const;
|
||||
const Bone& GetSkeleton() const;
|
||||
|
||||
Bone& GetSkeleton();
|
||||
|
||||
Animation* GetAnimation(UInt_64 inHashId);
|
||||
|
||||
Array<Animation> GetAnimations() const;
|
||||
const Array<Animation>& GetAnimations() const;
|
||||
|
||||
Array<Animation>& GetAnimations();
|
||||
|
||||
|
Reference in New Issue
Block a user