1#ifndef GENERATOR_REPEATMESH_HPP
2#define GENERATOR_REPEATMESH_HPP
14template<
typename mesh_t>
23 return index_ >= repeat_mesh_->instances_;
40 delta_ += repeat_mesh_->vertex_count_;
41 triangles_ = repeat_mesh_->mesh_.triangles();
55 : repeat_mesh_{repeatMesh}
56 , triangles_{repeatMesh->mesh_.triangles()}
57 , index_{repeatMesh->vertex_count_ > 0 ? 0 : repeatMesh->instances_}
62 int counttriangles_t() const noexcept
64 if(repeat_mesh_->instances_ < 1)
67 return count(repeat_mesh_->mesh_.triangles()) * (repeat_mesh_->instances_ - index_ - 1) +
count(triangles_);
83 return index_ >= repeat_mesh_->instances_;
100 delta_ += repeat_mesh_->delta_;
101 vertices_ = repeat_mesh_->mesh_.vertices();
107 : repeat_mesh_{repeatMesh}
108 , vertices_{repeatMesh->mesh_.
vertices()}
109 , index_{repeatMesh->vertex_count_ > 0 ? 0 : repeatMesh->instances_}
122 int countvertices_t() const noexcept
124 if(repeat_mesh_->instances_ < 1)
127 return repeat_mesh_->vertex_count_ * (repeat_mesh_->instances_ - index_ - 1) +
count(vertices_);
141 explicit repeat_mesh_t(mesh_t mesh,
int instances,
const gml::dvec3& delta) noexcept
142 : mesh_{std::move(mesh)}
143 , instances_{instances}
145 , vertex_count_{
count(mesh_.vertices())}
169template<
typename mesh_t>
bool done() const noexcept
friend int count(const triangles_t &generator) noexcept
triangle_t generate() const
friend int count(const vertices_t &generator) noexcept
bool done() const noexcept
mesh_vertex_t generate() const
repeat_mesh_t(mesh_t mesh, int instances, const gml::dvec3 &delta) noexcept
vertices_t vertices() const noexcept
triangles_t triangles() const noexcept
gml::ivec3 vertices
Zero based indices of the triangle vertices in counterclockwise order.
int count(const generator_t &generator) noexcept
Counts the number of steps left in the generator.
repeat_mesh_t< mesh_t > repeat_mesh(mesh_t mesh, int instances, const gml::dvec3 &delta) noexcept