Last active
April 5, 2018 08:15
-
-
Save Lisoph/8c39aa5a78f73a124f68dbd2552ebc51 to your computer and use it in GitHub Desktop.
Dithering based fading in Quake 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/id-Software/Quake-2/blob/372afde46e7defc9dd2d719a1732b8ace1fa096e/ref_soft/r_draw.c#L428 | |
void Draw_FadeScreen (void) | |
{ | |
int x,y; | |
byte *pbuf; | |
int t; | |
for (y=0 ; y<vid.height ; y++) | |
{ | |
pbuf = (byte *)(vid.buffer + vid.rowbytes*y); | |
t = (y & 1) << 1; | |
for (x=0 ; x<vid.width ; x++) | |
{ | |
if ((x & 3) != t) | |
pbuf[x] = 0; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment