VTK
dox/VolumeRendering/vtkOpenGLProjectedAAHexahedraMapper.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkOpenGLProjectedAAHexahedraMapper.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00031 #ifndef __vtkOpenGLProjectedAAHexahedraMapper_h
00032 #define __vtkOpenGLProjectedAAHexahedraMapper_h
00033 
00034 #include "vtkProjectedAAHexahedraMapper.h"
00035 
00036 class vtkFloatArray;
00037 class vtkPoints;
00038 class vtkUnsignedCharArray;
00039 class vtkVisibilitySort;
00040 class vtkVolumeProperty;
00041 class vtkRenderWindow;
00042 class vtkShaderProgram2;
00043 
00044 class VTK_VOLUMERENDERING_EXPORT vtkOpenGLProjectedAAHexahedraMapper : public vtkProjectedAAHexahedraMapper
00045 {
00046 public:
00047   vtkTypeMacro(vtkOpenGLProjectedAAHexahedraMapper,
00048                vtkProjectedAAHexahedraMapper);
00049   static vtkOpenGLProjectedAAHexahedraMapper *New();
00050   virtual void PrintSelf(ostream &os, vtkIndent indent);
00051 
00054   bool IsRenderSupported(vtkRenderWindow *w);
00055 
00056   void Render(vtkRenderer *renderer, vtkVolume *volume);
00057 
00058   void ReleaseGraphicsResources(vtkWindow *window);
00059 
00060 protected:
00061   vtkOpenGLProjectedAAHexahedraMapper();
00062   ~vtkOpenGLProjectedAAHexahedraMapper();
00063 
00065   float* ConvertScalars(vtkDataArray* inScalars);
00066 
00068   float* ConvertPoints(vtkPoints* inPoints);
00069 
00071   virtual void ProjectHexahedra(vtkRenderer *renderer, vtkVolume *volume);
00072 
00074   void Initialize(vtkRenderer *renderer, vtkVolume *volume);
00075 
00078   void UpdatePreintegrationTexture(vtkVolume *vome, vtkDataArray *scalars);
00079 
00082   void CreateProgram(vtkRenderWindow *w);
00083 
00085   void SetState(double* observer);
00086 
00088   void RenderHexahedron(float min[3], float max[3], float scalars[8]);
00089 
00091   void UnsetState();
00092 
00093 
00094   bool              Initialized;
00095 
00096   int UsingCellColors;
00097 
00098   float MaxCellSize;
00099   vtkTimeStamp InputAnalyzedTime;
00100   vtkTimeStamp PreintTextureTime;
00101   vtkTimeStamp ColorsMappedTime;
00102 
00103   unsigned int PreintTexture;
00104 
00105   // OpenGL arrays for primitive submission
00106   float* pos_points;
00107   float* min_points;
00108   float* node_data1;
00109   float* node_data2;
00110 
00111   // number of pending points
00112   int num_points;
00113   static const int max_points = 4096;
00114 
00115   // our shader
00116   vtkShaderProgram2 *Shader;
00117 
00118   int GaveError;
00119 
00120   float ScalarScale, ScalarShift, ScalarResolution;
00121   float LengthScale;
00122 
00123   vtkVolumeProperty *LastProperty;
00124 
00125   vtkFloatArray *ConvertedPoints;
00126   vtkFloatArray *ConvertedScalars;
00127 
00128 private:
00129   vtkOpenGLProjectedAAHexahedraMapper(const vtkOpenGLProjectedAAHexahedraMapper &);  // Not Implemented.
00130   void operator=(const vtkOpenGLProjectedAAHexahedraMapper &);  // Not Implemented.
00131 };
00132 
00133 #endif