From 9f8d3f0a00b04b768dea4e58a3dbb616087d7103 Mon Sep 17 00:00:00 2001 From: divverent Date: Mon, 27 Apr 2009 17:20:32 +0000 Subject: [PATCH] minimap: -boost = contrast boost (like in darkplaces) git-svn-id: svn://svn.icculus.org/netradiant/trunk@348 61c419a2-8eb2-4b30-bcec-8cead039b335 --- tools/quake3/q3map2/main.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tools/quake3/q3map2/main.c b/tools/quake3/q3map2/main.c index a4e446d6..41e76030 100644 --- a/tools/quake3/q3map2/main.c +++ b/tools/quake3/q3map2/main.c @@ -103,6 +103,7 @@ typedef struct minimap_s float *sample_offsets; float sharpen_boxmult; float sharpen_centermult; + float boost; float *data1f; float *sharpendata1f; vec3_t mins, size; @@ -319,6 +320,17 @@ static void MiniMapSharpen(int y) } } +static void MiniMapContrastBoost(int y) +{ + int x; + float *q = &minimap.data1f[y * minimap.width]; + for(x = 0; x < minimap.width; ++x) + { + *q = *q * minimap.boost / ((minimap.boost - 1) * *q + 1); + ++q; + } +} + void MiniMapMakeMinsMaxs(vec3_t mins_in, vec3_t maxs_in, float border, qboolean keepaspect) { vec3_t mins, maxs, extend; @@ -595,6 +607,7 @@ int MiniMapBSPMain( int argc, char **argv ) minimap.samples = 1; minimap.sample_offsets = NULL; + minimap.boost = 1.0; /* process arguments */ for( i = 1; i < (argc - 1); i++ ) @@ -678,6 +691,12 @@ int MiniMapBSPMain( int argc, char **argv ) mode = MINIMAP_MODE_WHITE; Sys_Printf( "Writing as white alpha image\n" ); } + else if( !strcmp( argv[ i ], "-boost" ) ) + { + minimap.boost = atof(argv[i + 1]); + i++; + Sys_Printf( "Contrast boost set to %f\n", minimap.boost ); + } } MiniMapMakeMinsMaxs(mins, maxs, border, keepaspect); @@ -725,6 +744,12 @@ int MiniMapBSPMain( int argc, char **argv ) } } + if(minimap.boost != 1.0) + { + Sys_Printf( "\n--- MiniMapContrastBoost (%d) ---\n", minimap.height ); + RunThreadsOnIndividual(minimap.height, qtrue, MiniMapContrastBoost); + } + if(minimap.sharpendata1f) { Sys_Printf( "\n--- MiniMapSharpen (%d) ---\n", minimap.height );