mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 14:02:59 +00:00 
			
		
		
		
	an option to desaturate colors for anaglyph
This commit is contained in:
		| @@ -137,18 +137,22 @@ bool fading = false; | |||||||
|  |  | ||||||
| ld fadeout = 1; | ld fadeout = 1; | ||||||
|  |  | ||||||
| int darkened(int c) { | color_t darkened(color_t c) { | ||||||
|   if(inmirrorcount&1) |   if(inmirrorcount&1) | ||||||
|     c = gradient(c, winf[waMirror].color, 0, 0.5, 1); |     c = gradient(c, winf[waMirror].color, 0, 0.5, 1); | ||||||
|   else if(inmirrorcount) |   else if(inmirrorcount) | ||||||
|     c = gradient(c, winf[waCloud].color, 0, 0.5, 1); |     c = gradient(c, winf[waCloud].color, 0, 0.5, 1); | ||||||
|   if(fading) c = gradient(backcolor, c, 0, fadeout, 1); |   if(fading) c = gradient(backcolor, c, 0, fadeout, 1); | ||||||
|  |   if(vid.desaturate) { | ||||||
|  |     ld luminance = 0.2125 * part(c,2) + 0.7154 * part(c,1) + 0.0721 * part(c, 0); | ||||||
|  |     c = gradient(c, int(luminance+.5) * 0x10101, 0, vid.desaturate, 100); | ||||||
|  |     } | ||||||
|   for(int i=0; i<darken; i++) |   for(int i=0; i<darken; i++) | ||||||
|     c = ((c & 0xFEFEFE) >> 1) + ((backcolor & 0xFEFEFE) >> 1); |     c = ((c & 0xFEFEFE) >> 1) + ((backcolor & 0xFEFEFE) >> 1); | ||||||
|   return c; |   return c; | ||||||
|   } |   } | ||||||
|  |  | ||||||
| int darkena(int c, int lev, int a) { | color_t darkena(color_t c, int lev, int a) { | ||||||
|   return (darkenedby(c, lev) << 8) + a; |   return (darkenedby(c, lev) << 8) + a; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -293,6 +293,7 @@ void initConfig() { | |||||||
|   addsaver(vid.lr_eyewidth, "eyewidth-lr", 0.5); |   addsaver(vid.lr_eyewidth, "eyewidth-lr", 0.5); | ||||||
|   addsaver(vid.anaglyph_eyewidth, "eyewidth-anaglyph", 0.1); |   addsaver(vid.anaglyph_eyewidth, "eyewidth-anaglyph", 0.1); | ||||||
|   addsaver(vid.fov, "field-of-vision", 90); |   addsaver(vid.fov, "field-of-vision", 90); | ||||||
|  |   addsaver(vid.desaturate, "desaturate", 0); | ||||||
|   addsaverenum(vid.stereo_mode, "stereo-mode"); |   addsaverenum(vid.stereo_mode, "stereo-mode"); | ||||||
|   addsaver(vid.euclid_to_sphere, "euclid to sphere projection", 1.5); |   addsaver(vid.euclid_to_sphere, "euclid to sphere projection", 1.5); | ||||||
|   addsaver(vid.twopoint_param, "twopoint parameter", 1); |   addsaver(vid.twopoint_param, "twopoint parameter", 1); | ||||||
| @@ -1311,6 +1312,13 @@ void showStereo() { | |||||||
|       break; |       break; | ||||||
|     } |     } | ||||||
|    |    | ||||||
|  |   dialog::addSelItem(XLAT("desaturate colors"), its(vid.desaturate)+"%", 'c'); | ||||||
|  |   dialog::add_action([] { | ||||||
|  |     dialog::editNumber(vid.desaturate, 0, 100, 10, 0, XLAT("remove standard colors"), | ||||||
|  |       XLAT("Make the game colors less saturated. This is useful in the anaglyph mode.") | ||||||
|  |       );     | ||||||
|  |     }); | ||||||
|  |    | ||||||
|   add_edit_fov('f'); |   add_edit_fov('f'); | ||||||
|  |  | ||||||
|   dialog::addBack(); |   dialog::addBack(); | ||||||
|   | |||||||
							
								
								
									
										5
									
								
								hyper.h
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								hyper.h
									
									
									
									
									
								
							| @@ -993,7 +993,7 @@ typedef color_t color_t; | |||||||
| void displayButton(int x, int y, const string& name, int key, int align, int rad = 0); | void displayButton(int x, int y, const string& name, int key, int align, int rad = 0); | ||||||
| void displayColorButton(int x, int y, const string& name, int key, int align, int rad, color_t color, color_t color2 = 0); | void displayColorButton(int x, int y, const string& name, int key, int align, int rad, color_t color, color_t color2 = 0); | ||||||
| inline string ONOFF(bool b) { return XLAT(b ? "ON" : "OFF"); } | inline string ONOFF(bool b) { return XLAT(b ? "ON" : "OFF"); } | ||||||
| int darkened(int c); | color_t darkened(color_t c); | ||||||
| extern int getcstat; | extern int getcstat; | ||||||
| bool displaychr(int x, int y, int shift, int size, char chr, color_t col); | bool displaychr(int x, int y, int shift, int size, char chr, color_t col); | ||||||
| bool displayfr(int x, int y, int b, int size, const string &s, color_t color, int align); | bool displayfr(int x, int y, int b, int size, const string &s, color_t color, int align); | ||||||
| @@ -1128,6 +1128,7 @@ struct videopar { | |||||||
|   ld lr_eyewidth, anaglyph_eyewidth; |   ld lr_eyewidth, anaglyph_eyewidth; | ||||||
|   ld fov; |   ld fov; | ||||||
|   bool consider_shader_projection; |   bool consider_shader_projection; | ||||||
|  |   int desaturate; | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
| extern videopar vid; | extern videopar vid; | ||||||
| @@ -2227,7 +2228,7 @@ inline bool mdAzimuthalEqui() { return pmodel == mdEquidistant || pmodel == mdEq | |||||||
|  |  | ||||||
| inline bool mdBandAny() { return pmodel == mdBand || pmodel == mdBandEquidistant || pmodel == mdBandEquiarea || pmodel == mdSinusoidal; } | inline bool mdBandAny() { return pmodel == mdBand || pmodel == mdBandEquidistant || pmodel == mdBandEquiarea || pmodel == mdSinusoidal; } | ||||||
|  |  | ||||||
| int darkena(int c, int lev, int a); | color_t darkena(color_t c, int lev, int a); | ||||||
|  |  | ||||||
| #define SHSIZE 16 | #define SHSIZE 16 | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue