CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
UvFlipMesh.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
10#include "TransformMesh.hpp"
11
13
15 template<typename Mesh> class UvFlipMesh {
16 private:
19
20 public:
24 UvFlipMesh(Mesh mesh, bool u, bool v)
25 : mTransformMesh{std::move(mesh), [u, v](MeshVertex& vertex) {
26 if(u)
27 vertex.texCoord[0] = 1.0 - vertex.texCoord[0];
28 if(v)
29 vertex.texCoord[1] = 1.0 - vertex.texCoord[1];
30 }} {}
31
32 using Triangles = typename Impl::Triangles;
33
34 [[nodiscard]] Triangles triangles() const noexcept { return mTransformMesh.triangles(); }
35
36 using Vertices = typename Impl::Vertices;
37
38 [[nodiscard]] Vertices vertices() const noexcept { return mTransformMesh.vertices(); }
39 };
40
41 template<typename Mesh> UvFlipMesh<Mesh> uvFlipMesh(Mesh mesh) { return UvFlipMesh<Mesh>{std::move(mesh)}; }
42
43} // namespace CeresEngine::MeshGenerator
Definition MeshVertex.hpp:14
Apply a mutator function to each vertex.
Definition TransformMesh.hpp:18
typename Impl::Triangles Triangles
Definition TransformMesh.hpp:50
Flips texture coordinate axis directions.
Definition UvFlipMesh.hpp:15
Triangles triangles() const noexcept
Definition UvFlipMesh.hpp:34
Vertices vertices() const noexcept
Definition UvFlipMesh.hpp:38
typename Impl::Vertices Vertices
Definition UvFlipMesh.hpp:36
UvFlipMesh(Mesh mesh, bool u, bool v)
Definition UvFlipMesh.hpp:24
Impl mTransformMesh
Definition UvFlipMesh.hpp:18
typename Impl::Triangles Triangles
Definition UvFlipMesh.hpp:32
A base class for all mesh implementations.
Definition Mesh.hpp:112
Definition AnyGenerator.hpp:12
UvFlipMesh< Mesh > uvFlipMesh(Mesh mesh)
Definition UvFlipMesh.hpp:41
auto move(Vector3 position)
Moves a entity to the given position.
Definition Helpers.hpp:22
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
Definition Span.hpp:668