1 #ifndef _RIVE_CUBIC_ASYMMETRIC_VERTEX_BASE_HPP_
2 #define _RIVE_CUBIC_ASYMMETRIC_VERTEX_BASE_HPP_
3 #include "core/field_types/core_double_type.hpp"
4 #include "shapes/cubic_vertex.hpp"
7 class CubicAsymmetricVertexBase : public CubicVertex
10 typedef CubicVertex Super;
13 static const uint16_t typeKey = 34;
15 /// Helper to quickly determine if a core object extends another without
17 bool isTypeOf(uint16_t typeKey) const override
21 case CubicAsymmetricVertexBase::typeKey:
22 case CubicVertexBase::typeKey:
23 case PathVertexBase::typeKey:
24 case ContainerComponentBase::typeKey:
25 case ComponentBase::typeKey:
32 uint16_t coreType() const override { return typeKey; }
34 static const uint16_t rotationPropertyKey = 79;
35 static const uint16_t inDistancePropertyKey = 80;
36 static const uint16_t outDistancePropertyKey = 81;
39 float m_Rotation = 0.0f;
40 float m_InDistance = 0.0f;
41 float m_OutDistance = 0.0f;
43 inline float rotation() const { return m_Rotation; }
44 void rotation(float value)
46 if (m_Rotation == value)
54 inline float inDistance() const { return m_InDistance; }
55 void inDistance(float value)
57 if (m_InDistance == value)
65 inline float outDistance() const { return m_OutDistance; }
66 void outDistance(float value)
68 if (m_OutDistance == value)
72 m_OutDistance = value;
76 Core* clone() const override;
77 void copy(const CubicAsymmetricVertexBase& object)
79 m_Rotation = object.m_Rotation;
80 m_InDistance = object.m_InDistance;
81 m_OutDistance = object.m_OutDistance;
82 CubicVertex::copy(object);
85 bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
89 case rotationPropertyKey:
90 m_Rotation = CoreDoubleType::deserialize(reader);
92 case inDistancePropertyKey:
93 m_InDistance = CoreDoubleType::deserialize(reader);
95 case outDistancePropertyKey:
96 m_OutDistance = CoreDoubleType::deserialize(reader);
99 return CubicVertex::deserialize(propertyKey, reader);
103 virtual void rotationChanged() {}
104 virtual void inDistanceChanged() {}
105 virtual void outDistanceChanged() {}