Skip to content

Commit

Permalink
refactor(core): add AUTO_MAT1 and AUTO_VEC1 macros
Browse files Browse the repository at this point in the history
  • Loading branch information
luishfonseca committed Sep 28, 2023
1 parent be79c91 commit 553695c
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions core/src/cubos/core/reflection/external/glm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,16 @@ class AddressOfImpl final : public FieldsTrait::AddressOf
#define AUTO_CONSTRUCTIBLE(type) \
ConstructibleTrait::typed<type>().withDefaultConstructor().withCopyConstructor().withMoveConstructor().build()

#define AUTO_VEC2(type) FieldsTrait().withField("x", &type::x).withField("y", &type::y)

#define AUTO_VEC1(type) FieldsTrait().withField("x", &type::x)
#define AUTO_VEC2(type) AUTO_VEC1(type).withField("y", &type::y)
#define AUTO_VEC3(type) AUTO_VEC2(type).withField("z", &type::z)

#define AUTO_VEC4(type) AUTO_VEC3(type).withField("w", &type::w)

#define AUTO_MAT1(type, column_type) FieldsTrait().withField(reflect<column_type>(), "a", new AddressOfImpl<type>(0))
#define AUTO_MAT2(type, column_type) \
FieldsTrait() \
.withField(reflect<column_type>(), "a", new AddressOfImpl<type>(0)) \
.withField(reflect<column_type>(), "b", new AddressOfImpl<type>(1))

AUTO_MAT1(type, column_type).withField(reflect<column_type>(), "b", new AddressOfImpl<type>(1))
#define AUTO_MAT3(type, column_type) \
AUTO_MAT2(type, column_type).withField(reflect<column_type>(), "c", new AddressOfImpl<type>(2))

#define AUTO_MAT4(type, column_type) \
AUTO_MAT3(type, column_type).withField(reflect<column_type>(), "d", new AddressOfImpl<type>(3))

Expand Down

0 comments on commit 553695c

Please sign in to comment.