+ // deluxemapped q3bsp files have an even number of lightmaps, and surfaces
+ // always index even numbered ones (0, 2, 4, ...), the odd numbered
+ // lightmaps are the deluxemaps (light direction textures), so if we
+ // encounter any odd numbered lightmaps it is not a deluxemapped bsp, it
+ // is also not a deluxemapped bsp if it has an odd number of lightmaps or
+ // less than 2
+ loadmodel->brushq3.deluxemapping = true;
+ loadmodel->brushq3.deluxemapping_modelspace = true;
+ if (count < 2 || (count & 1))
+ loadmodel->brushq3.deluxemapping = false;
+
+ // q3map2 sometimes (or always?) makes a second blank lightmap for no
+ // reason when only one lightmap is used, which can throw off the
+ // deluxemapping detection method, so check 2-lightmap bsp's specifically
+ // to see if the second lightmap is blank, if so it is not deluxemapped.
+ if (count == 2)
+ {
+ c = in[count - 1].rgb;
+ for (i = 0;i < 128*128*3;i++)
+ if (c[i])
+ break;
+ if (i == 128*128*3)
+ {
+ // all pixels in the unused lightmap were black...
+ loadmodel->brushq3.deluxemapping = false;
+ }
+ }
+
+ // further deluxemapping detection is done in Mod_Q3BSP_LoadFaces
+