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

VMDDisplayList.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr
00003  *cr            (C) Copyright 1995-2019 The Board of Trustees of the
00004  *cr                        University of Illinois
00005  *cr                         All Rights Reserved
00006  *cr
00007  ***************************************************************************/
00008 /***************************************************************************
00009  * RCS INFORMATION:
00010  *
00011  *      $RCSfile: VMDDisplayList.h,v $
00012  *      $Author: johns $        $Locker:  $             $State: Exp $
00013  *      $Revision: 1.46 $      $Date: 2020/12/12 22:54:24 $
00014  *
00015  ***************************************************************************/
00022 #ifndef VMDLINKEDLIST_H__
00023 #define VMDLINKEDLIST_H__
00024 
00025 #include <string.h>
00026 #include "ResizeArray.h"
00027 #include "Matrix4.h"
00028 
00030 struct VMDClipPlane {
00031   float center[3]; 
00032   float normal[3]; 
00033   float color[3];  
00034   int mode;        
00035 
00037   VMDClipPlane() {
00038     center[0] = center[1] = center[2] = 0;
00039     normal[0] = normal[1] = 0; normal[2] = 1;
00040     color[0] = color[1] = color[2] = 0.5;
00041     mode = 0;
00042   }
00043 };
00044 
00045 #define VMD_MAX_CLIP_PLANE 6
00046 
00049 #define PBC_NONE   0x00  // don't draw any PBC images
00050 #define PBC_X      0x01  // +X images
00051 #define PBC_Y      0x02  // +Y images
00052 #define PBC_Z      0x04  // +Z images
00053 #define PBC_OPX    0x08  // -X images
00054 #define PBC_OPY    0x10  // -Y images
00055 #define PBC_OPZ    0x20  // -Z images
00056 #define PBC_NOSELF 0x40  // set this flag to NOT draw the original image
00057 
00060 #define INSTANCE_NONE   0x0      // don't draw any instance images
00061 #define INSTANCE_ALL    0x00ffff // draw all of the instance images
00062 #define INSTANCE_NOSELF 0x01ffff // don't draw the original instance
00063 
00066 class VMDDisplayList {
00067 private:
00068   struct CommandHeader {
00069     int code;  
00070     long size; 
00071   };
00072 
00073 public:
00074   VMDDisplayList();   
00075   ~VMDDisplayList();  
00076 
00077   void *operator new(size_t);           
00078   void operator delete(void *, size_t); 
00079 
00080   Matrix4 mat;                     
00081   unsigned long serial;            
00082   int cacheskip;                   
00083   int pbc;                         
00084   int npbc;                        
00085   Matrix4 transX, transY, transZ;  
00086   Matrix4 transXinv, transYinv, transZinv; 
00087   int instanceset;                 
00088   ResizeArray<Matrix4> instances;  
00089 
00091 
00092   float ambient, specular, diffuse, shininess, mirror, opacity; 
00093   float outline, outlinewidth, transmode;
00094   int materialtag;  
00095 
00096 
00097   VMDClipPlane clipplanes[VMD_MAX_CLIP_PLANE]; 
00098 
00100   void *append(int code, long size);
00101 
00102   // Reset and also free up any linked memory blocks.  The original block will 
00103   // not be freed; it doesn't go away until you delete the object.
00104   void reset_and_free(unsigned long newserial);
00105 
00107   const VMDClipPlane *clipplane(int i) {
00108     if (i < 0 || i >= VMD_MAX_CLIP_PLANE) return NULL;
00109     return clipplanes+i;
00110   }
00111 
00113 
00114   // normals need not be normalized; it will be be normalized internally. 
00115   int set_clip_center(int i, const float *);
00116   int set_clip_normal(int i, const float *);
00117   int set_clip_color(int i, const float *);
00118   int set_clip_status(int i, int);
00119   int get_clip_status(int i, int &);
00121 
00122   struct VMDLinkIter {
00123     char *ptr;    // pointer to current place in memory pool
00124     int ncmds;    // commands remaining in the list
00125   };
00126 
00128   void first(VMDLinkIter *it) const {
00129     it->ptr = pool;
00130     it->ncmds = listsize;
00131   }
00132 
00134   int next(VMDLinkIter *it, char *&d) const {
00135     if (!(it->ncmds--)) return -1; // corresponds to DLASTCOMMAND
00136     CommandHeader *header = (CommandHeader *)(it->ptr);
00137     int code = header->code;
00138     long size = header->size;
00139     d = it->ptr + sizeof(CommandHeader);
00140     it->ptr += size;
00141     return code;
00142   }
00143 
00144 private:
00145   // number of commands in the display list
00146   int listsize; 
00147 
00148   // size of memory pool
00149   unsigned long poolsize;
00150 
00151   // amount of memory pool consumed by the current display list
00152   unsigned long poolused;
00153 
00154   // our memory pool
00155   char *pool;
00156 };    
00157 
00158 #endif

Generated on Wed Oct 9 02:43:44 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002