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:
26
inc/util.hpp
26
inc/util.hpp
@@ -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); }
|
||||
Reference in New Issue
Block a user