Changeset 906 for trunk


Ignore:
Timestamp:
Feb 26, 2008, 1:13:19 PM (17 years ago)
Author:
kostmo
Message:

preliminary automation of movie generation

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/apps/nanovis-test

    r901 r906  
    134134
    135135# ----------------------------------------------------------------------
     136# USAGE: karl_send_command <cmd>
     137#
     138# Used internally in this script (not from command prompt)
     139# ----------------------------------------------------------------------
     140proc karl_send_command {cmd} {
     141    global widgets
     142
     143    namespace eval Rappture::NanovisViewer [list $widgets(nanovis) _send_text $cmd]
     144
     145#    $widgets(command) delete 0 end
     146}
     147
     148# ----------------------------------------------------------------------
    136149# USAGE: reset
    137150#
     
    187200proc karl_activate_flow {} {
    188201
    189         puts "Activating flow..."
     202        global img_storage_dir
     203        puts "Preparing images..."
    190204
    191205        # sequence of commands to initilize flow visualization go here
    192         test
     206        karl_send_command {test}
     207        karl_send_command {flow vectorid 0}
     208        karl_send_command {flow particle visible on}
     209
     210        set renderserver render05
     211        set img_storage_dir [exec ssh $renderserver mktemp -d /tmp/animation.XXXXXX]
     212        karl_send_command "flow capture 117 $img_storage_dir"
    193213}
    194214
     
    199219proc karl_flow_movie {} {
    200220
    201         puts "Flow Movie"   
    202         set img_storage_dir [exec mktemp -d /tmp/animation.XXXXXX]
    203         puts $img_storage_dir
    204 
    205         # flow animation command sequence goes here
    206 #       flow capture 100 $img_storage_dir
    207         ## ??
    208 
    209         cd $img_storage_dir
    210 
    211         # get rid of this once the animation command sequence works
    212         return
     221        global img_storage_dir
     222        set renderserver render05
     223
    213224
    214225        if {0} {
    215226                # create animated gif:
    216227                puts "creating animated gif..."
    217                 exec convert -delay 20 -loop 0 image*.bmp animated_flow.gif
     228                exec ssh $renderserver convert -delay 20 -loop 0 $img_storage_dir/image*.bmp $img_storage_dir/animated_flow.gif
    218229        } else {
    219230                # create mpeg movie:
    220                 puts "creating mpeg movie..."
    221 
    222                 exec mogrify -format jpg *.bmp
    223                 exec ffmpeg -i image%03.jpg cool.mpg
    224                 exec rm *.jpg
     231                puts "creating mpeg movie in $img_storage_dir"
     232               
     233                exec ssh $renderserver "cd $img_storage_dir && mogrify -format jpg *.bmp && ffmpeg -i image%03d.jpg flow_movie.mpg 2>/dev/null && rm *.jpg"
    225234        }
    226         exec rm *.bmp
    227 
    228         # Now present the .mpg or .gif file to the user for downloading
     235
     236        # Now present the .mpg or .gif file to the user to download
    229237        ## ??
    230238
     239        return
     240
    231241        # Finally, delete the temporary animation directory we have created
    232         exec rmdir $img_storage_dir
     242        exec ssh $renderserver rmdir $img_storage_dir
    233243}
    234244
  • trunk/vizservers/nanovis/Command.cpp

    r902 r906  
    7575#include "Test.h"
    7676#endif
     77#include "Test.h"
    7778// EXTERN DECLARATIONS
    7879// in Nv.cpp
     
    12411242                    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
    12421243           
    1243 //                  NanoVis::bmp_write_to_file(frame_num, directory_name);
    1244                     NanoVis::bmp_write_to_file(frame_num, NULL);
     1244                    if (argc < 5)
     1245                        NanoVis::bmp_write_to_file(frame_num, NULL);
     1246                    else
     1247                        NanoVis::bmp_write_to_file(frame_num, (char*) argv[4]);
    12451248                }
    12461249            }
     
    13301333            }
    13311334            int state;
    1332             if (Tcl_GetBoolean(interp, argv[2], &state) != TCL_OK) {
     1335            if (Tcl_GetBoolean(interp, argv[3], &state) != TCL_OK) {
    13331336                return TCL_ERROR;
    13341337            }
     
    13801383        NanoVis::initParticle();
    13811384    } else if ((c == 'c') && (strcmp(argv[1],"capture") == 0)) {
    1382         if (argc != 3) {
     1385        if (argc > 4 || argc < 3) {
    13831386            Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
    1384                 " capture numframes\"", (char*)NULL);
     1387                " capture numframes [directory]\"", (char*)NULL);
    13851388            return TCL_ERROR;
    13861389        }
     
    13971400        }
    13981401        // Karl
     1402        //
     1403        Trace("FLOW started\n");
    13991404        for (int frame_count = 0; frame_count < total_frame_count;
    14001405             frame_count++) {
     
    14161421            NanoVis::read_screen();
    14171422            glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
     1423
     1424            if (argc < 4)
     1425                NanoVis::bmp_write_to_file(frame_count, NULL);
     1426            else
     1427                NanoVis::bmp_write_to_file(frame_count, (char*) argv[3]);
    14181428           
    1419             NanoVis::bmp_write_to_file(frame_count, NULL);
    1420 //            NanoVis::bmp_write_to_file(frame_count, directory_name);
    1421         }
     1429        }
     1430        Trace("FLOW end\n");
    14221431        // put your code...
    14231432        if (NanoVis::licRenderer) {
  • trunk/vizservers/nanovis/nanovis.cpp

    r902 r906  
    864864        printf("Writing %s\n", filename);
    865865        f = fopen(filename, "wb");
     866        if (f == 0)
     867        {
     868                Trace("cannot create file\n");
     869        }
    866870    }
    867871    else {
    868872        f = fopen("/tmp/image.bmp", "wb");
     873        if (f == 0)
     874        {
     875                Trace("cannot create file\n");
     876        }
    869877    }
    870878    fwrite((void*) header, sizeof(header), 1, f);
Note: See TracChangeset for help on using the changeset viewer.