Cogs.Core
RiserTelescopicJointComponent.h
1#include "EntityDefinition.h"
2#include "Components/Core/DynamicComponent.h"
3
4#include <glm/vec4.hpp>
5
6namespace Cogs
7{
8 namespace Core
9 {
10 class Context;
11
13 {
14 public:
15 bool reverse = false;
16
17 float topLength = 5.0f;
18 float armLength = 15.0f;
19 float cylinderLength = 15.0f;
20
21 float armInnerRadius = 0.7f;
22 float armOuterRadius = 0.8f;
23
24 float cylinderOuterRadius = 1.2f;
25 float innerCylinderLength = 10.0f;
26
27 float pistonRadius = 1.1f;
28 float pistonLength = 0.5f;
29
30 glm::vec4 armColor = glm::vec4(0.5f, 0.5f, 0.5f, 1.0f);
31
32 float connectorRadius = 1.2f;
33 float connectorLength = 1.0f;
34
35 float startDepth = 0.0f;
36 float endDepth = 100.0f;
37
38 static void registerType();
39
40 void initialize(Context * context);
41 void update();
42 void updateChildren();
43
44 private:
45 void updateBody(const std::vector<float> & trajectoryDepths);
46 void updateArm(const std::vector<float> & trajectoryDepths);
47 void updateTop(const std::vector<float> & trajectoryDepths);
48
49 EntityPtr body;
50 EntityPtr arm;
51 EntityPtr top;
52 };
53 }
54}
55
56template<> inline Cogs::StringView getName<Cogs::Core::RiserTelescopicJointComponent>() { return "RiserTelescopicJointComponent"; }
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition: Context.h:83
Base class for components implementing dynamic behavior.
void updateBody(const std::vector< float > &trajectoryDepths)
Updates the extrusion profile for the cylinder.
float innerCylinderLength
Length of the inner cylinder (inner stroke length).
void updateTop(const std::vector< float > &trajectoryDepths)
Update the extrusion profile for the arm.
float cylinderOuterRadius
Outer radius of the cylinder part.
bool reverse
If the joint profile should be reversed, i.e the arm after the cylinder.
void updateArm(const std::vector< float > &trajectoryDepths)
Update the extrusion profile for the arm.
float startDepth
Starting depth of the component.
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:24
std::shared_ptr< ComponentModel::Entity > EntityPtr
Smart pointer for Entity access.
Definition: EntityPtr.h:12
Contains all Cogs related functionality.
Definition: FieldSetter.h:23