Newer
Older
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
} else if(!strncmp( argv[0], "boxaxes", 5 )) {
if(argc>1) st->boxaxes = getbool( argv[1], !st->boxaxes );
else st->boxaxes = !st->boxaxes;
msg("boxaxes %s", st->boxaxes?"on":"off");
} else if(!strcmp(argv[0], "boxscale")) {
char buf[512];
int from, to;
if(argc>1) {
float v = atof(argv[1]);
from = getbool(argc>2?argv[2]:NULL, 0);
to = getbool(argc>3?argv[3]:NULL, MAXBOXLEV-1);
if(from<0) from = 0;
if(to>MAXBOXLEV-1) to=MAXBOXLEV-1;
while(from<=to)
st->boxscale[from++] = v;
}
sprintf(buf, "boxscales:");
for(to=MAXBOXLEV-1; to>1 && st->boxscale[to]==st->boxscale[to-1]; to--)
;
for(from = 0; from <= to; from++)
sprintf(buf+strlen(buf), " %g", st->boxscale[from]);
msg("%s", buf);
} else if(!strcmp( argv[0], "go" ) || !strcmp( argv[0], "gobox" )) {
int boxno = getbool( argv[1], -1 );
if(boxno < 0) {
msg("Usage: gobox <boxnumber> -- sets POI and jumps to view that AMR box");
} else {
specks_gobox( st, boxno, argc-2, argv+2 );
}
} else if(!strcmp( argv[0], "goboxscale" )) {
if(argc>1) sscanf(argv[1], "%f", &st->goboxscale);
msg("goboxscale %g (\"gobox\" sets scale to %g * box diagonal; 0 => leave scale intact)",
st->goboxscale, st->goboxscale);
} else if(!strcmp( argv[0], "psize" ) || !strcmp(argv[0], "pointsize")) {
if(argc>1) {
st->psize = getfloat( argv[1], st->psize );
IFCAVEMENU( set_psize( st->psize, NULL, st ) );
}
msg("pointsize %g pixels (times scale-lum value)", st->psize );
} else if(!strcmp( argv[0], "polysize" )) {
if(argc>1) {
st->polysize = getfloat(argv[1], st->polysize);
IFCAVEMENU( set_polysize( st->polysize, NULL, st ) );
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
}
if(argc>2) {
if(argv[2][0] == 'a' || argv[2][0] == 's') st->polyarea = 1;
else if(argv[2][0] == 'r') st->polyarea = 0;
}
msg("polysize %g%s", st->polysize, st->polyarea ? " area":"" );
} else if(!strncmp( argv[0], "polylum", 7 )) {
char *area = "";
if(argc>1) {
if(!specks_set_byvariable( st, argv[1], &st->polysizevar ))
if(!strcmp(argv[1], "-1") ||
!strcmp(argv[1], "point-size") ||
!strcmp(argv[1], "pointsize"))
st->polysizevar = -1;
if(st->polysizevar == CONSTVAL)
st->polysizevar = -1; /* Can't do const */
}
if(argc>2)
sscanf(argv[2], "%f", &st->polysize);
switch(argv[argc-1][0]) {
case 'r':
case 'd':
case 's': st->polyarea = 0; break;
case 'a': st->polyarea = 1; break;
}
if(st->polyarea) area = " area";
if(st->polysizevar < 0)
msg("polylumvar point-size%s", area);
else
msg("polylumvar %d(%s)%s", st->polysizevar,
st->vdesc[st->curdata][st->polysizevar].name,
area);
} else if(!strncmp( argv[0], "polyminpixels", 7 )) {
if(argc>1) st->polymin = getfloat(argv[1], st->polymin);
if(argc>2) st->polymax = getfloat(argv[2], st->polymax);
msg("polyminpixels %g %g (minpixels maxpixels)", st->polymin, st->polymax );
} else if(!strncmp( argv[0], "labelminpixels", 7 )) {
st->textmin = getfloat(argv[1], st->textmin);
msg("labelminpixels %g", st->textmin );
} else if(!strcmp( argv[0], "labelsize" ) || !strcmp(argv[0], "lsize")) {
st->textsize = getfloat(argv[1], st->textsize);
msg("labelsize %g", st->textsize);
} else if(!strcmp( argv[0], "point" ) || !strcmp( argv[0], "points" )) {
st->usepoint = getbool( argv[1], !st->usepoint );
IFCAVEMENU( set_point( st->usepoint, NULL, st ) );
msg("points %s", st->usepoint ? "on":"off");
} else if(!strcmp( argv[0], "poly" ) || !strncmp( argv[0], "polygon", 7 )) {
st->usepoly = getbool( argv[1], !st->usepoly );
IFCAVEMENU( set_poly( st->usepoly, NULL, st ) );
slevy
committed
} else if(!strcmp( argv[0], "vec" ) || !strncmp(argv[0], "vector", 6)) {
struct valdesc *vd = &st->vdesc[st->curdata][st->vecvar0];
st->usevec = getbool( argv[1], !st->usevec );
msg("vectors %s (vecscale %g) (vecvar %s(%d))",
st->usevec ? "on":"off",
st->vecscale,
vd->name, st->vecvar0);
} else if(!strcmp(argv[0], "vecscale")) {
st->vecscale = getfloat( argv[1], st->vecscale );
msg("vecscale %g (vec %s)", st->vecscale, st->usevec ? "on":"off");
} else if(!strncmp( argv[0], "texture", 7 ) || !strcmp( argv[0], "tx" )) {
if(argc > 1 && !strcmp(argv[1], "preload")) {
msg("Preloading textures...");
for(i = 0; i < st->ntextures; i++)
if(st->textures[i]) txload( st->textures[i] );
} else if(argc > 1 && !strncmp(argv[1], "report", 3)) {
if(argc == 2) {
for(i = 0; i < st->ntextures; i++)
if(st->textures[i]) st->textures[i]->report = ~0;
} else {
for(i = 2; i < argc; i++) {
int t = atoi(argv[i]);
if(t >= 0 && t < st->ntextures && st->textures[t])
st->textures[t]->report = ~0;
}
}
} else {
st->usetextures = getbool( argv[1], !st->usetextures );
msg("textures %s", st->usetextures ? "on":"off");
}
} else if(!strcmp( argv[0], "txscale" )) {
if(argc>1) sscanf(argv[1], "%f", &st->txscale);
msg("txscale %.3f", st->txscale);
} else if(!strncmp( argv[0], "polyorivar", 10)) {
if(argc>1) st->polyorivar0 = getbool(argv[1], -1);
msg(st->polyorivar0 >= 0
? "polyorivar %d : polygon orientations from var %d..%d"
: "polyorivar %d : polygon orientations parallel to screen",
st->polyorivar0, st->polyorivar0, st->polyorivar0+5);
} else if(!strcmp( argv[0], "texturevar")) {
if(argc>1) st->texturevar = getbool(argv[1], -1);
msg("texturevar %d", st->texturevar);
} else if(!strncmp( argv[0], "ellipsoids", 5 )) {
st->useellipsoids = getbool(argv[1], !st->useellipsoids);
msg("ellipsoids %s", st->useellipsoids ? "on":"off");
} else if(!strncmp( argv[0], "meshes", 4 )) {
st->usemeshes = getbool(argv[1], !st->usemeshes);
msg("meshes %s", st->usemeshes ? "on":"off");
} else if(!strncmp( argv[0], "mullions", 3 )) {
st->mullions = getfloat( argv[1], st->mullions );
msg("mullions %g", st->mullions);
} else if(!strcmp( argv[0], "label" ) || !strcmp( argv[0], "labels" )) {
st->usetext = getbool( argv[1], !st->usetext );
IFCAVEMENU( set_label( st->usetext, NULL, st ) );
msg("labels %s", st->usetext ? "on":"off");
} else if(!strcmp( argv[0], "laxes" )) {
st->usetextaxes = getbool(argv[1], !st->usetextaxes);
msg("laxes %s (axes on each label)", st->usetextaxes ? "on":"off");
} else if(!strncmp( argv[0], "polyside", 8 )) {
if(argc>1) sscanf(argv[1], "%d", &st->npolygon);
msg("polysides %d (polygons drawn with %d sides)",
st->npolygon,st->npolygon);
} else if(!strcmp( argv[0], "gamma" )) {
if(argc>1) sscanf(argv[1], "%f", &st->gamma);
msg("gamma %g", st->gamma);
} else if(!strncmp( argv[0], "cgamma", 4 ) || !strncmp(argv[0], "setgamma", 6)) {
float *p = NULL;
for(i = 1; i < argc; i++) {
if(!strcmp(argv[i], "-b")) i++, p = &st->rgbright[0];
else if(!strcmp(argv[i], "-g")) i++, p = &st->rgbgamma[0];
else if(i == argc-1) p = &st->rgbgamma[0];
else continue;
case 1: p[1] = p[2] = p[0]; /* and fall into... */
case 3: any = 1; break;
default: msg("setgamma [-b BRIGHT] [-g GAMMA]: want 1 or 3 floats not %s", argv[i]);
}
}
msg("setgamma -b %g,%g,%g -g %g,%g,%g",
st->rgbright[0],st->rgbright[1],st->rgbright[2],
st->rgbgamma[0],st->rgbgamma[1],st->rgbgamma[2]);
if(any)
specks_rgbremap( st );
if(argc>1)
st->alpha = getfloat(argv[1], st->alpha);
IFCAVEMENU( set_alpha( st->alpha, NULL, st ) );
msg("alpha %g", st->alpha);
} else if(!strncmp( argv[0], "fast", 4 )) {
st->fast = getbool(argv[1], !st->fast);
if(argc > 2) sscanf(argv[2], "%f", &st->pfaint);
if(argc > 3) sscanf(argv[3], "%f", &st->plarge);
msg("fast %s (ptsize %.3g %.3g (faintest largest))",
st->fast ? "on" : "off (better rendering)",
st->pfaint, st->plarge);
} else if(!strncmp( argv[0], "ptsize", 6 )) {
if(argc > 1) sscanf(argv[1], "%f", &st->pfaint);
if(argc > 2) sscanf(argv[2], "%f", &st->plarge);
msg("ptsize %.3g %.3g (faintest largest)", st->pfaint, st->plarge);
IFCAVEMENU( set_fog( st->fog, NULL, st ) );
} else if(!strcmp( argv[0], "menu" ) || !strcmp( argv[0], "fmenu" )) {
IFCAVEMENU( partimenu_fmenu( st, argc, argv ) );
} else if(!strcmp( argv[0], "datascale" ) && argc>1) {
float s, v = atof(argv[1]);
if(v!=0) {
struct specklist *sl;
struct speck *p;
int i;
for(sl = st->sl; sl != NULL; sl = sl->next) {
s = v / sl->scaledby;
for(i = 0, p = sl->specks; i < sl->nspecks; i++, p = NextSpeck(p, sl, 1)) {
p->p.x[0] *= s; p->p.x[1] *= s; p->p.x[2] *= s;
}
sl->scaledby = v;
}
}
} else if(!strcmp( argv[0], "where" ) || !strcmp( argv[0], "w" )) {
tellwhere(st);
} else if(!strcmp( argv[0], "version" )) {
extern char partiview_version[];
char *cp = strchr(local_id, ','); /* ... partibrains.c,v N.NN */
if(cp) {
cp += 3;
msg("version %s (brains %.*s) ", partiview_version, strcspn(cp, " "), cp);
msg("# Copyright (C) 2002 NCSA, University of Illinois");
}
else
return 0;
*stp = st; /* in case it changed, e.g. because of an "object" cmd */
return 1;
}