Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

DispCmds.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr                                                                       
00003  *cr            (C) Copyright 1995-2011 The Board of Trustees of the           
00004  *cr                        University of Illinois                       
00005  *cr                         All Rights Reserved                        
00006  *cr                                                                   
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  * RCS INFORMATION:
00011  *
00012  *      $RCSfile: DispCmds.h,v $
00013  *      $Author: johns $        $Locker:  $             $State: Exp $
00014  *      $Revision: 1.104 $      $Date: 2011/12/05 06:28:43 $
00015  *
00016  ***************************************************************************
00017  * DESCRIPTION:
00018  *
00019  * DispCmds - different display commands which take data and put it in
00020  *      a storage space provided by a given VMDDisplayList object.
00021  *
00022  * Notes:
00023  *      1. All coordinates are stored as 3 points (x,y,z), even if meant
00024  * for a 2D object.  The 3rd coord for 2D objects will be ignored.
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        DTRISTRIP, DWIREMESH,
00042        DCOLORINDEX, DMATERIALON, DMATERIALOFF, 
00043        DTEXT, DTEXTSIZE, DCOMMENT, DTEXTOFFSET,
00044        DCLIPPLANE, DVOLSLICE, DVOLTEXON, DVOLTEXOFF, DVOLUMETEXTURE,
00045        DSPHERERES, DSPHERETYPE, DLINEWIDTH, DLINESTYLE,
00046        DPICKPOINT, DPICKPOINT_ARRAY, DLASTCOMMAND=-1};
00047 
00049 enum { SOLIDSPHERE, POINTSPHERE };
00050 enum { SOLIDLINE, DASHEDLINE };
00051 
00052 
00058 struct DispCmdBeginRepGeomGroup {
00059   void putdata(const char *, VMDDisplayList *);
00060 };
00061 
00062 
00065 struct DispCmdComment {
00066   void putdata(const char *, VMDDisplayList *);
00067 };
00068 
00069 
00071 struct DispCmdPoint {
00072   void putdata(const float *, VMDDisplayList *);
00073   float pos[3];
00074 };
00075 
00076 
00078 struct DispCmdSphere {
00079   void putdata(float *, float, VMDDisplayList *);
00080   float pos_r[4]; 
00081 
00082 };
00083 
00084 
00086 struct DispCmdSphereArray {
00087   static void putdata(const float * centers, const float * radii, const float * colors,
00088                int num_spheres, int sphere_res, VMDDisplayList * dobj);
00089 
00090   inline void getpointers(
00091     float *& centers,
00092     float *& radii,
00093     float *& colors
00094     ) const {
00095     char *rawptr = (char *)this;
00096     centers = (float *) (rawptr + sizeof(DispCmdSphereArray));
00097     radii   = (float *) (rawptr + sizeof(DispCmdSphereArray) +
00098                          sizeof(float) * numspheres * 3);
00099     colors  = (float *) (rawptr + sizeof(DispCmdSphereArray) +
00100                          sizeof(float) * numspheres * 3 +
00101                          sizeof(float) * numspheres);
00102   }
00103 
00104   int numspheres;
00105   int sphereres;
00106 };
00107 
00108 
00110 struct DispCmdPointArray {
00111   static void putdata(const float * centers, const float * colors, float size,
00112                       int num_points, VMDDisplayList * dobj);
00113 
00114   static void putdata(const float * centers, const int *, Scene *, float size,
00115                       int num_points, const int *, int selected, 
00116                       VMDDisplayList * dobj);
00117 
00118   inline void getpointers(
00119     float *& centers,
00120     float *& colors
00121     ) const {
00122     char *rawptr = (char *)this;
00123     centers = (float *) (rawptr + sizeof(DispCmdPointArray));
00124     colors  = (float *) (rawptr + sizeof(DispCmdPointArray) +
00125                          sizeof(float) * numpoints * 3);
00126   }
00127   float size;
00128   int numpoints;
00129 };
00130 
00131 
00133 struct DispCmdLitPointArray {
00134   static void putdata(const float * centers, const float * normals, 
00135                const float * colors, float size, int num_points, 
00136                VMDDisplayList * dobj);
00137 
00138   inline void getpointers(
00139     float *& centers,
00140     float *& normals,
00141     float *& colors
00142     ) const {
00143     char *rawptr = (char *)this;
00144     centers = (float *) (rawptr + sizeof(DispCmdLitPointArray));
00145     normals = (float *) (rawptr + sizeof(DispCmdLitPointArray) + 
00146                          sizeof(float) * numpoints * 3);
00147     colors  = (float *) (rawptr + sizeof(DispCmdLitPointArray) +
00148                          sizeof(float) * numpoints * 6);
00149   }
00150 
00151   float size;
00152   int numpoints;
00153 };
00154 
00155 
00157 struct DispCmdLine {
00158   void putdata(float *, float *, VMDDisplayList *);
00159   float pos1[3];
00160   float pos2[3];
00161 };
00162 
00163 
00169 struct DispCmdLineArray {
00170   void putdata(float *v, int nlines, VMDDisplayList *);
00171 }; 
00172 
00173 
00179 struct DispCmdPolyLineArray {
00180   void putdata(float *v, int nlines, VMDDisplayList *);
00181 }; 
00182 
00183  
00188 struct DispCmdTriangle {
00189   void putdata(const float *, const float *, const float *, VMDDisplayList *);
00190   void putdata(const float *, const float *, const float *,
00191                const float *, const float *, const float *, VMDDisplayList *);
00192 
00193   float pos1[3], pos2[3], pos3[3];
00194   float norm1[3], norm2[3], norm3[3];
00195   void set_array(const float *, const float *, const float *, 
00196                  const float *, const float *, const float *,
00197                  VMDDisplayList *);
00198 };
00199  
00201 struct DispCmdSquare {
00202   float pos1[3], pos2[3], pos3[3], pos4[3];
00203   float norml[3];
00204   void putdata(float *p1, float *p2, float *p3, VMDDisplayList *);
00205 };
00206 
00207 
00209 struct DispCmdTriMesh {
00210   static void putdata(const float * vertices, 
00211                       const float * normals,
00212                       const float * colors,
00213                       int num_facets,
00214                       VMDDisplayList *);
00215 
00216   static void putdata(const float * vertices, 
00217                       const float * normals,
00218                       const float * colors,
00219                       int num_verts,
00220                       const int * facets, 
00221                       int num_facets, 
00222                       int enablestrips,
00223                       VMDDisplayList *);
00224 
00225 #if defined(VMDCUDA)
00226 
00227   static void cuda_putdata(const float * vertices_d, 
00228                            const float * normals_d,
00229                            const float * colors_d,
00230                            int num_facets,
00231                            VMDDisplayList *);
00232 #endif
00233 
00237   inline void getpointers(float *& cnv, int *& f) const {
00238     cnv = (float *)(((char *)this) + sizeof(DispCmdTriMesh));
00239     f = (int *)(cnv + 10*numverts);
00240   }
00241 
00244   inline void getpointers(float *& c, float *&n, float *&v) const {
00245     c = (float *)(((char *)this) + sizeof(DispCmdTriMesh));
00246     n = c + 3 * numverts;
00247     v = n + 3 * numverts;
00248   }
00249 
00252   inline void getpointers(float *&n, float *&v) const {
00253     n = (float *)(((char *)this) + sizeof(DispCmdTriMesh));
00254     v = n + 3 * numverts;
00255   }
00256 
00257   int pervertexcolors;  
00258   int numverts;         
00259   int numfacets;        
00260 };
00261 
00262 
00264 struct DispCmdTriStrips {
00265   static void putdata(const float * vertices, 
00266                const float * normals,
00267                const float * colors,
00268                int num_verts,
00269                const int * verts_per_strip,
00270                int num_strips, 
00271                const unsigned int * strip_data,
00272                const int num_strip_verts,
00273                int double_sided_lighting,
00274                VMDDisplayList * dobj);
00275 
00279   inline void getpointers(
00280       float *& cnv,
00281       int   *& f,
00282       int   *& vertsperstrip) const {
00283 
00284     char *rawptr = (char *)this;
00285     cnv= (float *)         (rawptr +
00286                             sizeof(DispCmdTriStrips));
00287   
00288     f= (int *)             (rawptr +
00289                             sizeof(DispCmdTriStrips) +
00290                             sizeof(float) * numverts * 10);
00291   
00292     vertsperstrip= (int *) (rawptr +
00293                             sizeof(DispCmdTriStrips) +
00294                             sizeof(float) * numverts * 10 +
00295                             sizeof(int)   * numstripverts);
00296   }
00297 
00298   int numverts;         
00299   int numstrips;        
00300   int numstripverts;    
00301   int doublesided;      
00302 }; 
00303 
00304 
00306 struct DispCmdWireMesh {
00307   static void putdata(const float * vertices, 
00308                const float * normals,
00309                const float * colors,
00310                int num_verts,
00311                const int * lines, 
00312                int num_lines, VMDDisplayList *);
00313 
00314   inline void getpointers(
00315     float *& cnv,          
00316     int   *& l             
00317     ) const {
00318     char *rawptr = (char *)this;
00319     cnv=(float *) (rawptr + sizeof(DispCmdWireMesh)); 
00320     l=(int *) (rawptr + sizeof(DispCmdWireMesh) + sizeof(float) * numverts * 10);
00321   }
00322 
00323   int numverts;         
00324   int numlines;         
00325 };
00326 
00327 
00328 #define CYLINDER_TRAILINGCAP 1
00329 #define CYLINDER_LEADINGCAP  2
00330 
00332 struct DispCmdCylinder {
00333   DispCmdCylinder(void);
00334   float rot[2];         
00335   int lastres;
00336   void putdata(const float *, const float *, float, int, int filled, 
00337     VMDDisplayList *); 
00338 };
00339  
00340 
00342 struct DispCmdCone {
00343   void putdata(float*, float *, float, float, int, VMDDisplayList *);
00344   float pos1[3], pos2[3]; 
00345   float radius, radius2; 
00346   int res;
00347 };
00348 
00349 
00351 struct DispCmdColorIndex {
00352   void putdata(int, VMDDisplayList *);
00353   int color;
00354 };
00355 
00356 
00358 struct DispCmdText {
00359   void putdata(const float *, const char *, float thickness, VMDDisplayList *);
00360 };
00361 
00362 
00364 struct DispCmdTextSize {
00365   void putdata(float, VMDDisplayList *);
00366   float size;
00367 };
00368 
00370 struct DispCmdTextOffset {
00371   void putdata(float x, float y, VMDDisplayList *);
00372   float x, y;
00373 };
00374 
00376 struct DispCmdVolSlice {
00377   void putdata(int mode, const float *norm, const float *verts, const float *texcoords, 
00378       VMDDisplayList *);
00380   int texmode;            
00381   float normal[3];        
00383   float v[12];
00384   float t[12];
00385 };
00386 
00389 struct DispCmdVolumeTexture {
00390   void putdata(unsigned long texID, const int size[3], 
00391       unsigned char *texptr, const float vp0[3], const float vp1[3], 
00392       const float vp2[3], const float vp3[3], VMDDisplayList *);
00393   unsigned char * texmap; 
00394   unsigned long ID;       
00395   unsigned xsize;
00396   unsigned ysize;
00397   unsigned zsize;
00398   float v0[3];            
00399   float v1[3];            
00400   float v2[3];            
00401   float v3[3];            
00402 };
00403 
00405 struct DispCmdSphereRes {
00406   void putdata(int, VMDDisplayList *);
00407   int res;
00408 };
00409 
00410 
00412 struct DispCmdSphereType {
00413   void putdata(int, VMDDisplayList *);
00414   int type;
00415 };
00416 
00417 
00419 struct DispCmdLineType {
00420   void putdata(int, VMDDisplayList *);
00421   int type;
00422 };
00423 
00424 
00426 struct DispCmdLineWidth {
00427   void putdata(int, VMDDisplayList *);
00428   int width;
00429 };
00430 
00431 
00433 struct DispCmdPickPoint {
00434   void putdata(float *, int, VMDDisplayList *);
00435   float postag[3];
00436   int tag;
00437 };
00438 
00439 
00442 struct DispCmdPickPointArray {
00447   void putdata(int num, int numsel, int firstsel,
00448                int *on, float *coords, VMDDisplayList *);
00449 
00451   void putdata(int num, int *indices, float *coords, VMDDisplayList *);
00452 
00453   inline void getpointers(float *& coords, int *& tags) const {
00454     char *rawptr = (char *)this;
00455     coords = (float *) (rawptr + sizeof(DispCmdPickPointArray));
00456 
00457     if (allselected) {
00458       tags = NULL;
00459       return;
00460     }
00461 
00462     tags = (int *) (rawptr + sizeof(DispCmdPickPointArray) + 
00463                     3 * sizeof(float) * numpicks);
00464   }
00465 
00466   int numpicks;
00467   int allselected;
00468   int firstindex;
00469 };
00470 
00471 #endif
00472 

Generated on Wed May 16 01:49:10 2012 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002