CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
AxisSwapPath.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 "TransformPath.hpp"
12
14
16 template<typename Path> class AxisSwapPath {
17 private:
20
21 public:
27 : mTransformPath{std::move(path),
28 [x, y, z](PathVertex& vertex) {
29 vertex.position = Vector3{vertex.position[static_cast<int>(x)], vertex.position[static_cast<int>(y)],
30 vertex.position[static_cast<int>(z)]};
31 vertex.tangent = Vector3{vertex.tangent[static_cast<int>(x)], vertex.tangent[static_cast<int>(y)], vertex.tangent[static_cast<int>(z)]};
32 vertex.normal = Vector3{vertex.normal[static_cast<int>(x)], vertex.normal[static_cast<int>(y)], vertex.normal[static_cast<int>(z)]};
33 }} {}
34
35 using Edges = typename Impl::Edges;
36 [[nodiscard]] Edges edges() const noexcept { return mTransformPath.edges(); }
37
38 using Vertices = typename Impl::Vertices;
39 [[nodiscard]] Vertices vertices() const noexcept { return mTransformPath.vertices(); }
40 };
41
42 template<typename Path> AxisSwapPath<Path> axisSwapPath(Path path, Axis x, Axis y, Axis z) { return AxisSwapPath<Path>{std::move(path), x, y, z}; }
43
44} // namespace CeresEngine::MeshGenerator
Swaps axis in path.
Definition AxisSwapPath.hpp:16
AxisSwapPath(Path path, Axis x, Axis y, Axis z)
Definition AxisSwapPath.hpp:26
Impl mTransformPath
Definition AxisSwapPath.hpp:19
typename Impl::Edges Edges
Definition AxisSwapPath.hpp:35
Edges edges() const noexcept
Definition AxisSwapPath.hpp:36
Vertices vertices() const noexcept
Definition AxisSwapPath.hpp:39
typename Impl::Vertices Vertices
Definition AxisSwapPath.hpp:38
Definition PathVertex.hpp:14
Apply a mutator function to each vertex.
Definition TransformPath.hpp:18
typename Impl::Edges Edges
Definition TransformPath.hpp:52
Definition AnyGenerator.hpp:12
Axis
Definition Axis.hpp:12
AxisSwapPath< Path > axisSwapPath(Path path, Axis x, Axis y, Axis z)
Definition AxisSwapPath.hpp:42
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