CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
ScalePath.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 "TransformPath.hpp"
11
13
15 template<typename Path> class ScalePath {
16 private:
19
20 public:
23 ScalePath(Path path, const Vector3& scale)
24 : mTransformPath{std::move(path), [scale](PathVertex& value) {
25 value.position *= scale;
26 value.tangent = normalize(scale * value.tangent);
27 value.normal = normalize(scale * value.normal);
28 }} {}
29
30 using Edges = typename Impl::Edges;
31
32 [[nodiscard]] Edges edges() const noexcept { return mTransformPath.edges(); }
33
34 using Vertices = typename Impl::Vertices;
35
36 [[nodiscard]] Vertices vertices() const noexcept { return mTransformPath.vertices(); }
37 };
38
39 template<typename Path> ScalePath<Path> scalePath(Path path, const Vector3& scale) { return ScalePath<Path>{std::move(path), scale}; }
40
41} // namespace CeresEngine::MeshGenerator
Definition PathVertex.hpp:14
Scales a path. Keeps tangents and normals unit length.
Definition ScalePath.hpp:15
Impl mTransformPath
Definition ScalePath.hpp:18
typename Impl::Edges Edges
Definition ScalePath.hpp:30
ScalePath(Path path, const Vector3 &scale)
Definition ScalePath.hpp:23
typename Impl::Vertices Vertices
Definition ScalePath.hpp:34
Edges edges() const noexcept
Definition ScalePath.hpp:32
Vertices vertices() const noexcept
Definition ScalePath.hpp:36
Apply a mutator function to each vertex.
Definition TransformPath.hpp:18
typename Impl::Edges Edges
Definition TransformPath.hpp:52
Definition AnyGenerator.hpp:12
ScalePath< Path > scalePath(Path path, const Vector3 &scale)
Definition ScalePath.hpp:39
auto move(Vector3 position)
Moves a entity to the given position.
Definition Helpers.hpp:22
auto scale(Vector3 scale)
Applies a scale to the entity.
Definition Helpers.hpp:32
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
Definition Span.hpp:668