move fsaa keyword next to ssao and away from dump_modify

we don't need to reallocate the buffers this way
This commit is contained in:
Axel Kohlmeyer
2023-08-17 19:57:46 -04:00
parent 988b121a96
commit 5528cefe0f
3 changed files with 51 additions and 59 deletions

View File

@ -248,10 +248,14 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) :
if (iarg+3 > narg) error->all(FLERR,"Illegal dump image command");
int width = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
int height = utils::inumeric(FLERR,arg[iarg+2],false,lmp);
if (width <= 0 || height <= 0)
error->all(FLERR,"Illegal dump image command");
image->width = width;
image->height = height;
if (width <= 0 || height <= 0) error->all(FLERR,"Illegal dump image command");
if (image->fsaa) {
image->width = width*2;
image->height = height*2;
} else {
image->width = width;
image->height = height;
}
iarg += 3;
} else if (strcmp(arg[iarg],"view") == 0) {
@ -345,6 +349,23 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) :
image->shiny = shiny;
iarg += 2;
} else if (strcmp(arg[iarg],"fsaa") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
int aa = utils::logical(FLERR, arg[iarg+1], false, lmp);
if (aa) {
if (!image->fsaa) {
image->width = image->width*2;
image->height = image->height*2;
}
} else {
if (image->fsaa) {
image->width = image->width/2;
image->height = image->height/2;
}
}
image->fsaa = aa;
iarg += 2;
} else if (strcmp(arg[iarg],"ssao") == 0) {
if (iarg+4 > narg) error->all(FLERR,"Illegal dump image command");
image->ssao = utils::logical(FLERR,arg[iarg+1],false,lmp);
@ -1555,35 +1576,6 @@ int DumpImage::modify_param(int narg, char **arg)
return n;
}
// if antialias state changes, we need to increase the buffer space
// change the (internal) image dimensions and reset the view parameters
if (strcmp(arg[0],"fsaa") == 0) {
if (narg < 2) error->all(FLERR,"Illegal dump_modify command");
int aa = utils::logical(FLERR, arg[1], false, lmp);
if (image->fsaa == NO) {
if (aa == YES) {
image->width = image->width*2;
image->height = image->height*2;
// reallocate buffers to make room
image->buffers();
}
} else {
if (aa == NO) {
image->width = image->width/2;
image->height = image->height/2;
box_bounds();
box_center();
view_params();
}
}
image->fsaa = aa;
// reset size based parameters
box_bounds();
box_center();
view_params();
return 2;
}
if (strcmp(arg[0],"bcolor") == 0) {
if (narg < 3) error->all(FLERR,"Illegal dump_modify command");
if (atom->nbondtypes == 0)