1 #ifndef _RIVE_CUBIC_ASYMMETRIC_VERTEX_BASE_HPP_
2 #define _RIVE_CUBIC_ASYMMETRIC_VERTEX_BASE_HPP_
3 #include "rive/core/field_types/core_double_type.hpp"
4 #include "rive/shapes/cubic_vertex.hpp"
6 class CubicAsymmetricVertexBase : public CubicVertex {
8 typedef CubicVertex Super;
11 static const uint16_t typeKey = 34;
13 /// Helper to quickly determine if a core object extends another without RTTI
15 bool isTypeOf(uint16_t typeKey) const override {
17 case CubicAsymmetricVertexBase::typeKey:
18 case CubicVertexBase::typeKey:
19 case PathVertexBase::typeKey:
20 case VertexBase::typeKey:
21 case ContainerComponentBase::typeKey:
22 case ComponentBase::typeKey:
29 uint16_t coreType() const override { return typeKey; }
31 static const uint16_t rotationPropertyKey = 79;
32 static const uint16_t inDistancePropertyKey = 80;
33 static const uint16_t outDistancePropertyKey = 81;
36 float m_Rotation = 0.0f;
37 float m_InDistance = 0.0f;
38 float m_OutDistance = 0.0f;
41 inline float rotation() const { return m_Rotation; }
42 void rotation(float value) {
43 if (m_Rotation == value) {
50 inline float inDistance() const { return m_InDistance; }
51 void inDistance(float value) {
52 if (m_InDistance == value) {
59 inline float outDistance() const { return m_OutDistance; }
60 void outDistance(float value) {
61 if (m_OutDistance == value) {
64 m_OutDistance = value;
68 Core* clone() const override;
69 void copy(const CubicAsymmetricVertexBase& object) {
70 m_Rotation = object.m_Rotation;
71 m_InDistance = object.m_InDistance;
72 m_OutDistance = object.m_OutDistance;
73 CubicVertex::copy(object);
76 bool deserialize(uint16_t propertyKey, BinaryReader& reader) override {
77 switch (propertyKey) {
78 case rotationPropertyKey:
79 m_Rotation = CoreDoubleType::deserialize(reader);
81 case inDistancePropertyKey:
82 m_InDistance = CoreDoubleType::deserialize(reader);
84 case outDistancePropertyKey:
85 m_OutDistance = CoreDoubleType::deserialize(reader);
88 return CubicVertex::deserialize(propertyKey, reader);
92 virtual void rotationChanged() {}
93 virtual void inDistanceChanged() {}
94 virtual void outDistanceChanged() {}