refactor: standardize object type identification using uLibTypeMacro and update serialization macros
This commit is contained in:
@@ -41,8 +41,10 @@ namespace uLib {
|
||||
*/
|
||||
class Cylinder : public TRS {
|
||||
|
||||
public:
|
||||
uLibTypeMacro(Cylinder, TRS)
|
||||
ULIB_DECLARE_PROPERTIES(Cylinder)
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief PROPERTIES
|
||||
@@ -51,22 +53,20 @@ public:
|
||||
float Height;
|
||||
int Axis;
|
||||
|
||||
virtual const char * GetClassName() const override { return "Cylinder"; }
|
||||
|
||||
|
||||
/**
|
||||
* @brief Default constructor. Aligns with Y by default.
|
||||
*/
|
||||
Cylinder() : m_LocalT(this), Radius(1.0), Height(1.0), Axis(1) {
|
||||
ULIB_ACTIVATE_PROPERTIES(*this);
|
||||
this->Sync();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Constructor with radius and height.
|
||||
*/
|
||||
Cylinder(float radius, float height, int axis = 1)
|
||||
Cylinder(float radius, float height, int axis = 1)
|
||||
: m_LocalT(this), Radius(radius), Height(height), Axis(axis) {
|
||||
ULIB_ACTIVATE_PROPERTIES(*this);
|
||||
this->Sync();
|
||||
}
|
||||
|
||||
@@ -75,7 +75,6 @@ public:
|
||||
*/
|
||||
Cylinder(const Cylinder ©)
|
||||
: m_LocalT(this), TRS(copy), Radius(copy.Radius), Height(copy.Height), Axis(copy.Axis) {
|
||||
ULIB_ACTIVATE_PROPERTIES(*this);
|
||||
this->Sync();
|
||||
}
|
||||
|
||||
@@ -84,10 +83,10 @@ public:
|
||||
*/
|
||||
template <class ArchiveT>
|
||||
void serialize(ArchiveT & ar, const unsigned int version) {
|
||||
ar & boost::serialization::make_nvp("TRS", boost::serialization::base_object<TRS>(*this));
|
||||
ar & HRP(Radius);
|
||||
ar & HRP(Height);
|
||||
ar & HRP(Axis);
|
||||
ar & boost::serialization::make_hrp_enum("Axis", Axis, {"X", "Y", "Z"});
|
||||
ar & HRP("TRS", boost::serialization::base_object<TRS>(*this));
|
||||
}
|
||||
|
||||
/** Sets the radius of the cylinder */
|
||||
|
||||
Reference in New Issue
Block a user