Unravel Engine C++ Reference
Loading...
Searching...
No Matches
uv_flip_mesh.hpp
Go to the documentation of this file.
1#ifndef GENERATOR_UVFLIPMESH_HPP
2#define GENERATOR_UVFLIPMESH_HPP
3
4#include "transform_mesh.hpp"
5
6namespace generator
7{
8
10template<typename mesh_t>
12{
13private:
15 impl_t transform_mesh_;
16
17public:
21 uv_flip_mesh_t(mesh_t mesh, bool u, bool v)
22 : transform_mesh_{std::move(mesh),
23 [u, v](mesh_vertex_t& vertex)
24 {
25 if(u)
26 vertex.tex_coord[0] = 1.0 - vertex.tex_coord[0];
27 if(v)
28 vertex.tex_coord[1] = 1.0 - vertex.tex_coord[1];
29 }}
30 {
31 }
32
34
35 triangles_t triangles() const noexcept
36 {
37 return transform_mesh_.triangles();
38 }
39
41
42 vertices_t vertices() const noexcept
43 {
44 return transform_mesh_.vertices();
45 }
46};
47
48template<typename mesh_t>
50{
51 return uv_flip_mesh_t<mesh_t>{std::move(mesh)};
52}
53} // namespace generator
54
55#endif
Apply a mutator function to each vertex.
typename impl_t::triangles_t triangles_t
Flips texture coordinate axis directions.
typename impl_t::vertices_t vertices_t
triangles_t triangles() const noexcept
vertices_t vertices() const noexcept
typename impl_t::triangles_t triangles_t
uv_flip_mesh_t(mesh_t mesh, bool u, bool v)
uv_flip_mesh_t< mesh_t > uv_flip_mesh(mesh_t mesh)