Newer
Older
} 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 ) );
msg("polygons %s", st->usepoly ? "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");