/* dependencies */
#include "q3map2.h"
-
+#include <glib.h>
/* sanity check */
if ( bspLightBytes == NULL ) {
- Sys_Printf( "WARNING: No BSP lightmap data\n" );
+ Sys_FPrintf( SYS_WRN, "WARNING: No BSP lightmap data\n" );
return;
}
buffer = NULL;
len = vfsLoadFile( filename, (void*) &buffer, -1 );
if ( len < 0 ) {
- Sys_Printf( "WARNING: Unable to load image %s\n", filename );
+ Sys_FPrintf( SYS_WRN, "WARNING: Unable to load image %s\n", filename );
continue;
}
/* sanity check it */
if ( pixels == NULL ) {
- Sys_Printf( "WARNING: Unable to load image %s\n", filename );
+ Sys_FPrintf( SYS_WRN, "WARNING: Unable to load image %s\n", filename );
continue;
}
if ( width != game->lightmapSize || height != game->lightmapSize ) {
- Sys_Printf( "WARNING: Image %s is not the right size (%d, %d) != (%d, %d)\n",
+ Sys_FPrintf( SYS_WRN, "WARNING: Image %s is not the right size (%d, %d) != (%d, %d)\n",
filename, width, height, game->lightmapSize, game->lightmapSize );
}
length = 0;
for ( x = 0; x < ( mesh->width - 1 ); x++ )
length += widthTable[ x ];
- lm->w = ceil( length / lm->sampleSize ) + 1;
+ lm->w = lm->sampleSize != 0 ? ceil( length / lm->sampleSize ) + 1 : 0;
if ( lm->w < ds->patchWidth ) {
lm->w = ds->patchWidth;
}
length = 0;
for ( y = 0; y < ( mesh->height - 1 ); y++ )
length += heightTable[ y ];
- lm->h = ceil( length / lm->sampleSize ) + 1;
+ lm->h = lm->sampleSize != 0 ? ceil( length / lm->sampleSize ) + 1 : 0;
if ( lm->h < ds->patchHeight ) {
lm->h = ds->patchHeight;
}
/* check for bogus axis */
if ( faxis[ axisNum ] == 0.0f ) {
- Sys_Printf( "WARNING: ProjectSurfaceLightmap: Chose a 0 valued axis\n" );
+ Sys_FPrintf( SYS_WRN, "WARNING: ProjectSurfaceLightmap: Chose a 0 valued axis\n" );
lm->w = lm->h = 0;
return qfalse;
}
return -1;
}
-
/* then lightmap sample size */
if ( aInfo->sampleSize < bInfo->sampleSize ) {
return 1;
superSample = 1;
}
else if ( superSample > 8 ) {
- Sys_Printf( "WARNING: Insane supersampling amount (%d) detected.\n", superSample );
+ Sys_FPrintf( SYS_WRN, "WARNING: Insane supersampling amount (%d) detected.\n", superSample );
superSample = 8;
}
return 0;
}
+
+
void FillOutLightmap( outLightmap_t *olm ){
int x, y;
int ofs;
}
}
+
+
/*
StoreSurfaceLightmaps()
stores the surface lightmaps into the bsp as byte rgb triplets
char dirname[ 1024 ], filename[ 1024 ];
shaderInfo_t *csi;
char lightmapName[ 128 ];
- const char *rgbGenValues[ 256 ];
- const char *alphaGenValues[ 256 ];
+ const char *rgbGenValues[ 256 ];
+ const char *alphaGenValues[ 256 ];
/* note it */
----------------------------------------------------------------- */
/* note it */
- Sys_Printf( "Subsampling..." );
+ Sys_FPrintf( SYS_VRB, "Subsampling..." );
/* walk the list of raw lightmaps */
numUsed = 0;
if ( noCollapse == qfalse && deluxemap == qfalse ) {
/* note it */
- Sys_Printf( "collapsing..." );
+ Sys_FPrintf( SYS_VRB, "collapsing..." );
/* set all twin refs to null */
for ( i = 0; i < numRawLightmaps; i++ )
----------------------------------------------------------------- */
/* note it */
- Sys_Printf( "sorting..." );
+ Sys_FPrintf( SYS_VRB, "sorting..." );
/* allocate a new sorted list */
if ( sortLightmaps == NULL ) {
----------------------------------------------------------------- */
/* note it */
- Sys_Printf( "allocating..." );
+ Sys_FPrintf( SYS_VRB, "allocating..." );
/* kill all existing output lightmaps */
if ( outLightmaps != NULL ) {
----------------------------------------------------------------- */
/* note it */
- Sys_Printf( "storing..." );
+ Sys_FPrintf( SYS_VRB, "storing..." );
/* count the bsp lightmaps and allocate space */
if ( bspLightBytes != NULL ) {
}
if ( numExtLightmaps > 0 ) {
- Sys_Printf( "\n" );
+ Sys_FPrintf( SYS_VRB, "\n" );
}
/* delete unused external lightmaps */
----------------------------------------------------------------- */
/* note it */
- Sys_Printf( "projecting..." );
+ Sys_FPrintf( SYS_VRB, "projecting..." );
/* walk the list of surfaces */
for ( i = 0; i < numBSPDrawSurfaces; i++ )
}
/* finish */
- Sys_Printf( "done.\n" );
+ Sys_FPrintf( SYS_VRB, "done.\n" );
/* calc num stored */
numStored = numBSPLightBytes / 3;