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

DrawMolItemQuickSurf.C

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 /***************************************************************************
00010  * RCS INFORMATION:
00011  *
00012  *      $RCSfile: DrawMolItemQuickSurf.C,v $
00013  *      $Author: johns $        $Locker:  $             $State: Exp $
00014  *      $Revision: 1.26 $       $Date: 2021/10/25 18:12:11 $
00015  *
00016  ***************************************************************************
00017  * DESCRIPTION:
00018  *   A continuation of rendering types from DrawMolItem
00019  *
00020  *   This file only contains code for fast gaussian surface representations 
00021  ***************************************************************************/
00022 #include <math.h>
00023 #include <stdlib.h>
00024 #include <stdio.h>
00025 
00026 #include "DrawMolItem.h"
00027 #include "BaseMolecule.h" // need volume data definitions
00028 #include "Inform.h"
00029 #include "Isosurface.h"
00030 #include "MoleculeList.h"
00031 #include "Scene.h"
00032 #include "VolumetricData.h"
00033 #include "VMDApp.h"
00034 #include "utilities.h"
00035 #include "WKFUtils.h" // timers
00036 #include "Measure.h"
00037 
00038 #define MYSGN(a) (((a) > 0) ? 1 : -1)
00039 
00040 void DrawMolItem::draw_quicksurf(float *pos, int quality, float radscale, float isovalue, float gridspacing) {
00041   const int *colidx = NULL;
00042   const float *cmap = NULL;
00043 
00044   if (atomSel->selected < 1)
00045     return;
00046 
00047   if (!mol->numframes() || gridspacing <= 0.0f)
00048     return; 
00049 
00050 #if 0
00051   // XXX this needs to be fixed so that things like the
00052   //     draw multiple frames feature will work correctly 
00053   int frame = mol->frame(); // draw currently active frame
00054   const Timestep *ts = mol->get_frame(frame);
00055 #endif
00056   const float *radii = mol->radius();
00057 
00058   int usecolor = draw_volume_get_colorid();
00059 
00060   // Use the active per-atom color map to generate a volumetric 
00061   // texture during the calculation of the density map
00062   if ((atomColor->method() != AtomColor::COLORID) &&
00063       (atomColor->method() != AtomColor::MOLECULE)) {
00064     colidx = atomColor->color;
00065     cmap = scene->color_value(0); // get start of color map
00066   } else {
00067     cmap = scene->color_value(usecolor); // active color 
00068   }
00069 
00070   // Set color, material, and add the rep comment token
00071   sprintf(commentBuffer, "Mol[%d] Rep[%d] QuickSurf", mol->id(), repNumber);
00072   cmdCommentX.putdata(commentBuffer, cmdList);
00073   append(DMATERIALON); // enable lighting and shading
00074   cmdColorIndex.putdata(usecolor, cmdList);
00075 
00076   // Extract the surface from a density map computed from atom positions/radii
00077   mol->app->qsurf->calc_surf(atomSel, mol, pos, radii, quality, radscale, 
00078                              gridspacing, isovalue, colidx, cmap, cmdList);
00079 }
00080 

Generated on Sat Apr 20 02:42:42 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002