Cogs.Core
VariableExtrusionComponent.h
1#pragma once
2
3#include "Foundation/ComponentModel/Component.h"
4
5#include <glm/vec2.hpp>
6#include <glm/vec3.hpp>
7
8#include <memory>
9
10namespace Cogs
11{
12 namespace Core
13 {
15 {
16 std::shared_ptr<ComponentModel::Entity> trajectory;
17
18 std::vector<glm::vec2> profile;
19 std::vector<float> depths;
20
21 std::vector<float> twist;
22 std::vector<float> morph;
23
24 std::vector<glm::vec3> crossSection;
25 std::vector<glm::vec3> morphCrossSection;
26
27 bool useTwist = false;
28 bool useMorph = false;
29 bool useOffset = true;
30
31 float angle = 0.0f;
32 bool enableRotation = false;
33
34 bool useSimpleRotation = true;
35
36 float depthOffset = 0.0f;
37 float radiusScale = 1.0f;
38
39 float creaseAngle = 0.45f;
40
41 int segmentCount = 32;
42
43 bool closed = true;
44
45 glm::vec2 textureScale = glm::vec2(1, 1);
46 glm::vec2 textureOffset = glm::vec2(0, 0);
47
48 static void registerType();
49 };
50 }
51}
52
53template<> inline Cogs::StringView getName<Cogs::Core::VariableExtrusionComponent>() { return "VariableExtrusionComponent"; }
Base class for Component instances.
Definition: Component.h:143
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:24
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
bool enableRotation
If rotation should be enabled.
bool useMorph
If morphing factors should be applied.
float radiusScale
Radius scale applied to the entire shape perpendicular to the direction of the trajectory.
bool closed
If the shape should be displayed closed.
float angle
Angle to rotate the shape around the trajectory by.
float depthOffset
Offset amount applied to the given profile depths before calculating the trajectory.
int segmentCount
Number of segments per cross section.
std::vector< float > twist
Twist factors given by segment.
glm::vec2 textureScale
Scale factor to multiply generated texture coordinates by.
bool useSimpleRotation
If rotation should be applied uniformly to the entire shape (instead of per segment).
std::vector< float > morph
Morph factors applied per segment controlling the amount of regular/morph cross section to use.
std::vector< glm::vec3 > morphCrossSection
Morph target cross section.
std::vector< glm::vec2 > profile
Extrusion profile in two component (radial, length).
std::vector< glm::vec3 > crossSection
Cross section shape.
std::vector< float > depths
Depth values for the profile.
bool useTwist
If twist factors should be applied.
std::shared_ptr< ComponentModel::Entity > trajectory
The trajectory this component is connected to.
glm::vec2 textureOffset
Offset in units to apply to generated texture coordinates.
float creaseAngle
Crease angle to use when smoothing normals.