Back to index

salome-gui  6.5.0
VTKViewer_PolyDataMapper.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #ifndef VTKViewer_POLYDATAMAPPER_H
00021 #define VTKViewer_POLYDATAMAPPER_H
00022 
00023 #include "VTKViewer.h"
00024 #include "VTKViewer_MarkerDef.h"
00025 
00026 #ifdef WNT
00027 #include <windows.h>
00028 #endif
00029 
00030 #include <map>
00031 
00032 #include <GL/gl.h>
00033 
00034 #include <vtkSmartPointer.h>
00035 
00036 class vtkImageData;
00037 
00038 #ifndef VTK_IMPLEMENT_MESA_CXX
00039 #include <vtkOpenGLPolyDataMapper.h>
00040 #define MAPPER_SUPERCLASS vtkOpenGLPolyDataMapper
00041 #else
00042 #include <vtkMesaPolyDataMapper.h>
00043 #define MAPPER_SUPERCLASS vtkMesaPolyDataMapper
00044 #endif
00045 
00046 //----------------------------------------------------------------------------
00048 
00056 class VTKVIEWER_EXPORT VTKViewer_PolyDataMapper : public MAPPER_SUPERCLASS
00057 {
00058 public:
00059   enum ExtensionsState { ES_None = 0, ES_Error, ES_Ok };
00060 
00061 public:
00062   static VTKViewer_PolyDataMapper* New();
00063   vtkTypeRevisionMacro( VTKViewer_PolyDataMapper, MAPPER_SUPERCLASS );
00064 
00066   void SetMarkerEnabled( bool );
00067 
00069   void SetMarkerStd( VTK::MarkerType, VTK::MarkerScale );
00070 
00072   void SetMarkerTexture( int, VTK::MarkerTexture );
00073 
00075   VTK::MarkerType GetMarkerType();
00076 
00078   VTK::MarkerScale GetMarkerScale();
00079 
00081   int GetMarkerTexture();
00082 
00084   virtual void RenderPiece( vtkRenderer*, vtkActor* );
00085 
00087   virtual int Draw( vtkRenderer*, vtkActor* );
00088 
00089 protected:
00090   VTKViewer_PolyDataMapper();
00091   ~VTKViewer_PolyDataMapper();
00092 
00094   int               InitExtensions();
00095 
00097   void              InitPointSprites();
00098 
00100   void              CleanupPointSprites();
00101 
00103   void              InitTextures();
00104 
00105 private:
00106   int               ExtensionsInitialized;
00107 
00108   GLuint            PointSpriteTexture;
00109 
00110   vtkSmartPointer<vtkImageData> ImageData;
00111 
00112   bool              MarkerEnabled;
00113   VTK::MarkerType   MarkerType;
00114   VTK::MarkerScale  MarkerScale;
00115   int               MarkerId;
00116 
00117   typedef std::map< int, vtkSmartPointer<vtkImageData> > ImageDataMap;
00118   ImageDataMap      StandardTextures;
00119   ImageDataMap      CustomTextures;
00120 };
00121 
00122 #endif