- draw_buffers( image, 1024, 1024, (v4f){ -1000.f, -1000.f, 1000.f, 1000.f }, tri, 1 );
+ // Compute bounds
+ csr_filter filter =
+ {
+ .classname = NULL,
+ .visgroup = NULL,
+ .compute_bounds_only = 1
+ };
+
+ // One pass for fitting, second pass for drawing
+ for( int i = 0; i < 2; i ++ )
+ {
+ if( num_strings == 1 )
+ {
+ // Draw everything
+ draw_vmf_group( &target, map, map->root, &filter, NULL, NULL );
+ csr_rt_save_buffers( &target, output_path, "all" );
+ }
+ else
+ {
+ // Draw groups
+ for( int i = 1; i < num_strings; i ++ )
+ {
+ filter.visgroup = strings[ i ];
+
+ draw_vmf_group( &target, map, map->root, &filter, NULL, NULL );
+ csr_rt_save_buffers( &target, output_path, strings[i] );
+
+ csr_rt_clear( &target );
+ }
+ }
+
+ if( i == 0 )
+ {
+ filter.compute_bounds_only = 0;
+ csr_auto_fit( &target, padding );
+ vmf_load_models( map );
+ }
+ else
+ {
+ float prog = 0.f;
+ csr_prog_begin( "Rendering" );
+ for(;;)
+ {
+ if( prog > 1.f )
+ break;
+
+ csr_prog_update( prog );
+ usleep( 20000 );
+
+ prog += 0.01f;
+ }
+
+ csr_prog_end();
+ }
+ }
+
+ if( write_txt )
+ {
+ char txt_path[ 512 ];
+
+ strcpy( txt_path, output_path );
+ strcat( txt_path, ".txt" );
+
+ csr_write_txt( txt_path, vmf_name, &target );
+ }
+
+ csr_rt_free( &target );
+ vmf_free( map );