Version: 9.16.0
VTKViewer_PolyDataMapper.h
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, OPEN CASCADE
2//
3// This library is free software; you can redistribute it and/or
4// modify it under the terms of the GNU Lesser General Public
5// License as published by the Free Software Foundation; either
6// version 2.1 of the License, or (at your option) any later version.
7//
8// This library is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11// Lesser General Public License for more details.
12//
13// You should have received a copy of the GNU Lesser General Public
14// License along with this library; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#ifndef VTKViewer_POLYDATAMAPPER_H
21#define VTKViewer_POLYDATAMAPPER_H
22
23#include "VTKViewer.h"
24#include "VTKViewer_MarkerDef.h"
25
26#ifdef WIN32
27#include <windows.h>
28#endif
29
30#include <map>
31
32#ifdef __APPLE__
33#include <OpenGL/gl.h>
34#else
35#include <GL/gl.h>
36#endif
37
38#include <vtkSmartPointer.h>
39
40class vtkImageData;
41
42#ifndef VTK_IMPLEMENT_MESA_CXX
43#include <vtkOpenGLPolyDataMapper.h>
44#define MAPPER_SUPERCLASS vtkOpenGLPolyDataMapper
45#else
46#include <vtkMesaPolyDataMapper.h>
47#define MAPPER_SUPERCLASS vtkMesaPolyDataMapper
48#endif
49
51
52//----------------------------------------------------------------------------
54
63{
64public:
65 enum ExtensionsState { ES_None = 0, ES_Error, ES_Ok };
66
67public:
70
71
72 void SetMarkerEnabled( bool );
73
75 void SetBallEnabled( bool );
76
77 bool GetBallEnabled( );
78
80 void SetBallScale( double );
81
82 double GetBallScale( );
83
85 void SetMarkerStd( VTK::MarkerType, VTK::MarkerScale );
86
88 void SetMarkerTexture( int, VTK::MarkerTexture );
89
91 VTK::MarkerType GetMarkerType();
92
94 VTK::MarkerScale GetMarkerScale();
95
97 int GetMarkerTexture();
98
100 virtual void RenderPiece( vtkRenderer*, vtkActor* );
102#ifndef VTK_OPENGL2
103 virtual int Draw( vtkRenderer*, vtkActor* );
104#else
105 virtual void RenderPieceDraw( vtkRenderer*, vtkActor* );
106#endif
107
108protected:
111
113 int InitExtensions();
114
116 void InitPointSprites();
117
119 void CleanupPointSprites();
120
122 void InitTextures();
123
125 int InitShader();
126
127 void InternalDraw(vtkRenderer*, vtkActor*);
128
129private:
131
133
134 vtkSmartPointer<vtkImageData> ImageData;
135
138#ifdef VTK_OPENGL2
139 GLhandleARB VertexShader;
140 GLhandleARB FragmentShader;
141 GLuint VertexArrayObject;
142#endif
143
144 struct Locations {
145 static const GLint INVALID_LOCATION = -1;
146
151
153 : ModelViewProjection (INVALID_LOCATION),
154 Projection (INVALID_LOCATION),
155 GeneralPointSize (INVALID_LOCATION),
156 PointSprite (INVALID_LOCATION)
157 {
158 //
159 }
160 } myLocations;
161
164 double BallScale;
168
169 typedef std::map< int, vtkSmartPointer<vtkImageData> > ImageDataMap;
172 ImageDataMap SpecialTextures; //special predefined textures, used to draw point sprites.
173};
174
175#endif
#define VTKVIEWER_EXPORT
Definition: VTKViewer.h:33
GLuint GLhandleARB
Definition: VTKViewer_OpenGLHelper.h:35
#define MAPPER_SUPERCLASS
Definition: VTKViewer_PolyDataMapper.h:44
Definition: VTKViewer_OpenGLHelper.h:106
OpenGL Point Sprites PolyData Mapper.
Definition: VTKViewer_PolyDataMapper.h:63
vtkTypeMacro(VTKViewer_PolyDataMapper, vtkOpenGLPolyDataMapper) void SetMarkerEnabled(bool)
Set point marker enabled.
GLhandleARB PointProgram
Definition: VTKViewer_PolyDataMapper.h:137
int ExtensionsInitialized
Definition: VTKViewer_PolyDataMapper.h:130
int MarkerId
Definition: VTKViewer_PolyDataMapper.h:167
ExtensionsState
Definition: VTKViewer_PolyDataMapper.h:65
@ ES_Error
Definition: VTKViewer_PolyDataMapper.h:65
std::map< int, vtkSmartPointer< vtkImageData > > ImageDataMap
Definition: VTKViewer_PolyDataMapper.h:169
VTK::MarkerScale MarkerScale
Definition: VTKViewer_PolyDataMapper.h:166
bool MarkerEnabled
Definition: VTKViewer_PolyDataMapper.h:162
static VTKViewer_PolyDataMapper * New()
ImageDataMap SpecialTextures
Definition: VTKViewer_PolyDataMapper.h:172
double BallScale
Definition: VTKViewer_PolyDataMapper.h:164
bool BallEnabled
Definition: VTKViewer_PolyDataMapper.h:163
vtkSmartPointer< vtkImageData > ImageData
Definition: VTKViewer_PolyDataMapper.h:134
ImageDataMap CustomTextures
Definition: VTKViewer_PolyDataMapper.h:171
ImageDataMap StandardTextures
Definition: VTKViewer_PolyDataMapper.h:170
VTKViewer_OpenGLHelper OpenGLHelper
Definition: VTKViewer_PolyDataMapper.h:136
VTK::MarkerType MarkerType
Definition: VTKViewer_PolyDataMapper.h:165
GLuint PointSpriteTexture
Definition: VTKViewer_PolyDataMapper.h:132
std::list< unsigned short > MarkerTexture
Definition: VTKViewer_MarkerDef.h:60
Definition: VTKViewer_PolyDataMapper.h:144
GLint Projection
Definition: VTKViewer_PolyDataMapper.h:148
Locations()
Definition: VTKViewer_PolyDataMapper.h:152
GLint ModelViewProjection
Definition: VTKViewer_PolyDataMapper.h:147
GLint PointSprite
Definition: VTKViewer_PolyDataMapper.h:150
GLint GeneralPointSize
Definition: VTKViewer_PolyDataMapper.h:149