3 #include "core/cl/triangle.h" 5 #include "utilities/aligned/vector.h" 12 template <
typename Vertex,
typename Surface>
15 using vertex_type = Vertex;
16 using surface_type = Surface;
20 util::aligned::vector<vertex_type> vertices,
21 util::aligned::vector<surface_type> surfaces)
22 : triangles_{triangles}
24 , surfaces_{surfaces} {
25 const auto check_surface = [&](
auto s) {
26 if (s < 0 || surfaces_.size() <= s) {
27 throw std::runtime_error{
"Surface index is out of range."};
30 const auto check_vertex = [&](
auto v) {
31 if (v < 0 || vertices_.size() <= v) {
32 throw std::runtime_error{
"Vertex index is out of range."};
36 for (
const auto& tri : triangles_) {
37 check_surface(tri.surface);
44 const util::aligned::vector<triangle>& get_triangles()
const {
47 const util::aligned::vector<vertex_type>& get_vertices()
const {
50 const util::aligned::vector<surface_type>& get_surfaces()
const {
56 swap(triangles_, rhs.triangles_);
57 swap(vertices_, rhs.vertices_);
58 swap(surfaces_, rhs.surfaces_);
63 template <
typename It>
68 util::aligned::vector<surface_type>{begin, end}};
75 std::fill(surfaces_.begin(), surfaces_.end(), surface);
79 util::aligned::vector<triangle> triangles_;
80 util::aligned::vector<vertex_type> vertices_;
81 util::aligned::vector<surface_type> surfaces_;
84 template <
typename Vertex,
typename Surface>
85 auto make_scene_data(util::aligned::vector<triangle> triangles,
86 util::aligned::vector<Vertex> vertices,
87 util::aligned::vector<Surface> surfaces) {
89 std::move(triangles), std::move(vertices), std::move(surfaces)};
Definition: scene_data.h:13
void set_surfaces(It begin, It end)
Definition: scene_data.h:64
void set_surfaces(const surface_type &surface)
Definition: scene_data.h:74
Definition: capsule_base.h:9