From: Rudolf Polzer Date: Fri, 9 Dec 2011 16:15:51 +0000 (+0100) Subject: properly ignore caulk X-Git-Tag: xonotic-v0.6.0~45 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=35162b6b63eb9f8b350a6d0e126d72cba0f5a1be;p=xonotic%2Fnetradiant.git properly ignore caulk --- diff --git a/Makefile b/Makefile index f87dba8b..5a9f2923 100644 --- a/Makefile +++ b/Makefile @@ -243,6 +243,7 @@ CPPFLAGS += -DRADIANT_VERSION="\"$(RADIANT_VERSION)\"" -DRADIANT_MAJOR_VERSION=" .PHONY: all all: \ + dependencies-check \ binaries \ install-data \ install-dll \ @@ -446,10 +447,10 @@ ifeq ($(OS),Win32) $(WINDRES) $< $@ endif -%.o: %.cpp dependencies-check $(if $(findstring $(DEPEND_ON_MAKEFILE),yes),$(wildcard Makefile*),) +%.o: %.cpp $(if $(findstring $(DEPEND_ON_MAKEFILE),yes),$(wildcard Makefile*),) | dependencies-check $(CXX) $< $(CFLAGS) $(CXXFLAGS) $(CFLAGS_COMMON) $(CXXFLAGS_COMMON) $(CPPFLAGS_EXTRA) $(CPPFLAGS_COMMON) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ -%.o: %.c dependencies-check $(if $(findstring $(DEPEND_ON_MAKEFILE),yes),$(wildcard Makefile*),) +%.o: %.c dependencies-check $(if $(findstring $(DEPEND_ON_MAKEFILE),yes),$(wildcard Makefile*),) | dependencies-check $(CC) $< $(CFLAGS) $(CFLAGS_COMMON) $(CPPFLAGS_EXTRA) $(CPPFLAGS_COMMON) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ diff --git a/tools/quake3/q3map2/light_ydnar.c b/tools/quake3/q3map2/light_ydnar.c index b777ee35..2ef1ad77 100644 --- a/tools/quake3/q3map2/light_ydnar.c +++ b/tools/quake3/q3map2/light_ydnar.c @@ -3144,9 +3144,10 @@ SetupBrushes() determines opaque brushes in the world and find sky shaders for sunlight calculations */ -void SetupBrushesFlags( int mask, int test ) +void SetupBrushesFlags( int mask_any, int test_any, int mask_all, int test_all ) { - int i, j, b, compileFlags; + int i, j, b; + unsigned int compileFlags, allCompileFlags; qboolean inside; bspBrush_t *brush; bspBrushSide_t *side; @@ -3175,23 +3176,25 @@ void SetupBrushesFlags( int mask, int test ) /* check all sides */ inside = qtrue; compileFlags = 0; + allCompileFlags = ~(0u); for( j = 0; j < brush->numSides && inside; j++ ) { /* do bsp shader calculations */ side = &bspBrushSides[ brush->firstSide + j ]; shader = &bspShaders[ side->shaderNum ]; - + /* get shader info */ - si = ShaderInfoForShader( shader->shader ); + si = ShaderInfoForShaderNull( shader->shader ); if( si == NULL ) continue; /* or together compile flags */ compileFlags |= si->compileFlags; + allCompileFlags &= si->compileFlags; } /* determine if this brush is opaque to light */ - if( (compileFlags & mask) == test ) + if( (compileFlags & mask_any) == test_any && (allCompileFlags & mask_all) == test_all ) { opaqueBrushes[ b >> 3 ] |= (1 << (b & 7)); numOpaqueBrushes++; @@ -3204,7 +3207,7 @@ void SetupBrushesFlags( int mask, int test ) } void SetupBrushes( void ) { - SetupBrushesFlags(C_TRANSLUCENT, 0); + SetupBrushesFlags(C_TRANSLUCENT, 0, 0, 0); } diff --git a/tools/quake3/q3map2/main.c b/tools/quake3/q3map2/main.c index f9017d5f..a1450487 100644 --- a/tools/quake3/q3map2/main.c +++ b/tools/quake3/q3map2/main.c @@ -361,7 +361,10 @@ determines solid non-sky brushes in the world void MiniMapSetupBrushes( void ) { - SetupBrushesFlags(C_SOLID | C_SKY, C_SOLID); + SetupBrushesFlags(C_SOLID | C_SKY, C_SOLID, C_NODRAW, 0); + // at least one must be solid + // none may be sky + // not all may be nodraw } qboolean MiniMapEvaluateSampleOffsets(int *bestj, int *bestk, float *bestval) @@ -716,20 +719,25 @@ int MiniMapBSPMain( int argc, char **argv ) if(v > ma) ma = v; } - s = 1 / (ma - mi); - o = mi / (ma - mi); - - // equations: - // brightness + contrast * v - // after autolevel: - // brightness + contrast * (v * s - o) - // = - // (brightness - contrast * o) + (contrast * s) * v - minimap.brightness = minimap.brightness - minimap.contrast * o; - minimap.contrast *= s; - - Sys_Printf( "Auto level: Brightness changed to %f\n", minimap.brightness ); - Sys_Printf( "Auto level: Contrast changed to %f\n", minimap.contrast ); + if(ma > mi) + { + s = 1 / (ma - mi); + o = mi / (ma - mi); + + // equations: + // brightness + contrast * v + // after autolevel: + // brightness + contrast * (v * s - o) + // = + // (brightness - contrast * o) + (contrast * s) * v + minimap.brightness = minimap.brightness - minimap.contrast * o; + minimap.contrast *= s; + + Sys_Printf( "Auto level: Brightness changed to %f\n", minimap.brightness ); + Sys_Printf( "Auto level: Contrast changed to %f\n", minimap.contrast ); + } + else + Sys_Printf( "Auto level: failed because all pixels are the same value\n" ); } if(minimap.brightness != 0 || minimap.contrast != 1) diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index b8949768..720d63b1 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -1807,7 +1807,7 @@ void FloodLightRawLightmap( int num ); void IlluminateRawLightmap( int num ); void IlluminateVertexes( int num ); -void SetupBrushesFlags( int mask, int test ); +void SetupBrushesFlags( int mask_any, int test_any, int mask_all, int test_all ); void SetupBrushes( void ); void SetupClusters( void ); qboolean ClusterVisible( int a, int b ); @@ -1858,6 +1858,7 @@ void EmitVertexRemapShader( char *from, char *to ); void LoadShaderInfo( void ); shaderInfo_t *ShaderInfoForShader( const char *shader ); +shaderInfo_t *ShaderInfoForShaderNull( const char *shader ); /* bspfile_abstract.c */ diff --git a/tools/quake3/q3map2/shaders.c b/tools/quake3/q3map2/shaders.c index dcbf79d2..5203c9d6 100644 --- a/tools/quake3/q3map2/shaders.c +++ b/tools/quake3/q3map2/shaders.c @@ -827,6 +827,13 @@ finds a shaderinfo for a named shader #define MAX_SHADER_DEPRECATION_DEPTH 16 +shaderInfo_t *ShaderInfoForShaderNull( const char *shaderName ) +{ + if(!strcmp(shaderName, "noshader")) + return NULL; + return ShaderInfoForShader(shaderName); +} + shaderInfo_t *ShaderInfoForShader( const char *shaderName ) { int i;