Get it finally working (somehow)
- Add working example - Add Namespace defs for Iron Ctr and C3D - Add Exit func / Vertex / Index counter to Iron - Add format bytes function to utils - Make stb_image optional - Compute texture uv's - Clear Everything in Drawlist::Clear - Use Amy::mat4 as matrix lib - Fix the most stupid rendering bug (i -> m_idx)
This commit is contained in:
@@ -11,4 +11,8 @@
|
||||
|
||||
namespace Amy {
|
||||
void RegisterCxxExceptionHandler();
|
||||
}
|
||||
}
|
||||
|
||||
using Iron = Amy::Iron;
|
||||
namespace Ctr = Amy::Ctr;
|
||||
using C3D = Amy::C3D;
|
||||
@@ -48,9 +48,9 @@ class Iron {
|
||||
std::vector<u16> IndexBuf;
|
||||
ivec4 ScissorRect;
|
||||
bool ScissorOn = false;
|
||||
int Layer;
|
||||
int Index;
|
||||
Texture* Tex;
|
||||
int Layer = 0;
|
||||
int Index = 0;
|
||||
Texture* Tex = nullptr;
|
||||
};
|
||||
class Drawlist {
|
||||
public:
|
||||
@@ -131,6 +131,7 @@ class Iron {
|
||||
~Iron() = default;
|
||||
|
||||
static void Init();
|
||||
static void Exit();
|
||||
static void NewFrame();
|
||||
static void DrawOn(C3D::Screen* screen);
|
||||
static void Draw(const std::vector<Command::ref>& data);
|
||||
@@ -152,6 +153,9 @@ class Iron {
|
||||
static bool InBox(const fvec2& a, const fvec2& b, const fvec2& c,
|
||||
const fvec4& area);
|
||||
|
||||
static ui VerticesDrawn() { return VertexCount; }
|
||||
static ui IndicesDrawn() { return IndexCount; }
|
||||
|
||||
private:
|
||||
static void pSetupShader();
|
||||
static void pFragConfig();
|
||||
@@ -165,5 +169,7 @@ class Iron {
|
||||
static mat4 m_mtx;
|
||||
static int m_idx, m_vtx;
|
||||
static Texture* m_solid;
|
||||
static ui VertexCount;
|
||||
static ui IndexCount;
|
||||
};
|
||||
} // namespace Amy
|
||||
} // namespace Amy
|
||||
|
||||
@@ -20,7 +20,7 @@ class LinearAllocator {
|
||||
|
||||
T* allocate(std::size_t n) {
|
||||
if (n > max_size()) {
|
||||
throw std::bad_alloc();
|
||||
throw std::runtime_error("[Amy] LinearAllocator: Bad alloc!");
|
||||
}
|
||||
return static_cast<T*>(linearAlloc(n * sizeof(T)));
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <chrono>
|
||||
#include <cinttypes>
|
||||
#include <functional>
|
||||
#include <format>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <numbers>
|
||||
|
||||
@@ -9,6 +9,7 @@ class Error : public std::runtime_error {
|
||||
};
|
||||
namespace Utils {
|
||||
vec<uc> LoadFile2Mem(ksr path);
|
||||
str FormatBytes(ull bytes);
|
||||
ui HashMemory(kvr<uc> data);
|
||||
ui NextPow2(ui v);
|
||||
bool IsSingleBitNum(ui v);
|
||||
|
||||
Reference in New Issue
Block a user