#include <time.h>
#include <stdarg.h>
+
+#include <unistd.h>
+
// CSR lib
#include "csrLog.h"
#include "csrOpt.h"
float padding = 128.f;
u32 resolution = 1024;
- int standard_layers = 0;
int write_txt = 1;
- int multi_sample = 1;
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;
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 )
#define log_init log_alloc
#define log_dealloc log_free
+
+const char *csr_prog_msg;
+void csr_prog_begin( const char *msg )
+{
+ csr_prog_msg = msg;
+}
+
+void csr_prog_update( float const percent )
+{
+ int const k_track_length = 40;
+
+ printf( "\r %s %d%% |", csr_prog_msg, (int)(percent*100.f) );
+
+ // Calculate how many steps travelled
+ int cur_pos = ((float)k_track_length * (1.f-percent));
+
+ for( int i = 0; i < cur_pos; i ++ )
+ printf( " " );
+
+ printf( "🚂🚃🚃🚃🚃" );
+
+ for( int i = 0; i < k_track_length-cur_pos; i ++ )
+ printf( " " );
+
+ printf( "|" );
+
+ fflush( stdout );
+}
+
+void csr_prog_end(void)
+{
+ csr_prog_update( 1.f );
+ printf( "\n" );
+}