CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
FlipPath.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 "Edge.hpp"
11#include "TransformPath.hpp"
12
14
16 template<typename Path> class FlipPath {
17 private:
20
21 public:
22 class Edges {
23 public:
24 [[nodiscard]] Edge generate() const {
25 Edge edge = mEdges.generate();
26 std::swap(edge.vertices[0], edge.vertices[1]);
27 return edge;
28 }
29
30 [[nodiscard]] bool done() const noexcept { return mEdges.done(); }
31
32 void next() { mEdges.next(); }
33
34 private:
36
37 Edges(const TransformPath<Path>& path) : mEdges{path.edges()} {}
38
39 friend class FlipPath;
40 };
41
44 : mTransformPath{std::move(path), [](PathVertex& vertex) {
45 vertex.tangent *= -1.0;
46 vertex.normal *= -1.0;
47 }} {}
48
49 [[nodiscard]] Edges edges() const noexcept { return {*this}; }
50
51 using Vertices = typename Impl::Vertices;
52 [[nodiscard]] Vertices vertices() const noexcept { return mTransformPath.vertices(); }
53 };
54
55 template<typename Path> FlipPath<Path> flipPath(Path path) { return FlipPath<Path>{std::move(path)}; }
56
57} // namespace CeresEngine::MeshGenerator
Will have a type named "Type" that has same type as value returned by method edges() for type Primiti...
Definition Utility.hpp:23
Definition Edge.hpp:14
Edges(const TransformPath< Path > &path)
Definition FlipPath.hpp:37
Edge generate() const
Definition FlipPath.hpp:24
bool done() const noexcept
Definition FlipPath.hpp:30
EdgeGeneratorType< TransformPath< Path > >::Type mEdges
Definition FlipPath.hpp:35
void next()
Definition FlipPath.hpp:32
Flips mesh inside out. Reverses triangles and normals.
Definition FlipPath.hpp:16
FlipPath(Path path)
Definition FlipPath.hpp:43
Impl mTransformPath
Definition FlipPath.hpp:19
Edges edges() const noexcept
Definition FlipPath.hpp:49
Vertices vertices() const noexcept
Definition FlipPath.hpp:52
typename Impl::Vertices Vertices
Definition FlipPath.hpp:51
Definition PathVertex.hpp:14
Apply a mutator function to each vertex.
Definition TransformPath.hpp:18
Definition AnyGenerator.hpp:12
FlipPath< Path > flipPath(Path path)
Definition FlipPath.hpp:55
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