add macro.h
This commit is contained in:
parent
fd98728283
commit
8a93176b14
@ -1,5 +1,6 @@
|
|||||||
using CommandLine;
|
using CommandLine;
|
||||||
using CppAst;
|
using CppAst;
|
||||||
|
using System.Collections.Generic;
|
||||||
namespace refl
|
namespace refl
|
||||||
{
|
{
|
||||||
[Verb("build",HelpText = "Generate custom code based on the parsed AST.")]
|
[Verb("build",HelpText = "Generate custom code based on the parsed AST.")]
|
||||||
@ -17,6 +18,8 @@ namespace refl
|
|||||||
[Option('i', "include", Required = false, HelpText = "link to the include dir")]
|
[Option('i', "include", Required = false, HelpText = "link to the include dir")]
|
||||||
public string IncludeDir { get; set; } = "";
|
public string IncludeDir { get; set; } = "";
|
||||||
|
|
||||||
|
[Option('m', "macros", Required = false, HelpText = "add the macros file")]
|
||||||
|
public string MacroFile { get; set; } = "";
|
||||||
|
|
||||||
[Option('d', "define", Required = false, HelpText = "define a macro on the command line")]
|
[Option('d', "define", Required = false, HelpText = "define a macro on the command line")]
|
||||||
public string Define { get; set; } = "";
|
public string Define { get; set; } = "";
|
||||||
@ -60,7 +63,17 @@ namespace refl
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
var parse_opt = MakeParserOptions(opt);
|
var parse_opt = MakeParserOptions(opt);
|
||||||
var compilation = CppAst.CppParser.ParseFiles(opt.InputFiles.Skip(1).ToList(), parse_opt);
|
List<string>? file_list = null;
|
||||||
|
if (Path.Exists(opt.MacroFile))
|
||||||
|
{
|
||||||
|
file_list = opt.InputFiles.ToList();
|
||||||
|
file_list[0] = opt.MacroFile;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
file_list = opt.InputFiles.Skip(1).ToList();
|
||||||
|
}
|
||||||
|
var compilation = CppAst.CppParser.ParseFiles(file_list, parse_opt);
|
||||||
if (opt.Verbose)
|
if (opt.Verbose)
|
||||||
{
|
{
|
||||||
// Print diagnostic messages
|
// Print diagnostic messages
|
||||||
|
|||||||
@ -71,6 +71,10 @@ namespace refl
|
|||||||
GenModuleMeta(module, null);
|
GenModuleMeta(module, null);
|
||||||
string file_name = Path.GetFileName(target);
|
string file_name = Path.GetFileName(target);
|
||||||
string? dir = Path.GetDirectoryName(target);
|
string? dir = Path.GetDirectoryName(target);
|
||||||
|
if(dir != null && !Directory.Exists(dir))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(dir);
|
||||||
|
}
|
||||||
var output = new StringBuilder();
|
var output = new StringBuilder();
|
||||||
output.AppendLine("#pragma once");
|
output.AppendLine("#pragma once");
|
||||||
foreach (var pair in FileList)
|
foreach (var pair in FileList)
|
||||||
|
|||||||
@ -35,7 +35,7 @@ namespace refl
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case State.Key:
|
case State.Key:
|
||||||
if(c == '=')
|
if(c == ',')
|
||||||
{
|
{
|
||||||
state = State.Value;
|
state = State.Value;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
"profiles": {
|
"profiles": {
|
||||||
"refl": {
|
"refl": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"commandLineArgs": "build F:\\csharp\\cppast\\src\\refl\\cpp\\vertex.h -o F:\\csharp\\cppast\\src\\refl\\cpp\\vertex_gen.inl -t F:\\csharp\\cppast\\src\\refl\\template\\refl.liquid -v"
|
"commandLineArgs": "build F:\\csharp\\cppast\\src\\refl\\cpp\\vertex.h -o F:\\csharp\\cppast\\src\\refl\\cpp\\gen\\vertex_gen.inl -t F:\\csharp\\cppast\\src\\refl\\template\\refl.liquid -m F:\\csharp\\cppast\\src\\refl\\cpp\\macro.h -v"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
38
src/refl/cpp/gen/meta_vertex_gen.inl
Normal file
38
src/refl/cpp/gen/meta_vertex_gen.inl
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#pragma once
|
||||||
|
struct vec3_Static_Meta {
|
||||||
|
consteval static auto __StaticFields() {
|
||||||
|
return std::make_tuple(&vec3::z, &vec3::name, &vec3::norm, &vec3::norm1, &vec3::norm2, &vec3::norm3);
|
||||||
|
};
|
||||||
|
|
||||||
|
consteval static auto __MakeStaticFields() {
|
||||||
|
return std::array{
|
||||||
|
refl::StaticMemberField(&vec3::z, FName("z"), { 5.f }),
|
||||||
|
refl::StaticMemberField(&vec3::name, FName("name"), { "hello meta" }),
|
||||||
|
refl::StaticMethodField(&vec3::norm, FName("norm"), { {3,4} }),
|
||||||
|
refl::StaticMethodField(&vec3::norm1, FName("norm1"), {1}),
|
||||||
|
refl::StaticMethodField(&vec3::norm2, FName("norm2"), {}),
|
||||||
|
refl::StaticMethodField(&vec3::norm3, FName("norm3"), {}),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
consteval static int Size() {
|
||||||
|
return refl::fetch_meta_size<vec3_Static_Meta>();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
struct vec3_Meta : public refl::Meta {
|
||||||
|
using MyStatic = vec3_Static_Meta;
|
||||||
|
using MyUClass = refl::UClass_Meta<vec3, vec3_parent>;;
|
||||||
|
inline static char s_data[MyStatic::Size()]{};
|
||||||
|
static auto __MakeFields() {
|
||||||
|
char* memory = &s_data[0];
|
||||||
|
return std::array{
|
||||||
|
MemberField(&vec3::z, FName("z"), memory, { 5.f }),
|
||||||
|
MemberField(&vec3::name, FName("name"), memory, { "hello meta" }),
|
||||||
|
MethodField(&vec3::norm, FName("norm"), memory, { {3,4} }),
|
||||||
|
MethodField(&vec3::norm1, FName("norm1"), memory, {1}),
|
||||||
|
MethodField(&vec3::norm2, FName("norm2"), memory, {}),
|
||||||
|
MethodField(&vec3::norm3, FName("norm3"), memory, {}),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
@ -1,3 +1,3 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#include "vkmeta_vertex_gen.inl"
|
||||||
#include "meta_vertex_gen.inl"
|
#include "meta_vertex_gen.inl"
|
||||||
#include "uimeta_vertex_gen.inl"
|
|
||||||
30
src/refl/cpp/gen/vkmeta_vertex_gen.inl
Normal file
30
src/refl/cpp/gen/vkmeta_vertex_gen.inl
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#pragma once
|
||||||
|
struct vec3_Static_vkMeta {
|
||||||
|
consteval static auto __StaticFields() {
|
||||||
|
return std::make_tuple(&vec3::x, &vec3::y);
|
||||||
|
};
|
||||||
|
|
||||||
|
consteval static auto __MakeStaticFields() {
|
||||||
|
return std::array{
|
||||||
|
refl::StaticMemberField(&vec3::x, FName("x"), ...),
|
||||||
|
refl::StaticMemberField(&vec3::y, FName("y"), ...),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
consteval static int Size() {
|
||||||
|
return refl::fetch_meta_size<vec3_Static_vkMeta>();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
struct vec3_vkMeta : public refl::Meta {
|
||||||
|
using MyStatic = vec3_Static_vkMeta;
|
||||||
|
using MyUClass = refl::UClass_Meta<vec3, vec3_parent>;;
|
||||||
|
inline static char s_data[MyStatic::Size()]{};
|
||||||
|
static auto __MakeFields() {
|
||||||
|
char* memory = &s_data[0];
|
||||||
|
return std::array{
|
||||||
|
MemberField(&vec3::x, FName("x"), memory, ...),
|
||||||
|
MemberField(&vec3::y, FName("y"), memory, ...),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
10
src/refl/cpp/macro.h
Normal file
10
src/refl/cpp/macro.h
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define __Meta(...) __cppast(Meta,__VA_ARGS__)
|
||||||
|
#define UPROPERTY(...) __Meta(__VA_ARGS__)
|
||||||
|
#define UFUNCTION(...) __Meta(__VA_ARGS__)
|
||||||
|
|
||||||
|
|
||||||
|
#define __vkMeta(...) __cppast(vkMeta,...)
|
||||||
|
#define UPROPERTY_vk(...) __vkMeta(...)
|
||||||
|
#define UFUNCTION_vk(...) __vkMeta(...)
|
||||||
@ -1,220 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
struct TestMain1_Static_Meta {
|
|
||||||
consteval static auto __StaticFields() {
|
|
||||||
return std::make_tuple(&TestMain1::x, &TestMain1::y, &TestMain1::z);
|
|
||||||
};
|
|
||||||
|
|
||||||
consteval static auto __MakeStaticFields() {
|
|
||||||
return std::array{
|
|
||||||
refl::StaticMemberField(&TestMain1::x, FName("x"), {}),
|
|
||||||
refl::StaticMemberField(&TestMain1::y, FName("y"), {}),
|
|
||||||
refl::StaticMemberField(&TestMain1::z, FName("z"), {}),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
consteval static int Size() {
|
|
||||||
return refl::fetch_meta_size<TestMain1_Static_Meta>();
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TestMain1_Meta : public refl::Meta {
|
|
||||||
using MyStatic = TestMain1_Static_Meta;
|
|
||||||
using MyUClass = refl::UClass_Meta<TestMain1, void>;;
|
|
||||||
inline static char s_data[MyStatic::Size()]{};
|
|
||||||
static auto __MakeFields() {
|
|
||||||
char* memory = &s_data[0];
|
|
||||||
return std::array{
|
|
||||||
MemberField(&TestMain1::x, FName("x"), memory, {}),
|
|
||||||
MemberField(&TestMain1::y, FName("y"), memory, {}),
|
|
||||||
MemberField(&TestMain1::z, FName("z"), memory, {}),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
namespace engineapi {
|
|
||||||
struct Vector3_Static_Meta {
|
|
||||||
consteval static auto __StaticFields() {
|
|
||||||
return std::make_tuple(&Vector3::x, &Vector3::y, &Vector3::z);
|
|
||||||
};
|
|
||||||
|
|
||||||
consteval static auto __MakeStaticFields() {
|
|
||||||
return std::array{
|
|
||||||
refl::StaticMemberField(&Vector3::x, FName("x"), {}),
|
|
||||||
refl::StaticMemberField(&Vector3::y, FName("y"), {}),
|
|
||||||
refl::StaticMemberField(&Vector3::z, FName("z"), {}),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
consteval static int Size() {
|
|
||||||
return refl::fetch_meta_size<Vector3_Static_Meta>();
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Vector3_Meta : public refl::Meta {
|
|
||||||
using MyStatic = Vector3_Static_Meta;
|
|
||||||
using MyUClass = refl::UClass_Meta<Vector3, void>;;
|
|
||||||
inline static char s_data[MyStatic::Size()]{};
|
|
||||||
static auto __MakeFields() {
|
|
||||||
char* memory = &s_data[0];
|
|
||||||
return std::array{
|
|
||||||
MemberField(&Vector3::x, FName("x"), memory, {}),
|
|
||||||
MemberField(&Vector3::y, FName("y"), memory, {}),
|
|
||||||
MemberField(&Vector3::z, FName("z"), memory, {}),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
struct Vector2_Static_Meta {
|
|
||||||
consteval static auto __StaticFields() {
|
|
||||||
return std::make_tuple(&Vector2::x, &Vector2::y);
|
|
||||||
};
|
|
||||||
|
|
||||||
consteval static auto __MakeStaticFields() {
|
|
||||||
return std::array{
|
|
||||||
refl::StaticMemberField(&Vector2::x, FName("x"), { 1.0 }),
|
|
||||||
refl::StaticMemberField(&Vector2::y, FName("y"), { 2.0 }),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
consteval static int Size() {
|
|
||||||
return refl::fetch_meta_size<Vector2_Static_Meta>();
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Vector2_Meta : public refl::Meta {
|
|
||||||
using MyStatic = Vector2_Static_Meta;
|
|
||||||
using MyUClass = refl::UClass_Meta<Vector2, void>;;
|
|
||||||
inline static char s_data[MyStatic::Size()]{};
|
|
||||||
static auto __MakeFields() {
|
|
||||||
char* memory = &s_data[0];
|
|
||||||
return std::array{
|
|
||||||
MemberField(&Vector2::x, FName("x"), memory, { 1.0 }),
|
|
||||||
MemberField(&Vector2::y, FName("y"), memory, { 2.0 }),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
struct PosVertex_Static_Meta {
|
|
||||||
consteval static auto __StaticFields() {
|
|
||||||
return std::make_tuple(&PosVertex::Position);
|
|
||||||
};
|
|
||||||
|
|
||||||
consteval static auto __MakeStaticFields() {
|
|
||||||
return std::array{
|
|
||||||
refl::StaticMemberField(&PosVertex::Position, FName("Position"), {}),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
consteval static int Size() {
|
|
||||||
return refl::fetch_meta_size<PosVertex_Static_Meta>();
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
struct PosVertex_Meta : public refl::Meta {
|
|
||||||
using MyStatic = PosVertex_Static_Meta;
|
|
||||||
using MyUClass = refl::UClass_Meta<PosVertex, Vertex>;;
|
|
||||||
inline static char s_data[MyStatic::Size()]{};
|
|
||||||
static auto __MakeFields() {
|
|
||||||
char* memory = &s_data[0];
|
|
||||||
return std::array{
|
|
||||||
MemberField(&PosVertex::Position, FName("Position"), memory, {}),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
struct TexVertex_Static_Meta {
|
|
||||||
consteval static auto __StaticFields() {
|
|
||||||
return std::make_tuple(&TexVertex::Position, &TexVertex::Normal, &TexVertex::TexCoords);
|
|
||||||
};
|
|
||||||
|
|
||||||
consteval static auto __MakeStaticFields() {
|
|
||||||
return std::array{
|
|
||||||
refl::StaticMemberField(&TexVertex::Position, FName("Position"), {}),
|
|
||||||
refl::StaticMemberField(&TexVertex::Normal, FName("Normal"), {}),
|
|
||||||
refl::StaticMemberField(&TexVertex::TexCoords, FName("TexCoords"), {}),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
consteval static int Size() {
|
|
||||||
return refl::fetch_meta_size<TexVertex_Static_Meta>();
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TexVertex_Meta : public refl::Meta {
|
|
||||||
using MyStatic = TexVertex_Static_Meta;
|
|
||||||
using MyUClass = refl::UClass_Meta<TexVertex, Vertex>;;
|
|
||||||
inline static char s_data[MyStatic::Size()]{};
|
|
||||||
static auto __MakeFields() {
|
|
||||||
char* memory = &s_data[0];
|
|
||||||
return std::array{
|
|
||||||
MemberField(&TexVertex::Position, FName("Position"), memory, {}),
|
|
||||||
MemberField(&TexVertex::Normal, FName("Normal"), memory, {}),
|
|
||||||
MemberField(&TexVertex::TexCoords, FName("TexCoords"), memory, {}),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
struct BoneVertex_Static_Meta {
|
|
||||||
consteval static auto __StaticFields() {
|
|
||||||
return std::make_tuple(&BoneVertex::Position, &BoneVertex::TexCoords, &BoneVertex::Normal, &BoneVertex::Tangent, &BoneVertex::Weights, &BoneVertex::BoneIDs);
|
|
||||||
};
|
|
||||||
|
|
||||||
consteval static auto __MakeStaticFields() {
|
|
||||||
return std::array{
|
|
||||||
refl::StaticMemberField(&BoneVertex::Position, FName("Position"), {}),
|
|
||||||
refl::StaticMemberField(&BoneVertex::TexCoords, FName("TexCoords"), {}),
|
|
||||||
refl::StaticMemberField(&BoneVertex::Normal, FName("Normal"), {}),
|
|
||||||
refl::StaticMemberField(&BoneVertex::Tangent, FName("Tangent"), {}),
|
|
||||||
refl::StaticMemberField(&BoneVertex::Weights, FName("Weights"), {}),
|
|
||||||
refl::StaticMemberField(&BoneVertex::BoneIDs, FName("BoneIDs"), {}),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
consteval static int Size() {
|
|
||||||
return refl::fetch_meta_size<BoneVertex_Static_Meta>();
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
struct BoneVertex_Meta : public refl::Meta {
|
|
||||||
using MyStatic = BoneVertex_Static_Meta;
|
|
||||||
using MyUClass = refl::UClass_Meta<BoneVertex, Vertex>;;
|
|
||||||
inline static char s_data[MyStatic::Size()]{};
|
|
||||||
static auto __MakeFields() {
|
|
||||||
char* memory = &s_data[0];
|
|
||||||
return std::array{
|
|
||||||
MemberField(&BoneVertex::Position, FName("Position"), memory, {}),
|
|
||||||
MemberField(&BoneVertex::TexCoords, FName("TexCoords"), memory, {}),
|
|
||||||
MemberField(&BoneVertex::Normal, FName("Normal"), memory, {}),
|
|
||||||
MemberField(&BoneVertex::Tangent, FName("Tangent"), memory, {}),
|
|
||||||
MemberField(&BoneVertex::Weights, FName("Weights"), memory, {}),
|
|
||||||
MemberField(&BoneVertex::BoneIDs, FName("BoneIDs"), memory, {}),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
namespace hello {
|
|
||||||
struct TestHello_Static_Meta {
|
|
||||||
consteval static auto __StaticFields() {
|
|
||||||
return std::make_tuple(&TestHello::x, &TestHello::z);
|
|
||||||
};
|
|
||||||
|
|
||||||
consteval static auto __MakeStaticFields() {
|
|
||||||
return std::array{
|
|
||||||
refl::StaticMemberField(&TestHello::x, FName("x"), {}),
|
|
||||||
refl::StaticMemberField(&TestHello::z, FName("z"), {}),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
consteval static int Size() {
|
|
||||||
return refl::fetch_meta_size<TestHello_Static_Meta>();
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TestHello_Meta : public refl::Meta {
|
|
||||||
using MyStatic = TestHello_Static_Meta;
|
|
||||||
using MyUClass = refl::UClass_Meta<TestHello, void>;;
|
|
||||||
inline static char s_data[MyStatic::Size()]{};
|
|
||||||
static auto __MakeFields() {
|
|
||||||
char* memory = &s_data[0];
|
|
||||||
return std::array{
|
|
||||||
MemberField(&TestHello::x, FName("x"), memory, {}),
|
|
||||||
MemberField(&TestHello::z, FName("z"), memory, {}),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,32 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
namespace engineapi {
|
|
||||||
namespace hello {
|
|
||||||
struct TestHello_Static_UIMeta {
|
|
||||||
consteval static auto __StaticFields() {
|
|
||||||
return std::make_tuple(&TestHello::y);
|
|
||||||
};
|
|
||||||
|
|
||||||
consteval static auto __MakeStaticFields() {
|
|
||||||
return std::array{
|
|
||||||
refl::StaticMemberField(&TestHello::y, FName("y"), {}),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
consteval static int Size() {
|
|
||||||
return refl::fetch_meta_size<TestHello_Static_UIMeta>();
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TestHello_UIMeta : public refl::Meta {
|
|
||||||
using MyStatic = TestHello_Static_UIMeta;
|
|
||||||
using MyUClass = refl::UClass_Meta<TestHello, void>;;
|
|
||||||
inline static char s_data[MyStatic::Size()]{};
|
|
||||||
static auto __MakeFields() {
|
|
||||||
char* memory = &s_data[0];
|
|
||||||
return std::array{
|
|
||||||
MemberField(&TestHello::y, FName("y"), memory, {}),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,75 +1,62 @@
|
|||||||
#pragma once
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#define MAX_NUM_BONES_PER_VERTEX 4
|
#include "refl/refl.h"
|
||||||
struct TestMain1 {
|
using namespace std;
|
||||||
__cppast(Meta = {})
|
using namespace refl;
|
||||||
float x;
|
struct vec3_parent {
|
||||||
__cppast(Meta = {})
|
virtual int norm(int x1, int& x2) {
|
||||||
float y;
|
x2 = x1 * x2;
|
||||||
__cppast(Meta = {})
|
return x2;
|
||||||
float z;
|
//cout << x2 << "vec3_parent::norm" << endl;
|
||||||
};
|
|
||||||
namespace engineapi {
|
|
||||||
namespace hello {
|
|
||||||
struct TestHello{
|
|
||||||
__cppast(Meta = {})
|
|
||||||
float x;
|
|
||||||
__cppast(UIMeta = {})
|
|
||||||
float y;
|
|
||||||
__cppast(Meta = {})
|
|
||||||
float z;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
struct Vector3 {
|
|
||||||
__cppast(Meta = {})
|
|
||||||
float x;
|
|
||||||
__cppast(Meta = {})
|
|
||||||
float y;
|
|
||||||
__cppast(Meta = {})
|
|
||||||
float z;
|
|
||||||
};
|
|
||||||
struct Vector2 {
|
|
||||||
__cppast(Meta = { 1.0 })
|
|
||||||
float x;
|
|
||||||
__cppast(Meta = { 2.0 })
|
|
||||||
float y;
|
|
||||||
};
|
|
||||||
struct Vertex {
|
|
||||||
|
|
||||||
};
|
|
||||||
struct PosVertex_Meta;
|
|
||||||
struct PosVertex : public Vertex {
|
|
||||||
using MyMeta = PosVertex_Meta;
|
|
||||||
__cppast(Meta = {})
|
|
||||||
Vector3 Position = {};
|
|
||||||
};
|
|
||||||
struct TexVertex_Meta;
|
|
||||||
struct TexVertex : public Vertex {
|
|
||||||
using MyMeta = TexVertex_Meta;
|
|
||||||
__cppast(Meta = {})
|
|
||||||
Vector3 Position = {};
|
|
||||||
__cppast(Meta = {})
|
|
||||||
Vector3 Normal = {};
|
|
||||||
__cppast(Meta = {})
|
|
||||||
Vector2 TexCoords = {};
|
|
||||||
};
|
|
||||||
struct BoneVertex_Meta;
|
|
||||||
struct BoneVertex : public Vertex
|
|
||||||
{
|
|
||||||
using MyMeta = BoneVertex_Meta;
|
|
||||||
__cppast(Meta = {})
|
|
||||||
Vector3 Position = {};
|
|
||||||
__cppast(Meta = {})
|
|
||||||
Vector2 TexCoords = {};
|
|
||||||
__cppast(Meta = {})
|
|
||||||
Vector3 Normal = {};
|
|
||||||
__cppast(Meta = {})
|
|
||||||
Vector3 Tangent = {};
|
|
||||||
// 骨骼蒙皮数据
|
|
||||||
__cppast(Meta = {})
|
|
||||||
float Weights[MAX_NUM_BONES_PER_VERTEX] = {};
|
|
||||||
__cppast(Meta = {})
|
|
||||||
uint32_t BoneIDs[MAX_NUM_BONES_PER_VERTEX] = {};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
struct vec3 : public vec3_parent {
|
||||||
|
using MyMeta = class vec3_Meta;
|
||||||
|
using MyMetas = MulytMeta<vec3>;
|
||||||
|
UPROPERTY_vk({ 1.f })
|
||||||
|
float x = 1;
|
||||||
|
UPROPERTY_vk({ 2.f })
|
||||||
|
float y = 2;
|
||||||
|
UPROPERTY({ 5.f })
|
||||||
|
float z = 3;
|
||||||
|
UPROPERTY({ "hello meta" })
|
||||||
|
string name = "???";
|
||||||
|
UFUNCTION({ {3,4} })
|
||||||
|
int norm(int x1, int& x2)override {
|
||||||
|
int tmp = x1 * 2 + 1;
|
||||||
|
x1 = x2;
|
||||||
|
x2 = tmp;
|
||||||
|
return x2;
|
||||||
|
//cout << x2 << "vec3::norm" << endl;
|
||||||
|
}
|
||||||
|
UFUNCTION({1})
|
||||||
|
virtual float norm1(int& x1) {
|
||||||
|
x1 = x1 * x * y * z;
|
||||||
|
x = x1;
|
||||||
|
y = x1 - 1;
|
||||||
|
//z = x1 - 10;
|
||||||
|
//cout << x1 << "::norm1" << endl;
|
||||||
|
return x1;
|
||||||
|
}
|
||||||
|
UFUNCTION({})
|
||||||
|
static void norm2(int x1 = 10) {
|
||||||
|
cout << x1 << "::norm2" << endl;
|
||||||
|
}
|
||||||
|
UFUNCTION({})
|
||||||
|
static void norm3(int x1 = 10) {
|
||||||
|
x1 = x1 * 10;
|
||||||
|
cout << x1 << "::norm3" << endl;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct MulytMeta<vec3> {
|
||||||
|
static const UClass* UIMeta();
|
||||||
|
static const UClass* GetMeta(const Name& name) {
|
||||||
|
if (name == FName("UIMeta")) {
|
||||||
|
return UIMeta();
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
//template const UClass* MetaClass<vec3::UIMeta>();
|
||||||
#include "meta_vertex_gen.inl"
|
#include "meta_vertex_gen.inl"
|
||||||
Loading…
Reference in New Issue
Block a user