CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
ScaleShape.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 "TransformShape.hpp"
11
13
15 template<typename Shape> class ScaleShape {
16 private:
19
20 public:
23 ScaleShape(Shape shape, const Vector2& scale)
24 : mTransformShape{std::move(shape), [scale](ShapeVertex& value) {
25 value.position *= scale;
26 value.tangent = normalize(scale * value.tangent);
27 }} {}
28
29 using Edges = typename Impl::Edges;
30
31 [[nodiscard]] Edges edges() const noexcept { return mTransformShape.edges(); }
32
33 using Vertices = typename Impl::Vertices;
34
35 [[nodiscard]] Vertices vertices() const noexcept { return mTransformShape.vertices(); }
36 };
37
38 template<typename Shape> ScaleShape<Shape> scaleShape(Shape shape, const Vector2& scale) { return ScaleShape<Shape>{std::move(shape), scale}; }
39
40} // namespace CeresEngine::MeshGenerator
Scales a shape keeping tangents unit length.
Definition ScaleShape.hpp:15
typename Impl::Edges Edges
Definition ScaleShape.hpp:29
Vertices vertices() const noexcept
Definition ScaleShape.hpp:35
ScaleShape(Shape shape, const Vector2 &scale)
Definition ScaleShape.hpp:23
typename Impl::Vertices Vertices
Definition ScaleShape.hpp:33
Edges edges() const noexcept
Definition ScaleShape.hpp:31
Impl mTransformShape
Definition ScaleShape.hpp:18
A point on a path.
Definition ShapeVertex.hpp:16
Apply a mutator function to each vertex.
Definition TransformShape.hpp:18
typename Impl::Edges Edges
Definition TransformShape.hpp:50
A type that describes a conjunction of shapes that can be filled and stroked.
Definition Shape.hpp:198
Definition AnyGenerator.hpp:12
ScaleShape< Shape > scaleShape(Shape shape, const Vector2 &scale)
Definition ScaleShape.hpp:38
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