* -saturation light switch, default = 1, affects lightmaps and vertex color; > 1 = saturate, 0 = grayscale, < 0 = complementary colors
This commit is contained in:
parent
ac1dd904f1
commit
858ec974f7
2
Makefile
2
Makefile
|
|
@ -583,7 +583,6 @@ $(INSTALLDIR)/q3map2.$(EXE): \
|
||||||
libddslib.$(A) \
|
libddslib.$(A) \
|
||||||
libfilematch.$(A) \
|
libfilematch.$(A) \
|
||||||
libl_net.$(A) \
|
libl_net.$(A) \
|
||||||
libmathlib.$(A) \
|
|
||||||
libpicomodel.$(A) \
|
libpicomodel.$(A) \
|
||||||
$(if $(findstring $(OS),Win32),icons/q3map2.o,) \
|
$(if $(findstring $(OS),Win32),icons/q3map2.o,) \
|
||||||
|
|
||||||
|
|
@ -749,7 +748,6 @@ $(INSTALLDIR)/radiant.$(EXE): \
|
||||||
libcmdlib.$(A) \
|
libcmdlib.$(A) \
|
||||||
libgtkutil.$(A) \
|
libgtkutil.$(A) \
|
||||||
libl_net.$(A) \
|
libl_net.$(A) \
|
||||||
libmathlib.$(A) \
|
|
||||||
libprofile.$(A) \
|
libprofile.$(A) \
|
||||||
libquickhull.$(A) \
|
libquickhull.$(A) \
|
||||||
libxmllib.$(A) \
|
libxmllib.$(A) \
|
||||||
|
|
|
||||||
|
|
@ -2248,6 +2248,13 @@ int LightMain( int argc, char **argv ){
|
||||||
lightmapContrast = ( 259 * ( lightmapContrast + 255 ) ) / ( 255 * ( 259 - lightmapContrast ) );
|
lightmapContrast = ( 259 * ( lightmapContrast + 255 ) ) / ( 255 * ( 259 - lightmapContrast ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Lighting saturation */
|
||||||
|
else if( striEqual( argv[ i ], "-saturation" ) ){
|
||||||
|
g_lightmapSaturation = atof( argv[ i + 1 ] );
|
||||||
|
Sys_Printf( "Lighting saturation set to %f\n", g_lightmapSaturation );
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
/* ydnar switches */
|
/* ydnar switches */
|
||||||
else if ( striEqual( argv[ i ], "-bounce" ) ) {
|
else if ( striEqual( argv[ i ], "-bounce" ) ) {
|
||||||
bounce = std::max( 0, atoi( argv[ i + 1 ] ) );
|
bounce = std::max( 0, atoi( argv[ i + 1 ] ) );
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,21 @@
|
||||||
#include "q3map2.h"
|
#include "q3map2.h"
|
||||||
|
|
||||||
|
|
||||||
|
// http://www.graficaobscura.com/matrix/index.html
|
||||||
|
static void color_saturate( Vector3& color, float saturation ){
|
||||||
|
/* This is the luminance vector. Notice here that we do not use the standard NTSC weights of 0.299, 0.587, and 0.114.
|
||||||
|
The NTSC weights are only applicable to RGB colors in a gamma 2.2 color space. For linear RGB colors these values are better. */
|
||||||
|
const Vector3 rgb2gray( 0.3086, 0.6094, 0.0820 );
|
||||||
|
Matrix4 tra( g_matrix4_identity );
|
||||||
|
tra.x().vec3().set( rgb2gray.x() * ( 1 - saturation ) );
|
||||||
|
tra.y().vec3().set( rgb2gray.y() * ( 1 - saturation ) );
|
||||||
|
tra.z().vec3().set( rgb2gray.z() * ( 1 - saturation ) );
|
||||||
|
tra.xx() += saturation;
|
||||||
|
tra.yy() += saturation;
|
||||||
|
tra.zz() += saturation;
|
||||||
|
matrix4_transform_direction( tra, color );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -53,6 +68,9 @@ Vector3b ColorToBytes( const Vector3& color, float scale ){
|
||||||
/* make a local copy */
|
/* make a local copy */
|
||||||
Vector3 sample = color * scale;
|
Vector3 sample = color * scale;
|
||||||
|
|
||||||
|
if( g_lightmapSaturation != 1 )
|
||||||
|
color_saturate( sample, g_lightmapSaturation );
|
||||||
|
|
||||||
/* muck with it */
|
/* muck with it */
|
||||||
gamma = 1.0f / lightmapGamma;
|
gamma = 1.0f / lightmapGamma;
|
||||||
for ( i = 0; i < 3; i++ )
|
for ( i = 0; i < 3; i++ )
|
||||||
|
|
|
||||||
|
|
@ -2345,6 +2345,7 @@ Q_EXTERN float lightmapExposure Q_ASSIGN( 0.0f );
|
||||||
Q_EXTERN float lightmapCompensate Q_ASSIGN( 1.0f );
|
Q_EXTERN float lightmapCompensate Q_ASSIGN( 1.0f );
|
||||||
Q_EXTERN float lightmapBrightness Q_ASSIGN( 1.0f );
|
Q_EXTERN float lightmapBrightness Q_ASSIGN( 1.0f );
|
||||||
Q_EXTERN float lightmapContrast Q_ASSIGN( 1.0f );
|
Q_EXTERN float lightmapContrast Q_ASSIGN( 1.0f );
|
||||||
|
inline float g_lightmapSaturation = 1;
|
||||||
|
|
||||||
/* ydnar: for runtime tweaking of falloff tolerance */
|
/* ydnar: for runtime tweaking of falloff tolerance */
|
||||||
Q_EXTERN float falloffTolerance Q_ASSIGN( 1.0f );
|
Q_EXTERN float falloffTolerance Q_ASSIGN( 1.0f );
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user