enable rtt dtor, default values for <text> node, dual-brush wip, more brush options
This commit is contained in:
23
src/util.h
23
src/util.h
@@ -45,9 +45,16 @@ std::vector<T> poly_remove_duplicate(const std::vector<T>& v, const float toller
|
||||
template<>
|
||||
std::vector<vertex_t> poly_remove_duplicate<vertex_t>(const std::vector<vertex_t>& v, const float tollerance);
|
||||
|
||||
// params {x, y} and {origin, size} form
|
||||
bool point_in_rect(const glm::vec2& point, const glm::vec4& rect);
|
||||
// params and returns {origin, size} form
|
||||
glm::vec4 rect_intersection(glm::vec4 a, glm::vec4 b);
|
||||
// params and returns {origin, size} form
|
||||
glm::vec4 rect_union(glm::vec4 a, glm::vec4 b);
|
||||
// params and returns {min, max} form
|
||||
glm::vec4 box_union(glm::vec4 a, glm::vec4 b);
|
||||
// params and returns {min, max} form
|
||||
glm::vec4 box_intersection(glm::vec4 a, glm::vec4 b);
|
||||
bool ray_intersect(glm::vec3 ray_origin, glm::vec3 ray_dir, glm::vec3 plane_origin,
|
||||
glm::vec3 plane_normal, glm::vec3 plane_tangent, glm::vec3& out_hit, float& out_t);
|
||||
bool segments_intersect(const glm::vec2& p0a, const glm::vec2& p0b,
|
||||
@@ -78,15 +85,23 @@ inline glm::vec2 xy(const glm::vec3& v) { return glm::vec2(v.x, v.y); }
|
||||
|
||||
void parallel_for(unsigned nb_elements, std::function<void(int i)> functor, bool use_threads = true);
|
||||
|
||||
template<typename T, int N> struct cbuffer
|
||||
template<typename T> struct cbuffer
|
||||
{
|
||||
T m_vec[N];
|
||||
std::unique_ptr<T[]> m_vec;
|
||||
int m_capacity = 0;
|
||||
int m_count = 0;
|
||||
int m_index = 0;
|
||||
cbuffer()
|
||||
cbuffer(int initial_capacity)
|
||||
{
|
||||
m_capacity = N;
|
||||
m_capacity = initial_capacity;
|
||||
m_index = 0;
|
||||
m_count = 0;
|
||||
m_vec = std::make_unique<T[]>(m_capacity);
|
||||
}
|
||||
void resize(int new_capacity)
|
||||
{
|
||||
m_capacity = new_capacity;
|
||||
m_vec = std::make_unique<T[]>(m_capacity);
|
||||
m_index = 0;
|
||||
m_count = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user