fixed instance loading forget to append basepath.. other path fixes (windows)
[csRadar.git] / ext_csr_substance.c
index 4dd2627c084b39be3313269b8bec28db764e1686..17184d58ab0f521273fd69b5644cd8582a0a2f08 100644 (file)
@@ -55,6 +55,22 @@ void csr_ext_exit( csr_api *api )
        csr_rt_free( &api->target );
 }
 
+void save_layers( csr_api *api, const char *layer )
+{
+       char output[512];
+       strcpy( output, api->output_path );
+       strcat( output, "_" );
+       strcat( output, layer );
+       
+       char *ext = output + strlen( output );
+       
+       strcpy( ext, ".pfm" );
+       csr_rt_save_c32f( &api->target, output, 0 );
+       
+       strcpy( ext, ".tga" );
+       csr_rt_save_tga( &api->target, output, 3*sizeof(float), 4 );
+}
+
 void draw_buffers( csr_api *api, int bounds_only )
 {
        csr_filter filter = { .compute_bounds_only = bounds_only };
@@ -67,8 +83,7 @@ void draw_buffers( csr_api *api, int bounds_only )
                
                if( !bounds_only )
                {
-                       csr_rt_save_buffers( &api->target, api->output_path, "all" );
-                       csr_rt_save_tga( &api->target, "test_test_test.tga", 3*sizeof(float), 4 );
+                       save_layers( api, "all" );
                }
        }
        else
@@ -82,13 +97,7 @@ void draw_buffers( csr_api *api, int bounds_only )
 
                        if( !bounds_only )
                        {
-                               csr_rt_save_buffers( &api->target, api->output_path, api->strings[i].str );                     
-                               //csr_rt_save_c32f( ... );
-                               //csr_rt_save_tga( ... );
-                               
-                               // tar_write_dds( ... );
-                               csr_rt_save_tga( &api->target, "test_test_test.tga", 3*sizeof(float), 4 );
-                               
+                               save_layers( api, api->strings[i].str );
                                csr_rt_clear( &api->target );
                        }
                }