/usr/include/vtk-5.8/vtkVolumeTextureMapper3D.h is in libvtk5-dev 5.8.0-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | /*=========================================================================
Program: Visualization Toolkit
Module: vtkVolumeTextureMapper3D.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkVolumeTextureMapper3D - volume render with 3D texture mapping
// .SECTION Description
// vtkVolumeTextureMapper3D renders a volume using 3D texture mapping.
// This class is actually an abstract superclass - with all the actual
// work done by vtkOpenGLVolumeTextureMapper3D.
//
// This mappers currently supports:
//
// - any data type as input
// - one component, or two or four non-independent components
// - composite blending
// - intermixed opaque geometry
// - multiple volumes can be rendered if they can
// be sorted into back-to-front order (use the vtkFrustumCoverageCuller)
//
// This mapper does not support:
// - more than one independent component
// - maximum intensity projection
//
// Internally, this mapper will potentially change the resolution of the
// input data. The data will be resampled to be a power of two in each
// direction, and also no greater than 128*256*256 voxels (any aspect)
// for one or two component data, or 128*128*256 voxels (any aspect)
// for four component data. The limits are currently hardcoded after
// a check using the GL_PROXY_TEXTURE3D because some graphics drivers
// were always responding "yes" to the proxy call despite not being
// able to allocate that much texture memory.
//
// Currently, calculations are computed using 8 bits per RGBA channel.
// In the future this should be expanded to handle newer boards that
// can support 15 bit float compositing.
//
// This mapper supports two main families of graphics hardware:
// nvidia and ATI. There are two different implementations of
// 3D texture mapping used - one based on nvidia's GL_NV_texture_shader2
// and GL_NV_register_combiners2 extension, and one based on
// ATI's GL_ATI_fragment_shader (supported also by some nvidia boards)
// To use this class in an application that will run on various
// hardware configurations, you should have a back-up volume rendering
// method. You should create a vtkVolumeTextureMapper3D, assign its
// input, make sure you have a current OpenGL context (you've rendered
// at least once), then call IsRenderSupported with a vtkVolumeProperty
// as an argument. This method will return 0 if the input has more than
// one independent component, or if the graphics hardware does not
// support the set of required extensions for using at least one of
// the two implemented methods (nvidia or ati)
//
// .SECTION Thanks
// Thanks to Alexandre Gouaillard at the Megason Lab, Department of Systems
// Biology, Harvard Medical School
// https://wiki.med.harvard.edu/SysBio/Megason/
// for the idea and initial patch to speed-up rendering with compressed
// textures.
//
// .SECTION see also
// vtkVolumeMapper
#ifndef __vtkVolumeTextureMapper3D_h
#define __vtkVolumeTextureMapper3D_h
#include "vtkVolumeMapper.h"
class vtkImageData;
class vtkColorTransferFunction;
class vtkPiecewiseFunction;
class vtkVolumeProperty;
class VTK_VOLUMERENDERING_EXPORT vtkVolumeTextureMapper3D : public vtkVolumeMapper
{
public:
vtkTypeMacro(vtkVolumeTextureMapper3D,vtkVolumeMapper);
void PrintSelf(ostream& os, vtkIndent indent);
static vtkVolumeTextureMapper3D *New();
// Description:
// The distance at which to space sampling planes. This
// may not be honored for interactive renders. An interactive
// render is defined as one that has less than 1 second of
// allocated render time.
vtkSetMacro( SampleDistance, float );
vtkGetMacro( SampleDistance, float );
// Description:
// These are the dimensions of the 3D texture
vtkGetVectorMacro( VolumeDimensions, int, 3 );
// Description:
// This is the spacing of the 3D texture
vtkGetVectorMacro( VolumeSpacing, float, 3 );
// Description:
// Based on hardware and properties, we may or may not be able to
// render using 3D texture mapping. This indicates if 3D texture
// mapping is supported by the hardware, and if the other extensions
// necessary to support the specific properties are available.
virtual int IsRenderSupported( vtkVolumeProperty *,
vtkRenderer *vtkNotUsed(r))
{return 0;}
// Description:
// Allow access to the number of polygons used for the
// rendering.
vtkGetMacro( NumberOfPolygons, int );
// Description:
// Allow access to the actual sample distance used to render
// the image.
vtkGetMacro( ActualSampleDistance, float );
//BTX
// Description:
// WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE
// DO NOT USE THIS METHOD OUTSIDE OF THE RENDERING PROCESS
// Render the volume
virtual void Render(vtkRenderer *, vtkVolume *) {};
// Description:
// What rendering method is supported?
enum
{
FRAGMENT_PROGRAM_METHOD=0,
NVIDIA_METHOD=1,
ATI_METHOD=2,
NO_METHOD=3
};
//ETX
// Description:
// Set the preferred render method. If it is supported, this
// one will be used. Don't allow ATI_METHOD - it is not actually
// supported.
vtkSetClampMacro( PreferredRenderMethod, int,
vtkVolumeTextureMapper3D::FRAGMENT_PROGRAM_METHOD,
vtkVolumeTextureMapper3D::NVIDIA_METHOD );
void SetPreferredMethodToFragmentProgram()
{ this->SetPreferredRenderMethod( vtkVolumeTextureMapper3D::FRAGMENT_PROGRAM_METHOD ); }
void SetPreferredMethodToNVidia()
{ this->SetPreferredRenderMethod( vtkVolumeTextureMapper3D::NVIDIA_METHOD ); }
vtkGetMacro(PreferredRenderMethod, int);
// Description:
// Set/Get if the mapper use compressed textures (if supported by the
// hardware). Initial value is false.
// There are two reasons to use compressed textures: 1. rendering can be 4
// times faster. 2. It saves some VRAM.
// There is one reason to not use compressed textures: quality may be lower
// than with uncompressed textures.
vtkSetMacro(UseCompressedTexture,bool);
vtkGetMacro(UseCompressedTexture,bool);
protected:
vtkVolumeTextureMapper3D();
~vtkVolumeTextureMapper3D();
float *PolygonBuffer;
float *IntersectionBuffer;
int NumberOfPolygons;
int BufferSize;
unsigned char *Volume1;
unsigned char *Volume2;
unsigned char *Volume3;
int VolumeSize;
int VolumeComponents;
int VolumeDimensions[3];
float VolumeSpacing[3];
float SampleDistance;
float ActualSampleDistance;
vtkImageData *SavedTextureInput;
vtkImageData *SavedParametersInput;
vtkColorTransferFunction *SavedRGBFunction;
vtkPiecewiseFunction *SavedGrayFunction;
vtkPiecewiseFunction *SavedScalarOpacityFunction;
vtkPiecewiseFunction *SavedGradientOpacityFunction;
int SavedColorChannels;
float SavedSampleDistance;
float SavedScalarOpacityDistance;
unsigned char ColorLookup[65536*4];
unsigned char AlphaLookup[65536];
float TempArray1[3*4096];
float TempArray2[4096];
int ColorTableSize;
float ColorTableScale;
float ColorTableOffset;
unsigned char DiffuseLookup[65536*4];
unsigned char SpecularLookup[65536*4];
vtkTimeStamp SavedTextureMTime;
vtkTimeStamp SavedParametersMTime;
int RenderMethod;
int PreferredRenderMethod;
bool UseCompressedTexture;
bool SupportsNonPowerOfTwoTextures;
// Description:
// For the given viewing direction, compute the set of polygons.
void ComputePolygons( vtkRenderer *ren, vtkVolume *vol, double bounds[6] );
// Description:
// Update the internal RGBA representation of the volume. Return 1 if
// anything change, 0 if nothing changed.
int UpdateVolumes( vtkVolume * );
int UpdateColorLookup( vtkVolume * );
// Description:
// Impemented in subclass - check is texture size is OK.
//BTX
virtual int IsTextureSizeSupported(int vtkNotUsed(size)[3],
int vtkNotUsed(components))
{
return 0;
}
//ETX
private:
vtkVolumeTextureMapper3D(const vtkVolumeTextureMapper3D&); // Not implemented.
void operator=(const vtkVolumeTextureMapper3D&); // Not implemented.
};
#endif
|