24#ifndef JAU_SSTACK_HPP_
25#define JAU_SSTACK_HPP_
51 template<
typename Value_type,
size_t Element_size,
52 std::enable_if_t<std::is_floating_point_v<Value_type> ||
53 std::is_integral_v<Value_type>,
62 std::vector<value_type> buffer;
76 : growSize(growSize_), buffer(initialSize) {}
79 const size_t p = buffer.size();
80 const size_t nsz = buffer.size() + length;
81 if( nsz > buffer.capacity() ) {
82 buffer.reserve(buffer.size() +
std::max(length, growSize));
96 const size_t sz = buffer.size();
100 dest[i] = buffer[p+i];
116 std::enable_if_t<std::is_floating_point_v<Value_type> ||
117 std::is_integral_v<Value_type>,
126 std::vector<matrix_t> buffer;
133 : growSize(16), buffer(0) {}
140 : growSize(growSize_), buffer(initialSize) {}
143 const size_t nsz = buffer.size() + length;
144 if( nsz > buffer.capacity() ) {
145 buffer.reserve(buffer.size() +
std::max(length, growSize));
151 buffer.push_back(src);
155 const size_t sz = buffer.size();
157 const size_t p = sz - 1;
158 dest.load( buffer[p] );
Basic 4x4 value_type matrix implementation using fields for intensive use-cases (host operations).
A Matrix stack of compounds, each consisting of 16 * T
constexpr_cxx20 MatrixStack() noexcept
Start w/ zero size and growSize is 16, half GL-min size (32)
constexpr_cxx20 void growIfNecessary(int length) noexcept
constexpr_cxx20 void pop(matrix_t &dest) noexcept
constexpr_cxx20 void push(const matrix_t &src) noexcept
constexpr_cxx20 MatrixStack(int initialSize, int growSize_) noexcept
Matrix4< value_type > matrix_t
A simple stack of compounds, each consisting of element_size * T
constexpr_cxx20 SimpleStack(int initialSize, int growSize_) noexcept
static constexpr const size_t element_size
constexpr_cxx20 size_t growIfNecessary(int length) noexcept
constexpr_cxx20 void push(const value_type *src) noexcept
constexpr_cxx20 SimpleStack() noexcept
Start w/ zero size and growSize is 16, half GL-min size (32)
constexpr_cxx20 void pop(value_type *dest) noexcept
#define constexpr_cxx20
constexpr qualifier replacement for C++20 constexpr.
constexpr T max(const T x, const T y) noexcept
Returns the maximum of two integrals (w/ branching) in O(1)
SimpleStack< float, 16 > Stack16f
4x4 float matrix stack based on single float elements
MatrixStack< float > Mat4fStack
4x4 float matrix stack