diff --git a/Makefile b/Makefile index 5c1f39e..9cbb759 100644 --- a/Makefile +++ b/Makefile @@ -3,12 +3,14 @@ debug: resource.res vertex.h pixel.h cl /nologo /W3 /std:c17 /c debug.c + cl /DDEBUG /nologo /W3 /std:c17 /c dynamenger.c cl /DDEBUG /nologo /W3 /std:c17 /c graphics.c - cl /DDEBUG /nologo /W3 /std:c17 /Fe:ssms.scr resource.res main.c graphics.obj debug.obj + cl /DDEBUG /nologo /W3 /std:c17 /Fe:ssms.scr resource.res main.c graphics.obj dynamenger.obj debug.obj release: resource.res vertex.h pixel.h + cl /nologo /W3 /std:c17 /c dynamenger.c cl /nologo /W3 /std:c17 /c graphics.c - cl /nologo /W3 /std:c17 /Fe:ssms.scr resource.res main.c graphics.obj + cl /nologo /W3 /std:c17 /Fe:ssms.scr resource.res main.c graphics.obj dynamenger.obj run: ssms.scr /s diff --git a/controls.h b/controls.h index d866aae..80723a8 100644 --- a/controls.h +++ b/controls.h @@ -2,6 +2,7 @@ #define LABEL_COLOUR 102 #define CTRL_SPONGE_LEVEL_1 103 #define CTRL_SPONGE_LEVEL_2 104 +#define CTRL_SPONGE_LEVEL_3 105 // REMINDER: TEXT is defined in winnt.h, not strictly necessary to include here because this header gets always included after windows.h in other files #define REGNAME_SPONGE_LEVEL TEXT("SpongeLevel") diff --git a/dynamenger.c b/dynamenger.c new file mode 100644 index 0000000..d450a6c --- /dev/null +++ b/dynamenger.c @@ -0,0 +1,775 @@ +#include "dynamenger.h" +#include + +#include "debug.h" + + + + +//////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////// +///////////////////////////INDICES////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////// + + + + + +// D3D11 GEOMETRY REMINDERS: +// +// DEFAULT POV: "ZPOV" +// X axis: left to right +// Y axis down to up +// Z axis: back to forth +// +// Left hand rule: x-middle, y-thumb, z-index +// +// triangle front face has clockwise vertices +// +// 0: X +// 1: Y +// 2: Z + + +shape* currentShape; + + +// The sort comparators, one for each axis. Currently sorting from negative to positive +int xpovCompare (void* context, const void* a, const void* b) { + + if (((vertex*) context)[*(unsigned int*) a].position[0] > ((vertex*) context)[*(unsigned int*) b].position[0]) return 1; + if (((vertex*) context)[*(unsigned int*) a].position[0] < ((vertex*) context)[*(unsigned int*) b].position[0]) return -1; + + if (((vertex*) context)[*(unsigned int*) a].position[2] > ((vertex*) context)[*(unsigned int*) b].position[2]) return 1; + if (((vertex*) context)[*(unsigned int*) a].position[2] < ((vertex*) context)[*(unsigned int*) b].position[2]) return -1; + + if (((vertex*) context)[*(unsigned int*) a].position[1] > ((vertex*) context)[*(unsigned int*) b].position[1]) return 1; + if (((vertex*) context)[*(unsigned int*) a].position[1] < ((vertex*) context)[*(unsigned int*) b].position[1]) return -1; + + return 0; +} + +int ypovCompare (void* context, const void* a, const void* b) { + + if (((vertex*) context)[*(unsigned int*) a].position[1] > ((vertex*) context)[*(unsigned int*) b].position[1]) return 1; + if (((vertex*) context)[*(unsigned int*) a].position[1] < ((vertex*) context)[*(unsigned int*) b].position[1]) return -1; + + if (((vertex*) context)[*(unsigned int*) a].position[0] > ((vertex*) context)[*(unsigned int*) b].position[0]) return 1; + if (((vertex*) context)[*(unsigned int*) a].position[0] < ((vertex*) context)[*(unsigned int*) b].position[0]) return -1; + + if (((vertex*) context)[*(unsigned int*) a].position[2] > ((vertex*) context)[*(unsigned int*) b].position[2]) return 1; + if (((vertex*) context)[*(unsigned int*) a].position[2] < ((vertex*) context)[*(unsigned int*) b].position[2]) return -1; + + return 0; +} + +int zpovCompare (void* context, const void* a, const void* b) { + + if (((vertex*) context)[*(unsigned int*) a].position[2] > ((vertex*) context)[*(unsigned int*) b].position[2]) return 1; + if (((vertex*) context)[*(unsigned int*) a].position[2] < ((vertex*) context)[*(unsigned int*) b].position[2]) return -1; + + if (((vertex*) context)[*(unsigned int*) a].position[1] > ((vertex*) context)[*(unsigned int*) b].position[1]) return 1; + if (((vertex*) context)[*(unsigned int*) a].position[1] < ((vertex*) context)[*(unsigned int*) b].position[1]) return -1; + + if (((vertex*) context)[*(unsigned int*) a].position[0] > ((vertex*) context)[*(unsigned int*) b].position[0]) return 1; + if (((vertex*) context)[*(unsigned int*) a].position[0] < ((vertex*) context)[*(unsigned int*) b].position[0]) return -1; + + return 0; +} + +int (*comparators[3])(void*, const void*, const void*) = {xpovCompare, ypovCompare, zpovCompare}; + + + + +// POV is through the selected axis, facing forward +// Vertices are sorted in arabic reading order (right-to-left, top-to-bottom) +// Get the vertices on the current layer + +// Rationale: get all the vertices on current layer, unordered. Then, use qsort with the right comparator + +// Exclude vertices out of the current layer + +// "Left hand rule" +// ZPOV: positive Y is up, positive X is right + +// CAUTION: layers is an array of pointers, fullindexmap is a pointer to an array! +// +// NOTE: is it possible to enforce const on vertices without warnings on qsort? +void buildIndexMap(vertex* vertices, unsigned int vtxcount, layer** layers, unsigned int layerCount, unsigned int** fullIndexMap, unsigned int* indexMapCount) { + + // Compute the index map total size: sum all the layer counts, then multiply by the three axes. Then, allocate the index map + *indexMapCount = 0; + for (unsigned int layerIdx = 0; layerIdx < layerCount; layerIdx++) { + *indexMapCount += layers[layerIdx]->idxCount; + } + *indexMapCount *= 3; + *fullIndexMap = calloc(*indexMapCount, sizeof **fullIndexMap); + + // Create an array that permutes the vertex order in memory with a sorted order by point of view + unsigned int* mirror = malloc(vtxcount * sizeof *mirror); + for (unsigned int i = 0; i < vtxcount; i++) { + mirror[i] = i; + } + +#ifdef DEBUG + fprintf(instanceLog, "Prepared for index construction\nVertex count: %u\nIndex map size: %u elements\n", vtxcount, *indexMapCount); +#endif + + unsigned int idxcaret = 0; + + // For each of the three axes + for (unsigned int axis = 0; axis < 3; axis++) { + + // Construct the idx permutation by sorting the mirroring array with the right comparator + qsort_s(mirror, vtxcount, sizeof mirror[0], comparators[axis], vertices); + +#ifdef DEBUG + fprintf(instanceLog, "Axis %u permutation:\nLog. ->Phys.\n", axis); + for (unsigned int i = 0; i < vtxcount; i++) { + fprintf(instanceLog, "%5u -> %5u\n", i, mirror[i]); + } +#endif + + unsigned int vtxcaret = 0; + + // POV permutation is ready; for each layer... + for (unsigned int layerIdx = 0; layerIdx < layerCount; layerIdx++) { + +#ifdef DEBUG + fprintf(instanceLog, "Building layer %u\n", layerIdx); +#endif + // ... and for each index in the layer template... + for (unsigned int i = 0; i < layers[layerIdx]->idxCount; i++, idxcaret++) { + +#ifdef DEBUG + fprintf(instanceLog, "Writing index %u, should be mapped in position %u + layers[%u]->indexmap[%u]\n", idxcaret, vtxcaret, layerIdx, i); + fprintf(instanceLog, "Index in template: %u\n", layers[layerIdx]->indexmap[i]); +#endif + // ....apply the magic + (*fullIndexMap)[idxcaret] = mirror[vtxcaret + layers[layerIdx]->indexmap[i]]; + +#ifdef DEBUG + fprintf(instanceLog, "Index %u written, result: %u\n", idxcaret, (*fullIndexMap)[idxcaret]); +#endif + } + + vtxcaret += layers[layerIdx]->vtxcount; + + } + + } + + free(mirror); +} + + +unsigned int* flipLayer(unsigned int* source, unsigned int size) { + + if (size == 0) return NULL; + + unsigned int* clone = malloc(size * sizeof *clone); + + for (unsigned int i = 0; i < size; i++) { + switch (i % 3) { + case 0: + clone[i] = source[i]; + break; + case 1: + clone[i+1] = source[i]; + break; + case 2: + clone[i-1] = source[i]; + break; + } + } + + return clone; +} + + + + + + + + + + + + + + + + +#include "mengerL0.h" +#include "mengerL1.h" +#include "mengerL2.h" +#include "mengerL3.h" + + + + +//////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////// +///////////////////////////VERTICES///////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////// + + +typedef struct { + vertex* inner; + vertex* planeXp; + vertex* planeXn; + vertex* planeYp; + vertex* planeYn; + vertex* planeZp; + vertex* planeZn; + unsigned int innerCount; + unsigned int planeCount; + +} replica; + + +replica base = {0}; + + +float pppTransform[4][4] = { + {1.f/3, 0, 0, 0}, + {0, 1.f/3, 0, 0}, + {0, 0, 1.f/3, 0}, + { 2.f/3 * SU, 2.f/3 * SU, 2.f/3 * SU, 1}, +}; +float ppnTransform[4][4] = { + {1.f/3, 0, 0, 0}, + {0, 1.f/3, 0, 0}, + {0, 0, 1.f/3, 0}, + { 2.f/3 * SU, 2.f/3 * SU, -2.f/3 * SU, 1}, +}; +float pnpTransform[4][4] = { + {1.f/3, 0, 0, 0}, + {0, 1.f/3, 0, 0}, + {0, 0, 1.f/3, 0}, + { 2.f/3 * SU, -2.f/3 * SU, 2.f/3 * SU, 1}, +}; +float pnnTransform[4][4] = { + {1.f/3, 0, 0, 0}, + {0, 1.f/3, 0, 0}, + {0, 0, 1.f/3, 0}, + { 2.f/3 * SU, -2.f/3 * SU, -2.f/3 * SU, 1}, +}; + +float nppTransform[4][4] = { + {1.f/3, 0, 0, 0}, + {0, 1.f/3, 0, 0}, + {0, 0, 1.f/3, 0}, + {-2.f/3 * SU, 2.f/3 * SU, 2.f/3 * SU, 1}, +}; +float npnTransform[4][4] = { + {1.f/3, 0, 0, 0}, + {0, 1.f/3, 0, 0}, + {0, 0, 1.f/3, 0}, + {-2.f/3 * SU, 2.f/3 * SU, -2.f/3 * SU, 1}, +}; +float nnpTransform[4][4] = { + {1.f/3, 0, 0, 0}, + {0, 1.f/3, 0, 0}, + {0, 0, 1.f/3, 0}, + {-2.f/3 * SU, -2.f/3 * SU, 2.f/3 * SU, 1}, +}; +float nnnTransform[4][4] = { + {1.f/3, 0, 0, 0}, + {0, 1.f/3, 0, 0}, + {0, 0, 1.f/3, 0}, + {-2.f/3 * SU, -2.f/3 * SU, -2.f/3 * SU, 1}, +}; + + + +float cppTransform[4][4] = { + {1.f/3, 0, 0, 0}, + {0, 1.f/3, 0, 0}, + {0, 0, 1.f/3, 0}, + { 0, 2.f/3 * SU, 2.f/3 * SU, 1}, +}; +float cpnTransform[4][4] = { + {1.f/3, 0, 0, 0}, + {0, 1.f/3, 0, 0}, + {0, 0, 1.f/3, 0}, + { 0, 2.f/3 * SU, -2.f/3 * SU, 1}, +}; +float cnpTransform[4][4] = { + {1.f/3, 0, 0, 0}, + {0, 1.f/3, 0, 0}, + {0, 0, 1.f/3, 0}, + { 0, -2.f/3 * SU, 2.f/3 * SU, 1}, +}; +float cnnTransform[4][4] = { + {1.f/3, 0, 0, 0}, + {0, 1.f/3, 0, 0}, + {0, 0, 1.f/3, 0}, + { 0, -2.f/3 * SU, -2.f/3 * SU, 1}, +}; + +float pcpTransform[4][4] = { + {1.f/3, 0, 0, 0}, + {0, 1.f/3, 0, 0}, + {0, 0, 1.f/3, 0}, + { 2.f/3 * SU, 0, 2.f/3 * SU, 1}, +}; +float pcnTransform[4][4] = { + {1.f/3, 0, 0, 0}, + {0, 1.f/3, 0, 0}, + {0, 0, 1.f/3, 0}, + { 2.f/3 * SU, 0, -2.f/3 * SU, 1}, +}; +float ncpTransform[4][4] = { + {1.f/3, 0, 0, 0}, + {0, 1.f/3, 0, 0}, + {0, 0, 1.f/3, 0}, + {-2.f/3 * SU, 0, 2.f/3 * SU, 1}, +}; +float ncnTransform[4][4] = { + {1.f/3, 0, 0, 0}, + {0, 1.f/3, 0, 0}, + {0, 0, 1.f/3, 0}, + {-2.f/3 * SU, 0, -2.f/3 * SU, 1}, +}; + +float ppcTransform[4][4] = { + {1.f/3, 0, 0, 0}, + {0, 1.f/3, 0, 0}, + {0, 0, 1.f/3, 0}, + { 2.f/3 * SU, 2.f/3 * SU, 0, 1}, +}; +float pncTransform[4][4] = { + {1.f/3, 0, 0, 0}, + {0, 1.f/3, 0, 0}, + {0, 0, 1.f/3, 0}, + { 2.f/3 * SU, -2.f/3 * SU, 0, 1}, +}; +float npcTransform[4][4] = { + {1.f/3, 0, 0, 0}, + {0, 1.f/3, 0, 0}, + {0, 0, 1.f/3, 0}, + {-2.f/3 * SU, 2.f/3 * SU, 0, 1}, +}; +float nncTransform[4][4] = { + {1.f/3, 0, 0, 0}, + {0, 1.f/3, 0, 0}, + {0, 0, 1.f/3, 0}, + {-2.f/3 * SU, -2.f/3 * SU, 0, 1}, +}; + + +void applyTransform(float* vector, float transform[4][4]) { + + float x = vector[0] * transform[0][0] + vector[1] * transform[1][0] + vector[2] * transform[2][0] + vector[3] * transform[3][0]; + float y = vector[0] * transform[0][1] + vector[1] * transform[1][1] + vector[2] * transform[2][1] + vector[3] * transform[3][1]; + float z = vector[0] * transform[0][2] + vector[1] * transform[1][2] + vector[2] * transform[2][2] + vector[3] * transform[3][2]; + float w = vector[0] * transform[0][3] + vector[1] * transform[1][3] + vector[2] * transform[2][3] + vector[3] * transform[3][3]; + + vector[0] = x; + vector[1] = y; + vector[2] = z; + vector[3] = w; +} + + +void cloneVertices(vertex* dest, unsigned int* caret, vertex* plane, const unsigned int count, float transform[4][4]) { + +#ifdef DEBUG + fprintf(instanceLog, "Cloning %u vertices on caret %u; source %p, dest %p\n", count, *caret, plane, dest); +#endif + memcpy(dest + *caret, plane, count * sizeof *plane); + for (unsigned int i = 0; i < count; i++) { +#ifdef DEBUG + fprintf(instanceLog, "Vertex %5d: % f, % f, % f, % f", *caret + i, dest[*caret + i].position[0], dest[*caret + i].position[1], dest[*caret + i].position[2], dest[*caret + i].position[3]); +#endif + applyTransform(dest[*caret + i].position, transform); +#ifdef DEBUG + fprintf(instanceLog, " -> % f, % f, % f, % f\n", dest[*caret + i].position[0], dest[*caret + i].position[1], dest[*caret + i].position[2], dest[*caret + i].position[3]); +#endif + } + *caret += count; +} + + +void levelUp(replica* block) { + + unsigned int biginnerCount = block->innerCount * 20 + block->planeCount * 24 + 8; + unsigned int bigplaneCount = block->planeCount * 8 + 4; + +#ifdef DEBUG + fprintf(instanceLog, "About to level up; expected vertex counts: 8 outer + 6 * %u side + %u inner = %u total\n", bigplaneCount, biginnerCount, 8 + 6 * bigplaneCount + biginnerCount); + fprintf(instanceLog, "block addresses: %p %p %p %p %p %p %p\n", block->inner, block->planeXp, block->planeXn, block->planeYp, block->planeYn, block->planeZp, block->planeZn); +#endif + + // Guaranteed not to invoke malloc(0), as the sizeof coefficients have an additive, positive constant + vertex* biginner = malloc(biginnerCount * sizeof *(biginner)); + vertex* bigplaneXp = malloc(bigplaneCount * sizeof *(bigplaneXp)); + vertex* bigplaneXn = malloc(bigplaneCount * sizeof *(bigplaneXn)); + vertex* bigplaneYp = malloc(bigplaneCount * sizeof *(bigplaneYp)); + vertex* bigplaneYn = malloc(bigplaneCount * sizeof *(bigplaneYn)); + vertex* bigplaneZp = malloc(bigplaneCount * sizeof *(bigplaneZp)); + vertex* bigplaneZn = malloc(bigplaneCount * sizeof *(bigplaneZn)); + +#ifdef DEBUG + fprintf(instanceLog, "clone addresses: %p %p %p %p %p %p %p\n", biginner, bigplaneXp, bigplaneXn, bigplaneYp, bigplaneYn, bigplaneZp, bigplaneZn); + + fprintf(instanceLog, "buffers allocated\n"); +#endif + + + // INNER + unsigned int innerCaret = 0; + + // The 8 grid vertices + biginner[innerCaret++] = (vertex) {{ SU/3, SU/3, -SU/3, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + biginner[innerCaret++] = (vertex) {{ SU/3, -SU/3, -SU/3, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + biginner[innerCaret++] = (vertex) {{-SU/3, SU/3, -SU/3, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + biginner[innerCaret++] = (vertex) {{-SU/3, -SU/3, -SU/3, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + biginner[innerCaret++] = (vertex) {{ SU/3, SU/3, SU/3, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + biginner[innerCaret++] = (vertex) {{ SU/3, -SU/3, SU/3, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + biginner[innerCaret++] = (vertex) {{-SU/3, SU/3, SU/3, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + biginner[innerCaret++] = (vertex) {{-SU/3, -SU/3, SU/3, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + + // The 20 blocks + cloneVertices(biginner, &innerCaret, block->inner, block->innerCount, pppTransform); + cloneVertices(biginner, &innerCaret, block->inner, block->innerCount, ppnTransform); + cloneVertices(biginner, &innerCaret, block->inner, block->innerCount, pnpTransform); + cloneVertices(biginner, &innerCaret, block->inner, block->innerCount, pnnTransform); + cloneVertices(biginner, &innerCaret, block->inner, block->innerCount, nppTransform); + cloneVertices(biginner, &innerCaret, block->inner, block->innerCount, npnTransform); + cloneVertices(biginner, &innerCaret, block->inner, block->innerCount, nnpTransform); + cloneVertices(biginner, &innerCaret, block->inner, block->innerCount, nnnTransform); + cloneVertices(biginner, &innerCaret, block->inner, block->innerCount, cppTransform); + cloneVertices(biginner, &innerCaret, block->inner, block->innerCount, cpnTransform); + cloneVertices(biginner, &innerCaret, block->inner, block->innerCount, cnpTransform); + cloneVertices(biginner, &innerCaret, block->inner, block->innerCount, cnnTransform); + cloneVertices(biginner, &innerCaret, block->inner, block->innerCount, pcpTransform); + cloneVertices(biginner, &innerCaret, block->inner, block->innerCount, pcnTransform); + cloneVertices(biginner, &innerCaret, block->inner, block->innerCount, ncpTransform); + cloneVertices(biginner, &innerCaret, block->inner, block->innerCount, ncnTransform); + cloneVertices(biginner, &innerCaret, block->inner, block->innerCount, ppcTransform); + cloneVertices(biginner, &innerCaret, block->inner, block->innerCount, pncTransform); + cloneVertices(biginner, &innerCaret, block->inner, block->innerCount, npcTransform); + cloneVertices(biginner, &innerCaret, block->inner, block->innerCount, nncTransform); + +#ifdef DEBUG + fprintf(instanceLog, "inner inners done\n"); +#endif + + // Inner sides - X + cloneVertices(biginner, &innerCaret, block->planeYn, block->planeCount, cppTransform); + cloneVertices(biginner, &innerCaret, block->planeZn, block->planeCount, cppTransform); + cloneVertices(biginner, &innerCaret, block->planeYn, block->planeCount, cpnTransform); + cloneVertices(biginner, &innerCaret, block->planeZp, block->planeCount, cpnTransform); + cloneVertices(biginner, &innerCaret, block->planeYp, block->planeCount, cnpTransform); + cloneVertices(biginner, &innerCaret, block->planeZn, block->planeCount, cnpTransform); + cloneVertices(biginner, &innerCaret, block->planeYp, block->planeCount, cnnTransform); + cloneVertices(biginner, &innerCaret, block->planeZp, block->planeCount, cnnTransform); + + // Inner sides - Y + cloneVertices(biginner, &innerCaret, block->planeXn, block->planeCount, pcpTransform); + cloneVertices(biginner, &innerCaret, block->planeZn, block->planeCount, pcpTransform); + cloneVertices(biginner, &innerCaret, block->planeXn, block->planeCount, pcnTransform); + cloneVertices(biginner, &innerCaret, block->planeZp, block->planeCount, pcnTransform); + cloneVertices(biginner, &innerCaret, block->planeXp, block->planeCount, ncpTransform); + cloneVertices(biginner, &innerCaret, block->planeZn, block->planeCount, ncpTransform); + cloneVertices(biginner, &innerCaret, block->planeXp, block->planeCount, ncnTransform); + cloneVertices(biginner, &innerCaret, block->planeZp, block->planeCount, ncnTransform); + + // Inner sides - Z + cloneVertices(biginner, &innerCaret, block->planeXn, block->planeCount, ppcTransform); + cloneVertices(biginner, &innerCaret, block->planeYn, block->planeCount, ppcTransform); + cloneVertices(biginner, &innerCaret, block->planeXn, block->planeCount, pncTransform); + cloneVertices(biginner, &innerCaret, block->planeYp, block->planeCount, pncTransform); + cloneVertices(biginner, &innerCaret, block->planeXp, block->planeCount, npcTransform); + cloneVertices(biginner, &innerCaret, block->planeYn, block->planeCount, npcTransform); + cloneVertices(biginner, &innerCaret, block->planeXp, block->planeCount, nncTransform); + cloneVertices(biginner, &innerCaret, block->planeYp, block->planeCount, nncTransform); + +#ifdef DEBUG + fprintf(instanceLog, "inner done\n"); +#endif + + // PLANES + +#ifdef DEBUG + fprintf(instanceLog, "Xp\n"); +#endif + // Xp + innerCaret = 0; + cloneVertices(bigplaneXp, &innerCaret, block->planeXp, block->planeCount, pppTransform); + cloneVertices(bigplaneXp, &innerCaret, block->planeXp, block->planeCount, pcpTransform); + cloneVertices(bigplaneXp, &innerCaret, block->planeXp, block->planeCount, pnpTransform); + cloneVertices(bigplaneXp, &innerCaret, block->planeXp, block->planeCount, pncTransform); + cloneVertices(bigplaneXp, &innerCaret, block->planeXp, block->planeCount, pnnTransform); + cloneVertices(bigplaneXp, &innerCaret, block->planeXp, block->planeCount, pcnTransform); + cloneVertices(bigplaneXp, &innerCaret, block->planeXp, block->planeCount, ppnTransform); + cloneVertices(bigplaneXp, &innerCaret, block->planeXp, block->planeCount, ppcTransform); + bigplaneXp[innerCaret++] = (vertex) {{ SU, SU/3, SU/3, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + bigplaneXp[innerCaret++] = (vertex) {{ SU, SU/3, -SU/3, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + bigplaneXp[innerCaret++] = (vertex) {{ SU, -SU/3, SU/3, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + bigplaneXp[innerCaret++] = (vertex) {{ SU, -SU/3, -SU/3, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + +#ifdef DEBUG + fprintf(instanceLog, "Xn\n"); +#endif + // Xn + innerCaret = 0; + cloneVertices(bigplaneXn, &innerCaret, block->planeXn, block->planeCount, nppTransform); + cloneVertices(bigplaneXn, &innerCaret, block->planeXn, block->planeCount, ncpTransform); + cloneVertices(bigplaneXn, &innerCaret, block->planeXn, block->planeCount, nnpTransform); + cloneVertices(bigplaneXn, &innerCaret, block->planeXn, block->planeCount, nncTransform); + cloneVertices(bigplaneXn, &innerCaret, block->planeXn, block->planeCount, nnnTransform); + cloneVertices(bigplaneXn, &innerCaret, block->planeXn, block->planeCount, ncnTransform); + cloneVertices(bigplaneXn, &innerCaret, block->planeXn, block->planeCount, npnTransform); + cloneVertices(bigplaneXn, &innerCaret, block->planeXn, block->planeCount, npcTransform); + bigplaneXn[innerCaret++] = (vertex) {{-SU, SU/3, SU/3, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + bigplaneXn[innerCaret++] = (vertex) {{-SU, SU/3, -SU/3, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + bigplaneXn[innerCaret++] = (vertex) {{-SU, -SU/3, SU/3, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + bigplaneXn[innerCaret++] = (vertex) {{-SU, -SU/3, -SU/3, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + + +#ifdef DEBUG + fprintf(instanceLog, "Yp\n"); +#endif + // Yp + innerCaret = 0; + cloneVertices(bigplaneYp, &innerCaret, block->planeYp, block->planeCount, pppTransform); + cloneVertices(bigplaneYp, &innerCaret, block->planeYp, block->planeCount, cppTransform); + cloneVertices(bigplaneYp, &innerCaret, block->planeYp, block->planeCount, nppTransform); + cloneVertices(bigplaneYp, &innerCaret, block->planeYp, block->planeCount, npcTransform); + cloneVertices(bigplaneYp, &innerCaret, block->planeYp, block->planeCount, npnTransform); + cloneVertices(bigplaneYp, &innerCaret, block->planeYp, block->planeCount, cpnTransform); + cloneVertices(bigplaneYp, &innerCaret, block->planeYp, block->planeCount, ppnTransform); + cloneVertices(bigplaneYp, &innerCaret, block->planeYp, block->planeCount, ppcTransform); + bigplaneYp[innerCaret++] = (vertex) {{ SU/3, SU, SU/3, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + bigplaneYp[innerCaret++] = (vertex) {{ SU/3, SU, -SU/3, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + bigplaneYp[innerCaret++] = (vertex) {{-SU/3, SU, SU/3, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + bigplaneYp[innerCaret++] = (vertex) {{-SU/3, SU, -SU/3, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + +#ifdef DEBUG + fprintf(instanceLog, "Yn\n"); +#endif + // Yn + innerCaret = 0; + cloneVertices(bigplaneYn, &innerCaret, block->planeYn, block->planeCount, pnpTransform); + cloneVertices(bigplaneYn, &innerCaret, block->planeYn, block->planeCount, cnpTransform); + cloneVertices(bigplaneYn, &innerCaret, block->planeYn, block->planeCount, nnpTransform); + cloneVertices(bigplaneYn, &innerCaret, block->planeYn, block->planeCount, nncTransform); + cloneVertices(bigplaneYn, &innerCaret, block->planeYn, block->planeCount, nnnTransform); + cloneVertices(bigplaneYn, &innerCaret, block->planeYn, block->planeCount, cnnTransform); + cloneVertices(bigplaneYn, &innerCaret, block->planeYn, block->planeCount, pnnTransform); + cloneVertices(bigplaneYn, &innerCaret, block->planeYn, block->planeCount, pncTransform); + bigplaneYn[innerCaret++] = (vertex) {{ SU/3, -SU, SU/3, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + bigplaneYn[innerCaret++] = (vertex) {{ SU/3, -SU, -SU/3, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + bigplaneYn[innerCaret++] = (vertex) {{-SU/3, -SU, SU/3, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + bigplaneYn[innerCaret++] = (vertex) {{-SU/3, -SU, -SU/3, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + + +#ifdef DEBUG + fprintf(instanceLog, "Zp\n"); +#endif + // Zp + innerCaret = 0; + cloneVertices(bigplaneZp, &innerCaret, block->planeZp, block->planeCount, pppTransform); + cloneVertices(bigplaneZp, &innerCaret, block->planeZp, block->planeCount, cppTransform); + cloneVertices(bigplaneZp, &innerCaret, block->planeZp, block->planeCount, nppTransform); + cloneVertices(bigplaneZp, &innerCaret, block->planeZp, block->planeCount, ncpTransform); + cloneVertices(bigplaneZp, &innerCaret, block->planeZp, block->planeCount, nnpTransform); + cloneVertices(bigplaneZp, &innerCaret, block->planeZp, block->planeCount, cnpTransform); + cloneVertices(bigplaneZp, &innerCaret, block->planeZp, block->planeCount, pnpTransform); + cloneVertices(bigplaneZp, &innerCaret, block->planeZp, block->planeCount, pcpTransform); + bigplaneZp[innerCaret++] = (vertex) {{ SU/3, SU/3, SU, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + bigplaneZp[innerCaret++] = (vertex) {{ SU/3, -SU/3, SU, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + bigplaneZp[innerCaret++] = (vertex) {{-SU/3, SU/3, SU, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + bigplaneZp[innerCaret++] = (vertex) {{-SU/3, -SU/3, SU, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + +#ifdef DEBUG + fprintf(instanceLog, "Zn\n"); +#endif + // Zn + innerCaret = 0; + cloneVertices(bigplaneZn, &innerCaret, block->planeZn, block->planeCount, ppnTransform); + cloneVertices(bigplaneZn, &innerCaret, block->planeZn, block->planeCount, cpnTransform); + cloneVertices(bigplaneZn, &innerCaret, block->planeZn, block->planeCount, npnTransform); + cloneVertices(bigplaneZn, &innerCaret, block->planeZn, block->planeCount, ncnTransform); + cloneVertices(bigplaneZn, &innerCaret, block->planeZn, block->planeCount, nnnTransform); + cloneVertices(bigplaneZn, &innerCaret, block->planeZn, block->planeCount, cnnTransform); + cloneVertices(bigplaneZn, &innerCaret, block->planeZn, block->planeCount, pnnTransform); + cloneVertices(bigplaneZn, &innerCaret, block->planeZn, block->planeCount, pcnTransform); + bigplaneZn[innerCaret++] = (vertex) {{ SU/3, SU/3, -SU, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + bigplaneZn[innerCaret++] = (vertex) {{ SU/3, -SU/3, -SU, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + bigplaneZn[innerCaret++] = (vertex) {{-SU/3, SU/3, -SU, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + bigplaneZn[innerCaret++] = (vertex) {{-SU/3, -SU/3, -SU, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}; + + +#ifdef DEBUG + fprintf(instanceLog, "sides done\n"); +#endif + + free(block->inner); + free(block->planeXp); + free(block->planeXn); + free(block->planeYp); + free(block->planeYn); + free(block->planeZp); + free(block->planeZn); + + block->inner = biginner; + block->planeXp = bigplaneXp; + block->planeXn = bigplaneXn; + block->planeYp = bigplaneYp; + block->planeYn = bigplaneYn; + block->planeZp = bigplaneZp; + block->planeZn = bigplaneZn; + + block->innerCount = biginnerCount; + block->planeCount = bigplaneCount; + +} + + +#define SSMS_EPSILON 0.00001f +void adjust(vertex* vertices, unsigned int count, int level) { + + // Create the array of canonical values + int divisor = 1; + for (int i = 0; i < level; divisor *= 3, i++); + + float* canons = malloc((divisor + 1) * sizeof *canons); + + int dividend = divisor; + for (int i = 0; i <= divisor; i++) { + canons[i] = SU * ((float) dividend / divisor); + dividend -= 2; + } + +#ifdef DEBUG + fprintf(instanceLog, "Canonical values: \n"); + for (int i = 0; i <= divisor; i++) { + fprintf(instanceLog, "% f\n", canons[i]); + } +#endif + + // Adjust all the vertices + for (unsigned int i = 0; i < count; i++) { + for (unsigned int dim = 0; dim < 3; dim++) { + for (int canon = 0; canon <= divisor; canon++) { + if (vertices[i].position[dim] < canons[canon] + SSMS_EPSILON && vertices[i].position[dim] > canons[canon] - SSMS_EPSILON) { + vertices[i].position[dim] = canons[canon]; + } + } + } + } + +} + + +vertex* flatten(replica* sponge) { + + vertex* vtx = malloc((8 + sponge->innerCount + 6 * sponge->planeCount) * sizeof *(sponge->inner)); + + memcpy(vtx , mengerL0_vtcs , 8 * sizeof *(sponge->inner)); + memcpy(vtx + 8 , sponge->inner , sponge->innerCount * sizeof *(sponge->inner)); + memcpy(vtx + 8 + sponge->innerCount , sponge->planeXp, sponge->planeCount * sizeof *(sponge->inner)); + memcpy(vtx + 8 + sponge->innerCount + sponge->planeCount , sponge->planeXn, sponge->planeCount * sizeof *(sponge->inner)); + memcpy(vtx + 8 + sponge->innerCount + sponge->planeCount * 2, sponge->planeYp, sponge->planeCount * sizeof *(sponge->inner)); + memcpy(vtx + 8 + sponge->innerCount + sponge->planeCount * 3, sponge->planeYn, sponge->planeCount * sizeof *(sponge->inner)); + memcpy(vtx + 8 + sponge->innerCount + sponge->planeCount * 4, sponge->planeZp, sponge->planeCount * sizeof *(sponge->inner)); + memcpy(vtx + 8 + sponge->innerCount + sponge->planeCount * 5, sponge->planeZn, sponge->planeCount * sizeof *(sponge->inner)); + + free(sponge->inner); + free(sponge->planeXp); + free(sponge->planeXn); + free(sponge->planeYp); + free(sponge->planeYn); + free(sponge->planeZp); + free(sponge->planeZn); + + + return vtx; +} + + + +//////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////// +///////////////////////////BUILDER////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////// + + +void buildShape(int spongeLevel) { + + + + switch (spongeLevel) { + case 0: + currentShape = &mengerL0; + break; + + case 1: + currentShape = &mengerL1; + break; + + case 2: + currentShape = &mengerL2; + break; + + case 3: + currentShape = &mengerL3; + break; + } + + // Write down the vertices + for (int i = 0; i < spongeLevel; levelUp(&base), i++); + + +#ifdef DEBUG + fprintf(instanceLog, "Flattening\n"); +#endif + + currentShape->vertices = flatten(&base); + currentShape->vertexCount = base.innerCount + 8 + 6 * base.planeCount; + currentShape->vertexSize = currentShape->vertexCount * sizeof *(currentShape->vertices); + +#ifdef DEBUG + fprintf(instanceLog, "Adjusting\n"); +#endif + + adjust(currentShape->vertices, currentShape->vertexCount, spongeLevel); + +#ifdef DEBUG + fprintf(instanceLog, "Flipping templates\n"); +#endif + + (*(currentShape->compileLayers))(); + +#ifdef DEBUG + fprintf(instanceLog, "Building index map\n"); +#endif + + + buildIndexMap(currentShape->vertices, currentShape->vertexCount, currentShape->layers, currentShape->layerCount, &(currentShape->indices), &(currentShape->indexCount)); + +#ifdef DEBUG + fprintf(instanceLog, "Map built, size: %u\n", currentShape->indexCount); + + for (unsigned int i = 0; i < currentShape->indexCount; i++){ + fprintf(instanceLog, "%u\n", currentShape->indices[i]); + } +#endif + + currentShape->indexSize = (currentShape->indexCount) * sizeof *(currentShape->indices); + +#ifdef DEBUG + fprintf(instanceLog, "Shape: vtxbytes %u, idxbytes %u, idxcount %u\n", mengerL0.vertexSize, mengerL0.indexSize, mengerL0.indexCount); +#endif +} + + diff --git a/dynamenger.h b/dynamenger.h new file mode 100644 index 0000000..d3eb1ce --- /dev/null +++ b/dynamenger.h @@ -0,0 +1,35 @@ +#define SIDE_UNIT 0.4f + +// Shortened name for vertex maps +#define SU SIDE_UNIT + + +// The struct that models a 3D RGBA vertex, +typedef struct { + float position[4]; + float colour[4]; +} vertex; + +typedef struct { + unsigned int vtxcount; + unsigned int idxCount; + unsigned int* indexmap; +} layer; + +typedef struct { + vertex* vertices; + unsigned int* indices; + unsigned int vertexSize; + unsigned int indexSize; + unsigned int indexCount; + unsigned int vertexCount; + layer** layers; + unsigned int layerCount; + void (*compileLayers)(); +} shape; + + +extern shape* currentShape; + + +void buildShape(); diff --git a/graphics.c b/graphics.c index 20856b2..51b6e15 100644 --- a/graphics.c +++ b/graphics.c @@ -15,6 +15,45 @@ #include "vertex.h" #include "pixel.h" +#include "dynamenger.h" + + + +// The world transforms struct, and the transforms +typedef struct { + float orientMatrix[4][4]; + float pointTranslateMatrix[4][4]; + float rotateMatrix[4][4]; + float translateMatrix[4][4]; +} transformMatrices; + + +transformMatrices transforms = { + .orientMatrix = { + {1.0f, 0.0f, 0.0f, 0.0f}, + {0.0f, 1.0f, 0.0f, 0.0f}, + {0.0f, 0.0f, 1.0f, 0.0f}, + {0.0f, 0.0f, 0.0f, 1.0f}, + }, + .pointTranslateMatrix = { + {1.0f, 0.0f, 0.0f, 0.0f}, + {0.0f, 1.0f, 0.0f, 0.0f}, + {0.0f, 0.0f, 1.0f, 0.0f}, + {0.0f, 0.0f, 0.0f, 1.0f}, + }, + .rotateMatrix = { + {1.0f, 0.0f, 0.0f, 0.0f}, + {0.0f, 1.0f, 0.0f, 0.0f}, + {0.0f, 0.0f, 1.0f, 0.0f}, + {0.0f, 0.0f, 0.0f, 1.0f}, + }, + .translateMatrix = { + {1.0f, 0.0f, 0.0f, 0.0f}, + {0.0f, 1.0f, 0.0f, 0.0f}, + {0.0f, 0.0f, 1.0f, 0.3f}, + {0.0f, 0.0f, 0.0f, 1.0f}, + }, +}; @@ -54,7 +93,6 @@ D3D11_VIEWPORT viewport; - // Axes orientation, observer's point of view: // // X: right @@ -64,16 +102,11 @@ D3D11_VIEWPORT viewport; // Triangles that are counter-clockwise are culled by default -// The struct that models a 3D RGBA vertex, along with the format description required by the Input Assembly stage -typedef struct { - float x, y, z; - float colour[4]; -} vertex; - +// The vertex format description required by the Input Assembly stage; has to accurately match the vertex type D3D11_INPUT_ELEMENT_DESC vertexInputSpec[2] = { { .SemanticName = "POSITION", // The HLSL semantic associated with this element in a shader input-signature - .Format = DXGI_FORMAT_R32G32B32_FLOAT, // The data type of the element data + .Format = DXGI_FORMAT_R32G32B32A32_FLOAT, // The data type of the element data .AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT, // Offset (in bytes) from the start of the vertex .InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA // Identifies the input data class for a single input slot }, @@ -85,74 +118,6 @@ D3D11_INPUT_ELEMENT_DESC vertexInputSpec[2] = { } }; -#include "mengerL1.h" -#include "mengerL2.h" - -struct shape_impl { - vertex* vertices; - unsigned int* indices; - UINT vertexSize; - UINT indexSize; - UINT indexCount; -}; - -shape mengerL1 = { - .vertices = mengerL1_vtcs, - .indices = mengerL1_idcs, - .vertexSize = sizeof mengerL1_vtcs, - .indexSize = sizeof mengerL1_idcs, - .indexCount = sizeof mengerL1_idcs / sizeof (unsigned int), -}; - -shape mengerL2 = { - .vertices = mengerL2_vtcs, - .indices = mengerL2_idcs, - .vertexSize = sizeof mengerL2_vtcs, - .indexSize = sizeof mengerL2_idcs, - .indexCount = sizeof mengerL2_idcs / sizeof (unsigned int), -}; - - -shape* currentShape; - - -// The world transforms struct, and the transforms -typedef struct { - float orientMatrix[4][4]; - float pointTranslateMatrix[4][4]; - float rotateMatrix[4][4]; - float translateMatrix[4][4]; -} transformMatrices; - - -transformMatrices transforms = { - .orientMatrix = { - {1.0f, 0.0f, 0.0f, 0.0f}, - {0.0f, 1.0f, 0.0f, 0.0f}, - {0.0f, 0.0f, 1.0f, 0.0f}, - {0.0f, 0.0f, 0.0f, 1.0f}, - }, - .pointTranslateMatrix = { - {1.0f, 0.0f, 0.0f, 0.0f}, - {0.0f, 1.0f, 0.0f, 0.0f}, - {0.0f, 0.0f, 1.0f, 0.0f}, - {0.0f, 0.0f, 0.0f, 1.0f}, - }, - .rotateMatrix = { - {1.0f, 0.0f, 0.0f, 0.0f}, - {0.0f, 1.0f, 0.0f, 0.0f}, - {0.0f, 0.0f, 1.0f, 0.0f}, - {0.0f, 0.0f, 0.0f, 1.0f}, - }, - .translateMatrix = { - {1.0f, 0.0f, 0.0f, 0.0f}, - {0.0f, 1.0f, 0.0f, 0.0f}, - {0.0f, 0.0f, 1.0f, 0.3f}, - {0.0f, 0.0f, 0.0f, 1.0f}, - }, -}; - - // All the description structures; may result useful for quicker changes diff --git a/graphics.h b/graphics.h index f2579f8..569f4bf 100644 --- a/graphics.h +++ b/graphics.h @@ -7,12 +7,6 @@ #include -typedef struct shape_impl shape; - -extern shape mengerL1; -extern shape mengerL2; -extern shape* currentShape; - void InitD3D(HWND window, int width, int height); void resizeD3D(int width, int height); @@ -20,3 +14,5 @@ void resizeD3D(int width, int height); void CALLBACK RenderFrame(HWND window, UINT message, UINT_PTR timerID, DWORD currentTime); void CleanD3D(); + +void buildShape(); diff --git a/main.c b/main.c index 3f3a1ce..e50b8ac 100644 --- a/main.c +++ b/main.c @@ -14,6 +14,7 @@ #include #include "graphics.h" +#include "dynamenger.h" #pragma comment(lib, "user32.lib") #pragma comment(lib, "comctl32.lib") @@ -43,7 +44,7 @@ void GetScrConfig() { // DOWNCAST switch (RegQueryValueEx(rootKey, REGNAME_SPONGE_LEVEL, NULL, ®TypeSpongeLevel, (LPVOID) &spongeLevel, &slSize)) { case ERROR_SUCCESS: - if (regTypeSpongeLevel != REG_DWORD || spongeLevel < 1 || spongeLevel > 2) { + if (regTypeSpongeLevel != REG_DWORD || spongeLevel < 1 || spongeLevel > 3) { spongeLevel = 1; } break; @@ -89,14 +90,8 @@ LRESULT WINAPI ScreenSaverProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP fprintf(instanceLog, "Sponge level: %lu\n", spongeLevel); #endif - switch (spongeLevel) { - case 1: - currentShape = &mengerL1; - break; - case 2: - currentShape = &mengerL2; - break; - } + // Let Dynamenger do the hard work + buildShape(spongeLevel); // Get window info, and start the engines CREATESTRUCT* wInfo = (CREATESTRUCT*) lParam; @@ -159,6 +154,9 @@ BOOL WINAPI ScreenSaverConfigureDialog(HWND hDlg, UINT message, WPARAM wParam, L case 2: CheckRadioButton(hDlg, CTRL_SPONGE_LEVEL_1, CTRL_SPONGE_LEVEL_2, CTRL_SPONGE_LEVEL_2); break; + case 3: + CheckRadioButton(hDlg, CTRL_SPONGE_LEVEL_3, CTRL_SPONGE_LEVEL_3, CTRL_SPONGE_LEVEL_3); + break; } return TRUE; @@ -173,6 +171,9 @@ BOOL WINAPI ScreenSaverConfigureDialog(HWND hDlg, UINT message, WPARAM wParam, L case CTRL_SPONGE_LEVEL_2: spongeLevel = 2; return TRUE; + case CTRL_SPONGE_LEVEL_3: + spongeLevel = 3; + return TRUE; case IDOK: RegSetValueEx(rootKey, REGNAME_SPONGE_LEVEL, 0, REG_DWORD, (LPVOID) &spongeLevel, sizeof spongeLevel); case IDCANCEL: diff --git a/mengerL0.h b/mengerL0.h new file mode 100644 index 0000000..1463609 --- /dev/null +++ b/mengerL0.h @@ -0,0 +1,35 @@ +vertex mengerL0_vtcs[] = { + {{ SU, SU, -SU, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}, + {{ SU, -SU, -SU, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}, + {{-SU, SU, -SU, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}, + {{-SU, -SU, -SU, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}, + {{ SU, SU, SU, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}, + {{ SU, -SU, SU, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}, + {{-SU, SU, SU, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}, + {{-SU, -SU, SU, 1}, {0.3f, 0.3f, 0.3f, 1.0f}}, +}; + + +layer* L0_layers[2] = { + &((layer){ + .vtxcount = 4, + .idxCount = 6, + .indexmap = ((unsigned int[6]) {0, 2, 1, 1, 2, 3}), // Negative layer - counter + }), + &((layer){ + .vtxcount = 4, + .idxCount = 6, + .indexmap = ((unsigned int[6]) {0, 1, 2, 1, 3, 2}), // Positive layer - clock + }), +}; + +void L0_completeLayers() {} + +shape mengerL0 = { + .vertices = mengerL0_vtcs, + .vertexSize = sizeof mengerL0_vtcs, + .vertexCount = sizeof mengerL0_vtcs / sizeof mengerL0_vtcs[0], + .layers = L0_layers, + .layerCount = sizeof L0_layers / sizeof L0_layers[0], + .compileLayers = &L0_completeLayers +}; diff --git a/mengerL1.h b/mengerL1.h index 18b9cd0..5910e27 100644 --- a/mengerL1.h +++ b/mengerL1.h @@ -1,162 +1,36 @@ - - -// The shape vertices themselves, and their indices; buckle up... -vertex mengerL1_vtcs[] = { - { 0.4f, 0.4f, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f, -0.4f, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - {-0.4f, 0.4f, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - {-0.4f, -0.4f, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f, 0.4f, 0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f, -0.4f, 0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - {-0.4f, 0.4f, 0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - {-0.4f, -0.4f, 0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - - { 0.4f, 0.4f/3, -0.4f/3, {0.5f, 0.5f, 0.0f, 1.0f}}, - { 0.4f, -0.4f/3, -0.4f/3, {0.5f, 0.5f, 0.0f, 1.0f}}, - {-0.4f, 0.4f/3, -0.4f/3, {0.5f, 0.5f, 0.0f, 1.0f}}, - {-0.4f, -0.4f/3, -0.4f/3, {0.5f, 0.5f, 0.0f, 1.0f}}, - { 0.4f, 0.4f/3, 0.4f/3, {0.5f, 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- { 0.4f/3, -0.4f/3, -0.4f/3, {1.0f, 1.0f, 1.0f, 1.0f}}, - {-0.4f/3, 0.4f/3, -0.4f/3, {1.0f, 1.0f, 1.0f, 1.0f}}, - {-0.4f/3, -0.4f/3, -0.4f/3, {1.0f, 1.0f, 1.0f, 1.0f}}, - { 0.4f/3, 0.4f/3, 0.4f/3, {1.0f, 1.0f, 1.0f, 1.0f}}, - { 0.4f/3, -0.4f/3, 0.4f/3, {1.0f, 1.0f, 1.0f, 1.0f}}, - {-0.4f/3, 0.4f/3, 0.4f/3, {1.0f, 1.0f, 1.0f, 1.0f}}, - {-0.4f/3, -0.4f/3, 0.4f/3, {1.0f, 1.0f, 1.0f, 1.0f}}, +layer L1_templates[2] = { + { + .vtxcount = 8, + .idxCount = 3 * 8, + .indexmap = ((unsigned int[3 * 8]) {0, 2, 3, 0, 3, 1, 1, 3, 5, 1, 5, 7, 7, 5, 4, 7, 4, 6, 6, 4, 2, 6, 2, 0}), + }, + { + .vtxcount = 12, + .idxCount = 3 * 8, + .indexmap = ((unsigned int[3 * 8]) {0, 3, 4, 0, 4, 1, 5, 4, 8, 5, 8, 9, 11, 8, 7, 11, 7, 10, 6, 7, 3, 6, 3, 2}), + } }; -unsigned int mengerL1_idcs[] = { - - 24, 25, 32, - 25, 33, 32, - 25, 27, 33, - 27, 35, 33, - 27, 26, 35, - 26, 34, 35, - 26, 24, 34, - 24, 32, 34, - - 30, 31, 38, - 31, 39, 38, - 31, 29, 39, - 29, 37, 39, - 29, 28, 37, - 28, 36, 37, - 28, 30, 36, - 30, 38, 36, - - 12, 13, 36, - 13, 37, 36, - 13, 9, 37, - 9, 33, 37, - 9, 8, 33, - 8, 32, 33, - 8, 12, 32, - 12, 36, 32, +layer L1_templates_flipped[2] = {0}; - 10, 11, 34, - 11, 35, 34, - 11, 15, 35, - 15, 39, 35, - 15, 14, 39, - 14, 38, 39, - 14, 10, 38, - 10, 34, 38, +void L1_completeLayers() { - 20, 16, 36, - 16, 32, 36, - 16, 18, 32, - 18, 34, 32, - 18, 22, 34, - 22, 38, 34, - 22, 20, 38, - 20, 36, 38, + for (int i = 0; i < 2; i++) { + L1_templates_flipped[i] = L1_templates[i]; + L1_templates_flipped[i].indexmap = flipLayer(L1_templates[i].indexmap, L1_templates[i].idxCount); + } +} - 17, 21, 33, - 21, 37, 33, - 21, 23, 37, - 23, 39, 37, - 23, 19, 39, - 19, 35, 39, - 19, 17, 35, - 17, 33, 35, - - 0, 1, 24, - 0, 24, 26, - 2, 0, 26, - 2, 26, 27, - 3, 2, 27, - 3, 27, 25, - 1, 3, 25, - 1, 25, 24, - - 6, 7, 30, - 6, 30, 28, - 4, 6, 28, - 4, 28, 29, - 5, 4, 29, - 5, 29, 31, - 7, 5, 31, - 7, 31, 30, - - 4, 5, 12, - 4, 12, 8, - 0, 4, 8, - 0, 8, 9, - 1, 0, 9, - 1, 9, 13, - 5, 1, 13, - 5, 13, 12, - - 2, 3, 10, - 2, 10, 14, - 6, 2, 14, - 6, 14, 15, - 7, 6, 15, - 7, 15, 11, - 3, 7, 11, - 3, 11, 10, - - 4, 0, 20, - 4, 20, 22, - 6, 4, 22, - 6, 22, 18, - 2, 6, 18, - 2, 18, 16, - 0, 2, 16, - 0, 16, 20, - - 1, 5, 17, - 1, 17, 19, - 3, 1, 19, - 3, 19, 23, - 7, 3, 23, - 7, 23, 21, - 5, 7, 21, - 5, 21, 17, - -}; \ No newline at end of file +#define LAYER_COUNT 4 +shape mengerL1 = { + .layerCount = LAYER_COUNT, + .layers = (layer*[LAYER_COUNT]) { + L1_templates, + L1_templates_flipped + 1, + L1_templates + 1, + L1_templates_flipped + }, + .compileLayers = &L1_completeLayers +}; +#undef LAYER_COUNT diff --git a/mengerL2.h b/mengerL2.h index 591fae2..19306d6 100644 --- a/mengerL2.h +++ b/mengerL2.h @@ -1,1883 +1,70 @@ - -// The shape vertices themselves, and their indices; buckle up... - -// Each "face" is indexed left-to-right, top to bottom; constant axis points forward - -vertex mengerL2_vtcs[] = { - - // First layer, exterior [Type I] - {-0.4f, 0.4f, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, // 0 - { 0.4f, 0.4f, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - - {-0.4f*7/9, 0.4f*7/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, // 2 - {-0.4f*5/9, 0.4f*7/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - {-0.4f/9, 0.4f*7/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f/9, 0.4f*7/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*5/9, 0.4f*7/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*7/9, 0.4f*7/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - - {-0.4f*7/9, 0.4f*5/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, // 8 - {-0.4f*5/9, 0.4f*5/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - {-0.4f/9, 0.4f*5/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f/9, 0.4f*5/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*5/9, 0.4f*5/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*7/9, 0.4f*5/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - - {-0.4f*3/9, 0.4f*3/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, // 14 - { 0.4f*3/9, 0.4f*3/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - - {-0.4f*7/9, 0.4f/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, // 16 - {-0.4f*5/9, 0.4f/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*5/9, 0.4f/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*7/9, 0.4f/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - - {-0.4f*7/9, -0.4f/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, // 20 - {-0.4f*5/9, -0.4f/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*5/9, -0.4f/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*7/9, -0.4f/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - - {-0.4f*3/9, -0.4f*3/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, // 24 - { 0.4f*3/9, -0.4f*3/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - - {-0.4f*7/9, -0.4f*5/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, // 26 - {-0.4f*5/9, -0.4f*5/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - {-0.4f/9, -0.4f*5/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f/9, -0.4f*5/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*5/9, -0.4f*5/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*7/9, -0.4f*5/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - - {-0.4f*7/9, -0.4f*7/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, // 32 - {-0.4f*5/9, -0.4f*7/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - {-0.4f/9, -0.4f*7/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f/9, -0.4f*7/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*5/9, -0.4f*7/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*7/9, -0.4f*7/9, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - - {-0.4f, -0.4f, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, // 38 - { 0.4f, -0.4f, -0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - - - // Second layer [Type II] - {-0.4f*7/9, 0.4f, -0.4f*7/9, {0.3f, 0.3f, 0.3f, 1.0f}}, // 40 - {-0.4f*5/9, 0.4f, -0.4f*7/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - {-0.4f/9, 0.4f, -0.4f*7/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f/9, 0.4f, -0.4f*7/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*5/9, 0.4f, -0.4f*7/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*7/9, 0.4f, -0.4f*7/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - - {-0.4f, 0.4f*7/9, -0.4f*7/9, {0.3f, 0.3f, 0.3f, 1.0f}}, // 46 - {-0.4f*7/9, 0.4f*7/9, -0.4f*7/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - {-0.4f*5/9, 0.4f*7/9, -0.4f*7/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - {-0.4f/9, 0.4f*7/9, -0.4f*7/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f/9, 0.4f*7/9, -0.4f*7/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*5/9, 0.4f*7/9, -0.4f*7/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*7/9, 0.4f*7/9, -0.4f*7/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f, 0.4f*7/9, -0.4f*7/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - - {-0.4f, 0.4f*5/9, -0.4f*7/9, {0.3f, 0.3f, 0.3f, 1.0f}}, // 54 - {-0.4f*7/9, 0.4f*5/9, -0.4f*7/9, {0.3f, 0.3f, 0.3f, 1.0f}}, -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, -0.4f*7/9, -0.4f*7/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - {-0.4f/9, -0.4f*7/9, -0.4f*7/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f/9, -0.4f*7/9, -0.4f*7/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*5/9, -0.4f*7/9, -0.4f*7/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*7/9, -0.4f*7/9, -0.4f*7/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f, -0.4f*7/9, -0.4f*7/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - - {-0.4f*7/9, -0.4f, -0.4f*7/9, {0.3f, 0.3f, 0.3f, 1.0f}}, // 98 - {-0.4f*5/9, -0.4f, -0.4f*7/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - {-0.4f/9, -0.4f, -0.4f*7/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f/9, -0.4f, -0.4f*7/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*5/9, -0.4f, -0.4f*7/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*7/9, -0.4f, -0.4f*7/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - - - // Third layer [Type II] - {-0.4f*7/9, 0.4f, -0.4f*5/9, {0.3f, 0.3f, 0.3f, 1.0f}}, // 104 - {-0.4f*5/9, 0.4f, -0.4f*5/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - {-0.4f/9, 0.4f, -0.4f*5/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f/9, 0.4f, -0.4f*5/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*5/9, 0.4f, -0.4f*5/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*7/9, 0.4f, -0.4f*5/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - - {-0.4f, 0.4f*7/9, -0.4f*5/9, {0.3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.3f, 1.0f}}, - { 0.4f/9, -0.4f, -0.4f*5/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*5/9, -0.4f, -0.4f*5/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*7/9, -0.4f, -0.4f*5/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - - - // Fourth layer [Type III] - {-0.4f*3/9, 0.4f, -0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, // 168 - { 0.4f*3/9, 0.4f, -0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - - {-0.4f/9, 0.4f*7/9, -0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, // 170 - { 0.4f/9, 0.4f*7/9, -0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - - {-0.4f/9, 0.4f*5/9, -0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, // 172 - { 0.4f/9, 0.4f*5/9, -0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - - {-0.4f, 0.4f*3/9, -0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, // 174 - {-0.4f*3/9, 0.4f*3/9, -0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*3/9, 0.4f*3/9, -0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f, 0.4f*3/9, -0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - - {-0.4f*7/9, 0.4f/9, -0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, // 178 - {-0.4f*5/9, 0.4f/9, -0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*5/9, 0.4f/9, -0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*7/9, 0.4f/9, -0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - - {-0.4f*7/9, -0.4f/9, -0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, // 182 - {-0.4f*5/9, -0.4f/9, -0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*5/9, -0.4f/9, -0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*7/9, -0.4f/9, -0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - - {-0.4f, -0.4f*3/9, -0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, // 186 - {-0.4f*3/9, -0.4f*3/9, -0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*3/9, -0.4f*3/9, -0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f, -0.4f*3/9, -0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - - {-0.4f/9, -0.4f*5/9, -0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, // 190 - { 0.4f/9, -0.4f*5/9, -0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - - {-0.4f/9, -0.4f*7/9, -0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, // 192 - { 0.4f/9, -0.4f*7/9, -0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - - {-0.4f*3/9, -0.4f, -0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, // 194 - { 0.4f*3/9, -0.4f, -0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - - - // Fifth layer [Type IV] - {-0.4f*7/9, 0.4f, -0.4f/9, {0.3f, 0.3f, 0.3f, 1.0f}}, // 196 - {-0.4f*5/9, 0.4f, -0.4f/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*5/9, 0.4f, -0.4f/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*7/9, 0.4f, -0.4f/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - - {-0.4f, 0.4f*7/9, -0.4f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f, 1.0f}}, - - {-0.4f, -0.4f*3/9, 0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, // 310 - {-0.4f*3/9, -0.4f*3/9, 0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*3/9, -0.4f*3/9, 0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f, -0.4f*3/9, 0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - - {-0.4f/9, -0.4f*5/9, 0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, // 314 - { 0.4f/9, -0.4f*5/9, 0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - - {-0.4f/9, -0.4f*7/9, 0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, // 316 - { 0.4f/9, -0.4f*7/9, 0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - - {-0.4f*3/9, -0.4f, 0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, // 318 - { 0.4f*3/9, -0.4f, 0.4f*3/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - - - // Eighth layer [Type II] - {-0.4f*7/9, 0.4f, 0.4f*5/9, {0.3f, 0.3f, 0.3f, 1.0f}}, // 320 - {-0.4f*5/9, 0.4f, 0.4f*5/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - {-0.4f/9, 0.4f, 0.4f*5/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f/9, 0.4f, 0.4f*5/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*5/9, 0.4f, 0.4f*5/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*7/9, 0.4f, 0.4f*5/9, {0.3f, 0.3f, 0.3f, 1.0f}}, - - {-0.4f, 0.4f*7/9, 0.4f*5/9, {0.3f, 0.3f, 0.3f, 1.0f}}, // 326 - {-0.4f*7/9, 0.4f*7/9, 0.4f*5/9, {0.3f, 0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0.3f, 0.3f, 1.0f}}, - - {-0.4f*7/9, -0.4f*5/9, 0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, // 474 - {-0.4f*5/9, -0.4f*5/9, 0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - {-0.4f/9, -0.4f*5/9, 0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f/9, -0.4f*5/9, 0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*5/9, -0.4f*5/9, 0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*7/9, -0.4f*5/9, 0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - - {-0.4f*7/9, -0.4f*7/9, 0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, // 480 - {-0.4f*5/9, -0.4f*7/9, 0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - {-0.4f/9, -0.4f*7/9, 0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f/9, -0.4f*7/9, 0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*5/9, -0.4f*7/9, 0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - { 0.4f*7/9, -0.4f*7/9, 0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - - {-0.4f, -0.4f, 0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, // 486 - { 0.4f, -0.4f, 0.4f, {0.3f, 0.3f, 0.3f, 1.0f}}, - +layer L2_templates[4] = { + { + .vtxcount = 40, + .idxCount = 3 * 28, + .indexmap = (unsigned int[3 * 28]) { + 0, 2, 7, 0, 7, 1, 1, 7, 37, 1, 37, 39, 39, 37, 32, 39, 32, 38, 38, 32, 2, 38, 2, 0, + 5, 11, 12, 5, 12, 6, 23, 22, 30, 23, 30, 31, 34, 28, 27, 34, 27, 33, 16, 17, 9, 16, 9, 8, + 3, 14, 15, 3, 10, 4, 10, 15, 13, 13, 15, 25, 13, 18, 19, 18, 25, 36, 36, 25, 24, 36, 29, 35, 29, 24, 26, 26, 24, 14, 26, 21, 20, 21, 14, 3} + }, + { + .vtxcount = 64, + .idxCount = 3 * 48, + .indexmap = (unsigned int[3 * 48]) { + 0, 7, 8, 0, 8, 1, 2, 9, 10, 2, 10, 3, 4, 11, 12, 4, 12, 5, + 13, 12, 20, 13, 20, 21, 31, 30, 38, 31, 38, 39, 49, 48, 56, 49, 56, 57, + 63, 56, 55, 63, 55, 62, 61, 54, 53, 61, 53, 60, 59, 52, 51, 59, 51, 58, + 50, 51, 43, 50, 43, 42, 32, 33, 25, 32, 25, 24, 14, 15, 7, 14, 7, 6, + 8, 16, 17, 8, 17, 9, 10, 18, 19, 10, 19, 11, 20, 19, 29, 20, 29, 30, 38, 37, 47, 38, 47, 48, 55, 47, 46, 55, 46, 54, 53, 45, 44, 53, 44, 52, 43, 44, 34, 43, 34, 33, 25, 26, 16, 25, 16, 15, + 17, 22, 23, 17, 23, 18, 29, 28, 36, 29, 36, 37, 46, 41, 40, 46, 40, 45, 34, 35, 27, 34, 27, 26} + }, + { + .vtxcount = 28, + .idxCount = 3 * 32, + .indexmap = (unsigned int[3 * 32]) { + 0, 2, 3, 0, 3, 1, 1, 3, 5, 1, 5, 8, 8, 5, 4, 8, 4, 7, 7, 4, 2, 7, 2, 0, + 9, 13, 17, 9, 17, 21, 21, 17, 16, 21, 16, 20, 20, 16, 12, 20, 12, 8, 8, 12, 13, 8, 13, 9, + 27, 25, 24, 27, 24, 26, 26, 24, 22, 26, 22, 19, 19, 22, 23, 19, 23, 20, 20, 23, 25, 20, 25, 27, + 18, 14, 10, 18, 10, 6, 6, 10, 11, 6, 11, 7, 7, 11, 15, 7, 15, 19, 19, 15, 14, 19, 14, 18} + }, + { + .vtxcount = 48, + .idxCount = 3 * 32, + .indexmap = (unsigned int[3 * 32]) { + 0, 5, 6, 0, 6, 1, 7, 6, 14, 7, 14, 15, 21, 14, 13, 21, 13, 20, 12, 13, 5, 12, 5, 4, + 11, 10, 18, 11, 18, 19, 23, 18, 17, 23, 17, 22, 16, 17, 9, 16, 9, 8, 2, 9, 10, 2, 10, 3, + 47, 42, 41, 47, 41, 46, 40, 41, 33, 40, 33, 32, 26, 33, 34, 26, 34, 27, 35, 34, 42, 35, 42, 43, + 36, 37, 29, 36, 29, 28, 24, 29, 30, 24, 30, 25, 31, 30, 38, 31, 38, 39, 45, 38, 37, 45, 37, 44} + } }; - - -// Triangle front is clockwise -unsigned int mengerL2_idcs[] = { - - - //Z axis, face 1 [type I], clockwise - 0, 1, 7, - 0, 7, 2, - 1, 39, 37, - 1, 37, 7, - 39, 32, 37, - 39, 38, 32, - 38, 0, 2, - 38, 2, 32, - - 5, 6, 12, - 5, 12, 11, - 23, 31, 30, - 23, 30, 22, - 34, 33, 27, - 34, 27, 28, - 16, 8, 9, - 16, 9, 17, - - 3, 4, 10, - 3, 15, 14, - 10, 13, 15, - 13, 19, 18, - 13, 25, 15, - 18, 36, 25, - 36, 35, 29, - 36, 24, 25, - 29, 26, 24, - 26, 20, 21, - 26, 14, 24, - 21, 3, 14, - - //Z axis, face 2 [type II], counterclockwise - 40, 47, 48, - 40, 48, 41, - 42, 49, 50, - 42, 50, 43, - 44, 51, 52, - 44, 52, 45, - 53, 52, 60, - 53, 60, 61, - 71, 70, 78, - 71, 78, 79, - 89, 88, 96, - 89, 96, 97, - 103, 96, 95, - 103, 95, 102, - 101, 94, 93, - 101, 93, 100, - 99, 92, 91, - 99, 91, 98, - 90, 91, 83, - 90, 83, 82, - 72, 73, 65, - 72, 65, 64, - 54, 55, 47, - 54, 47, 46, - - 48, 56, 57, - 48, 57, 49, - 50, 58, 59, - 50, 59, 51, - 60, 59, 69, - 60, 69, 70, - 78, 77, 87, - 78, 87, 88, - 95, 87, 86, - 95, 86, 94, - 93, 85, 84, - 93, 84, 92, - 83, 84, 74, - 83, 74, 73, - 65, 66, 56, - 65, 56, 55, - - 57, 62, 63, - 57, 63, 58, - 69, 68, 76, - 69, 76, 77, - 86, 81, 80, - 86, 80, 85, - 74, 75, 67, - 74, 67, 66, - - //Z axis, face 3 [type II], clockwise - 104, 112, 111, - 104, 105, 112, - 106, 114, 113, - 106, 107, 114, - 108, 116, 115, - 108, 109, 116, - 117, 124, 116, - 117, 125, 124, - 135, 142, 134, - 135, 143, 142, - 153, 160, 152, - 153, 161, 160, - 167, 159, 160, - 167, 166, 159, - 165, 157, 158, - 165, 164, 157, - 163, 155, 156, - 163, 162, 155, - 154, 147, 155, - 154, 146, 147, - 136, 129, 137, - 136, 128, 129, - 118, 111, 119, - 118, 110, 111, - - 112, 121, 120, - 112, 113, 121, - 114, 123, 122, - 114, 115, 123, - 124, 133, 123, - 124, 134, 133, - 142, 151, 141, - 142, 152, 151, - 159, 150, 151, - 159, 158, 150, - 157, 148, 149, - 157, 156, 148, - 147, 138, 148, - 147, 137, 138, - 129, 120, 130, - 129, 119, 120, - - 121, 127, 126, - 121, 122, 127, - 133, 140, 132, - 133, 141, 140, - 150, 144, 145, - 150, 149, 144, - 138, 131, 139, - 138, 130, 131, - - //Z axis, face 4 [type III], counterclockwise - 168, 170, 171, - 168, 171, 169, - 169, 171, 173, - 169, 173, 176, - 176, 173, 172, - 176, 172, 175, - 175, 172, 170, - 175, 170, 168, - - 177, 181, 185, - 177, 185, 189, - 189, 185, 184, - 189, 184, 188, - 188, 184, 180, - 188, 180, 176, - 176, 180, 181, - 176, 181, 177, - - 195, 193, 192, - 195, 192, 194, - 194, 192, 190, - 194, 190, 187, - 187, 190, 191, - 187, 191, 188, - 188, 191, 193, - 188, 193, 195, - - 186, 182, 178, - 186, 178, 174, - 174, 178, 179, - 174, 179, 175, - 175, 179, 183, - 175, 183, 187, - 187, 183, 182, - 187, 182, 186, - - //Z axis, face 5 [type IV], counterclockwise - 196, 201, 202, - 196, 202, 197, - 203, 202, 210, - 203, 210, 211, - 217, 210, 209, - 217, 209, 216, - 208, 209, 201, - 208, 201, 200, - - 207, 206, 214, - 207, 214, 215, - 219, 214, 213, - 219, 213, 218, - 212, 213, 205, - 212, 205, 204, - 198, 205, 206, - 198, 206, 199, - - 243, 238, 237, - 243, 237, 242, - 236, 237, 229, - 236, 229, 228, - 222, 229, 230, - 222, 230, 223, - 231, 230, 238, - 231, 238, 239, - - 232, 233, 225, - 232, 225, 224, - 220, 225, 226, - 220, 226, 221, - 227, 226, 234, - 227, 234, 235, - 241, 234, 233, - 241, 233, 240, - - //Z axis, face 6 [type IV], clockwise - 244, 250, 249, - 244, 245, 250, - 251, 258, 250, - 251, 259, 258, - 265, 257, 258, - 265, 264, 257, - 256, 249, 257, - 256, 248, 249, - - 255, 262, 254, - 255, 263, 262, - 267, 261, 262, - 267, 266, 261, - 260, 253, 261, - 260, 252, 253, - 246, 254, 253, - 246, 247, 254, - - 291, 285, 286, - 291, 290, 285, - 284, 277, 285, - 284, 276, 277, - 270, 278, 277, - 270, 271, 278, - 279, 286, 278, - 279, 287, 286, - - 280, 273, 281, - 280, 272, 273, - 268, 274, 273, - 268, 269, 274, - 275, 282, 274, - 275, 283, 282, - 289, 281, 282, - 289, 288, 281, - - //Z axis, face 7 [type III], clockwise - 292, 295, 294, - 292, 293, 295, - 293, 297, 295, - 293, 300, 297, - 300, 296, 297, - 300, 299, 296, - 299, 294, 296, - 299, 292, 294, - - 301, 309, 305, - 301, 313, 309, - 313, 308, 309, - 313, 312, 308, - 312, 304, 308, - 312, 300, 304, - 300, 305, 304, - 300, 301, 305, - - 319, 316, 317, - 319, 318, 316, - 318, 314, 316, - 318, 311, 314, - 311, 315, 314, - 311, 312, 315, - 312, 317, 315, - 312, 319, 317, - - 310, 302, 306, - 310, 298, 302, - 298, 303, 302, - 298, 299, 303, - 299, 307, 303, - 299, 311, 307, - 311, 306, 307, - 311, 310, 306, - - //Z axis, face 8 [type II], counterclockwise - 320, 327, 328, - 320, 328, 321, - 322, 329, 330, - 322, 330, 323, - 324, 331, 332, - 324, 332, 325, - 333, 332, 340, - 333, 340, 341, - 351, 350, 358, - 351, 358, 359, - 369, 368, 376, - 369, 376, 377, - 383, 376, 375, - 383, 375, 382, - 381, 374, 373, - 381, 373, 380, - 379, 372, 371, - 379, 371, 378, - 370, 371, 363, - 370, 363, 362, - 352, 353, 345, - 352, 345, 344, - 334, 335, 327, - 334, 327, 326, - - 328, 336, 337, - 328, 337, 329, - 330, 338, 339, - 330, 339, 331, - 340, 339, 349, - 340, 349, 350, - 358, 357, 367, - 358, 367, 368, - 375, 367, 366, - 375, 366, 374, - 373, 365, 364, - 373, 364, 372, - 363, 364, 354, - 363, 354, 353, - 345, 346, 336, - 345, 336, 335, - - 337, 342, 343, - 337, 343, 338, - 349, 348, 356, - 349, 356, 357, - 366, 361, 360, - 366, 360, 365, - 354, 355, 347, - 354, 347, 346, - - //Z axis, face 9 [type II], clockwise - 384, 392, 391, - 384, 385, 392, - 386, 394, 393, - 386, 387, 394, - 388, 396, 395, - 388, 389, 396, - 397, 404, 396, - 397, 405, 404, - 415, 422, 414, - 415, 423, 422, - 433, 440, 432, - 433, 441, 440, - 447, 439, 440, - 447, 446, 439, - 445, 437, 438, - 445, 444, 437, - 443, 435, 436, - 443, 442, 435, - 434, 427, 435, - 434, 426, 427, - 416, 409, 417, - 416, 408, 409, - 398, 391, 399, - 398, 390, 391, - - 392, 401, 400, - 392, 393, 401, - 394, 403, 402, - 394, 395, 403, - 404, 413, 403, - 404, 414, 413, - 422, 431, 421, - 422, 432, 431, - 439, 430, 431, - 439, 438, 430, - 437, 428, 429, - 437, 436, 428, - 427, 418, 428, - 427, 417, 418, - 409, 400, 410, - 409, 399, 400, - - 401, 407, 406, - 401, 402, 407, - 413, 420, 412, - 413, 421, 420, - 430, 424, 425, - 430, 429, 424, - 418, 411, 419, - 418, 410, 411, - - //Z axis, face 10 [type I], counterclockwise - 448, 455, 449, - 448, 450, 455, - 449, 485, 487, - 449, 455, 485, - 487, 485, 480, - 487, 480, 486, - 486, 450, 448, - 486, 480, 450, - - 453, 460, 454, - 453, 459, 460, - 471, 478, 479, - 471, 470, 478, - 482, 475, 481, - 482, 476, 475, - 464, 457, 456, - 464, 465, 457, - - 451, 458, 452, - 451, 462, 463, - 458, 463, 461, - 461, 466, 467, - 461, 463, 473, - 466, 473, 484, - 484, 477, 483, - 484, 473, 472, - 477, 472, 474, - 474, 469, 468, - 474, 472, 462, - 469, 462, 451, - - - - //Y axis, face 1 [type I], clockwise - 38, 103, 98, - 38, 39, 103, - 39, 447, 103, - 39, 487, 447, - 487, 442, 447, - 487, 486, 442, - 486, 98, 442, - 486, 38, 98, - - 101, 166, 165, - 101, 102, 166, - 291, 382, 290, - 291, 383, 382, - 444, 379, 380, - 444, 443, 379, - 240, 163, 241, - 240, 162, 163, - - 99, 100, 164, - 99, 195, 194, - 164, 167, 195, - 167, 243, 242, - 167, 319, 195, - 242, 446, 319, - 446, 445, 381, - 446, 318, 319, - 381, 378, 318, - 378, 288, 289, - 378, 194, 318, - 289, 99, 194, - - //Y axis, face 2 [type II], counterclockwise - 32, 91, 92, - 32, 92, 33, - 34, 93, 94, - 34, 94, 35, - 36, 95, 96, - 36, 96, 37, - 97, 96, 160, - 97, 160, 161, - 239, 238, 286, - 239, 286, 287, - 377, 376, 440, - 377, 440, 441, - 485, 440, 439, - 485, 439, 484, - 483, 438, 437, - 483, 437, 482, - 481, 436, 435, - 481, 435, 480, - 434, 435, 371, - 434, 371, 370, - 280, 281, 233, - 280, 233, 232, - 154, 155, 91, - 154, 91, 90, - - 92, 156, 157, - 92, 157, 93, - 94, 158, 159, - 94, 159, 95, - 160, 159, 237, - 160, 237, 238, - 286, 285, 375, - 286, 375, 376, - 439, 375, 374, - 439, 374, 438, - 437, 373, 372, - 437, 372, 436, - 371, 372, 282, - 371, 282, 281, - 233, 234, 156, - 233, 156, 155, - - 157, 192, 193, - 157, 193, 158, - 237, 236, 284, - 237, 284, 285, - 374, 317, 316, - 374, 316, 373, - 282, 283, 235, - 282, 235, 234, - - //Y axis, face 3 [type II], clockwise - 26, 84, 83, - 26, 27, 84, - 28, 86, 85, - 28, 29, 86, - 30, 88, 87, - 30, 31, 88, - 89, 152, 88, - 89, 153, 152, - 231, 278, 230, - 231, 279, 278, - 369, 432, 368, - 369, 433, 432, - 479, 431, 432, - 479, 478, 431, - 477, 429, 430, - 477, 476, 429, - 475, 427, 428, - 475, 474, 427, - 426, 363, 427, - 426, 362, 363, - 272, 225, 273, - 272, 224, 225, - 146, 83, 147, - 146, 82, 83, - - 84, 149, 148, - 84, 85, 149, - 86, 151, 150, - 86, 87, 151, - 152, 229, 151, - 152, 230, 229, - 278, 367, 277, - 278, 368, 367, - 431, 366, 367, - 431, 430, 366, - 429, 364, 365, - 429, 428, 364, - 363, 274, 364, - 363, 273, 274, - 225, 148, 226, - 225, 147, 148, - - 149, 191, 190, - 149, 150, 191, - 229, 276, 228, - 229, 277, 276, - 366, 314, 315, - 366, 365, 314, - 274, 227, 275, - 274, 226, 227, - - //Y axis, face 4 [type III], counterclockwise - 24, 80, 81, - 24, 81, 25, - 25, 81, 145, - 25, 145, 188, - 188, 145, 144, - 188, 144, 187, - 187, 144, 80, - 187, 80, 24, - - 189, 223, 271, - 189, 271, 313, - 313, 271, 270, - 313, 270, 312, - 312, 270, 222, - 312, 222, 188, - 188, 222, 223, - 188, 223, 189, - - 473, 425, 424, - 473, 424, 472, - 472, 424, 360, - 472, 360, 311, - 311, 360, 361, - 311, 361, 312, - 312, 361, 425, - 312, 425, 473, - - 310, 268, 220, - 310, 220, 186, - 186, 220, 221, - 186, 221, 187, - 187, 221, 269, - 187, 269, 311, - 311, 269, 268, - 311, 268, 310, - - //Y axis, face 5 [type IV], counterclockwise - 20, 73, 74, - 20, 74, 21, - 75, 74, 138, - 75, 138, 139, - 183, 138, 137, - 183, 137, 182, - 136, 137, 73, - 136, 73, 72, - - 79, 78, 142, - 79, 142, 143, - 185, 142, 141, - 185, 141, 184, - 140, 141, 77, - 140, 77, 76, - 22, 77, 78, - 22, 78, 23, - - 471, 422, 421, - 471, 421, 470, - 420, 421, 357, - 420, 357, 356, - 308, 357, 358, - 308, 358, 309, - 359, 358, 422, - 359, 422, 423, - - 416, 417, 353, - 416, 353, 352, - 306, 353, 354, - 306, 354, 307, - 355, 354, 418, - 355, 418, 419, - 469, 418, 417, - 469, 417, 468, - - //Y axis, face 6 [type IV], clockwise - 16, 66, 65, - 16, 17, 66, - 67, 130, 66, - 67, 131, 130, - 179, 129, 130, - 179, 178, 129, - 128, 65, 129, - 128, 64, 65, - - 71, 134, 70, - 71, 135, 134, - 181, 133, 134, - 181, 180, 133, - 132, 69, 133, - 132, 68, 69, - 18, 70, 69, - 18, 19, 70, - - 467, 413, 414, - 467, 466, 413, - 412, 349, 413, - 412, 348, 349, - 304, 350, 349, - 304, 305, 350, - 351, 414, 350, - 351, 415, 414, - - 408, 345, 409, - 408, 344, 345, - 302, 346, 345, - 302, 303, 346, - 347, 410, 346, - 347, 411, 410, - 465, 409, 410, - 465, 464, 409, - - //Y axis, face 7 [type III], clockwise - 14, 63, 62, - 14, 15, 63, - 15, 127, 63, - 15, 176, 127, - 176, 126, 127, - 176, 175, 126, - 175, 62, 126, - 175, 14, 62, - - 177, 267, 219, - 177, 301, 267, - 301, 266, 267, - 301, 300, 266, - 300, 218, 266, - 300, 176, 218, - 176, 219, 218, - 176, 177, 219, - - 463, 406, 407, - 463, 462, 406, - 462, 342, 406, - 462, 299, 342, - 299, 343, 342, - 299, 300, 343, - 300, 407, 343, - 300, 463, 407, - - 298, 216, 264, - 298, 174, 216, - 174, 217, 216, - 174, 175, 217, - 175, 265, 217, - 175, 299, 265, - 299, 264, 265, - 299, 298, 264, - - //Y axis, face 8 [type II], counterclockwise - 8, 55, 56, - 8, 56, 9, - 10, 57, 58, - 10, 58, 11, - 12, 59, 60, - 12, 60, 13, - 61, 60, 124, - 61, 124, 125, - 215, 214, 262, - 215, 262, 263, - 341, 340, 404, - 341, 404, 405, - 461, 404, 403, - 461, 403, 460, - 459, 402, 401, - 459, 401, 458, - 457, 400, 399, - 457, 399, 456, - 398, 399, 335, - 398, 335, 334, - 256, 257, 209, - 256, 209, 208, - 118, 119, 55, - 118, 55, 54, - - 56, 120, 121, - 56, 121, 57, - 58, 122, 123, - 58, 123, 59, - 124, 123, 213, - 124, 213, 214, - 262, 261, 339, - 262, 339, 340, - 403, 339, 338, - 403, 338, 402, - 401, 337, 336, - 401, 336, 400, - 335, 336, 258, - 335, 258, 257, - 209, 210, 120, - 209, 120, 119, - - 121, 172, 173, - 121, 173, 122, - 213, 212, 260, - 213, 260, 261, - 338, 297, 296, - 338, 296, 337, - 258, 259, 211, - 258, 211, 210, - - //Y axis, face 9 [type II], clockwise - 2, 48, 47, - 2, 3, 48, - 4, 50, 49, - 4, 5, 50, - 6, 52, 51, - 6, 7, 52, - 53, 116, 52, - 53, 117, 116, - 207, 254, 206, - 207, 255, 254, - 333, 396, 332, - 333, 397, 396, - 455, 395, 396, - 455, 454, 395, - 453, 393, 394, - 453, 452, 393, - 451, 391, 392, - 451, 450, 391, - 390, 327, 391, - 390, 326, 327, - 248, 201, 249, - 248, 200, 201, - 110, 47, 111, - 110, 46, 47, - - 48, 113, 112, - 48, 49, 113, - 50, 115, 114, - 50, 51, 115, - 116, 205, 115, - 116, 206, 205, - 254, 331, 253, - 254, 332, 331, - 395, 330, 331, - 395, 394, 330, - 393, 328, 329, - 393, 392, 328, - 327, 250, 328, - 327, 249, 250, - 201, 112, 202, - 201, 111, 112, - - 113, 171, 170, - 113, 114, 171, - 205, 252, 204, - 205, 253, 252, - 330, 294, 295, - 330, 329, 294, - 250, 203, 251, - 250, 202, 203, - - //Y axis, face 10 [type I], counterclockwise - 0, 40, 45, - 0, 45, 1, - 1, 45, 389, - 1, 389, 449, - 449, 389, 384, - 449, 384, 448, - 448, 384, 40, - 448, 40, 0, - - 43, 107, 108, - 43, 108, 44, - 247, 246, 324, - 247, 324, 325, - 386, 322, 321, - 386, 321, 385, - 196, 197, 105, - 196, 105, 104, - - 41, 106, 42, - 41, 168, 169, - 106, 169, 109, - 109, 198, 199, - 109, 169, 293, - 198, 293, 388, - 388, 323, 387, - 388, 293, 292, - 323, 292, 320, - 320, 245, 244, - 320, 292, 168, - 245, 168, 41, - - - - //X axis, face 1 [type I], clockwise - 0, 90, 46, - 0, 38, 90, - 38, 434, 90, - 38, 486, 434, - 486, 390, 434, - 486, 448, 390, - 448, 46, 390, - 448, 0, 46, - - 72, 146, 136, - 72, 82, 146, - 280, 362, 272, - 280, 370, 362, - 408, 334, 344, - 408, 398, 334, - 200, 118, 208, - 200, 110, 118, - - 54, 64, 128, - 54, 186, 174, - 128, 154, 186, - 154, 232, 224, - 154, 310, 186, - 224, 426, 310, - 426, 416, 352, - 426, 298, 310, - 352, 326, 298, - 326, 248, 256, - 326, 174, 298, - 256, 54, 174, - - //X axis, face 2 [type II], counterclockwise - 2, 47, 55, - 2, 55, 8, - 16, 65, 73, - 16, 73, 20, - 26, 83, 91, - 26, 91, 32, - 98, 91, 155, - 98, 155, 162, - 240, 233, 281, - 240, 281, 288, - 378, 371, 435, - 378, 435, 442, - 480, 435, 427, - 480, 427, 474, - 468, 409, 464, - 468, 417, 409, - 456, 399, 391, - 456, 391, 450, - 384, 391, 327, - 384, 327, 320, - 244, 249, 201, - 244, 201, 196, - 104, 111, 47, - 104, 47, 40, - - 55, 119, 129, - 55, 129, 65, - 73, 137, 147, - 73, 147, 83, - 155, 147, 225, - 155, 225, 233, - 281, 273, 363, - 281, 363, 371, - 427, 363, 353, - 427, 353, 417, - 409, 345, 335, - 409, 335, 399, - 327, 335, 257, - 327, 257, 249, - 201, 209, 119, - 201, 119, 111, - - 129, 178, 182, - 129, 182, 137, - 268, 273, 225, - 268, 225, 220, - 302, 345, 353, - 302, 353, 306, - 257, 264, 216, - 257, 216, 209, - - //X axis, face 3 [type II], clockwise - 3, 56, 48, - 3, 9, 56, - 17, 74, 66, - 17, 21, 74, - 27, 92, 84, - 27, 33, 92, - 99, 156, 92, - 99, 163, 156, - 241, 282, 234, - 241, 289, 282, - 379, 436, 372, - 379, 443, 436, - 481, 428, 436, - 481, 475, 428, - 469, 410, 418, - 469, 465, 410, - 457, 392, 400, - 457, 451, 392, - 385, 328, 392, - 385, 321, 328, - 245, 202, 250, - 245, 197, 202, - 105, 48, 112, - 105, 41, 48, - - 56, 130, 120, - 56, 66, 130, - 74, 148, 138, - 74, 84, 148, - 156, 226, 148, - 156, 234, 226, - 282, 364, 274, - 282, 372, 364, - 428, 354, 364, - 428, 418, 354, - 410, 336, 346, - 410, 400, 336, - 328, 258, 336, - 328, 250, 258, - 202, 120, 210, - 202, 112, 120, - - 130, 183, 179, - 130, 138, 183, - 226, 269, 221, - 226, 274, 269, - 354, 303, 307, - 354, 346, 303, - 258, 217, 265, - 258, 210, 217, - - //X axis, face 4 [type III], counterclockwise - 14, 67, 75, - 14, 75, 24, - 24, 75, 139, - 24, 139, 187, - 187, 139, 131, - 187, 131, 175, - 175, 131, 67, - 175, 67, 14, - - 194, 235, 283, - 194, 283, 318, - 318, 283, 275, - 318, 275, 311, - 311, 275, 227, - 311, 227, 187, - 187, 227, 235, - 187, 235, 194, - - 472, 419, 411, - 472, 411, 462, - 462, 411, 347, - 462, 347, 299, - 299, 347, 355, - 299, 355, 311, - 311, 355, 419, - 311, 419, 472, - - 292, 251, 203, - 292, 203, 168, - 168, 203, 211, - 168, 211, 175, - 175, 211, 259, - 175, 259, 299, - 299, 259, 251, - 299, 251, 292, - - //X axis, face 5 [type IV], counterclockwise - 4, 49, 57, - 4, 57, 10, - 62, 57, 121, - 62, 121, 126, - 172, 121, 113, - 172, 113, 170, - 106, 113, 49, - 106, 49, 42, - - 100, 93, 157, - 100, 157, 164, - 192, 157, 149, - 192, 149, 190, - 144, 149, 85, - 144, 85, 80, - 28, 85, 93, - 28, 93, 34, - - 482, 437, 429, - 482, 429, 476, - 424, 429, 365, - 424, 365, 360, - 314, 365, 373, - 314, 373, 316, - 380, 373, 437, - 380, 437, 444, - - 386, 393, 329, - 386, 329, 322, - 294, 329, 337, - 294, 337, 296, - 342, 337, 401, - 342, 401, 406, - 458, 401, 393, - 458, 393, 452, - - //X axis, face 6 [type IV], clockwise - 5, 58, 50, - 5, 11, 58, - 63, 122, 58, - 63, 127, 122, - 173, 114, 122, - 173, 171, 114, - 107, 50, 114, - 107, 43, 50, - - 101, 158, 94, - 101, 165, 158, - 193, 150, 158, - 193, 191, 150, - 145, 86, 150, - 145, 81, 86, - 29, 94, 86, - 29, 35, 94, - - 483, 430, 438, - 483, 477, 430, - 425, 366, 430, - 425, 361, 366, - 315, 374, 366, - 315, 317, 374, - 381, 438, 374, - 381, 445, 438, - - 387, 330, 394, - 387, 323, 330, - 295, 338, 330, - 295, 297, 338, - 343, 402, 338, - 343, 407, 402, - 459, 394, 402, - 459, 453, 394, - - //X axis, face 7 [type III], clockwise - 15, 76, 68, - 15, 25, 76, - 25, 140, 76, - 25, 188, 140, - 188, 132, 140, - 188, 176, 132, - 176, 68, 132, - 176, 15, 68, - - 195, 284, 236, - 195, 319, 284, - 319, 276, 284, - 319, 312, 276, - 312, 228, 276, - 312, 188, 228, - 188, 236, 228, - 188, 195, 236, - - 473, 412, 420, - 473, 463, 412, - 463, 348, 412, - 463, 300, 348, - 300, 356, 348, - 300, 312, 356, - 312, 420, 356, - 312, 473, 420, - - 293, 204, 252, - 293, 169, 204, - 169, 212, 204, - 169, 176, 212, - 176, 260, 212, - 176, 300, 260, - 300, 252, 260, - 300, 293, 252, - - //X axis, face 8 [type II], counterclockwise - 6, 51, 59, - 6, 59, 12, - 18, 69, 77, - 18, 77, 22, - 30, 87, 95, - 30, 95, 36, - 102, 95, 159, - 102, 159, 166, - 242, 237, 285, - 242, 285, 290, - 382, 375, 439, - 382, 439, 446, - 484, 439, 431, - 484, 431, 478, - 470, 421, 413, - 470, 413, 466, - 460, 403, 395, - 460, 395, 454, - 388, 395, 331, - 388, 331, 324, - 246, 253, 205, - 246, 205, 198, - 108, 115, 51, - 108, 51, 44, - - 59, 123, 133, - 59, 133, 69, - 77, 141, 151, - 77, 151, 87, - 159, 151, 229, - 159, 229, 237, - 285, 277, 367, - 285, 367, 375, - 431, 367, 357, - 431, 357, 421, - 413, 349, 339, - 413, 339, 403, - 331, 339, 261, - 331, 261, 253, - 205, 213, 123, - 205, 123, 115, - - 133, 180, 184, - 133, 184, 141, - 229, 222, 270, - 229, 270, 277, - 357, 308, 304, - 357, 304, 349, - 261, 266, 218, - 261, 218, 213, - - //X axis, face 9 [type II], clockwise - 7, 60, 52, - 7, 13, 60, - 19, 78, 70, - 19, 23, 78, - 31, 96, 88, - 31, 37, 96, - 103, 160, 96, - 103, 167, 160, - 243, 286, 238, - 243, 291, 286, - 383, 440, 376, - 383, 447, 440, - 485, 432, 440, - 485, 479, 432, - 471, 414, 422, - 471, 467, 414, - 461, 396, 404, - 461, 455, 396, - 389, 332, 396, - 389, 325, 332, - 247, 206, 254, - 247, 199, 206, - 109, 52, 116, - 109, 45, 52, - - 60, 134, 124, - 60, 70, 134, - 78, 152, 142, - 78, 88, 152, - 160, 230, 152, - 160, 238, 230, - 286, 368, 278, - 286, 376, 368, - 432, 358, 368, - 432, 422, 358, - 414, 340, 350, - 414, 404, 340, - 332, 262, 340, - 332, 254, 262, - 206, 124, 214, - 206, 116, 124, - - 134, 185, 181, - 134, 142, 185, - 230, 271, 223, - 230, 278, 271, - 358, 305, 309, - 358, 350, 305, - 262, 219, 267, - 262, 214, 219, - - //X axis, face 10 [type I], counterclockwise - 1, 53, 97, - 1, 97, 39, - 39, 97, 441, - 39, 441, 487, - 487, 441, 397, - 487, 397, 449, - 449, 397, 53, - 449, 53, 1, - - 79, 143, 153, - 79, 153, 89, - 287, 279, 369, - 287, 369, 377, - 415, 351, 341, - 415, 341, 405, - 207, 215, 125, - 207, 125, 117, - - 61, 135, 71, - 61, 177, 189, - 135, 189, 161, - 161, 231, 239, - 161, 189, 313, - 231, 313, 433, - 433, 359, 423, - 433, 313, 301, - 359, 301, 333, - 333, 263, 255, - 333, 301, 177, - 263, 177, 61, - -}; \ No newline at end of file +layer L2_templates_flipped[4] = {0}; + +void L2_completeLayers() { + + for (int i = 0; i < 4; i++) { + L2_templates_flipped[i] = L2_templates[i]; + L2_templates_flipped[i].indexmap = flipLayer(L2_templates[i].indexmap, L2_templates[i].idxCount); + } + +} + + +#define LAYER_COUNT 10 +shape mengerL2 = { + .layerCount = LAYER_COUNT, + .layers = (layer*[LAYER_COUNT]) { + L2_templates, + L2_templates_flipped + 1, + L2_templates + 1, + L2_templates_flipped + 2, + L2_templates_flipped + 3, + L2_templates + 3, + L2_templates + 2, + L2_templates_flipped + 1, + L2_templates + 1, + L2_templates_flipped + }, + .compileLayers = &L2_completeLayers +}; +#undef LAYER_COUNT diff --git a/mengerL3.h b/mengerL3.h new file mode 100644 index 0000000..e39009e --- /dev/null +++ b/mengerL3.h @@ -0,0 +1,341 @@ +layer L3_templates[8] = { + { + .vtxcount = 296, + .idxCount = 3 * 208, + // .idxCount = 0, + .indexmap = (unsigned int[]) { + 0, 2, 19, 0, 19, 1, 1, 19, 293, 1, 293, 295, 295, 293, 276, 295, 276, 294, 294, 276, 2, 294, 2, 0, + + 3, 21, 22, 3, 22, 4, 5, 23, 24, 5, 24, 6, 7, 25, 26, 7, 26, 8, 9, 27, 28, 9, 28, 10, 11, 29, 30, 11, 30, 12, 13, 31, 32, 13, 32, 14, 15, 33, 34, 15, 34, 16, 17, 35, 36, 17, 36, 18, + 37, 36, 54, 37, 54, 55, 67, 66, 90, 67, 90, 91, 109, 108, 122, 109, 122, 123, 135, 134, 146, 135, 146, 147, 155, 154, 170, 155, 170, 171, 183, 182, 202, 183, 202, 203, 221, 220, 238, 221, 238, 239, 251, 250, 274, 251, 274, 275, + 292, 274, 273, 292, 273, 291, 290, 272, 271, 290, 271, 289, 288, 270, 269, 288, 269, 287, 286, 268, 267, 286, 267, 285, 284, 266, 265, 284, 265, 283, 282, 264, 263, 282, 263, 281, 280, 262, 261, 280, 261, 279, 278, 260, 259, 278, 259, 277, + 258, 259, 241, 258, 241, 240, 228, 229, 205, 228, 205, 204, 186, 187, 173, 186, 173, 172, 160, 161, 149, 160, 149, 148, 140, 141, 125, 140, 125, 124, 112, 113, 93, 112, 93, 92, 74, 75, 57, 74, 57, 56, 44, 45, 21, 44, 21, 20, + + 21, 38, 43, 21, 43, 36, 36, 43, 257, 36, 257, 274, 274, 257, 252, 274, 252, 259, 259, 252, 38, 259, 38, 21, + + 39, 46, 49, 39, 49, 40, 40, 49, 61, 40, 61, 70, 70, 61, 58, 70, 58, 69, 69, 58, 46, 69, 46, 39, 47, 59, 60, 47, 60, 48, + 41, 50, 53, 41, 53, 42, 42, 53, 65, 42, 65, 72, 72, 65, 62, 72, 62, 71, 71, 62, 50, 71, 50, 41, 51, 63, 64, 51, 64, 52, + 73, 89, 133, 73, 133, 139, 139, 133, 132, 139, 132, 138, 138, 132, 88, 138, 88, 72, 72, 88, 89, 72, 89, 73, 107, 106, 120, 107, 120, 121, + 159, 169, 219, 159, 219, 227, 227, 219, 218, 227, 218, 226, 226, 218, 168, 226, 168, 158, 158, 168, 169, 158, 169, 159, 181, 180, 200, 181, 200, 201, + 256, 249, 246, 256, 246, 255, 255, 246, 234, 255, 234, 225, 225, 234, 237, 225, 237, 226, 226, 237, 249, 226, 249, 256, 248, 236, 235, 248, 235, 247, + 254, 245, 242, 254, 242, 253, 253, 242, 230, 253, 230, 223, 223, 230, 233, 223, 233, 224, 224, 233, 245, 224, 245, 254, 244, 232, 231, 244, 231, 243, + 222, 206, 162, 222, 162, 156, 156, 162, 163, 156, 163, 157, 157, 163, 207, 157, 207, 223, 223, 207, 206, 223, 206, 222, 188, 189, 175, 188, 175, 174, + 136, 126, 76, 136, 76, 68, 68, 76, 77, 68, 77, 69, 69, 77, 127, 69, 127, 137, 137, 127, 126, 137, 126, 136, 114, 115, 95, 114, 95, 94, + + 69, 78, 87, 69, 87, 72, 72, 87, 217, 72, 217, 226, 226, 217, 208, 226, 208, 223, 223, 208, 78, 223, 78, 69, + + 79, 97, 98, 79, 98, 80, 81, 99, 100, 81, 100, 82, 83, 101, 102, 83, 102, 84, 85, 103, 104, 85, 104, 86, + 105, 104, 118, 105, 118, 119, 131, 130, 144, 131, 144, 145, 153, 152, 166, 153, 166, 167, 179, 178, 198, 179, 198, 199, + 216, 198, 197, 216, 197, 215, 214, 196, 195, 214, 195, 213, 212, 194, 193, 212, 193, 211, 210, 192, 191, 210, 191, 209, + 190, 191, 177, 190, 177, 176, 164, 165, 151, 164, 151, 150, 142, 143, 129, 142, 129, 128, 116, 117, 97, 116, 97, 96, + + 97, 110, 111, 97, 111, 104, 104, 111, 185, 104, 185, 198, 198, 185, 184, 198, 184, 191, 191, 184, 110, 191, 110, 97} + }, + { + .vtxcount = 416, + .idxCount = 3 * 336, + // .idxCount = 0, + .indexmap = (unsigned int[]) { + 0, 19, 20, 0, 20, 1, 2, 21, 22, 2, 22, 3, 4, 23, 24, 4, 24, 5, 6, 25, 26, 6, 26, 7, 8, 27, 28, 8, 28, 9, 10, 29, 30, 10, 30, 11, 12, 31, 32, 12, 32, 13, 14, 33, 34, 14, 34, 15, 16, 35, 36, 16, 36, 17, + 37, 36, 56, 37, 56, 57, 83, 82, 102, 83, 102, 103, 129, 128, 148, 129, 148, 149, 171, 170, 186, 171, 186, 187, 207, 206, 222, 207, 222, 223, 243, 242, 258, 243, 258, 259, 285, 284, 304, 285, 304, 305, 331, 330, 350, 331, 350, 351, 377, 376, 396, 377, 396, 397, + 415, 396, 395, 415, 395, 414, 413, 394, 393, 413, 393, 412, 411, 392, 391, 411, 391, 410, 409, 390, 389, 409, 389, 408, 407, 388, 387, 407, 387, 406, 405, 386, 385, 405, 385, 404, 403, 384, 383, 403, 383, 402, 401, 382, 381, 401, 381, 400, 399, 380, 379, 399, 379, 398, + 378, 379, 359, 378, 359, 358, 332, 333, 313, 332, 313, 312, 286, 287, 267, 286, 267, 266, 244, 245, 229, 244, 229, 228, 208, 209, 193, 208, 193, 192, 172, 173, 157, 172, 157, 156, 130, 131, 111, 130, 111, 110, 84, 85, 65, 84, 65, 64, 38, 39, 19, 38, 19, 18, + + 20, 40, 41, 20, 41, 21, 22, 42, 43, 22, 43, 23, 24, 44, 45, 24, 45, 25, 26, 46, 47, 26, 47, 27, 28, 48, 49, 28, 49, 29, 30, 50, 51, 30, 51, 31, 32, 52, 53, 32, 53, 33, 34, 54, 55, 34, 55, 35, + 56, 55, 81, 56, 81, 82, 102, 101, 127, 102, 127, 128, 148, 147, 169, 148, 169, 170, 186, 185, 205, 186, 205, 206, 222, 221, 241, 222, 241, 242, 258, 257, 283, 258, 283, 284, 304, 303, 329, 304, 329, 330, 350, 349, 375, 350, 375, 376, + 395, 375, 374, 395, 374, 394, 393, 373, 372, 393, 372, 392, 391, 371, 370, 391, 370, 390, 389, 369, 368, 389, 368, 388, 387, 367, 366, 387, 366, 386, 385, 365, 364, 385, 364, 384, 383, 363, 362, 383, 362, 382, 381, 361, 360, 381, 360, 380, + 359, 360, 334, 359, 334, 333, 313, 314, 288, 313, 288, 287, 267, 268, 246, 267, 246, 245, 229, 230, 210, 229, 210, 209, 193, 194, 174, 193, 174, 173, 157, 158, 132, 157, 132, 131, 111, 112, 86, 111, 86, 85, 65, 66, 40, 65, 40, 39, + + 41, 58, 59, 41, 59, 42, 43, 69, 70, 43, 70, 44, 45, 71, 72, 45, 72, 46, 47, 60, 61, 47, 61, 48, 49, 75, 76, 49, 76, 50, 51, 77, 78, 51, 78, 52, 53, 62, 63, 53, 63, 54, + 81, 80, 100, 81, 100, 101, 127, 126, 146, 127, 146, 147, 169, 168, 184, 169, 184, 185, 205, 204, 220, 205, 220, 221, 241, 240, 256, 241, 256, 257, 283, 282, 302, 283, 302, 303, 329, 328, 348, 329, 348, 349, + 374, 357, 356, 374, 356, 373, 372, 346, 345, 372, 345, 371, 370, 344, 343, 370, 343, 369, 368, 355, 354, 368, 354, 367, 366, 340, 339, 366, 339, 365, 364, 338, 337, 364, 337, 363, 362, 353, 352, 362, 352, 361, + 334, 335, 315, 334, 315, 314, 288, 289, 269, 288, 269, 268, 246, 247, 231, 246, 231, 230, 210, 211, 195, 210, 195, 194, 174, 175, 159, 174, 159, 158, 132, 133, 113, 132, 113, 112, 86, 87, 67, 86, 67, 66, + + 68, 88, 89, 68, 89, 69, 70, 90, 91, 70, 91, 71, 72, 92, 93, 72, 93, 73, 74, 94, 95, 74, 95, 75, 76, 96, 97, 76, 97, 77, 78, 98, 99, 78, 99, 79, + 109, 108, 125, 109, 125, 126, 146, 145, 167, 146, 167, 168, 184, 183, 190, 184, 190, 191, 227, 226, 239, 227, 239, 240, 256, 255, 281, 256, 281, 282, 302, 301, 310, 302, 310, 311, + 347, 327, 326, 347, 326, 346, 345, 325, 324, 345, 324, 344, 343, 323, 322, 343, 322, 342, 341, 321, 320, 341, 320, 340, 339, 319, 318, 339, 318, 338, 337, 317, 316, 337, 316, 336, + 306, 307, 290, 306, 290, 289, 269, 270, 248, 269, 248, 247, 231, 232, 225, 231, 225, 224, 188, 189, 176, 188, 176, 175, 159, 160, 134, 159, 134, 133, 113, 114, 105, 113, 105, 104, + + 89, 115, 116, 89, 116, 90, 91, 117, 118, 91, 118, 92, 106, 119, 120, 106, 120, 107, 95, 121, 122, 95, 122, 96, 97, 123, 124, 97, 124, 98, + 125, 124, 144, 125, 144, 145, 167, 166, 182, 167, 182, 183, 203, 202, 218, 203, 218, 219, 239, 238, 254, 239, 254, 255, 281, 280, 300, 281, 300, 301, + 326, 300, 299, 326, 299, 325, 324, 298, 297, 324, 297, 323, 309, 296, 295, 309, 295, 308, 320, 294, 293, 320, 293, 319, 318, 292, 291, 318, 291, 317, + 290, 291, 271, 290, 271, 270, 248, 249, 233, 248, 233, 232, 212, 213, 197, 212, 197, 196, 176, 177, 161, 176, 161, 160, 134, 135, 115, 134, 115, 114, + + 116, 136, 137, 116, 137, 117, 118, 138, 139, 118, 139, 119, 120, 140, 141, 120, 141, 121, 122, 142, 143, 122, 143, 123, + 144, 143, 165, 144, 165, 166, 182, 181, 201, 182, 201, 202, 218, 217, 237, 218, 237, 238, 254, 253, 279, 254, 279, 280, + 299, 279, 278, 299, 278, 298, 297, 277, 276, 297, 276, 296, 295, 275, 274, 295, 274, 294, 293, 273, 272, 293, 272, 292, + 271, 272, 250, 271, 250, 249, 233, 234, 214, 233, 214, 213, 197, 198, 178, 197, 178, 177, 161, 162, 136, 161, 136, 135, + + 137, 150, 151, 137, 151, 138, 139, 152, 153, 139, 153, 140, 141, 154, 155, 141, 155, 142, + 165, 164, 180, 165, 180, 181, 201, 200, 216, 201, 216, 217, 237, 236, 252, 237, 252, 253, + 278, 265, 264, 278, 264, 277, 276, 263, 262, 276, 262, 275, 274, 261, 260, 274, 260, 273, + 250, 251, 235, 250, 235, 234, 214, 215, 199, 214, 199, 198, 178, 179, 163, 178, 163, 162, + + } + }, + { + .vtxcount = 192, + .idxCount = 3 * 208, + // .idxCount = 0, + .indexmap = (unsigned int[]) { + 0, 6, 7, 0, 7, 1, 1, 7, 20, 7, 13, 20, 20, 13, 12, 20, 12, 19, 19, 12, 0, 12, 6, 0, + 2, 8, 9, 2, 9, 3, 3, 9, 22, 9, 15, 22, 22, 15, 14, 22, 14, 21, 21, 14, 2, 14, 8, 2, + 4, 10, 11, 4, 11, 5, 5, 11, 24, 11, 17, 24, 24, 17, 16, 24, 16, 23, 23, 16, 4, 16, 10, 4, + + 25, 37, 49, 25, 49, 57, 57, 49, 56, 49, 48, 56, 56, 48, 36, 56, 36, 24, 24, 36, 25, 36, 37, 25, + 87, 95, 103, 87, 103, 111, 111, 103, 110, 103, 102, 110, 110, 102, 94, 110, 94, 86, 86, 94, 87, 94, 95, 87, + 141, 153, 165, 141, 165, 173, 173, 165, 172, 165, 164, 172, 172, 164, 152, 172, 152, 140, 140, 152, 141, 152, 153, 141, + + 191, 185, 184, 191, 184, 190, 190, 184, 171, 184, 178, 171, 171, 178, 179, 171, 179, 172, 172, 179, 191, 179, 185, 191, + 189, 183, 182, 189, 182, 188, 188, 182, 169, 182, 176, 169, 169, 176, 177, 169, 177, 170, 170, 177, 189, 177, 183, 189, + 187, 181, 180, 187, 180, 186, 186, 180, 167, 180, 174, 167, 167, 174, 175, 167, 175, 168, 168, 175, 187, 175, 181, 187, + + 166, 154, 142, 166, 142, 134, 134, 142, 135, 142, 143, 135, 135, 143, 155, 135, 155, 167, 167, 155, 166, 155, 154, 166, + 104, 96, 88, 104, 88, 80, 80, 88, 81, 88, 89, 81, 81, 89, 97, 81, 97, 105, 105, 97, 104, 97, 96, 104, + 50, 38, 26, 50, 26, 18, 18, 26, 19, 26, 27, 19, 19, 27, 39, 19, 39, 51, 51, 39, 50, 39, 38, 50, + + 20, 28, 31, 20, 31, 21, 21, 31, 53, 31, 43, 53, 53, 43, 40, 53, 40, 52, 52, 40, 20, 40, 28, 20, 29, 41, 42, 29, 42, 30, + 22, 32, 35, 22, 35, 23, 23, 35, 55, 35, 47, 55, 55, 47, 44, 55, 44, 54, 54, 44, 22, 44, 32, 22, 33, 45, 46, 33, 46, 34, + + 56, 63, 79, 56, 79, 86, 86, 79, 85, 79, 78, 85, 85, 78, 62, 85, 62, 55, 55, 62, 56, 62, 63, 56, 69, 68, 74, 69, 74, 75, + 110, 115, 133, 110, 133, 140, 140, 133, 139, 133, 132, 139, 139, 132, 114, 139, 114, 109, 109, 114, 110, 114, 115, 110, 119, 118, 126, 119, 126, 127, + + 171, 163, 160, 171, 160, 170, 170, 160, 138, 160, 148, 138, 138, 148, 151, 138, 151, 139, 139, 151, 171, 151, 163, 171, 162, 150, 149, 162, 149, 161, + 169, 159, 156, 169, 156, 168, 168, 156, 136, 156, 144, 136, 136, 144, 147, 136, 147, 137, 137, 147, 169, 147, 159, 169, 158, 146, 145, 158, 145, 157, + + 135, 128, 112, 135, 112, 105, 105, 112, 106, 112, 113, 106, 106, 113, 129, 106, 129, 136, 136, 129, 135, 129, 128, 135, 122, 123, 117, 122, 117, 116, + 81, 76, 58, 81, 58, 51, 51, 58, 52, 58, 59, 52, 52, 59, 77, 52, 77, 82, 82, 77, 81, 77, 76, 81, 72, 73, 65, 72, 65, 64, + + 53, 60, 61, 53, 61, 54, 54, 61, 71, 61, 67, 71, 71, 67, 66, 71, 66, 70, 70, 66, 53, 66, 60, 53, + 85, 93, 101, 85, 101, 109, 109, 101, 108, 101, 100, 108, 108, 100, 92, 108, 92, 84, 84, 92, 85, 92, 93, 85, + 138, 131, 130, 138, 130, 137, 137, 130, 120, 130, 124, 120, 120, 124, 125, 120, 125, 121, 121, 125, 138, 125, 131, 138, + 106, 98, 90, 106, 90, 82, 82, 90, 83, 90, 91, 83, 83, 91, 99, 83, 99, 107, 107, 99, 106, 99, 98, 106, + + } + }, + { + .vtxcount = 320, + .idxCount = 3 * 224, + // .idxCount = 0, + .indexmap = (unsigned int[]) { + 0, 13, 14, 0, 14, 1, 2, 17, 18, 2, 18, 3, 4, 19, 20, 4, 20, 5, 6, 23, 24, 6, 24, 7, 8, 25, 26, 8, 26, 9, 10, 29, 30, 10, 30, 11, + 31, 30, 50, 31, 50, 51, 95, 94, 114, 95, 114, 115, 135, 134, 150, 135, 150, 151, 183, 182, 198, 183, 198, 199, 223, 222, 242, 223, 242, 243, 287, 286, 306, 287, 306, 307, + 319, 306, 305, 319, 305, 318, 317, 302, 301, 317, 301, 316, 315, 300, 299, 315, 299, 314, 313, 296, 295, 313, 295, 312, 311, 294, 293, 311, 293, 310, 309, 290, 289, 309, 289, 308, + 288, 289, 269, 288, 269, 268, 224, 225, 205, 224, 205, 204, 184, 185, 169, 184, 169, 168, 136, 137, 121, 136, 121, 120, 96, 97, 77, 96, 77, 76, 32, 33, 13, 32, 13, 12, + + 14, 34, 35, 14, 35, 15, 16, 36, 37, 16, 37, 17, 18, 38, 39, 18, 39, 19, 20, 40, 41, 20, 41, 21, 22, 42, 43, 22, 43, 23, 24, 44, 45, 24, 45, 25, 26, 46, 47, 26, 47, 27, 28, 48, 49, 28, 49, 29, + 50, 49, 62, 50, 62, 63, 75, 74, 93, 75, 93, 94, 114, 113, 133, 114, 133, 134, 150, 149, 158, 150, 158, 159, 167, 166, 181, 167, 181, 182, 198, 197, 221, 198, 221, 222, 242, 241, 254, 242, 254, 255, 267, 266, 285, 267, 285, 286, + 305, 285, 284, 305, 284, 304, 303, 283, 282, 303, 282, 302, 301, 281, 280, 301, 280, 300, 299, 279, 278, 299, 278, 298, 297, 277, 276, 297, 276, 296, 295, 275, 274, 295, 274, 294, 293, 273, 272, 293, 272, 292, 291, 271, 270, 291, 270, 290, + 269, 270, 257, 269, 257, 256, 244, 245, 226, 244, 226, 225, 205, 206, 186, 205, 186, 185, 169, 170, 161, 169, 161, 160, 152, 153, 138, 152, 138, 137, 121, 122, 98, 121, 98, 97, 77, 78, 65, 77, 65, 64, 52, 53, 34, 52, 34, 33, + + 37, 54, 55, 37, 55, 38, 39, 56, 57, 39, 57, 40, 43, 58, 59, 43, 59, 44, 45, 60, 61, 45, 61, 46, + 93, 92, 112, 93, 112, 113, 133, 132, 148, 133, 148, 149, 181, 180, 196, 181, 196, 197, 221, 220, 240, 221, 240, 241, + 282, 265, 264, 282, 264, 281, 280, 263, 262, 280, 262, 279, 276, 261, 260, 276, 260, 275, 274, 259, 258, 274, 258, 273, + 226, 227, 207, 226, 207, 206, 186, 187, 171, 186, 171, 170, 138, 139, 123, 138, 123, 122, 98, 99, 79, 98, 79, 78, + + 66, 81, 82, 66, 82, 67, 68, 83, 84, 68, 84, 69, 70, 87, 88, 70, 88, 71, 72, 89, 90, 72, 90, 73, + 91, 90, 110, 91, 110, 111, 131, 130, 146, 131, 146, 147, 179, 178, 194, 179, 194, 195, 219, 218, 238, 219, 238, 239, + 253, 238, 237, 253, 237, 252, 251, 236, 235, 251, 235, 250, 249, 232, 231, 249, 231, 248, 247, 230, 229, 247, 229, 246, + 228, 229, 209, 228, 209, 208, 188, 189, 173, 188, 173, 172, 140, 141, 125, 140, 125, 124, 100, 101, 81, 100, 81, 80, + + 82, 102, 103, 82, 103, 83, 84, 104, 105, 84, 105, 85, 86, 106, 107, 86, 107, 87, 88, 108, 109, 88, 109, 89, + 110, 109, 129, 110, 129, 130, 146, 145, 156, 146, 156, 157, 165, 164, 177, 165, 177, 178, 194, 193, 217, 194, 217, 218, + 237, 217, 216, 237, 216, 236, 235, 215, 214, 235, 214, 234, 233, 213, 212, 233, 212, 232, 231, 211, 210, 231, 210, 230, + 209, 210, 190, 209, 190, 189, 173, 174, 163, 173, 163, 162, 154, 155, 142, 154, 142, 141, 125, 126, 102, 125, 102, 101, + + 103, 116, 117, 103, 117, 104, 107, 118, 119, 107, 119, 108, 129, 128, 144, 129, 144, 145, 177, 176, 192, 177, 192, 193, 216, 203, 202, 216, 202, 215, 212, 201, 200, 212, 200, 211, 190, 191, 175, 190, 175, 174, 142, 143, 127, 142, 127, 126, + + } + }, + { + .vtxcount = 156, + .idxCount = 3 * 112, + // .idxCount = 0, + .indexmap = (unsigned int[]) { + 0, 2, 7, 0, 7, 1, 1, 7, 37, 1, 37, 40, 40, 37, 32, 40, 32, 39, 39, 32, 2, 39, 2, 0, + 5, 11, 12, 5, 12, 6, 23, 22, 30, 23, 30, 31, 34, 28, 27, 34, 27, 33, 16, 17, 9, 16, 9, 8, + 3, 14, 15, 3, 10, 4, 10, 15, 13, 13, 15, 25, 13, 18, 19, 18, 25, 36, 36, 25, 24, 36, 29, 35, 29, 24, 26, 26, 24, 14, 26, 21, 20, 21, 14, 3, + + 41, 53, 113, 41, 113, 117, 117, 113, 108, 117, 108, 116, 116, 108, 48, 116, 48, 40, 40, 48, 53, 40, 53, 41, + 85, 84, 100, 85, 100, 101, 110, 98, 97, 110, 97, 109, 74, 75, 61, 74, 61, 60, 51, 63, 64, 51, 64, 52, + 65, 69, 89, 65, 76, 77, 76, 89, 112, 112, 89, 88, 112, 99, 111, 99, 88, 96, 96, 88, 68, 96, 83, 82, 83, 68, 49, 49, 68, 69, 49, 62, 50, 62, 69, 65, + + 155, 153, 148, 155, 148, 154, 154, 148, 118, 154, 118, 115, 115, 118, 123, 115, 123, 116, 116, 123, 153, 116, 153, 155, + 150, 144, 143, 150, 143, 149, 132, 133, 125, 132, 125, 124, 121, 127, 128, 121, 128, 122, 139, 138, 146, 139, 146, 147, + 152, 141, 140, 152, 145, 151, 145, 140, 142, 142, 140, 130, 142, 137, 136, 137, 130, 119, 119, 130, 131, 119, 126, 120, 126, 131, 129, 129, 131, 141, 129, 134, 135, 134, 141, 152, + + 114, 102, 42, 114, 42, 38, 38, 42, 47, 38, 47, 39, 39, 47, 107, 39, 107, 115, 115, 107, 102, 115, 102, 114, + 70, 71, 55, 70, 55, 54, 45, 57, 58, 45, 58, 46, 81, 80, 94, 81, 94, 95, 104, 92, 91, 104, 91, 103, + 90, 86, 66, 90, 79, 78, 79, 66, 43, 43, 66, 67, 43, 56, 44, 56, 67, 59, 59, 67, 87, 59, 72, 73, 72, 87, 106, 106, 87, 86, 106, 93, 105, 93, 86, 90, + + } + }, + { + .vtxcount = 256, + .idxCount = 3 * 192, + // .idxCount = 0, + .indexmap = (unsigned int[]) { + 0, 13, 14, 0, 14, 1, 2, 15, 16, 2, 16, 3, 4, 17, 18, 4, 18, 5, + 19, 18, 34, 19, 34, 35, 55, 54, 70, 55, 70, 71, 91, 90, 106, 91, 106, 107, + 121, 106, 105, 121, 105, 120, 119, 104, 103, 119, 103, 118, 117, 102, 101, 117, 101, 116, + 100, 101, 85, 100, 85, 84, 64, 65, 49, 64, 49, 48, 28, 29, 13, 28, 13, 12, + 14, 30, 31, 14, 31, 15, 16, 32, 33, 16, 33, 17, + 34, 33, 53, 34, 53, 54, 70, 69, 89, 70, 89, 90, + 105, 89, 88, 105, 88, 104, 103, 87, 86, 103, 86, 102, + 85, 86, 66, 85, 66, 65, 49, 50, 30, 49, 30, 29, + 31, 44, 45, 31, 45, 32, 53, 52, 68, 53, 68, 69, 88, 81, 80, 88, 80, 87, 66, 67, 51, 66, 51, 50, + + 6, 21, 22, 6, 22, 7, 8, 23, 24, 8, 24, 9, 10, 25, 26, 10, 26, 11, + 27, 26, 42, 27, 42, 43, 63, 62, 78, 63, 78, 79, 99, 98, 114 , 99, 114, 115, + 127, 114, 113, 127, 113, 126, 125, 112, 111, 125, 111, 124, 123, 110, 109, 123, 109, 122, + 108, 109, 93, 108, 93, 92, 72, 73, 57, 72, 57, 56, 36, 37, 21, 36, 21, 20, + 22, 38, 39, 22, 39, 23, 24, 40, 41, 24, 41, 25, + 42, 41, 61, 42, 61, 62, 78, 77, 97, 78, 97, 98, + 113, 97, 96, 113, 96, 112, 111, 95, 94, 111, 94, 110, + 93, 94, 74, 93, 74, 73, 57, 58, 38, 57, 38, 37, + 39, 46, 47, 39, 47, 40, 61, 60, 76, 61, 76, 77, 96, 83, 82, 96, 82, 95, 74, 75, 59, 74, 59, 58, + + 128, 141, 142, 128, 142, 129, 130, 143, 144, 130, 144, 131, 132, 145, 146, 132, 146, 133, + 147, 146, 162, 147, 162, 163, 183, 182, 198, 183, 198, 199, 219, 218, 234, 219, 234, 235, + 249, 234, 233, 249, 233, 248, 247, 232, 231, 247, 231, 246, 245, 230, 229, 245, 229, 244, + 228, 229, 213, 228, 213, 212, 192, 193, 177, 192, 177, 176, 156, 157, 141, 156, 141, 140, + 142, 158, 159, 142, 159, 143, 144, 160, 161, 144, 161, 145, + 162, 161, 181, 162, 181, 182, 198, 197, 217, 198, 217, 218, + 233, 217, 216, 233, 216, 232, 231, 215, 214, 231, 214, 230, + 213, 214, 194, 213, 194, 193, 177, 178, 158, 177, 158, 157, + 159, 172, 173, 159, 173, 160, 181, 180, 196, 181, 196, 197, 216, 209, 208, 216, 208, 215, 194, 195, 179, 194, 179, 178, + + 134, 149, 150, 134, 150, 135, 136, 151, 152, 136, 152, 137, 138, 153, 154, 138, 154, 139, + 155, 154, 170, 155, 170, 171, 191, 190, 206, 191, 206, 207, 227, 226, 242, 227, 242, 243, + 255, 242, 241, 255, 241, 254, 253, 240, 239, 253, 239, 252, 251, 238, 237, 251, 237, 250, + 236, 237, 221, 236, 221, 220, 200, 201, 185, 200, 185, 184, 164, 165, 149, 164, 149, 148, + 150, 166, 167, 150, 167, 151, 152, 168, 169, 152, 169, 153, + 170, 169, 189, 170, 189, 190, 206, 205, 225, 206, 225, 226, + 241, 225, 224, 241, 224, 240, 239, 223, 222, 239, 222, 238, + 221, 222, 202, 221, 202, 201, 185, 186, 166, 185, 166, 165, + 167, 174, 175, 167, 175, 168, 189, 188, 204, 189, 204, 205, 224, 211, 210, 224, 210, 223, 202, 203, 187, 202, 187, 186, + + } + }, + { + .vtxcount = 112, + .idxCount = 3 * 128, + // .idxCount = 0, + .indexmap = (unsigned int[]) { + 0, 4, 5, 0, 5, 1, 1, 5, 9, 1, 9, 14, 14, 9, 8, 14, 8, 13, 13, 8, 4, 13, 4, 0, + 15, 23, 31, 15, 31, 39, 39, 31, 30, 39, 30, 38, 38, 30, 22, 38, 22, 14, 14, 22, 23, 14, 23, 15, + 53, 49, 48, 53, 48, 52, 52, 48, 44, 52, 44, 37, 37, 44, 45, 37, 45, 38, 38, 45, 49, 38, 49, 53, + 36, 28, 20, 36, 20, 12, 12, 20, 21, 12, 21, 13, 13, 21, 29, 13, 29, 37, 37, 29, 28, 37, 28, 36, + + 2, 6, 7, 2, 7, 3, 3, 7, 11, 3, 11, 18, 18, 11, 10, 18, 10, 17, 17, 10, 6, 17, 6, 2, + 19, 27, 35, 19, 35, 43, 43, 35, 34, 43, 34, 42, 42, 34, 26, 42, 26, 18, 18, 26, 27, 18, 27, 19, + 55, 51, 50, 55, 50, 54, 54, 50, 46, 54, 46, 41, 41, 46, 47, 41, 47, 42, 42, 47, 51, 42, 51, 55, + 40, 32, 24, 40, 24, 16, 16, 24, 25, 16, 25, 17, 17, 25, 33, 17, 33, 41, 41, 33, 32, 41, 32, 40, + + 56, 60, 61, 56, 61, 57, 57, 61, 65, 57, 65, 70, 70, 65, 64, 70, 64, 69, 69, 64, 60, 69, 60, 56, + 71, 79, 87, 71, 87, 95, 95, 87, 86, 95, 86, 94, 94, 86, 78, 94, 78, 70, 70, 78, 79, 70, 79, 71, + 109, 105, 104, 109, 104, 108, 108, 104, 100, 108, 100, 93, 93, 100, 101, 93, 101, 94, 94, 101, 105, 94, 105, 109, + 92, 84, 76, 92, 76, 68, 68, 76, 77, 68, 77, 69, 69, 77, 85, 69, 85, 93, 93, 85, 84, 93, 84, 92, + + 58, 62, 63, 58, 63, 59, 59, 63, 67, 59, 67, 74, 74, 67, 66, 74, 66, 73, 73, 66, 62, 73, 62, 58, + 75, 83, 91, 75, 91, 99, 99, 91, 90, 99, 90, 98, 98, 90, 82, 98, 82, 74, 74, 82, 83, 74, 83, 75, + 111, 107, 106, 111, 106, 110, 110, 106, 102, 110, 102, 97, 97, 102, 103, 97, 103, 98, 98, 103, 107, 98, 107, 111, + 96, 88, 80, 96, 80, 72, 72, 80, 81, 72, 81, 73, 73, 81, 89, 73, 89, 97, 97, 89, 88, 97, 88, 96, + + } + }, + { + .vtxcount = 192, + .idxCount = 3 * 128, + // .idxCount = 0, + .indexmap = (unsigned int[]) { + 0, 9, 10, 0, 10, 1, 11, 10, 26, 11, 26, 27, 41, 26, 25, 41, 25, 40, 24, 25, 9, 24, 9, 8, + 2, 13, 14, 2, 14, 3, 15, 14, 30, 15, 30, 31, 43, 30, 29, 43, 29, 42, 28, 29, 13, 28, 13, 12, + 4, 17, 18, 4, 18, 5, 19, 18, 34, 19, 34, 35, 45, 34, 33, 45, 33, 44, 32, 33, 17, 32, 17, 16, + 6, 21, 22, 6, 22, 7, 23, 22, 38, 23, 38, 39, 47, 38, 37, 47, 37, 46, 36, 37, 21, 36, 21, 20, + + 48, 57, 58, 48, 58, 49, 59, 58, 74, 59, 74, 75, 89, 74, 73, 89, 73, 88, 72, 73, 57, 72, 57, 56, + 50, 61, 62, 50, 62, 51, 63, 62, 78, 63, 78, 79, 91, 78, 77, 91, 77, 90, 76, 77, 61, 76, 61, 60, + 52, 65, 66, 52, 66, 53, 67, 66, 82, 67, 82, 83, 93, 82, 81, 93, 81, 92, 80, 81, 65, 80, 65, 64, + 54, 69, 70, 54, 70, 55, 71, 70, 86, 71, 86, 87, 95, 86, 85, 95, 85, 94, 84, 85, 69, 84, 69, 68, + + 96, 105, 106, 96, 106, 97, 107, 106, 122, 107, 122, 123, 137, 122, 121, 137, 121, 136, 120, 121, 105, 120, 105, 104, + 98, 109, 110, 98, 110, 99, 111, 110, 126, 111, 126, 127, 139, 126, 125, 139, 125, 138, 124, 125, 109, 124, 109, 108, + 100, 113, 114, 100, 114, 101, 115, 114, 130, 115, 130, 131, 141, 130, 129, 141, 129, 140, 128, 129, 113, 128, 113, 112, + 102, 117, 118, 102, 118, 103, 119, 118, 134, 119, 134, 135, 143, 134, 133, 143, 133, 142, 132, 133, 117, 132, 117, 116, + + 144, 153, 154, 144, 154, 145, 155, 154, 170, 155, 170, 171, 185, 170, 169, 185, 169, 184, 168, 169, 153, 168, 153, 152, + 146, 157, 158, 146, 158, 147, 159, 158, 174, 159, 174, 175, 187, 174, 173, 187, 173, 186, 172, 173, 157, 172, 157, 156, + 148, 161, 162, 148, 162, 149, 163, 162, 178, 163, 178, 179, 189, 178, 177, 189, 177, 188, 176, 177, 161, 176, 161, 160, + 150, 165, 166, 150, 166, 151, 167, 166, 182, 167, 182, 183, 191, 182, 181, 191, 181, 190, 180, 181, 165, 180, 165, 164, + + } + } +}; + +layer L3_templates_flipped[8] = {0}; + +void L3_completeLayers() { + + for (int i = 0; i < 8; i++) { + L3_templates_flipped[i] = L3_templates[i]; + L3_templates_flipped[i].indexmap = flipLayer(L3_templates[i].indexmap, L3_templates[i].idxCount); + } + +} + + +#define LAYER_COUNT 28 +shape mengerL3 = { + .layerCount = LAYER_COUNT, + .layers = (layer*[LAYER_COUNT]) { + L3_templates, + + L3_templates_flipped + 1, + L3_templates + 1, + + L3_templates_flipped + 2, + + L3_templates_flipped + 3, + L3_templates + 3, + + L3_templates + 2, + + L3_templates_flipped + 1, + L3_templates + 1, + + L3_templates_flipped + 4, + + L3_templates_flipped + 5, + L3_templates + 5, + + L3_templates_flipped + 6, + + L3_templates_flipped + 7, + L3_templates + 7, + + L3_templates + 6, + + L3_templates_flipped + 5, + L3_templates + 5, + + L3_templates + 4, + + L3_templates_flipped + 1, + L3_templates + 1, + + L3_templates_flipped + 2, + + L3_templates_flipped + 3, + L3_templates + 3, + + L3_templates + 2, + + L3_templates_flipped + 1, + L3_templates + 1, + + L3_templates_flipped + }, + .compileLayers = &L3_completeLayers +}; +#undef LAYER_COUNT diff --git a/resource.rc b/resource.rc index 244f98c..52a9ac4 100644 --- a/resource.rc +++ b/resource.rc @@ -5,7 +5,7 @@ // Layout macros -#define DIALOG_WIDTH 160 +#define DIALOG_WIDTH 180 #define DIALOG_HEIGHT 63 ID_APP ICON SSMS.ICO @@ -26,10 +26,11 @@ BEGIN RTEXT "Sponge level:" LABEL_SPONGE, 6, 8, 50, 8 //RTEXT "Colour:" LABEL_COLOUR, 6, 20, 50, 8 - AUTORADIOBUTTON "1" CTRL_SPONGE_LEVEL_1, 60, 8, 20, 8, WS_GROUP - AUTORADIOBUTTON "2" CTRL_SPONGE_LEVEL_2, 80, 8, 20, 8 + AUTORADIOBUTTON "1" CTRL_SPONGE_LEVEL_1, 60, 8, 20, 8, WS_GROUP + AUTORADIOBUTTON "2" CTRL_SPONGE_LEVEL_2, 80, 8, 20, 8 + AUTORADIOBUTTON "3" CTRL_SPONGE_LEVEL_3, 100, 8, 20, 8 - DEFPUSHBUTTON "OK" IDOK, 117, 10, 40, 14 - PUSHBUTTON "Cancel" IDCANCEL, 117, 32, 40, 14 + DEFPUSHBUTTON "OK" IDOK, 125, 10, 40, 14 + PUSHBUTTON "Cancel" IDCANCEL, 125, 32, 40, 14 END