#include <string.h>
#include <math.h>
#include <time.h>
+#include <stdarg.h>
// CSR lib
+#include "csrLog.h"
#include "csrOpt.h"
#include "csrTypes.h"
#include "csrMath.h"
char output_path[ 512 ]; // Full path eg. /home/harry/my_map.vmf
char vmf_name[ 128 ]; // Just the base name eg. my_map
int output_set = 0;
+ EMSAA sampling_mode = k_EMSAA_RGSS;
while( csr_argp( argc, argv ) )
{
{
if( num_strings == 20 )
{
- fprintf( stderr, "Too many arguments! Max 20\n" );
- fs_exit();
- exit(0);
+ log_error( "Too many arguments! Max 20\n" );
+ goto IL_CSR_EXIT;
}
- printf( "got: %s\n", arg );
-
strings[ num_strings ++ ] = arg;
}
{
padding = atof( arg );
}
+
+ if( (arg = csr_long_opt_arg( "multi-sample" )) )
+ {
+ if( !strcmp( arg, "none" ))
+ {
+ sampling_mode = k_EMSAA_none;
+ }
+ else if( !strcmp( arg, "rgss" ))
+ {
+ sampling_mode = k_EMSAA_RGSS;
+ }
+ else if( !strcmp( arg, "2x" ))
+ {
+ sampling_mode = k_EMSAA_2x2;
+ }
+ else if( !strcmp( arg, "8r" ))
+ {
+ sampling_mode = k_EMSAA_8R;
+ }
+ else
+ {
+ log_error( "Invalid sampling pattern '%s'\n", arg );
+ goto IL_CSR_EXIT;
+ }
+ }
if( csr_opt( 'v' ) || csr_long_opt( "version" ) )
{
printf( "csRadar version: " CSR_VERSION "\n" );
- return 0;
+ goto IL_CSR_EXIT;
}
if( csr_opt( 'h' ) || csr_long_opt( "help" ) )
" -r 1024 Output resolution\n"
" -o <output> Specify output name/path\n"
" --padding=128 When cropping radar, add padding units to border\n"
- " --standard-layers Use standard TAR layers/groups\n"
+ //" --standard-layers Use standard TAR layers/groups\n"
" --no-txt Don't create matching radar txt\n"
- " --multi-sample= [ none, 2, 4, 4r, 8kn (default), 16c ]\n"
+ " --multi-sample=RGSS [ none, 2x, rgss, 8r ]\n"
+ " --extension=TAR Use an extension binary instead\n"
"\n"
" -v --version Display program version\n"
" -h --help Display this help text\n"
);
- return 0;
+ goto IL_CSR_EXIT;
}
}
if( num_strings )
{
- vmf_map *map = vmf_init( strings[0], 1 );
+ vmf_map *map = vmf_init( strings[0] );
if( map )
{
strcpy( vmf_name, base_name );
- printf( "output_path: '%s'\nvmf_name: '%s'\n", output_path, vmf_name );
-
+ log_info( "output_path: '%s'\n", output_path );
+ log_info( "vmf_name: '%s'\n", vmf_name );
- // Main
-
+ // Main
csr_target target;
- csr_create_target( &target, resolution, resolution );
+ csr_create_target( &target, resolution, resolution, sampling_mode );
csr_rt_clear( &target );
+ csr_use_program( &target, frag_gbuffer );
+
// Compute bounds
csr_filter filter =
{
}
}
- filter.compute_bounds_only = 0;
- csr_auto_fit( &target, padding );
+ if( i == 0 )
+ {
+ filter.compute_bounds_only = 0;
+ csr_auto_fit( &target, padding );
+ vmf_load_models( map );
+ }
}
if( write_txt )
}
else
{
- fprintf( stderr, "Could not load VMF\n" );
+ log_error( "Could not load VMF\n" );
}
}
else
{
- fprintf( stderr, "Missing required argument: mapfile\n" );
+ log_error( "Missing required argument: mapfile\n" );
}
+IL_CSR_EXIT:
fs_exit();
-
return 0;
}