Fixed all errors.

This commit is contained in:
2023-12-18 02:13:20 -08:00
parent 3acb78f247
commit 0a6f5533ee
37 changed files with 950 additions and 1090 deletions

View File

@@ -31,7 +31,7 @@ namespace ehs
UInt_64 GetGlyphScale() const;
Glyph GetGlyph(const Char_32 code) const;
Glyph GetGlyph(Char_32 code) const;
Vec2_f CalculateSize(const Str_8& text) const;
@@ -41,8 +41,6 @@ namespace ehs
UInt_64 CalculateIndexAtPoint(const Str_8& text, const Vec2_f& point) const;
Mesh Generate(const Anchor anchor, const Str_8& text) const;
FontAtlas* Clone() const override;
Mesh Generate(Anchor anchor, const Str_8& text) const;
};
}

View File

@@ -1,6 +1,7 @@
#pragma once
#include "EHS.h"
#include "Types.h"
#include "BaseObj.h"
#include "DataType.h"
#include "Str.h"
#include "Serializer.h"
@@ -10,10 +11,12 @@
namespace ehs
{
class Audio : public Resource
class Audio : public BaseObj
{
private:
static Array<AudioCodec> codecs;
UInt_64 hashId;
Str_8 id;
UInt_64 sampleRate;
DataType dataType;
UInt_8 byteDepth;
@@ -24,29 +27,31 @@ namespace ehs
Byte* peak;
public:
static bool HasCodec(const UInt_64 hashExt);
static bool HasCodec(UInt_64 hashExt);
static bool HasCodec(const Str_8& ext);
static bool AddCodec(AudioCodec codec);
static const AudioCodec* GetCodec(const UInt_64 hashExt);
static const AudioCodec* GetCodec(UInt_64 hashExt);
static const AudioCodec* GetCodec(const Str_8& ext);
~Audio() override;
~Audio();
Audio();
Audio(Str_8 id, const UInt_64 sampleRate, const DataType dataType, const UInt_8 channels, const UInt_64 frames, const Byte* const data);
Audio(Str_8 id);
Audio(Str_8 id, const UInt_64 sampleRate, const DataType dataType, const UInt_8 channels, const Serializer<UInt_64>& data);
Audio(Str_8 id, UInt_64 sampleRate, DataType dataType, UInt_8 channels, UInt_64 frames, const Byte* data);
Audio(Str_8 id, const UInt_64 sampleRate, const DataType dataType, const UInt_8 channels, const Vector<Byte>& data);
Audio(Str_8 id, UInt_64 sampleRate, DataType dataType, UInt_8 channels, const Serializer<UInt_64>& data);
Audio(Str_8 id, const UInt_64 sampleRate, const DataType dataType, const UInt_8 channels, const Array<Byte>& data);
Audio(Str_8 id, UInt_64 sampleRate, DataType dataType, UInt_8 channels, const Vector<Byte>& data);
Audio(Str_8 id, const UInt_64 sampleRate, const DataType dataType, const UInt_8 channels, const UInt_64 frames);
Audio(Str_8 id, UInt_64 sampleRate, DataType dataType, UInt_8 channels, const Array<Byte>& data);
Audio(Str_8 id, UInt_64 sampleRate, DataType dataType, UInt_8 channels, UInt_64 frames);
Audio(Audio&& audio) noexcept;
@@ -60,6 +65,14 @@ namespace ehs
operator Byte*();
void Release();
UInt_64 GetHashId() const;
void SetId(Str_8 newId);
Str_8 GetId() const;
UInt_64 GetSampleRate() const;
DataType GetDataType() const;
@@ -78,23 +91,23 @@ namespace ehs
float GetLength() const;
Array<Byte> FrameAsMono(const UInt_64 frameIndex) const;
Array<Byte> FrameAsMono(UInt_64 frameIndex) const;
Array<Byte> FrameAsStereo(const UInt_64 frameIndex) const;
Array<Byte> FrameAsStereo(UInt_64 frameIndex) const;
Array<Byte> FrameAsFive_One(const UInt_64 frameIndex) const;
Array<Byte> FrameAsFive_One(UInt_64 frameIndex) const;
Array<Byte> FrameAsSeven_One(const UInt_64 frameIndex) const;
Array<Byte> FrameAsSeven_One(UInt_64 frameIndex) const;
SInt_8 SampleAsSInt_8(const UInt_64 sampleIndex) const;
SInt_8 SampleAsSInt_8(UInt_64 sampleIndex) const;
SInt_16 SampleAsSInt_16(const UInt_64 sampleIndex) const;
SInt_16 SampleAsSInt_16(UInt_64 sampleIndex) const;
float SampleAsFloat(const UInt_64 sampleIndex) const;
float SampleAsFloat(UInt_64 sampleIndex) const;
SInt_32 SampleAsSInt_32(const UInt_64 sampleIndex) const;
SInt_32 SampleAsSInt_32(UInt_64 sampleIndex) const;
SInt_64 SampleAsSInt_64(const UInt_64 sampleIndex) const;
SInt_64 SampleAsSInt_64(UInt_64 sampleIndex) const;
SInt_8 PeakAsSInt_8() const;
@@ -106,17 +119,17 @@ namespace ehs
SInt_64 PeakAsSInt_64() const;
void SetPeak(const UInt_64 size, const Byte* newPeak);
void SetPeak(UInt_64 size, const Byte* newPeak);
const Byte* GetPeak() const;
void ToDataType(const DataType newDataType);
void ToDataType(DataType newDataType);
Audio GetAsDataType(const DataType newDataType) const;
Audio GetAsDataType(DataType newDataType) const;
void ToChannels(const UInt_8 newChannels);
void ToChannels(UInt_8 newChannels);
Audio GetAsChannels(const UInt_8 newChannels) const;
Audio GetAsChannels(UInt_8 newChannels) const;
bool ToFile(const Str_8& filePath) const;
@@ -124,32 +137,32 @@ namespace ehs
static Audio* FromFile_Heap(const Str_8& filePath);
static Audio FromFile(const Str_8& filePath, const DataType required);
static Audio FromFile(const Str_8& filePath, DataType required);
static Audio* FromFile_Heap(const Str_8& filePath, const DataType required);
static Audio* FromFile_Heap(const Str_8& filePath, DataType required);
static Audio FromData(const Str_8& ext, const Str_8& id, Serializer<UInt_64>& data);
static Audio FromData(Str_8 id, const Str_8& ext, Serializer<UInt_64>& data);
private:
void ToMono(const UInt_64 newFrameCount, Byte* newData, const UInt_64 frameOffset) const;
void ToMono(UInt_64 newFrameCount, Byte* newData, UInt_64 frameOffset) const;
void Mono_to_Stereo(const UInt_64 newFrameCount, Byte* newData, const UInt_64 frameOffset) const;
void Mono_to_Stereo(UInt_64 newFrameCount, Byte* newData, UInt_64 frameOffset) const;
void Five_One_to_Stereo(const UInt_64 newFrameCount, Byte* newData, const UInt_64 frameOffset) const;
void Five_One_to_Stereo(UInt_64 newFrameCount, Byte* newData, UInt_64 frameOffset) const;
void Seven_One_to_Stereo(const UInt_64 newFrameCount, Byte* newData, const UInt_64 frameOffset) const;
void Seven_One_to_Stereo(UInt_64 newFrameCount, Byte* newData, UInt_64 frameOffset) const;
void Mono_to_Five_One(const UInt_64 newFrameCount, Byte* newData, const UInt_64 frameOffset) const;
void Mono_to_Five_One(UInt_64 newFrameCount, Byte* newData, UInt_64 frameOffset) const;
void Stereo_to_Five_One(const UInt_64 newFrameCount, Byte* newData, const UInt_64 frameOffset) const;
void Stereo_to_Five_One(UInt_64 newFrameCount, Byte* newData, UInt_64 frameOffset) const;
void Seven_One_to_Five_One(const UInt_64 newFrameCount, Byte* newData, const UInt_64 frameOffset) const;
void Seven_One_to_Five_One(UInt_64 newFrameCount, Byte* newData, UInt_64 frameOffset) const;
void Mono_to_Seven_One(const UInt_64 newFrameCount, Byte* newData, const UInt_64 frameOffset) const;
void Mono_to_Seven_One(UInt_64 newFrameCount, Byte* newData, UInt_64 frameOffset) const;
void Stereo_to_Seven_One(const UInt_64 newFrameCount, Byte* newData, const UInt_64 frameOffset) const;
void Stereo_to_Seven_One(UInt_64 newFrameCount, Byte* newData, UInt_64 frameOffset) const;
void Five_One_to_Seven_One(const UInt_64 newFrameCount, Byte* newData, const UInt_64 frameOffset) const;
void Five_One_to_Seven_One(UInt_64 newFrameCount, Byte* newData, UInt_64 frameOffset) const;
// To SInt_8
void SInt_16_to_SInt_8(Byte* newData, Byte* newPeak) const;

View File

@@ -1,6 +1,7 @@
#pragma once
#include "EHS.h"
#include "Types.h"
#include "BaseObj.h"
#include "Str.h"
#include "ImgCodec.h"
@@ -12,12 +13,14 @@ namespace ehs
NEAREST_NEIGHBOR
};
class Img
class Img : public BaseObj
{
private:
static Array<ImgCodec> codecs;
protected:
UInt_64 hashId;
Str_8 id;
UInt_8 bitDepth;
UInt_8 channels;
UInt_64 width;
@@ -40,9 +43,11 @@ namespace ehs
Img();
Img(UInt_8 bitDepth, UInt_8 channels, UInt_64 width, UInt_64 height, const Byte* data);
Img(Str_8 id);
Img(UInt_8 bitDepth, UInt_8 channels, UInt_64 width, UInt_64 height);
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 bitDepth, UInt_8 channels, UInt_64 width, UInt_64 height);
Img(Img&& img) noexcept;
@@ -58,6 +63,12 @@ namespace ehs
void Release();
UInt_64 GetHashId() const;
void SetId(Str_8 newId);
Str_8 GetId() const;
UInt_8 BitDepth() const;
UInt_8 Channels() const;
@@ -120,7 +131,7 @@ namespace ehs
static Img* FromFile_Heap(const Str_8& filePath);
static Img FromData(const Str_8& ext, Serializer<UInt_64>& data);
static Img FromData(Str_8 id, const Str_8& ext, Serializer<UInt_64>& data);
private:
Img GetNearestNeighbor(UInt_64 newWidth, UInt_64 newHeight) const;

View File

@@ -3,6 +3,7 @@
#include "EHS.h"
#include "Array.h"
#include "Vertex.h"
#include "BaseObj.h"
namespace ehs
{
@@ -38,15 +39,13 @@ namespace ehs
1
});
class Mesh : public Resource
class Mesh final : public BaseObj
{
protected:
UInt_64 hashId;
Str_8 id;
Array<Vertex_f> vertices;
Array<UInt_32> indices;
GpuBuffer srcVertBuffer;
GpuBuffer dstVertBuffer;
GpuBuffer srcIndBuffer;
GpuBuffer dstIndBuffer;
public:
Mesh();
@@ -55,8 +54,6 @@ namespace ehs
Mesh(Str_8 id, Array<Vertex_f> vertices);
Mesh(Str_8 id);
Mesh(Mesh&& mesh) noexcept;
Mesh(const Mesh& mesh);
@@ -65,19 +62,13 @@ namespace ehs
Mesh& operator=(const Mesh& mesh);
bool UploadToGpu(GpuCmdBuffer* cmdBuffer) override;
void Release();
bool PostGpuUpload() override;
UInt_64 GetHashId() const;
bool HasPostGpuUploaded() const override;
void SetId(Str_8 newId);
bool ReleaseFromGpu() override;
bool IsUploaded() const override;
void Bind(GpuCmdBuffer* cmdBuffer);
void Draw(GpuCmdBuffer* cmdBuffer, const UInt_32 instances = 1);
Str_8 GetId() const;
void SetVertices(const Array<Vertex_f>& newVertices);

View File

@@ -14,9 +14,11 @@ namespace ehs
EHM
};
class Model : public Resource
class Model : public BaseObj
{
protected:
UInt_64 hashId;
Str_8 id;
Array<Mesh> meshes;
Bone skeleton;
Array<Animation> animations;
@@ -40,29 +42,27 @@ namespace ehs
Model& operator=(const Model& model) = default;
bool UploadToGpu(GpuCmdBuffer* cmdBuffer) override;
void Release();
bool PostGpuUpload() override;
UInt_64 GetHashId() const;
bool ReleaseFromGpu() override;
void SetId(Str_8 newId);
bool IsUploaded() const override;
void Draw(GpuCmdBuffer* cmdBuffer, const UInt_32 instances = 1);
Str_8 GetId() const;
Array<Mesh> GetMeshes() const;
Array<Mesh>& GetMeshes();
Mesh* GetMesh(const UInt_64 hashId);
Mesh* GetMesh(UInt_64 inHashId);
Mesh* GetMesh(const Str_8& id);
Mesh* GetMesh(const Str_8& inId);
Bone GetSkeleton() const;
Bone& GetSkeleton();
Animation* GetAnimation(const UInt_64 hashId);
Animation* GetAnimation(UInt_64 inHashId);
Array<Animation> GetAnimations() const;
@@ -70,7 +70,7 @@ namespace ehs
void Calculate();
void Export(const Str_8& filePath, const ModelEncoding encoding);
void Export(const Str_8& filePath, ModelEncoding encoding);
private:
void ToEHM(File& file);

View File

@@ -1,6 +1,7 @@
#pragma once
#include "EHS.h"
#include "Vec4.h"
#include "Vec3.h"
#include "Vec2.h"
#include "Color4.h"

View File

@@ -19,6 +19,8 @@ namespace ehs
class Comms : public BaseObj
{
private:
friend class Endpoint;
static const Version ver;
static const UInt_64 internalSys;
static const UInt_64 connectOp;

View File

@@ -17,7 +17,7 @@ namespace ehs
class Endpoint : public BaseObj
{
private:
Socket hdl;
Comms* owner;
EndDisp disposition;
Status status;
Architecture arch;
@@ -40,10 +40,10 @@ namespace ehs
public:
Endpoint();
Endpoint(const Socket hdl, const EndDisp disposition, const Architecture arch, const Str_8& id,
Endpoint(Comms* owner, const EndDisp disposition, const Architecture arch, const Str_8& id,
const AddrType& type, const Str_8& address, const UInt_16 port);
Endpoint(const Socket hdl, const AddrType& type, const Str_8& address, const UInt_16 port);
Endpoint(Comms* owner, const AddrType& type, const Str_8& address, const UInt_16 port);
Endpoint(const Endpoint& end);