zengine-old/engine/3rdparty/zlib/test/refl/vertex.h
2024-04-11 10:13:15 +08:00

47 lines
1.1 KiB
C++

#include <iostream>
#include "refl/refl.h"
using namespace std;
using namespace refl;
struct vec3_parent {
virtual void norm(int x1, int& x2) {
x2 = x1 * x2;
//cout << x2 << "vec3_parent::norm" << endl;
}
};
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;
}
using MyUClass = UClass_Custom;
static void BuildClass(MyUClass& cls) {
cls.parent = &TypeInfo<vec3_parent>::StaticClass;
cls.AttrNum = 3;
cls.FList = {
MakeMemberField(&vec3::x, "x"),
MakeMemberField(&vec3::y, "y"),
MakeMemberField(&vec3::z, "z"),
MakeMethodField(&vec3::norm, "norm", {8, 9}),
MakeMethodField(&vec3::norm1, "norm1",{(float)2.0})
};
}
};