git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@7389 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2011-12-22 21:47:52 +00:00
parent 5516886635
commit 3919257309
4 changed files with 2015 additions and 1615 deletions

File diff suppressed because it is too large Load Diff

View File

@ -34,103 +34,34 @@ class DumpImage : public DumpCustom {
private:
int filetype;
int acolor,adiam;
double adiamvalue;
int atomflag,bondflag;
int bcolor,bdiam;
double bdiamvalue;
int width,height;
double theta,phi;
char *thetastr,*phistr;
int thetavar,phivar;
int cflag;
double cx,cy,cz;
char *cxstr,*cystr,*czstr;
int cxvar,cyvar,czvar;
double up[3];
char *upxstr,*upystr,*upzstr;
int upxvar,upyvar,upzvar;
double zoom,persp;
char *zoomstr,*perspstr;
int zoomvar,perspvar;
int boxflag,axesflag;
double boxdiam,axeslen,axesdiam;
double shiny;
int ssao,seed;
double ssaoint;
int acolor,adiam; // what determines color/diam of atoms
double adiamvalue; // atom diameter value
int atomflag,bondflag; // 0/1 for draw atoms,bonds
int bcolor,bdiam; // what determines color/diam of bonds
double bdiamvalue; // bond diameter value
char *thetastr,*phistr; // variables for view theta,phi
int thetavar,phivar; // index to theta,phi vars
int cflag; // static/dynamic box center
double cx,cy,cz; // fractional box center
char *cxstr,*cystr,*czstr; // variables for box center
int cxvar,cyvar,czvar; // index to box center vars
char *upxstr,*upystr,*upzstr; // view up vector variables
int upxvar,upyvar,upzvar; // index to up vector vars
char *zoomstr,*perspstr; // view zoom and perspective variables
int zoomvar,perspvar; // index to zoom,persp vars
int boxflag,axesflag; // 0/1 for draw box and axes
double boxdiam,axeslen,axesdiam; // params for drawing box and axes
int npixels,viewflag;
double *depthBuffer,*surfaceBuffer;
double *depthcopy,*surfacecopy;
char *imageBuffer,*rgbcopy,*writeBuffer;
int viewflag; // overall view is static or dynamic
double **bufcopy;
double *diamtype,*diamelement,*bdiamtype; // per-type diameters
double **colortype,**colorelement,**bcolortype; // per-type colors
class Image *image; // class that renders each image
double **bufcopy; // buffer for communicating bond/atom info
int maxbufcopy;
// constant view params
double FOV;
double ambientColor[3];
double keyLightTheta;
double keyLightPhi;
double keyLightColor[3];
double fillLightTheta;
double fillLightPhi;
double fillLightColor[3];
double backLightTheta;
double backLightPhi;
double backLightColor[3];
double specularHardness;
double specularIntensity;
double SSAORadius;
int SSAOSamples;
double SSAOJitter;
// dynamic view params
double xctr,yctr,zctr,zdist;
double tanPerPixel;
double camDir[3],camUp[3],camRight[4],camPos[3];
double keyLightDir[3],fillLightDir[3],backLightDir[3];
double keyHalfDir[3];
// dump_modify values
int ncolors;
char **username;
double **userrgb;
double *diamtype,*diamelement,*bdiamtype;
double **colortype,**colorelement,**bcolortype;
double *boxcolor;
int background[3];
// color map
int mstyle,mrange; // 2-letter style/range of color map
int mlo,mhi; // bounds = NUMERIC or MINVALUE or MAXVALUE
double mlovalue,mhivalue; // user bounds if NUMERIC
double locurrent,hicurrent; // current bounds for this snapshot
double mbinsize,mbinsizeinv; // bin size for sequential color map
struct MapEntry {
int single,lo,hi; // NUMERIC or MINVALUE or MAXVALUE
double svalue,lvalue,hvalue; // actual value
double *color; // RGB values
};
MapEntry *mentry;
int nentry;
double interpolate[3];
class RanMars *random;
void init_style();
int modify_param(int, char **);
void write();
@ -141,34 +72,6 @@ class DumpImage : public DumpCustom {
void color_minmax();
void create_image();
// rasterizing methods
void draw_sphere(double *, double *, double);
void draw_cylinder(double *, double *, double *, double, int);
void draw_pixel(int, int, double, double *, double*);
void compute_SSAO();
void write_JPG();
void write_PPM();
double *value2color(double);
double *color2rgb(const char *);
double *element2color(char *);
double element2diam(char *);
// inlined functions
inline double saturate(double v) {
if (v < 0.0) return 0.0;
else if (v > 1.0) return 1.0;
else return v;
}
inline double distance(double* a, double* b) {
return sqrt((a[0] - b[0]) * (a[0] - b[0]) +
(a[1] - b[1]) * (a[1] - b[1]) +
(a[2] - b[2]) * (a[2] - b[2]));
}
};
}

1627
src/image.cpp Normal file

File diff suppressed because it is too large Load Diff

151
src/image.h Normal file
View File

@ -0,0 +1,151 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifndef LMP_IMAGE_H
#define LMP_IMAGE_H
#include "math.h"
#include "stdio.h"
#include "pointers.h"
namespace LAMMPS_NS {
class Image : protected Pointers {
public:
int width,height; // size of image
double theta,phi; // view image from theta,phi
double xctr,yctr,zctr; // center of image in user coords
double up[3]; // up direction in image
double zoom; // zoom factor
double persp; // perspective factor
double shiny; // shininess of objects
int ssao; // SSAO on or off
int seed; // RN seed for SSAO
double ssaoint; // strength of shading from 0 to 1
double *boxcolor; // color to draw box outline with
int background[3]; // RGB values of background
Image(class LAMMPS *);
~Image();
void buffers();
void clear();
void merge();
void write_JPG(FILE *);
void write_PPM(FILE *);
void view_params(double, double, double, double, double, double);
void color_minmax(int, double *, int);
void draw_sphere(double *, double *, double);
void draw_cylinder(double *, double *, double *, double, int);
void draw_triangle(double *, double *, double *, double *);
void draw_box(double (*)[3], double);
void draw_axes(double (*)[3], double);
int colormap(int, char **);
int addcolor(char *, double, double, double);
double *element2color(char *);
double element2diam(char *);
double *value2color(double);
double *color2rgb(const char *);
private:
int me,nprocs;
int npixels;
double *depthBuffer,*surfaceBuffer;
double *depthcopy,*surfacecopy;
char *imageBuffer,*rgbcopy,*writeBuffer;
// constant view params
double FOV;
double ambientColor[3];
double keyLightTheta;
double keyLightPhi;
double keyLightColor[3];
double fillLightTheta;
double fillLightPhi;
double fillLightColor[3];
double backLightTheta;
double backLightPhi;
double backLightColor[3];
double specularHardness;
double specularIntensity;
double SSAORadius;
int SSAOSamples;
double SSAOJitter;
// dynamic view params
double zdist;
double tanPerPixel;
double camDir[3],camUp[3],camRight[4],camPos[3];
double keyLightDir[3],fillLightDir[3],backLightDir[3];
double keyHalfDir[3];
// color values
int ncolors;
char **username;
double **userrgb;
// color map
int mstyle,mrange; // 2-letter style/range of color map
int mlo,mhi; // bounds = NUMERIC or MINVALUE or MAXVALUE
double mlovalue,mhivalue; // user bounds if NUMERIC
double locurrent,hicurrent; // current bounds for this snapshot
double mbinsize,mbinsizeinv; // bin size for sequential color map
struct MapEntry {
int single,lo,hi; // NUMERIC or MINVALUE or MAXVALUE
double svalue,lvalue,hvalue; // actual value
double *color; // RGB values
};
MapEntry *mentry;
int nentry;
double interpolate[3];
// SSAO RNG
class RanMars *random;
// internal methods
void draw_pixel(int, int, double, double *, double*);
void compute_SSAO();
// inline functions
inline double saturate(double v) {
if (v < 0.0) return 0.0;
else if (v > 1.0) return 1.0;
else return v;
}
inline double distance(double* a, double* b) {
return sqrt((a[0] - b[0]) * (a[0] - b[0]) +
(a[1] - b[1]) * (a[1] - b[1]) +
(a[2] - b[2]) * (a[2] - b[2]));
}
};
}
#endif