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

VolumeTexture.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 /***************************************************************************
00010 * RCS INFORMATION:
00011 *
00012 * $RCSfile: VolumeTexture.h,v $
00013 * $Author: johns $ $Locker: $ $State: Exp $
00014 * $Revision: 1.10 $ $Date: 2020年10月22日 03:43:24 $
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 #include <stddef.h>
00026 
00027 class VolumetricData;
00028 class Scene;
00029 
00030 class VolumeTexture {
00031 public:
00032 // constructor - initialize values, no memory allocation.
00033 VolumeTexture();
00034 // Destructor
00035 ~VolumeTexture();
00036 
00037 // Assign reference to grid data. Caller must ensure that the
00038 // lifetime of the volumetric data is at least as long as the VolumeTexture
00039 // instance; for VMD this should be fine since we currently never delete
00040 // VolumetricData instances. This invalidates any previously generated
00041 // texture maps.
00042 void setGridData(VolumetricData *);
00043 
00044 //
00045 // routines to generate texture maps from the grid data.
00046 //
00047 
00049 void generatePosTexture();
00050 
00052 void generateIndexTexture();
00053 
00054 // a charge-oriented texturing method
00055 void generateChargeTexture(float datamin, float datamax);
00056 
00057 // HSV color ramp
00058 void generateHSVTexture(float datamin, float datamax);
00059 
00060 // VMD color scale color ramp
00061 void generateColorScaleTexture(float datamin, float datamax, const Scene *);
00062 
00063 void generateContourLineTexture(float densityperline, float linewidth);
00064 
00065 // Get an ID for the current texture; this gets incremented whenever the
00066 // texture changes.
00067 unsigned long getTextureID() const { return texid; }
00068 
00069 // Get the size of the current texture along x/y/z axes.
00070 const int *getTextureSize() const { return size; }
00071 
00072 // Return a pointer to the texture map. This data is allocated using
00073 // vmd_alloc and will exist for the lifetime of the VolumeTexture instance.
00074 unsigned char *getTextureMap() const { return texmap; }
00075 
00076 // Calculate texgen plane equations for the current texture.
00077 void calculateTexgenPlanes(float v0[4], float v1[4], float v2[4], float v3[4]) const;
00078 
00079 private:
00080 VolumetricData *v;
00081 unsigned char *texmap;
00082 int size[3];
00083 unsigned long texid;
00084 
00085 // copy and operator= disallowed
00086 VolumeTexture(VolumeTexture &) {}
00087 VolumeTexture &operator=(VolumeTexture &) { return *this; }
00088 
00089 // compute texel count from current size[] 
00090 ptrdiff_t num_texels(void) { return ptrdiff_t(size[0])*ptrdiff_t(size[1])*ptrdiff_t(size[2]); }
00091 
00092 // allocate texture memory for n texels (3n bytes), and update texid. 
00093 // Return success.
00094 int allocateTextureMap(ptrdiff_t ntexels);
00095 };
00096 
00097 #endif
00098 

Generated on Wed Nov 19 02:47:33 2025 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002

AltStyle によって変換されたページ (->オリジナル) /