1 #ifndef _RIVE_CUBIC_DETACHED_VERTEX_BASE_HPP_
2 #define _RIVE_CUBIC_DETACHED_VERTEX_BASE_HPP_
3 #include "core/field_types/core_double_type.hpp"
4 #include "shapes/cubic_vertex.hpp"
7 class CubicDetachedVertexBase : public CubicVertex
10 typedef CubicVertex Super;
13 static const uint16_t typeKey = 6;
15 /// Helper to quickly determine if a core object extends another without
17 bool isTypeOf(uint16_t typeKey) const override
21 case CubicDetachedVertexBase::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 inRotationPropertyKey = 84;
35 static const uint16_t inDistancePropertyKey = 85;
36 static const uint16_t outRotationPropertyKey = 86;
37 static const uint16_t outDistancePropertyKey = 87;
40 float m_InRotation = 0.0f;
41 float m_InDistance = 0.0f;
42 float m_OutRotation = 0.0f;
43 float m_OutDistance = 0.0f;
45 inline float inRotation() const { return m_InRotation; }
46 void inRotation(float value)
48 if (m_InRotation == value)
56 inline float inDistance() const { return m_InDistance; }
57 void inDistance(float value)
59 if (m_InDistance == value)
67 inline float outRotation() const { return m_OutRotation; }
68 void outRotation(float value)
70 if (m_OutRotation == value)
74 m_OutRotation = value;
78 inline float outDistance() const { return m_OutDistance; }
79 void outDistance(float value)
81 if (m_OutDistance == value)
85 m_OutDistance = value;
89 Core* clone() const override;
90 void copy(const CubicDetachedVertexBase& object)
92 m_InRotation = object.m_InRotation;
93 m_InDistance = object.m_InDistance;
94 m_OutRotation = object.m_OutRotation;
95 m_OutDistance = object.m_OutDistance;
96 CubicVertex::copy(object);
99 bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
103 case inRotationPropertyKey:
104 m_InRotation = CoreDoubleType::deserialize(reader);
106 case inDistancePropertyKey:
107 m_InDistance = CoreDoubleType::deserialize(reader);
109 case outRotationPropertyKey:
110 m_OutRotation = CoreDoubleType::deserialize(reader);
112 case outDistancePropertyKey:
113 m_OutDistance = CoreDoubleType::deserialize(reader);
116 return CubicVertex::deserialize(propertyKey, reader);
120 virtual void inRotationChanged() {}
121 virtual void inDistanceChanged() {}
122 virtual void outRotationChanged() {}
123 virtual void outDistanceChanged() {}