Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef VISU_OpenGLPointSpriteMapper_HeaderFile
00029 #define VISU_OpenGLPointSpriteMapper_HeaderFile
00030
00031 #if defined(_MSC_VER)
00032 # pragma warning ( disable : 4275 )
00033 #endif
00034
00035 #ifdef WIN32
00036 #include <windows.h>
00037 #endif
00038
00039 #include <GL/gl.h>
00040
00041 #include <vtkSmartPointer.h>
00042 #include <vtkConfigure.h>
00043
00044 #include "VTKViewer.h"
00045
00046 class vtkCellArray;
00047 class vtkPoints;
00048 class vtkProperty;
00049 class vtkImageData;
00050 class vtkXMLImageDataReader;
00051
00052 #ifndef VTK_IMPLEMENT_MESA_CXX
00053 #include <vtkOpenGLPolyDataMapper.h>
00054 #define MAPPER_SUPERCLASS vtkOpenGLPolyDataMapper
00055 #else
00056 #include <vtkMesaPolyDataMapper.h>
00057 #define MAPPER_SUPERCLASS vtkMesaPolyDataMapper
00058 #endif
00059
00060 #ifndef GL_ARB_shader_objects
00061 typedef GLuint GLhandleARB;
00062 #endif
00063
00064 #include "VISUPipeline.hxx"
00065
00066
00068
00076 class VISU_PIPELINE_EXPORT VISU_OpenGLPointSpriteMapper : public MAPPER_SUPERCLASS
00077 {
00078 public:
00080
00087 enum RenderModes { Accumulate = 0, Occlude };
00088
00089 enum PrimitiveTypes { PointSprite = 0, OpenGLPoint, GeomSphere };
00090
00091 static VISU_OpenGLPointSpriteMapper *New();
00092 vtkTypeRevisionMacro(VISU_OpenGLPointSpriteMapper,MAPPER_SUPERCLASS);
00093
00095
00101
00102 vtkGetMacro(DefaultPointSize, float);
00103
00105 void
00106 SetAverageCellSize(float theSize);
00107
00109 vtkGetMacro(AverageCellSize, float);
00110
00112 vtkSetMacro(RenderMode, int);
00113
00115 vtkGetMacro(RenderMode, int);
00116
00118 virtual void RenderPiece(vtkRenderer *ren, vtkActor *a);
00119
00121 void ReleaseGraphicsResources(vtkWindow *);
00122
00124 virtual int Draw(vtkRenderer *ren, vtkActor *a);
00125
00127 static float GetMaximumSupportedSize();
00128
00130
00134 vtkSetMacro(UseOpenGLMapper, bool);
00135
00137 vtkGetMacro(UseOpenGLMapper, bool);
00138
00140 vtkSetMacro(UsePointSprites, bool);
00141
00143 vtkGetMacro(UsePointSprites, bool);
00144
00146
00147 vtkSetMacro(UseTextures, bool);
00148
00150 vtkGetMacro(UseTextures, bool);
00151
00153
00154 vtkSetMacro(UseShader, bool);
00155
00157 vtkGetMacro(UseShader, bool);
00158
00160
00165 vtkGetMacro(PointSpriteMode, int);
00166 void SetPointSpriteMode( int );
00167
00169 vtkGetMacro(PrimitiveType, int);
00170
00172 void SetPrimitiveType( int );
00173
00175 void SetPointSpriteClamp( float );
00176
00178 vtkGetMacro(PointSpriteClamp, float);
00179
00181 void SetPointSpriteSize( float );
00182
00184 vtkGetMacro(PointSpriteSize, float);
00185
00187 void SetPointSpriteMinSize( float );
00188
00190 vtkGetMacro(PointSpriteMinSize, float);
00191
00193 void SetPointSpriteMaxSize( float );
00194
00196 vtkGetMacro(PointSpriteMaxSize, float);
00197
00199 void SetPointSpriteMagnification( float );
00200
00202 vtkGetMacro(PointSpriteMagnification, float);
00203
00205 void SetPointSpriteAlphaThreshold( float );
00206
00208 vtkGetMacro(PointSpriteAlphaThreshold, float);
00209
00211 vtkSetMacro(PointSpriteOpacity, float);
00212
00214 vtkGetMacro(PointSpriteOpacity, float);
00215
00217 void SetImageData(vtkImageData* theImageData);
00218
00220 vtkImageData* GetImageData();
00221
00222 protected:
00223 VISU_OpenGLPointSpriteMapper();
00224 ~VISU_OpenGLPointSpriteMapper();
00225
00227 bool InitExtensions();
00228
00230 void InitPointSprites();
00231
00233 void CleanupPointSprites();
00234
00236 void InitTextures();
00237
00239 void InitShader();
00240
00242 void SetShaderVariable( const char* variable, float value );
00243
00245 void PrintInfoLog( GLhandleARB );
00246
00247 private:
00248 bool UseOpenGLMapper;
00249
00250 bool UsePointSprites;
00251 bool UseTextures;
00252 bool UseShader;
00253
00254 int RenderMode;
00255 int ListId;
00256 vtkIdType TotalCells;
00257 int ExtensionsInitialized;
00258 float DefaultPointSize;
00259
00260 GLhandleARB VertexProgram;
00261
00262 int PrimitiveType;
00263
00264 int PointSpriteMode;
00265
00266 float PointSpriteClamp;
00267 float PointSpriteSize;
00268 float PointSpriteMinSize;
00269 float PointSpriteMaxSize;
00270 float PointSpriteMagnification;
00271
00272 GLuint PointSpriteTexture;
00273 float PointSpriteAlphaThreshold;
00274 float PointSpriteOpacity;
00275
00276 float AverageCellSize;
00277
00278 vtkSmartPointer<vtkImageData> ImageData;
00279 };
00280
00281 #endif