Cześć. Postanowiłem się trochę pobawić makrami i ułożyłem coś takiego:
#define CORE 0, 0, 0
#define RIGHT 1, 0, 0
#define FRONT 0, 1, 0
#define TOP 0, 0, 1
#define RIGHT_FRONT 1, 1, 0
#define RIGHT_TOP 1, 0, 1
#define FRONT_TOP 0, 1, 1
#define FAR 1, 1, 1
#define SET_TRIANGLE(right_1, top_1, front_1, right_2, top_2, front_2, right_3, top_3, front_3) \
if (cube[right_1][front_1][top_1] == 2 && cube[right_2][front_2][top_2] == 2 && cube[right_3][front_3][top_3] == 2) \
{ \
int32 v1 = verticesIndexes[x + right_1][y + front_1][z + top_1]; \
int32 v2 = verticesIndexes[x + right_2][y + front_2][z + top_2]; \
int32 v3 = verticesIndexes[x + right_3][y + front_3][z + top_3];
I wywołanie tego takie:
SET_TRIANGLE(CORE, RIGHT_FRONT, FRONT_TOP)
Założenie było takie, że pojedyncza z tych definów(CORE, RIGHT, FRONT itd) na samej górze zastąpi 3 argumenty z makra "SET_TRIANGLE", jednak program rozumie jedno takie makro jako jeden argument i w right_1 wpisuje np. 0, 0, 0. Pytanie jest takie, czy da się jakoś zmusić by rozumiał te definicje jako 3 argumenty do SET_TRIANGLE, zamiast jeden? Albo czy da się jakoś wyciągnąć pojedyncze wartości z makra? Np. RIGHT.X zwróci 1, a RIGHT.Y zwróci 0?