CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
TranslateMesh.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 TranslateMesh {
16 private:
19
20 public:
23 TranslateMesh(Mesh mesh, const Vector3& delta)
24 : mTransformMesh{std::move(mesh), [delta](MeshVertex& value) {
25 value.position += delta;
26 }} {}
27
28 using Triangles = typename Impl::Triangles;
29
30 [[nodiscard]] Triangles triangles() const noexcept { return mTransformMesh.triangles(); }
31
32 using Vertices = typename Impl::Vertices;
33
34 [[nodiscard]] Vertices vertices() const noexcept { return mTransformMesh.vertices(); }
35 };
36
37 template<typename Mesh> TranslateMesh<Mesh> translateMesh(Mesh mesh, const Vector3& delta) { return TranslateMesh<Mesh>{std::move(mesh), delta}; }
38
39} // 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
Translates the position of each vertex by given amount.
Definition TranslateMesh.hpp:15
TranslateMesh(Mesh mesh, const Vector3 &delta)
Definition TranslateMesh.hpp:23
Triangles triangles() const noexcept
Definition TranslateMesh.hpp:30
Vertices vertices() const noexcept
Definition TranslateMesh.hpp:34
typename Impl::Vertices Vertices
Definition TranslateMesh.hpp:32
Impl mTransformMesh
Definition TranslateMesh.hpp:18
typename Impl::Triangles Triangles
Definition TranslateMesh.hpp:28
A base class for all mesh implementations.
Definition Mesh.hpp:112
Definition AnyGenerator.hpp:12
TranslateMesh< Mesh > translateMesh(Mesh mesh, const Vector3 &delta)
Definition TranslateMesh.hpp:37
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