12#ifndef JAU_MATH_UTIL_SSTACK_HPP_
13#define JAU_MATH_UTIL_SSTACK_HPP_
37 template<jau::req::arithmetic Value_type,
size_t Element_size>
45 std::vector<value_type> buffer;
59 : growSize(growSize_), buffer(initialSize) {}
62 const size_t p = buffer.size();
63 const size_t nsz = buffer.size() + length;
64 if( nsz > buffer.capacity() ) {
65 buffer.reserve(buffer.size() + std::max(length, growSize));
79 const size_t sz = buffer.size();
83 dest[i] = buffer[p+i];
98 template <jau::req::packed_
floating_po
int Value_type>
106 std::vector<matrix_t> buffer;
113 : growSize(16), buffer(0) {}
120 : growSize(growSize_), buffer(initialSize) {}
123 const size_t nsz = buffer.size() + length;
124 if( nsz > buffer.capacity() ) {
125 buffer.reserve(buffer.size() + std::max(length, growSize));
131 buffer.push_back(src);
135 const size_t sz = buffer.size();
137 const size_t p = sz - 1;
138 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 void growIfNecessary(int length) noexcept
constexpr_cxx20 void push(const matrix_t &src) noexcept
Matrix4< value_type > matrix_t
constexpr_cxx20 MatrixStack() noexcept
Start w/ zero size and growSize is 16, half GL-min size (32)
constexpr_cxx20 void pop(matrix_t &dest) noexcept
constexpr_cxx20 MatrixStack(int initialSize, int growSize_) noexcept
A simple stack of compounds, each consisting of element_size * T
constexpr_cxx20 SimpleStack(int initialSize, int growSize_) noexcept
constexpr_cxx20 size_t growIfNecessary(int length) 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
constexpr_cxx20 void push(const value_type *src) noexcept
static constexpr const size_t element_size
#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