CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
UvSwapMesh.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 UvSwapMesh {
16 private:
19
20 public:
23 : mTransformMesh{std::move(mesh), [](MeshVertex& vertex) {
24 std::swap(vertex.texCoord[0], vertex.texCoord[1]);
25 }} {}
26
27 using Triangles = typename Impl::Triangles;
28
29 [[nodiscard]] Triangles triangles() const noexcept { return mTransformMesh.triangles(); }
30
31 using Vertices = typename Impl::Vertices;
32
33 [[nodiscard]] Vertices vertices() const noexcept { return mTransformMesh.vertices(); }
34 };
35
36 template<typename Mesh> UvSwapMesh<Mesh> uvSwapMesh(Mesh mesh) { return UvSwapMesh<Mesh>{std::move(mesh)}; }
37
38} // 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
Swaps the texture coordinates axis u and v.
Definition UvSwapMesh.hpp:15
typename Impl::Vertices Vertices
Definition UvSwapMesh.hpp:31
UvSwapMesh(Mesh mesh)
Definition UvSwapMesh.hpp:22
Triangles triangles() const noexcept
Definition UvSwapMesh.hpp:29
Vertices vertices() const noexcept
Definition UvSwapMesh.hpp:33
typename Impl::Triangles Triangles
Definition UvSwapMesh.hpp:27
Impl mTransformMesh
Definition UvSwapMesh.hpp:18
A base class for all mesh implementations.
Definition Mesh.hpp:112
Definition AnyGenerator.hpp:12
UvSwapMesh< Mesh > uvSwapMesh(Mesh mesh)
Definition UvSwapMesh.hpp:36
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