1 #ifndef _RIVE_CUBIC_WEIGHT_BASE_HPP_
2 #define _RIVE_CUBIC_WEIGHT_BASE_HPP_
3 #include "bones/weight.hpp"
4 #include "core/field_types/core_uint_type.hpp"
7 class CubicWeightBase : public Weight
13 static const uint16_t typeKey = 46;
15 /// Helper to quickly determine if a core object extends another without
17 bool isTypeOf(uint16_t typeKey) const override
21 case CubicWeightBase::typeKey:
22 case WeightBase::typeKey:
23 case ComponentBase::typeKey:
30 uint16_t coreType() const override { return typeKey; }
32 static const uint16_t inValuesPropertyKey = 110;
33 static const uint16_t inIndicesPropertyKey = 111;
34 static const uint16_t outValuesPropertyKey = 112;
35 static const uint16_t outIndicesPropertyKey = 113;
40 int m_OutValues = 255;
43 inline int inValues() const { return m_InValues; }
44 void inValues(int value)
46 if (m_InValues == value)
54 inline int inIndices() const { return m_InIndices; }
55 void inIndices(int value)
57 if (m_InIndices == value)
65 inline int outValues() const { return m_OutValues; }
66 void outValues(int value)
68 if (m_OutValues == value)
76 inline int outIndices() const { return m_OutIndices; }
77 void outIndices(int value)
79 if (m_OutIndices == value)
87 Core* clone() const override;
88 void copy(const CubicWeightBase& object)
90 m_InValues = object.m_InValues;
91 m_InIndices = object.m_InIndices;
92 m_OutValues = object.m_OutValues;
93 m_OutIndices = object.m_OutIndices;
97 bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
101 case inValuesPropertyKey:
102 m_InValues = CoreUintType::deserialize(reader);
104 case inIndicesPropertyKey:
105 m_InIndices = CoreUintType::deserialize(reader);
107 case outValuesPropertyKey:
108 m_OutValues = CoreUintType::deserialize(reader);
110 case outIndicesPropertyKey:
111 m_OutIndices = CoreUintType::deserialize(reader);
114 return Weight::deserialize(propertyKey, reader);
118 virtual void inValuesChanged() {}
119 virtual void inIndicesChanged() {}
120 virtual void outValuesChanged() {}
121 virtual void outIndicesChanged() {}