]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
properly ignore caulk
authorRudolf Polzer <divverent@xonotic.org>
Fri, 9 Dec 2011 16:15:51 +0000 (17:15 +0100)
committerRudolf Polzer <divverent@xonotic.org>
Fri, 9 Dec 2011 16:15:51 +0000 (17:15 +0100)
Makefile
tools/quake3/q3map2/light_ydnar.c
tools/quake3/q3map2/main.c
tools/quake3/q3map2/q3map2.h
tools/quake3/q3map2/shaders.c

index f87dba8b71091424d5f94c3f939e185de0e457a7..5a9f292360d13c8b57b2a6effb8250a60133999e 100644 (file)
--- 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 $@
 
 
index b777ee3565b93d1ea4455b5f77e74af54ae604d0..2ef1ad771651d9e0d5886c7a2a8eb0294a82c94f 100644 (file)
@@ -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);
 }
 
 
index f9017d5f938f1444e536979a3b0e9a4f6897885e..a14504877fa4dd25866103bc68510e3abaa522ab 100644 (file)
@@ -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)
index b89497688d94c4632cafb29c9f057ec2afc27ef6..720d63b1070b895e1eec5cbd99fb125594bafcaa 100644 (file)
@@ -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 */
index dcbf79d2c99b088129cf7ed3ee5ed3f48179a1f9..5203c9d66b96f60a6ab6d80bf9d0f17ad6f0dd64 100644 (file)
@@ -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;