12#ifndef JAU_MATH_UTIL_SSTACK_HPP_
13#define JAU_MATH_UTIL_SSTACK_HPP_
37 template<
typename Value_type,
size_t Element_size,
38 std::enable_if_t<std::is_floating_point_v<Value_type> ||
39 std::is_integral_v<Value_type>,
48 std::vector<value_type> buffer;
62 : growSize(growSize_), buffer(initialSize) {}
65 const size_t p = buffer.size();
66 const size_t nsz = buffer.size() + length;
67 if( nsz > buffer.capacity() ) {
68 buffer.reserve(buffer.size() + std::max(length, growSize));
82 const size_t sz = buffer.size();
86 dest[i] = buffer[p+i];
102 std::enable_if_t<std::is_floating_point_v<Value_type> ||
103 std::is_integral_v<Value_type>,
112 std::vector<matrix_t> buffer;
119 : growSize(16), buffer(0) {}
126 : growSize(growSize_), buffer(initialSize) {}
129 const size_t nsz = buffer.size() + length;
130 if( nsz > buffer.capacity() ) {
131 buffer.reserve(buffer.size() + std::max(length, growSize));
137 buffer.push_back(src);
141 const size_t sz = buffer.size();
143 const size_t p = sz - 1;
144 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.
SimpleStack< float, 16 > Stack16f
4x4 float matrix stack based on single float elements
MatrixStack< float > Mat4fStack
4x4 float matrix stack