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

VolumeTexture.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: VolumeTexture.h,v $
00013  *      $Author: johns $        $Locker:  $             $State: Exp $
00014  *      $Revision: 1.5 $      $Date: 2010/12/16 04:08:50 $
00015  *
00016  ***************************************************************************
00017  * DESCRIPTION:
00018  *   Class for managing volumetric texture maps for use by the various
00019  *   DrawMolItem representation methods.
00020  ***************************************************************************/
00021 
00022 #ifndef VOLUME_TEXTURE_H_
00023 #define VOLUME_TEXTURE_H_
00024 
00025 class VolumetricData;
00026 class Scene;
00027 
00028 class VolumeTexture {
00029 public:
00030   // constructor - initialize values, no memory allocation.
00031   VolumeTexture();
00032   // Destructor
00033   ~VolumeTexture();
00034   
00035   // Assign reference to grid data.  Caller must ensure that the
00036   // lifetime of the volumetric data is at least as long as the VolumeTexture
00037   // instance; for VMD this should be fine since we currently never delete
00038   // VolumetricData instances.  This invalidates any previously generated
00039   // texture maps.
00040   void setGridData(const VolumetricData *);
00041 
00042   //
00043   // routines to generate texture maps from the grid data.
00044   //
00045   
00047   void generatePosTexture();
00048 
00050   void generateIndexTexture();
00051 
00052   // a charge-oriented texturing method
00053   void generateChargeTexture(float datamin, float datamax);
00054 
00055   // HSV color ramp
00056   void generateHSVTexture(float datamin, float datamax);
00057 
00058   // VMD color scale color ramp
00059   void generateColorScaleTexture(float datamin, float datamax, const Scene *);
00060 
00061   void generateContourLineTexture(float densityperline, float linewidth);
00062 
00063   // Get an ID for the current texture; this gets incremented whenever the
00064   // texture changes.
00065   unsigned long getTextureID() const { return texid; }
00066 
00067   // Get the size of the current texture along x/y/z axes.
00068   const int *getTextureSize() const { return size; }
00069 
00070   // Return a pointer to the texture map.  This data is allocated using
00071   // vmd_alloc and will exist for the lifetime of the VolumeTexture instance.
00072   unsigned char *getTextureMap() const { return texmap; }
00073 
00074   // Calculate texgen plane equations for the current texture.
00075   void calculateTexgenPlanes(float v0[4], float v1[4], float v2[4], float v3[4]) const;
00076 
00077 private:
00078   const VolumetricData *v;
00079   unsigned char *texmap;
00080   int size[3];
00081   unsigned long texid;
00082 
00083   // copy and operator= disallowed
00084   VolumeTexture(const VolumeTexture &) {}
00085   VolumeTexture &operator=(const VolumeTexture &) { return *this; }
00086 
00087   // allocate texture memory for n pixels (3n bytes), and update texid.  
00088   // Return success.
00089   int allocateTextureMap(int npixels);
00090 };
00091 
00092 #endif
00093 

Generated on Sat May 26 01:48:39 2012 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002