mirror of
https://github.com/allemangD/toddcox-visualize.git
synced 2025-11-10 03:52:48 -05:00
- clean up main-gui.cpp - Add Primitive constructor from vector - move ubo bindbufferbase to correct location
41 lines
931 B
C++
41 lines
931 B
C++
#pragma once
|
|
|
|
#include <tc/core.hpp>
|
|
#include <cmath>
|
|
#include <optional>
|
|
#include <numeric>
|
|
#include <iostream>
|
|
#include "combo_iterator.hpp"
|
|
|
|
/**
|
|
* An primitive stage N indices.
|
|
* @tparam N
|
|
*/
|
|
template<unsigned N>
|
|
struct Primitive {
|
|
static_assert(N > 0, "Primitives must contain at least one point. Primitive<0> or lower is impossible.");
|
|
|
|
std::array<unsigned, N> inds;
|
|
|
|
Primitive() = default;
|
|
|
|
Primitive(const Primitive<N> &) = default;
|
|
|
|
Primitive(const Primitive<N - 1> &sub, unsigned root) {
|
|
std::copy(sub.inds.begin(), sub.inds.end(), inds.begin());
|
|
inds[N - 1] = root;
|
|
}
|
|
|
|
explicit Primitive(const std::vector<unsigned> &values) {
|
|
std::copy(values.begin(), values.begin() + N, inds.begin());
|
|
}
|
|
|
|
~Primitive() = default;
|
|
|
|
void apply(const tc::Cosets &table, int gen) {
|
|
for (auto &ind : inds) {
|
|
ind = table.get(ind, gen);
|
|
}
|
|
}
|
|
};
|