CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
MirrorMesh.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 "Axis.hpp"
11#include "AxisFlipMesh.hpp"
12#include "MergeMesh.hpp"
13
15
17 template<typename Mesh> class MirrorMesh {
18 private:
21
22 public:
25 MirrorMesh(Mesh mesh, const Axis axis) : mMergeMesh{mesh, {mesh, axis == Axis::X, axis == Axis::Y, axis == Axis::Z}} {}
26
27 using Triangles = typename Impl::Triangles;
28 [[nodiscard]] Triangles triangles() const noexcept { return mMergeMesh.triangles(); }
29
30 using Vertices = typename Impl::Vertices;
31 [[nodiscard]] Vertices vertices() const noexcept { return mMergeMesh.vertices(); }
32 };
33
34 template<typename Mesh> MirrorMesh<Mesh> mirrorMesh(Mesh mesh) { return MirrorMesh<Mesh>{std::move(mesh)}; }
35
36} // namespace CeresEngine::MeshGenerator
Duplicates the mesh by mirrorring it along an axis.
Definition MirrorMesh.hpp:17
typename Impl::Vertices Vertices
Definition MirrorMesh.hpp:30
Triangles triangles() const noexcept
Definition MirrorMesh.hpp:28
Impl mMergeMesh
Definition MirrorMesh.hpp:20
Vertices vertices() const noexcept
Definition MirrorMesh.hpp:31
MirrorMesh(Mesh mesh, const Axis axis)
Definition MirrorMesh.hpp:25
typename Impl::Triangles Triangles
Definition MirrorMesh.hpp:27
A base class for all mesh implementations.
Definition Mesh.hpp:112
Definition AnyGenerator.hpp:12
MirrorMesh< Mesh > mirrorMesh(Mesh mesh)
Definition MirrorMesh.hpp:34
Axis
Definition Axis.hpp:12
Axis axis(const StringView &str) noexcept
Returns the Axis constant that is represented by str.
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25