1

**General coding questions / voxel waves**

« **on:**April 04, 2018 »

Does anyone know of or have an example of this effect, the one that future crew had in second reality? The only example I've been able to find is by Insolit Dust who used to post here, but it's difficult to read and has enough hardcoded values that I can't really tell what it's trying to do. Any language should be okay, but it's more difficult for me to deconstruct an xy location if the video is addressed like unsigned char *b = DBuf + (a << + (a << 6) + i;

snippet from insolit dust, he posted a link to his site here so I hope this is okay!

snippet from insolit dust, he posted a link to his site here so I hope this is okay!

Code: [Select]

`void Line(int x0, int y0, int x1, int y1, int hy, int s)`

{

register int i;

int sx, sy;

int c,y,h,u0,v0,u1,v1,a,b,h0,h1,h2,h3;

sx = (x1 - x0) / 320;

sy = (y1 - y0) / 320;

for (i = 0; i < 320; i++)

{

u0 = (x0 >> 16) & 0xFF;

a = (x0 >> 8) & 255;

v0 = ((y0 >> 8) & 0xFF00);

b = (y0 >> 8) & 255;

u1 = (u0 + 1) & 0xFF;

v1 = (v0 + 256) & 0xFF00;

h0 = HMap[u0 + v0];

h2 = HMap[u0 + v1];

h1 = HMap[u1 + v0];

h3 = HMap[u1 + v1];

h0 = (h0 << 8) + a * (h1 - h0);

h2 = (h2 << 8) + a * (h3 - h2);

h = ((h0 << 8) + b * (h2 - h0)) >> 16;

h0 = CMap[u0 + v0];

h2 = CMap[u0 + v1];

h1 = CMap[u1 + v0];

h3 = CMap[u1 + v1];

h0 = (h0 << 8) + a * (h1 - h0);

h2 = (h2 << 8) + a * (h3 - h2);

c = ((h0 << 8) + b * (h2 - h0));

y = (((h - hy) * s) >> 11) + (240 / 2);

if (y < (a = LastY[i]))

{

unsigned char *b = DBuf + (a << 8) + (a << 6) + i;

int sc,cc;

if (LastC[i] == -1)

LastC[i] = c;

sc = (c - LastC[i]) / (a - y);

cc = LastC[i];

if (a > 240 - 1)

{

b -= (a - (240 - 1)) * 320;

cc += (a - (240 - 1)) * sc;

a = 240 - 1;

}

if (y < 0)

y = 0;

while (y < a)

{

*b = cc >> 18;

cc += sc;

b -= 320;

a--;

}

LastY[i] = y;

}

LastC[i] = c;

x0 += sx;

y0 += sy;

}

}