Newer
Older
}
}
index = parti_current_subcam();
if(index > 0) {
char params[100];
char *name = parti_get_subcam( index, params );
msg("subcam %s %s # az el rol L R B T // subcam -tilt %g", name, params, ppui.sctilt);
} else {
int wx, wy;
float hx, hy = .5 * parti_fovy(NULL);
sscanf( parti_winsize(NULL), "%d%*c%d", &wx, &wy );
if(wy == 0) wy = 1;
hx = atan( tan(hy*(M_PI/180))*wx / wy ) * (180/M_PI);
msg("subcam off 0 0 0 %g %g %g %g # a e r L R B T (default)",
hx, hx, hy, hy);
}
float focallen = parti_focal( (argc>1) ? argv[1] : NULL );
msg("focallength %g", focallen);
} else if(!strcmp( argv[0], "focalpoint" )) {
/* args:
* on/off
* x y z [minfocallen]
*/
Point fpt;
float minlen;
int ison = parti_focalpoint( argc-1, (argv+1), &fpt, &minlen );
msg(ison ? "focalpoint %g %g %g %g # pointxyz minfocallen"
: "focalpoint off # %g %g %g %g # pointxyz minfocallen",
fpt.x[0],fpt.x[1],fpt.x[2], minlen);
} else if(!strncmp( argv[0], "jump", 4 )) {
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
Point xyz;
float aer[3];
static int stupid[3] = {1,0,2}; /* aer -> rx ry rz */
Matrix c2w;
parti_getc2w( &c2w );
tfm2xyzaer( &xyz, aer, &c2w );
if(argc>1) {
for(i=1; i<argc && i<4+3; i++) {
if(i-1<3) xyz.x[i-1] = getfloat(argv[i], xyz.x[i-1]);
else aer[stupid[i-4]] = getfloat(argv[i], aer[stupid[i-4]]);
}
xyzaer2tfm( &c2w, &xyz, aer );
parti_setc2w( &c2w );
}
msg("jump %g %g %g %g %g %g (XYZ RxRyRz)",
xyz.x[0],xyz.x[1],xyz.x[2],
aer[1],aer[0],aer[2]);
} else if(!strncmp( argv[0], "home", 4 )) {//marx version 0.7.03
Point xyz;
float aer[3];
static int stupid[3] = {1,0,2}; /* aer -> rx ry rz */
Matrix c2w;
parti_getc2w( &c2w );
tfm2xyzaer( &xyz, aer, &c2w );
if(argc>1) {
for(i=1; i<argc && i<4+3; i++) {
if(i-1<3) xyz.x[i-1] = getfloat(argv[i], xyz.x[i-1]);
else aer[stupid[i-4]] = getfloat(argv[i], aer[stupid[i-4]]);
}
xyzaer2tfm( &c2w, &xyz, aer );
parti_setc2w( &c2w );
ppui.home[0] = xyz.x[0]; ppui.home[1] = xyz.x[1]; ppui.home[2] = xyz.x[2];
//ppui.home[3] = aer[0]; ppui.home[4] = aer[1]; ppui.home[5] = aer[2]; bug in releases >= 0.7.03
ppui.home[3] = aer[1]; ppui.home[4] = aer[0]; ppui.home[5] = aer[2]; //version 0.7.05 fix for the line above
}
msg("home %g %g %g %g %g %g (XYZ RxRyRz)", ppui.home[0], ppui.home[1], ppui.home[2], ppui.home[3], ppui.home[4], ppui.home[5]);
} else if(!strncmp(argv[0], "inertia", 5)) {
if(argc > 1)
ppui.view->inertia( getbool( argv[1], ppui.view->inertia() ) );
msg("inertia %s", ppui.view->inertia() ? "on":"off");
} else if((!strcmp( argv[0], "rdata" ) || !strcmp(argv[0], "readpath"))
&& argc>1) {
char *tfname = argv[1];
char *realfile = findfile( fromfname, tfname );
if(realfile == NULL) {
tfname = (char *)alloca(strlen(argv[1]) + 32);
sprintf(tfname, "data/record/%s%s", argv[1],
strstr(argv[1], ".wf") ? "" : ".wf");
realfile = findfile( NULL, tfname+12 );
}
if(realfile == NULL)
realfile = findfile( fromfname, tfname );
if(realfile)
parti_readpath( realfile );
else
msg("%s: can't find \"%s\" nor data/record/... nor ...wf",
argv[0],argv[1]);
} else if(!strcmp( argv[0], "play" )) {
parti_play( argc>1 ? rejoinargs(1, argc, argv) : NULL );
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
} else if(!strcmp( argv[0], "frame" )) {
CONST struct wfpath *pp;
i = parti_frame( argv[1], &pp );
msg("frame %d (of %d..%d)", pp->curframe,
pp->frame0, pp->nframes + pp->frame0 - 1);
} else if(!strcmp( argv[0], "interest") || !strcmp( argv[0], "int" ) ||
!strcmp( argv[0], "center" ) ||
!strcmp( argv[0], "cen" )) {
Point cen;
float censize = parti_getcensize();
parti_getcenter( &cen );
if(argc > 1) {
sscanf(argv[1], "%f%*c%f%*c%f%*c%f",
&cen.x[0],&cen.x[1],&cen.x[2], &censize);
if(argc > 3)
for(i=0;i<3;i++)
cen.x[i] = getfloat(argv[i+1], cen.x[i]);
if(argc == 3 || argc == 5)
sscanf(argv[argc-1], "%f", &censize);
parti_center( &cen );
if(censize != parti_getcensize())
parti_censize( censize );
}
msg("center %g %g %g %g(radius)", cen.x[0],cen.x[1],cen.x[2], censize);
} else if(!strcmp( argv[0], "censize" )) {
if(argc>1)
parti_censize( getfloat(argv[1], parti_getcensize()));
msg("censize %g (interest-marker size)", parti_getcensize());
} else if(!strcmp( argv[0], "detach" )) { /* "detach" or "detach f" or "detach f +50+100" */
parti_detachview( rejoinargs( (argc>1 ? 1 : 0), argc, argv ));
} else {
return 0;
}
return 1;
}
int main(int argc, char *argv[])
{
static GLuint pickbuffer[20480];
extern char partiview_version[];
static Point black = {0,0,0};
ppui.view->bgcolor( &black );
ppui.view->dspcontext( 0 ); /* assign a display context, so texture code can track window changes */
char title[64];
sprintf(title, "partiview %.10s", partiview_version);
ppui.mainwin->label( title );
/* make_window() sets ppui.view, etc. */
parti_add_commands( pp_parse_args, "partiview", NULL );
parti_add_reader( pp_read, "partiview", NULL );
pp_ui_init();
ppui.view->add_drawer( drawjunk, NULL, NULL, NULL, 0 );
ppui.view->pickbuffer( COUNT(pickbuffer), pickbuffer );
ppui.view->zspeed = 5;
ppui.view->farclip( 2500 );
ppui.censize = 1.0;
ppui.view->movingtarget( 0 );
ppui.view->msg = msg;
if(ppui.hrdiag) {
ppui.hrdiag->msg = msg;
ppui.playspeed = 1;
ppui.playframe->lstep(10);
initShaderStuff( false ); // prepare to load shader programs (later)
parti_object( "g1", NULL, 1 );
readrc( &ppui.st );
int i = 0;
if(Fl::args(argc, argv, i, cmdargs) == 0) {
fprintf(stderr, "Unrecognized option: %s\n", argv[i]);
exit(1);
}
for( ; i < argc; i++) {
specks_read( &ppui.st, argv[i] );
}
ppui.view->notifier( pp_viewchanged, ppui.st );
ppui_refresh( ppui.st );
if(ppui.detached == 'h')
ppui.mainwin->hide();
else
ppui.mainwin->show(argc, argv);
#ifdef GLUT_MULTISAMPLE // if multisampling known to FLTK
parti_stereo( parti_stereo(NULL) ); // side effect: enables multisampling
#endif
ppui.view->make_current(); // to allow shader stuff to work
initShaderStuff( true );
//marx version 0.7.03 process any pending events followed by simulation user pressing enter key
//this appears to properly initialize the steprow group
/*
for(i = 1; i < 11; i++) //11 is arbitrary probably only need 5
Fl::wait(.1);
pp_cmd_cb( ppui.cmd, NULL );
*/
//replaces the above in release because the above seemed to stop working in 0.7.06
//in effect i am replacing a software emulation of pressing the enter key with software simulation of a mouse click
smarx
committed
int cnt = 0;
while(double v = Fl::wait(.1)){
if(v < 0) //error
break;
if(cnt++ > 5) //because in windows wait(time) will not return 0 if time > 0
break;
}
ppui_refresh(NULL);
//end of replaces the above ...
#if 0 /* was: #ifdef __APPLE__ */
Fl_Window* mw = ppui.mainwin;
Fl::wait(.1);
ppui.mainwin->resize(mw->x()+1, mw->y()+1, mw->w()+1, mw->h()+1); //marx: version 0.7.04
//the resize compensates for bug that appears under os x only - damage to widgets does not cause redraw but resize seems to cause the needed redraw
// this bug appears to be fixed (by fltk 1.1.10, probably earlier),
// and doing this causes the main window to be non-resizable,
// so let's toss it. Thanks to Jonathan Strawn <jonnyflash@gmail.com>,
// UNM ARTS Lab, for figuring this out. -slevy
if(ppui.reqwinsize != NULL) {
parti_update();
parti_winsize( ppui.reqwinsize );
ppui.reqwinsize = NULL;
}
Fl::visible_focus(0); //marx: version 0.7.02 - keep the pre fltk-1.1.x old style of only text widgets to get keyboard focus
Fl_Tooltip::delay(.5); //marx: version 0.7.02
Fl_Tooltip::font(FL_HELVETICA_BOLD); //marx: version 0.7.02
Fl_Tooltip::color(68); //marx: version 0.7.02
// run "late" command files -- -C <file>
for(i = 0; i < nlatecmds; i++)
specks_commandstr( &ppui.st, latecmds[i] );
// this shouldn't be necessary, but does it help on MacOS X?? slevy 2013.07.11
ppui.view->redraw();
return Fl::run();
}