axis spheres still aren't showing, but some obvious bugs were removed. still debugging

This commit is contained in:
2025-08-22 11:13:16 -05:00
parent 19f786ee7c
commit a79b074201
6 changed files with 39 additions and 34 deletions

View File

@@ -7,12 +7,13 @@
#include <glm/mat4x4.hpp>
#include "util.hpp"
#include "body.hpp"
Array<char*> _split_str_inner(const char* s, char delim, bool just_check_ws);
template<class T> void append(Array<T>& a, T el) {
if (a.len == a.cap) {
resize(a, max(8, a.cap * 2));
resize(a, std::max((size_t)8, a.cap * 2));
}
a[a.len] = el;
a.len++;
@@ -27,11 +28,11 @@ template<class T> T pop(Array<T>& a) {
template<class T> void resize(Array<T>& a, size_t new_cap) {
T* new_data = (T*)malloc(sizeof(T) * new_cap);
if (a.len > 0) {
memcpy(new_data, a.data, min(a.len, new_cap));
memcpy(new_data, a.data, std::min(a.len, new_cap));
}
free(a.data);
a.data = new_data;
a.len = min(a.len, new_cap);
a.len = std::min(a.len, new_cap);
a.cap = new_cap;
}