}
}
- if ( sampleSize != lm->sampleSize && lmLimitSize == 0 ) {
- Sys_FPrintf( SYS_VRB,"WARNING: surface at (%6.0f %6.0f %6.0f) (%6.0f %6.0f %6.0f) too large for desired samplesize/lightmapsize/lightmapscale combination, increased samplesize from %d to %d\n",
- info->mins[0],
- info->mins[1],
- info->mins[2],
- info->maxs[0],
- info->maxs[1],
- info->maxs[2],
- lm->sampleSize,
- (int) sampleSize );
+ if ( sampleSize != lm->sampleSize && lmLimitSize == 0 ){
+ if ( debugSampleSize == 1 || lm->customWidth > 128 ){
+ Sys_FPrintf( SYS_VRB,"WARNING: surface at (%6.0f %6.0f %6.0f) (%6.0f %6.0f %6.0f) too large for desired samplesize/lightmapsize/lightmapscale combination, increased samplesize from %d to %d\n",
+ info->mins[0],
+ info->mins[1],
+ info->mins[2],
+ info->maxs[0],
+ info->maxs[1],
+ info->maxs[2],
+ lm->sampleSize,
+ (int) sampleSize );
+ }
+ else if ( debugSampleSize == 0 ){
+ Sys_FPrintf( SYS_VRB,"WARNING: surface at (%6.0f %6.0f %6.0f) (%6.0f %6.0f %6.0f) too large for desired samplesize/lightmapsize/lightmapscale combination, increased samplesize from %d to %d\n",
+ info->mins[0],
+ info->mins[1],
+ info->mins[2],
+ info->maxs[0],
+ info->maxs[1],
+ info->maxs[2],
+ lm->sampleSize,
+ (int) sampleSize );
+ debugSampleSize--;
+ }
+ else{
+ debugSampleSize--;
+ }
}
/* set actual sample size */
/* determine if surface requires a lightmap */
if ( ds->surfaceType == MST_TRIANGLE_SOUP ||
ds->surfaceType == MST_FOLIAGE ||
- ( info->si->compileFlags & C_VERTEXLIT ) ) {
+ ( info->si->compileFlags & C_VERTEXLIT ) ||
+ nolm == qtrue ) {
numSurfsVertexLit++;
}
else
FinishRawLightmap( lm );
}
+ if ( debugSampleSize < -1 ){
+ Sys_FPrintf( SYS_VRB, "+%d similar occurrences;\t-debugSampleSize to show ones\n", -debugSampleSize - 1 );
+ }
+
/* allocate vertex luxel storage */
for ( k = 0; k < MAX_LIGHTMAPS; k++ )
{
*/
#define LIGHTMAP_RESERVE_COUNT 1
-static void FindOutLightmaps( rawLightmap_t *lm, qboolean fastLightmapSearch ){
+static void FindOutLightmaps( rawLightmap_t *lm, qboolean fastAllocate ){
int i, j, k, lightmapNum, xMax, yMax, x = -1, y = -1, sx, sy, ox, oy, offset;
outLightmap_t *olm;
surfaceInfo_t *info;
}
/* if fast allocation, skip lightmap files that are more than 90% complete */
- if ( fastLightmapSearch == qtrue ) {
+ if ( fastAllocate == qtrue ) {
if (olm->freeLuxels < (olm->customWidth * olm->customHeight) / 10) {
continue;
}
}
/* if fast allocation, do not test allocation on every pixels, especially for large lightmaps */
- if ( fastLightmapSearch == qtrue ) {
+ if ( fastAllocate == qtrue ) {
xIncrement = MAX(1, lm->w / 15);
yIncrement = MAX(1, lm->h / 15);
}
/* allocate LIGHTMAP_RESERVE_COUNT new output lightmaps */
numOutLightmaps += LIGHTMAP_RESERVE_COUNT;
olm = safe_malloc( numOutLightmaps * sizeof( outLightmap_t ) );
+ if ( !olm ){
+ Error( "FindOutLightmaps: Failed to allocate memory.\n" );
+ }
+
if ( outLightmaps != NULL && numOutLightmaps > LIGHTMAP_RESERVE_COUNT ) {
memcpy( olm, outLightmaps, ( numOutLightmaps - LIGHTMAP_RESERVE_COUNT ) * sizeof( outLightmap_t ) );
free( outLightmaps );
stores the surface lightmaps into the bsp as byte rgb triplets
*/
-void StoreSurfaceLightmaps( qboolean fastLightmapSearch, qboolean storeForReal ){
+void StoreSurfaceLightmaps( qboolean fastAllocate, qboolean storeForReal ){
int i, j, k, x, y, lx, ly, sx, sy, *cluster, mappedSamples;
int style, size, lightmapNum, lightmapNum2;
float *normal, *luxel, *bspLuxel, *bspLuxel2, *radLuxel, samples, occludedSamples;
for ( i = 0; i < numRawLightmaps; i++ )
{
lm = &rawLightmaps[ sortLightmaps[ i ] ];
- FindOutLightmaps( lm, fastLightmapSearch );
+ FindOutLightmaps( lm, fastAllocate );
}
/* set output numbers in twinned lightmaps */