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 class Scene;
00031
00035 enum { DBEGINREPGEOMGROUP, DPOINT, DPOINTARRAY, DLITPOINTARRAY,
00036 DLINE, DLINEARRAY, DPOLYLINEARRAY,
00037 DCYLINDER,
00038 DSPHERE, DSPHEREARRAY,
00039 DTRIANGLE, DSQUARE, DCONE,
00040 DTRIMESH_C4F_N3F_V3F, DTRIMESH_C3F_N3F_V3F,
00041 DTRIMESH_C4U_N3F_V3F, DTRIMESH_C4U_N3B_V3F,
00042 DTRISTRIP, DWIREMESH,
00043 DCOLORINDEX, DMATERIALON, DMATERIALOFF,
00044 DTEXT, DTEXTSIZE, DCOMMENT, DTEXTOFFSET,
00045 DCLIPPLANE, DVOLSLICE, DVOLTEXON, DVOLTEXOFF, DVOLUMETEXTURE,
00046 DSPHERERES, DSPHERETYPE, DLINEWIDTH, DLINESTYLE,
00047 DPICKPOINT, DPICKPOINT_ARRAY, DLASTCOMMAND=-1};
00048
00050 enum { SOLIDSPHERE, POINTSPHERE };
00051 enum { SOLIDLINE, DASHEDLINE };
00052
00053
00059 struct DispCmdBeginRepGeomGroup {
00060 void putdata(const char *, VMDDisplayList *);
00061 };
00062
00063
00066 struct DispCmdComment {
00067 void putdata(const char *, VMDDisplayList *);
00068 };
00069
00070
00072 struct DispCmdPoint {
00073 void putdata(const float *, VMDDisplayList *);
00074 float pos[3];
00075 };
00076
00077
00079 struct DispCmdSphere {
00080 void putdata(float *, float, VMDDisplayList *);
00081 float pos_r[4];
00082
00083 };
00084
00085
00087 struct DispCmdSphereArray {
00088 static void putdata(const float * centers, const float * radii, const float * colors,
00089 int num_spheres, int sphere_res, VMDDisplayList * dobj);
00090
00091 inline void getpointers(
00092 float *& centers,
00093 float *& radii,
00094 float *& colors
00095 ) const {
00096 char *rawptr = (char *)this;
00097 centers = (float *) (rawptr + sizeof(DispCmdSphereArray));
00098 radii = (float *) (rawptr + sizeof(DispCmdSphereArray) +
00099 sizeof(float) * numspheres * 3);
00100 colors = (float *) (rawptr + sizeof(DispCmdSphereArray) +
00101 sizeof(float) * numspheres * 3 +
00102 sizeof(float) * numspheres);
00103 }
00104
00105 int numspheres;
00106 int sphereres;
00107 };
00108
00109
00111 struct DispCmdPointArray {
00112 static void putdata(const float * centers, const float * colors, float size,
00113 int num_points, VMDDisplayList * dobj);
00114
00115 static void putdata(const float * centers, const int *, Scene *, float size,
00116 int num_points, const int *, int selected,
00117 VMDDisplayList * dobj);
00118
00119 inline void getpointers(
00120 float *& centers,
00121 float *& colors
00122 ) const {
00123 char *rawptr = (char *)this;
00124 centers = (float *) (rawptr + sizeof(DispCmdPointArray));
00125 colors = (float *) (rawptr + sizeof(DispCmdPointArray) +
00126 sizeof(float) * numpoints * 3);
00127 }
00128 float size;
00129 int numpoints;
00130 };
00131
00132
00134 struct DispCmdLitPointArray {
00135 static void putdata(const float * centers, const float * normals,
00136 const float * colors, float size, int num_points,
00137 VMDDisplayList * dobj);
00138
00139 inline void getpointers(
00140 float *& centers,
00141 float *& normals,
00142 float *& colors
00143 ) const {
00144 char *rawptr = (char *)this;
00145 centers = (float *) (rawptr + sizeof(DispCmdLitPointArray));
00146 normals = (float *) (rawptr + sizeof(DispCmdLitPointArray) +
00147 sizeof(float) * numpoints * 3);
00148 colors = (float *) (rawptr + sizeof(DispCmdLitPointArray) +
00149 sizeof(float) * numpoints * 6);
00150 }
00151
00152 float size;
00153 int numpoints;
00154 };
00155
00156
00158 struct DispCmdLine {
00159 void putdata(float *, float *, VMDDisplayList *);
00160 float pos1[3];
00161 float pos2[3];
00162 };
00163
00164
00170 struct DispCmdLineArray {
00171 void putdata(float *v, int nlines, VMDDisplayList *);
00172 };
00173
00174
00180 struct DispCmdPolyLineArray {
00181 void putdata(float *v, int nlines, VMDDisplayList *);
00182 };
00183
00184
00189 struct DispCmdTriangle {
00190 void putdata(const float *, const float *, const float *, VMDDisplayList *);
00191 void putdata(const float *, const float *, const float *,
00192 const float *, const float *, const float *, VMDDisplayList *);
00193
00194 float pos1[3], pos2[3], pos3[3];
00195 float norm1[3], norm2[3], norm3[3];
00196 void set_array(const float *, const float *, const float *,
00197 const float *, const float *, const float *,
00198 VMDDisplayList *);
00199 };
00200
00202 struct DispCmdSquare {
00203 float pos1[3], pos2[3], pos3[3], pos4[3];
00204 float norml[3];
00205 void putdata(float *p1, float *p2, float *p3, VMDDisplayList *);
00206 };
00207
00208
00210 struct DispCmdTriMesh {
00211 static void putdata(const float * vertices,
00212 const float * normals,
00213 const float * colors,
00214 int num_facets,
00215 VMDDisplayList *);
00216
00217 static void putdata(const float * vertices,
00218 const float * normals,
00219 const unsigned char * colors,
00220 int num_facets,
00221 VMDDisplayList *);
00222
00223 static void putdata(const float * vertices,
00224 const char * normals,
00225 const unsigned char * colors,
00226 int num_facets,
00227 VMDDisplayList *);
00228
00229 static void putdata(const float * vertices,
00230 const float * normals,
00231 const float * colors,
00232 int num_verts,
00233 const int * facets,
00234 int num_facets,
00235 int enablestrips,
00236 VMDDisplayList *);
00237
00238 #if defined(VMDCUDA)
00239
00240 static void cuda_putdata(const float * vertices_d,
00241 const float * normals_d,
00242 const float * colors_d,
00243 int num_facets,
00244 VMDDisplayList *);
00245
00247 static void cuda_putdata(const float * vertices_d,
00248 const float * normals_d,
00249 const unsigned char * colors_d,
00250 int num_facets,
00251 VMDDisplayList *);
00252
00254 static void cuda_putdata(const float * vertices_d,
00255 const char * normals_d,
00256 const unsigned char * colors_d,
00257 int num_facets,
00258 VMDDisplayList *);
00259 #endif
00260
00264 inline void getpointers(float *& cnv, int *& f) const {
00265 cnv = (float *)(((char *)this) + sizeof(DispCmdTriMesh));
00266 f = (int *)(cnv + 10*numverts);
00267 }
00268
00271 inline void getpointers(float *& c, float *&n, float *&v) const {
00272 c = (float *)(((char *)this) + sizeof(DispCmdTriMesh));
00273 n = c + 3 * numverts;
00274 v = n + 3 * numverts;
00275 }
00276
00277 inline void getpointers(unsigned char *& c, float *&n, float *&v) const {
00278 c = (unsigned char *)(((char *)this) + sizeof(DispCmdTriMesh));
00279 n = (float *) (c + numverts * 4 * sizeof(unsigned char));
00280 v = n + 3 * numverts;
00281 }
00282
00283 inline void getpointers(unsigned char *& c, char *&n, float *&v) const {
00284 c = (unsigned char *)(((char *)this) + sizeof(DispCmdTriMesh));
00285 v = (float *) (c + numverts * 4 * sizeof(unsigned char));
00286 n = (char *) (v + 3 * numverts);
00287 }
00288
00291 inline void getpointers(float *&n, float *&v) const {
00292 n = (float *)(((char *)this) + sizeof(DispCmdTriMesh));
00293 v = n + 3 * numverts;
00294 }
00295
00296 inline void getpointers(char *&n, float *&v) const {
00297 v = (float *)(((char *)this) + sizeof(DispCmdTriMesh));
00298 n = (char *) (v + 3 * numverts);
00299 }
00300
00301 int pervertexcolors;
00302 int numverts;
00303 int numfacets;
00304 };
00305
00306
00308 struct DispCmdTriStrips {
00309 static void putdata(const float * vertices,
00310 const float * normals,
00311 const float * colors,
00312 int num_verts,
00313 const int * verts_per_strip,
00314 int num_strips,
00315 const unsigned int * strip_data,
00316 const int num_strip_verts,
00317 int double_sided_lighting,
00318 VMDDisplayList * dobj);
00319
00323 inline void getpointers(
00324 float *& cnv,
00325 int *& f,
00326 int *& vertsperstrip) const {
00327
00328 char *rawptr = (char *)this;
00329 cnv= (float *) (rawptr +
00330 sizeof(DispCmdTriStrips));
00331
00332 f= (int *) (rawptr +
00333 sizeof(DispCmdTriStrips) +
00334 sizeof(float) * numverts * 10);
00335
00336 vertsperstrip= (int *) (rawptr +
00337 sizeof(DispCmdTriStrips) +
00338 sizeof(float) * numverts * 10 +
00339 sizeof(int) * numstripverts);
00340 }
00341
00342 int numverts;
00343 int numstrips;
00344 int numstripverts;
00345 int doublesided;
00346 };
00347
00348
00350 struct DispCmdWireMesh {
00351 static void putdata(const float * vertices,
00352 const float * normals,
00353 const float * colors,
00354 int num_verts,
00355 const int * lines,
00356 int num_lines, VMDDisplayList *);
00357
00358 inline void getpointers(
00359 float *& cnv,
00360 int *& l
00361 ) const {
00362 char *rawptr = (char *)this;
00363 cnv=(float *) (rawptr + sizeof(DispCmdWireMesh));
00364 l=(int *) (rawptr + sizeof(DispCmdWireMesh) + sizeof(float) * numverts * 10);
00365 }
00366
00367 int numverts;
00368 int numlines;
00369 };
00370
00371
00372 #define CYLINDER_TRAILINGCAP 1
00373 #define CYLINDER_LEADINGCAP 2
00374
00376 struct DispCmdCylinder {
00377 DispCmdCylinder(void);
00378 float rot[2];
00379 int lastres;
00380 void putdata(const float *, const float *, float, int, int filled,
00381 VMDDisplayList *);
00382 };
00383
00384
00386 struct DispCmdCone {
00387 void putdata(float*, float *, float, float, int, VMDDisplayList *);
00388 float pos1[3], pos2[3];
00389 float radius, radius2;
00390 int res;
00391 };
00392
00393
00395 struct DispCmdColorIndex {
00396 void putdata(int, VMDDisplayList *);
00397 int color;
00398 };
00399
00400
00402 struct DispCmdText {
00403 void putdata(const float *, const char *, float thickness, VMDDisplayList *);
00404 };
00405
00406
00408 struct DispCmdTextSize {
00409 void putdata(float, VMDDisplayList *);
00410 float size;
00411 };
00412
00414 struct DispCmdTextOffset {
00415 void putdata(float x, float y, VMDDisplayList *);
00416 float x, y;
00417 };
00418
00420 struct DispCmdVolSlice {
00421 void putdata(int mode, const float *norm, const float *verts, const float *texcoords,
00422 VMDDisplayList *);
00424 int texmode;
00425 float normal[3];
00427 float v[12];
00428 float t[12];
00429 };
00430
00433 struct DispCmdVolumeTexture {
00434 void putdata(unsigned long texID, const int size[3],
00435 unsigned char *texptr, const float vp0[3], const float vp1[3],
00436 const float vp2[3], const float vp3[3], VMDDisplayList *);
00437 unsigned char * texmap;
00438 unsigned long ID;
00439 unsigned xsize;
00440 unsigned ysize;
00441 unsigned zsize;
00442 float v0[3];
00443 float v1[3];
00444 float v2[3];
00445 float v3[3];
00446 };
00447
00449 struct DispCmdSphereRes {
00450 void putdata(int, VMDDisplayList *);
00451 int res;
00452 };
00453
00454
00456 struct DispCmdSphereType {
00457 void putdata(int, VMDDisplayList *);
00458 int type;
00459 };
00460
00461
00463 struct DispCmdLineType {
00464 void putdata(int, VMDDisplayList *);
00465 int type;
00466 };
00467
00468
00470 struct DispCmdLineWidth {
00471 void putdata(int, VMDDisplayList *);
00472 int width;
00473 };
00474
00475
00477 struct DispCmdPickPoint {
00478 void putdata(float *, int, VMDDisplayList *);
00479 float postag[3];
00480 int tag;
00481 };
00482
00483
00486 struct DispCmdPickPointArray {
00491 void putdata(int num, int numsel, int firstsel,
00492 int *on, float *coords, VMDDisplayList *);
00493
00495 void putdata(int num, int *indices, float *coords, VMDDisplayList *);
00496
00497 inline void getpointers(float *& coords, int *& tags) const {
00498 char *rawptr = (char *)this;
00499 coords = (float *) (rawptr + sizeof(DispCmdPickPointArray));
00500
00501 if (allselected) {
00502 tags = NULL;
00503 return;
00504 }
00505
00506 tags = (int *) (rawptr + sizeof(DispCmdPickPointArray) +
00507 3 * sizeof(float) * numpicks);
00508 }
00509
00510 int numpicks;
00511 int allselected;
00512 int firstindex;
00513 };
00514
00515 #endif
00516