2024-04-11 10:13:15 +08:00
|
|
|
#include <iostream>
|
|
|
|
|
#include "refl/refl.h"
|
2024-04-03 17:58:02 +08:00
|
|
|
using namespace std;
|
2024-04-11 10:13:15 +08:00
|
|
|
using namespace refl;
|
|
|
|
|
struct vec3_parent {
|
|
|
|
|
virtual void norm(int x1, int& x2) {
|
|
|
|
|
x2 = x1 * x2;
|
|
|
|
|
//cout << x2 << "vec3_parent::norm" << endl;
|
|
|
|
|
}
|
2024-04-03 17:58:02 +08:00
|
|
|
};
|
2024-04-11 10:13:15 +08:00
|
|
|
struct vec3 : public vec3_parent {
|
|
|
|
|
float x = 1;
|
|
|
|
|
float y = 2;
|
|
|
|
|
float z = 3;
|
|
|
|
|
string name{ "hellohellohellohellohellohello" };
|
|
|
|
|
void norm(int x1, int& x2)override {
|
|
|
|
|
//x2 = x1 * x2;
|
|
|
|
|
//cout << x2 << "vec3::norm" << endl;
|
|
|
|
|
}
|
|
|
|
|
virtual float norm1(int& x1) {
|
|
|
|
|
//x1 = x1 * x * y * z;
|
|
|
|
|
//x = x1;
|
|
|
|
|
//y = x1 - 1;
|
|
|
|
|
//z = x1 - 10;
|
|
|
|
|
//cout << x1 << "::norm1" << endl;
|
|
|
|
|
return x1;
|
|
|
|
|
}
|
|
|
|
|
static void norm2(int x1 = 10) {
|
|
|
|
|
//cout << x1 << "::norm2" << endl;
|
|
|
|
|
}
|
|
|
|
|
static void norm3(int x1 = 10) {
|
|
|
|
|
x1 = x1 * 10;
|
|
|
|
|
//cout << x1 << "::norm3" << endl;
|
|
|
|
|
}
|
2024-04-13 17:47:44 +08:00
|
|
|
constexpr static auto __GetFields() {
|
|
|
|
|
return std::tuple{
|
|
|
|
|
MakeTuple(&vec3::x, "x"),
|
|
|
|
|
MakeTuple(&vec3::y, "y"),
|
|
|
|
|
MakeTuple(&vec3::z, "z"),
|
|
|
|
|
MakeTuple(&vec3::norm, "norm"),
|
|
|
|
|
MakeTuple(&vec3::norm1, "norm1"),
|
|
|
|
|
MakeTuple(&vec3::norm2, "norm2")
|
2024-04-11 10:13:15 +08:00
|
|
|
};
|
2024-04-13 17:47:44 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#define REGISTER_FIELDS(MemberFunc, MethodFunc)\
|
|
|
|
|
MemberFunc(&vec3::x, "x")\
|
|
|
|
|
MemberFunc(&vec3::y, "y")\
|
|
|
|
|
MemberFunc(&vec3::z, "z")\
|
|
|
|
|
MethodFunc(&vec3::norm,"norm",{})\
|
|
|
|
|
MethodFunc(&vec3::norm1,"norm1",{})\
|
|
|
|
|
MethodFunc(&vec3::norm2,"norm2",{})
|
|
|
|
|
REGISTER_CLASS_META(vec3, vec3_parent)
|
|
|
|
|
BUILD_FELDS()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#undef REGISTER_FIELDS
|
2024-04-11 10:13:15 +08:00
|
|
|
};
|