-#endif /* USE_MCUBES */
-
-
-/* ---- marching tetrahedra implementation (incomplete) ---- */
-#ifdef USE_MTETRA
-
-static unsigned int mt_bitcode(float v0, float v1, float v2, float v3, float thres);
-static void emmit(struct metasurface *ms, float v0, float v1, vec3 p0, vec3 p1, int rev)
-
-
-#define REVBIT(x) ((x) & 8)
-#define INV(x) (~(x) & 0xf)
-#define EDGE(a, b) emmit(ms, val[idx[a]], val[idx[b]], pos[idx[a]], pos[idx[b]], REVBIT(code))
-static void process_tetra(struct metasurface *ms, int *idx, vec3 *pos, float *val)
-{
- unsigned int code = mt_bitcode(val[idx[0]], val[idx[1]], val[idx[2]], val[idx[3]], ms->thres);
-
- switch(code) {
- case 1:
- case INV(1):
- EDGE(0, 1);
- EDGE(0, 2);
- EDGE(0, 3);
- break;
-
- case 2:
- case INV(2):
- EDGE(1, 0);
- EDGE(1, 3);
- EDGE(1, 2);
- break;
-
- case 3:
- case INV(3):
- EDGE(0, 3);
- EDGE(0, 2);
- EDGE(1, 3);
-
- EDGE(1, 3);
- EDGE(1, 2);
- EDGE(0, 2);
- break;
-
- case 4:
- case INV(4):
- EDGE(2, 0);
- EDGE(2, 1);
- EDGE(2, 3);
- break;
-
- case 5:
- case INV(5):
- EDGE(0, 1);
- EDGE(2, 3);
- EDGE(0, 3);
-
- EDGE(0, 1);
- EDGE(1, 2);
- EDGE(2, 3);
- break;
-
- case 6:
- case INV(6):
- EDGE(0, 1);
- EDGE(1, 3);
- EDGE(2, 3);
-
- EDGE(0, 1);
- EDGE(0, 2);
- EDGE(2, 3);
- break;
-
- case 7:
- case INV(7):
- EDGE(3, 0);
- EDGE(3, 2);
- EDGE(3, 1);
- break;
-
- default:
- break; /* cases 0 and 15 */
- }
-}
-
-#define BIT(i) ((v##i > thres) ? (1 << i) : 0)
-static unsigned int mt_bitcode(float v0, float v1, float v2, float v3, float thres)
-{
- return BIT(0) | BIT(1) | BIT(2) | BIT(3);
-}
-
-static void emmit(struct metasurface *ms, float v0, float v1, vec3 p0, vec3 p1, int rev)
-{
- int i;
- float t = (ms->thres - v0) / (v1 - v0);
-
- vec3 p;
- for(i=0; i<3; i++) {
- p[i] = p0[i] + (p1[i] - p0[i]) * t;
- }
- ms->vertex(ms, p[0], p[1], p[2]);
-
- /*for(i=0; i<3; i++) {
- ms->vbuf[ms->nverts][i] = p0[i] + (p1[i] - p0[i]) * t;
- }
-
- if(++ms->nverts >= 3) {
- ms->nverts = 0;
-
- for(i=0; i<3; i++) {
- int idx = rev ? (2 - i) : i;
- ms->vertex(ms, ms->vbuf[idx][0], ms->vbuf[idx][1], ms->vbuf[idx][2]);
- }
- }*/
-}
-#endif /* USE_MTETRA */