cropping
[csRadar.git] / csRadar.c
index 9c8c0b4d0f08e8922896ef1911554a2ba8c6e78a..43b9c0eff82b6ccbd6ebcf53320127007f5ee242 100644 (file)
--- a/csRadar.c
+++ b/csRadar.c
@@ -20,7 +20,6 @@
 #include "vmdl.h"
 #include "vmf.h"
 
-
 // CSR main
 #include "csrDraw.h"
 #include "csr32f.h"
@@ -39,16 +38,34 @@ int main( int argc, char *argv[] )
                
                vmf_map *map = vmf_init( argv[1], 1 );
                
-               // TODO: Make init/free codes
-               csr_target target = 
+               csr_target target;
+               
+               csr_create_target( &target, 1024, 1024 );
+               csr_rt_clear( &target );
+               
+               csr_filter filter_layout =
                {
-                       .x = 1024, .y = 1024,
-                       .fragments = (csr_frag *)csr_malloc( 1024*1024*sizeof(csr_frag) ),
-                       .bounds = { -1000.f, -1000.f, 1000.f, 1000.f }
+                       .classname = NULL,
+                       .visgroup = "tar_layout"
                };
-               csr_rt_clear( &target );
                
-               draw_vmf_group( &target, map, map->root, 0, NULL, NULL );
+               csr_filter filter_buyzone =
+               {
+                       .classname = "func_buyzone",
+                       .visgroup = NULL
+               };
+               
+               csr_filter filter_setup = 
+               {
+                       .classname = NULL,
+                       .visgroup = NULL,
+                       .compute_bounds_only = 1
+               };
+               
+               draw_vmf_group( &target, map, map->root, &filter_setup, NULL, NULL );
+               csr_auto_fit( &target, 128.f );
+               
+               draw_vmf_group( &target, map, map->root, NULL, NULL, NULL );
                
                float *rgba_test = (float *)csr_malloc( 1024*1024*sizeof(float)*3 );
                
@@ -67,7 +84,8 @@ int main( int argc, char *argv[] )
                
                csr_32f_write( "hello.pfm", 1024, 1024, rgba_test );
                
-               free( target.fragments );
+               csr_rt_free( &target );
+               
                free( rgba_test );
                vmf_free( map );
                fs_exit();