00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef DISPCMDS_H
00027 #define DISPCMDS_H
00028
00029 class VMDDisplayList;
00030
00034 enum { DPOINT, DPOINTARRAY, DLITPOINTARRAY,
00035 DLINE, DLINEARRAY, DPOLYLINEARRAY,
00036 DCYLINDER,
00037 DSPHERE, DSPHERE_I, DSPHEREARRAY,
00038 DTRIANGLE, DSQUARE, DCONE,
00039 DTRIMESH, DTRISTRIP, DWIREMESH,
00040 DCOLORINDEX, DMATERIALON, DMATERIALOFF,
00041 DTEXT, DTEXTSIZE, DCOMMENT, DTEXTOFFSET,
00042 DCLIPPLANE, DVOLSLICE, DVOLTEXON, DVOLTEXOFF, DVOLUMETEXTURE,
00043 DSPHERERES, DSPHERETYPE, DLINEWIDTH, DLINESTYLE,
00044 DPICKPOINT, DPICKPOINT_I, DPICKPOINT_IARRAY,
00045 DDATABLOCK, DLASTCOMMAND=-1};
00046
00048 enum { SOLIDSPHERE, POINTSPHERE };
00049 enum { SOLIDLINE, DASHEDLINE };
00050
00051
00055 struct DispCmdDataBlock {
00056 void putdata(float *, int, VMDDisplayList *);
00057 float *data;
00058 };
00059
00060
00062 struct DispCmdPoint {
00063 void putdata(const float *, VMDDisplayList *);
00064 float pos[3];
00065 };
00066
00067
00069 struct DispCmdSphere {
00070 void putdata(float *, float, VMDDisplayList *);
00071 float pos_r[4];
00072
00073 };
00074
00075
00077 struct DispCmdSphereIndex {
00078 void putdata(int, float, VMDDisplayList *);
00079 int pos;
00080 float rad;
00081 };
00082
00083
00085 struct DispCmdSphereArray {
00086 static void putdata(const float * centers, const float * radii, const float * colors,
00087 int num_spheres, int sphere_res, VMDDisplayList * dobj);
00088
00089 inline void getpointers(
00090 float *& centers,
00091 float *& radii,
00092 float *& colors
00093 ) const {
00094 char *rawptr = (char *)this;
00095 centers = (float *) (rawptr + sizeof(DispCmdSphereArray));
00096 radii = (float *) (rawptr + sizeof(DispCmdSphereArray) +
00097 sizeof(float) * numspheres * 3);
00098 colors = (float *) (rawptr + sizeof(DispCmdSphereArray) +
00099 sizeof(float) * numspheres * 3 +
00100 sizeof(float) * numspheres);
00101 }
00102
00103 int numspheres;
00104 int sphereres;
00105 };
00106
00107
00109 struct DispCmdPointArray {
00110 static void putdata(const float * centers, const float * colors, float size,
00111 int num_points, VMDDisplayList * dobj);
00112
00113 inline void getpointers(
00114 float *& centers,
00115 float *& colors
00116 ) const {
00117 char *rawptr = (char *)this;
00118 centers = (float *) (rawptr + sizeof(DispCmdPointArray));
00119 colors = (float *) (rawptr + sizeof(DispCmdPointArray) +
00120 sizeof(float) * numpoints * 3);
00121 }
00122 float size;
00123 int numpoints;
00124 };
00125
00126
00128 struct DispCmdLitPointArray {
00129 static void putdata(const float * centers, const float * normals,
00130 const float * colors, float size, int num_points,
00131 VMDDisplayList * dobj);
00132
00133 inline void getpointers(
00134 float *& centers,
00135 float *& normals,
00136 float *& colors
00137 ) const {
00138 char *rawptr = (char *)this;
00139 centers = (float *) (rawptr + sizeof(DispCmdLitPointArray));
00140 normals = (float *) (rawptr + sizeof(DispCmdLitPointArray) +
00141 sizeof(float) * numpoints * 3);
00142 colors = (float *) (rawptr + sizeof(DispCmdLitPointArray) +
00143 sizeof(float) * numpoints * 6);
00144 }
00145
00146 float size;
00147 int numpoints;
00148 };
00149
00150
00152 struct DispCmdLine {
00153 void putdata(float *, float *, VMDDisplayList *);
00154 float pos1[3];
00155 float pos2[3];
00156 };
00157
00158
00164 struct DispCmdLineArray {
00165 void putdata(float *v, int nlines, VMDDisplayList *);
00166 };
00167
00168
00174 struct DispCmdPolyLineArray {
00175 void putdata(float *v, int nlines, VMDDisplayList *);
00176 };
00177
00178
00183 struct DispCmdTriangle {
00184 void putdata(const float *, const float *, const float *, VMDDisplayList *);
00185 void putdata(const float *, const float *, const float *,
00186 const float *, const float *, const float *, VMDDisplayList *);
00187
00188 float pos1[3], pos2[3], pos3[3];
00189 float norm1[3], norm2[3], norm3[3];
00190 void set_array(const float *, const float *, const float *,
00191 const float *, const float *, const float *,
00192 VMDDisplayList *);
00193 };
00194
00196 struct DispCmdSquare {
00197 float pos1[3], pos2[3], pos3[3], pos4[3];
00198 float norml[3];
00199 void putdata(float *p1, float *p2, float *p3, VMDDisplayList *);
00200 };
00201
00202
00204 struct DispCmdTriMesh {
00205 static void putdata(const float * vertices,
00206 const float * normals,
00207 const float * colors,
00208 int num_verts,
00209 const int * facets,
00210 int num_facets,
00211 int enablestrips,
00212 VMDDisplayList *);
00213
00217 inline void getpointers(float *& cnv, int *& f) const {
00218 cnv = (float *)(((char *)this) + sizeof(DispCmdTriMesh));
00219 f = (int *)(cnv + 10*numverts);
00220 }
00221 int numverts;
00222 int numfacets;
00223 };
00224
00225
00227 struct DispCmdTriStrips {
00228 static void putdata(const float * vertices,
00229 const float * normals,
00230 const float * colors,
00231 int num_verts,
00232 const int * verts_per_strip,
00233 int num_strips,
00234 const unsigned int * strip_data,
00235 const int num_strip_verts,
00236 int double_sided_lighting,
00237 VMDDisplayList * dobj);
00238
00242 inline void getpointers(
00243 float *& cnv,
00244 int *& f,
00245 int *& vertsperstrip) const {
00246
00247 char *rawptr = (char *)this;
00248 cnv= (float *) (rawptr +
00249 sizeof(DispCmdTriStrips));
00250
00251 f= (int *) (rawptr +
00252 sizeof(DispCmdTriStrips) +
00253 sizeof(float) * numverts * 10);
00254
00255 vertsperstrip= (int *) (rawptr +
00256 sizeof(DispCmdTriStrips) +
00257 sizeof(float) * numverts * 10 +
00258 sizeof(int) * numstripverts);
00259 }
00260
00261 int numverts;
00262 int numstrips;
00263 int numstripverts;
00264 int doublesided;
00265 };
00266
00267
00269 struct DispCmdWireMesh {
00270 static void putdata(const float * vertices,
00271 const float * normals,
00272 const float * colors,
00273 int num_verts,
00274 const int * lines,
00275 int num_lines, VMDDisplayList *);
00276
00277 inline void getpointers(
00278 float *& cnv,
00279 int *& l
00280 ) const {
00281 char *rawptr = (char *)this;
00282 cnv=(float *) (rawptr + sizeof(DispCmdWireMesh));
00283 l=(int *) (rawptr + sizeof(DispCmdWireMesh) + sizeof(float) * numverts * 10);
00284 }
00285
00286 int numverts;
00287 int numlines;
00288 };
00289
00290
00291 #define CYLINDER_TRAILINGCAP 1
00292 #define CYLINDER_LEADINGCAP 2
00293
00295 struct DispCmdCylinder {
00296 DispCmdCylinder(void);
00297 float rot[2];
00298 int lastres;
00299 void putdata(const float *, const float *, float, int, int filled,
00300 VMDDisplayList *);
00301 };
00302
00303
00305 struct DispCmdCone {
00306 void putdata(float*, float *, float, float, int, VMDDisplayList *);
00307 float pos1[3], pos2[3];
00308 float radius, radius2;
00309 int res;
00310 };
00311
00312
00314 struct DispCmdColorIndex {
00315 void putdata(int, VMDDisplayList *);
00316 int color;
00317 };
00318
00319
00321 struct DispCmdText {
00322 void putdata(const float *,const char *, VMDDisplayList *);
00323 };
00324
00325
00327 struct DispCmdComment {
00328 void putdata(const char *,VMDDisplayList *);
00329 };
00330
00331
00333 struct DispCmdTextSize {
00334 void putdata(float, VMDDisplayList *);
00335 float size;
00336 };
00337
00339 struct DispCmdTextOffset {
00340 void putdata(float x, float y, VMDDisplayList *);
00341 float x, y;
00342 };
00343
00345 struct DispCmdVolSlice {
00346 void putdata(int mode, const float *norm, const float *verts, const float *texcoords,
00347 VMDDisplayList *);
00349 int texmode;
00350 float normal[3];
00352 float v[12];
00353 float t[12];
00354 };
00355
00358 struct DispCmdVolumeTexture {
00359 void putdata(unsigned long texID, const int size[3],
00360 unsigned char *texptr, const float vp0[3], const float vp1[3],
00361 const float vp2[3], const float vp3[3], VMDDisplayList *);
00362 unsigned char * texmap;
00363 unsigned long ID;
00364 unsigned xsize;
00365 unsigned ysize;
00366 unsigned zsize;
00367 float v0[3];
00368 float v1[3];
00369 float v2[3];
00370 float v3[3];
00371 };
00372
00374 struct DispCmdSphereRes {
00375 void putdata(int, VMDDisplayList *);
00376 int res;
00377 };
00378
00379
00381 struct DispCmdSphereType {
00382 void putdata(int, VMDDisplayList *);
00383 int type;
00384 };
00385
00386
00388 struct DispCmdLineType {
00389 void putdata(int, VMDDisplayList *);
00390 int type;
00391 };
00392
00393
00395 struct DispCmdLineWidth {
00396 void putdata(int, VMDDisplayList *);
00397 int width;
00398 };
00399
00400
00402 struct DispCmdPickPoint {
00403 void putdata(float *, int, VMDDisplayList *);
00404 float postag[3];
00405 int tag;
00406 };
00407
00408
00411 struct DispCmdPickPointIndex {
00412 void putdata(int, int, VMDDisplayList *);
00413 int pos, tag;
00414 };
00415
00416
00419 struct DispCmdPickPointIndexArray {
00424 void putdata(int num, int numsel, int *onoff, VMDDisplayList *);
00425
00427 void putdata(int num, int *indices, VMDDisplayList *);
00428
00429 inline void getpointers(int *& tags) const {
00430 if (allselected) {
00431 tags = NULL;
00432 return;
00433 }
00434
00435 char *rawptr = (char *)this;
00436 tags = (int *) (rawptr + sizeof(DispCmdPickPointIndexArray));
00437 }
00438
00439 int numpicks;
00440 int allselected;
00441 };
00442
00443 #endif
00444