cleanup build. add demo project. add timing features to sync. switch to more std::string and std::vector usage over custom, hacky Array template

This commit is contained in:
2025-09-01 21:56:43 -05:00
parent b4e90dce4d
commit 75e72ba9ca
25 changed files with 663 additions and 1759 deletions

View File

@@ -2,30 +2,18 @@
#include <stdio.h>
#include <cstdlib>
#include <string>
#include <fstream>
#include <sstream>
#include <glm/ext/matrix_float4x4.hpp>
#include <glm/ext/quaternion_float.hpp>
#include <glm/ext/vector_float4.hpp>
typedef unsigned int uint;
template<class T> struct Array {
T* data;
size_t len;
size_t cap;
inline T& operator[](int i) { return data[i]; }
};
template<class T> void append(Array<T>& a, T el);
template<class T> T pop(Array<T>& a);
template<class T> void resize(Array<T>& a, size_t new_cap);
template<class T> void clear(Array<T>& a);
bool read_file(Array<char>* out, const char* filepath);
Array<char*> split_str(const char* s, char delimiter);
Array<char*> split_str(const char* s);
bool read_file(std::string* s, const char* filepath);
std::vector<std::string> split_str(std::string s, char delim);
glm::mat4 quat_to_mat4(glm::quat q);
float randf();
template<class T> T lerp(T start, T end, float t) { return t * end + (1 - t) * start; }
template<class T> float ilerp(T start, T end, T pos) { return (pos - start) / (end - start); }
float randf(); // returns a float between 0 and 1
template<class T> float ilerp(T start, T end, T pos) { return (pos - start) / (end - start); }