numvis++; // count the leaf itself
- //Sys_FPrintf (SYS_VRB,"cluster %4i : %4i visible\n", leafnum, numvis);
+ //Sys_FPrintf( SYS_VRB,"cluster %4i : %4i visible\n", leafnum, numvis );
++clustersizehistogram[numvis];
memcpy( bspVisBytes + VIS_HEADER_SIZE + leafnum * leafbytes, uncompressed, leafbytes );
*/
void WriteFloat( FILE *f, vec_t v );
-void WritePortals( char *filename ){
+void WritePortals( char *portalpathfile ){
int i, j, num;
FILE *pf;
vportal_t *p;
fixedWinding_t *w;
// write the file
- pf = fopen( filename, "w" );
+ pf = fopen( portalpathfile, "w" );
if ( !pf ) {
- Error( "Error opening %s", filename );
+ Error( "Error opening %s", portalpathfile );
}
num = 0;
============
*/
void LoadPortals( char *name ){
- int i, j, hint;
+ int i, j, flags;
vportal_t *p;
leaf_t *l;
char magic[80];
|| leafnums[1] > portalclusters ) {
Error( "LoadPortals: reading portal %i", i );
}
- if ( fscanf( f, "%i ", &hint ) != 1 ) {
- Error( "LoadPortals: reading hint state" );
+ if ( fscanf( f, "%i ", &flags ) != 1 ) {
+ Error( "LoadPortals: reading flags" );
}
w = p->winding = NewFixedWinding( numpoints );
l->numportals++;
p->num = i + 1;
- p->hint = hint;
+ p->hint = ((flags & 1) != 0);
+ p->sky = ((flags & 2) != 0);
p->winding = w;
VectorSubtract( vec3_origin, plane.normal, p->plane.normal );
p->plane.dist = -plane.dist;
===========
*/
int VisMain( int argc, char **argv ){
- char portalfile[1024];
int i;
+ char portalFilePath[ 1024 ];
+ portalFilePath[0] = 0;
/* note it */
strcpy( outbase, "/tmp" );
}
-
/* ydnar: -hint to merge all but hint portals */
else if ( !strcmp( argv[ i ], "-hint" ) ) {
Sys_Printf( "hint = true\n" );
hint = qtrue;
mergevis = qtrue;
}
-
- else
+ else if ( !strcmp( argv[ i ], "-prtfile" ) )
{
- Sys_Printf( "WARNING: Unknown option \"%s\"\n", argv[ i ] );
+ strcpy( portalFilePath, argv[i + 1] );
+ i++;
+ Sys_Printf( "Use %s as portal file\n", portalFilePath );
+ }
+
+ else{
+ Sys_FPrintf( SYS_WRN, "WARNING: Unknown option \"%s\"\n", argv[ i ] );
}
}
if ( i != argc - 1 ) {
- Error( "usage: vis [-threads #] [-level 0-4] [-fast] [-v] bspfile" );
+ Error( "usage: vis [-threads #] [-level 0-4] [-fast] [-v] BSPFilePath" );
}
LoadBSPFile( source );
/* load the portal file */
- sprintf( portalfile, "%s%s", inbase, ExpandArg( argv[ i ] ) );
- StripExtension( portalfile );
- strcat( portalfile, ".prt" );
- Sys_Printf( "Loading %s\n", portalfile );
- LoadPortals( portalfile );
+ if (!portalFilePath[0]) {
+ sprintf( portalFilePath, "%s%s", inbase, ExpandArg( argv[ i ] ) );
+ StripExtension( portalFilePath );
+ strcat( portalFilePath, ".prt" );
+ }
+ Sys_Printf( "Loading %s\n", portalFilePath );
+ LoadPortals( portalFilePath );
/* ydnar: exit if no portals, hence no vis */
if ( numportals == 0 ) {
/* delete the prt file */
if ( !saveprt ) {
- remove( portalfile );
+ remove( portalFilePath );
}
/* write the bsp file */