VTK
vtkCompositePolyDataMapper2Internal.h
Go to the documentation of this file.
1 // this class encapsulates values tied to a
2 // polydata
4 {
5 public:
7  unsigned int FlatIndex;
8  double Opacity;
9  bool IsOpaque;
10  bool Visibility;
15 
16  bool Marked;
17 
18  unsigned int StartVertex;
19  unsigned int NextVertex;
20 
21  // point line poly strip edge stripedge
24 
25  // stores the mapping from vtk cells to gl_PrimitiveId
27 };
28 
29 //===================================================================
30 // We define a helper class that is a subclass of vtkOpenGLPolyDataMapper
31 class VTKRENDERINGOPENGL2_EXPORT vtkCompositeMapperHelper2 : public vtkOpenGLPolyDataMapper
32 {
33 public:
36 
37  void SetParent(vtkCompositePolyDataMapper2* p) { this->Parent = p; }
38 
39  vtkCompositeMapperHelperData* AddData(vtkPolyData* pd, unsigned int flatIndex);
40 
41  // Description:
42  // Implemented by sub classes. Actual rendering is done here.
43  void RenderPiece(vtkRenderer* ren, vtkActor* act) override;
44 
45  // keep track of what data is being used as the multiblock
46  // can change
47  void ClearMark();
48  void RemoveUnused();
49  bool GetMarked() { return this->Marked; }
50  void SetMarked(bool v) { this->Marked = v; }
51 
55  std::vector<vtkPolyData*> GetRenderedList() { return this->RenderedList; }
56 
62  vtkHardwareSelector* sel, std::vector<unsigned int>& pixeloffsets, vtkProp* prop) override;
63 
64  virtual void ProcessCompositePixelBuffers(vtkHardwareSelector* sel, vtkProp* prop,
65  vtkCompositeMapperHelperData* hdata, std::vector<unsigned int>& mypixels);
66 
67 protected:
69  std::map<vtkPolyData*, vtkCompositeMapperHelperData*> Data;
70 
71  bool Marked;
72 
73  vtkCompositeMapperHelper2() { this->Parent = nullptr; };
74  ~vtkCompositeMapperHelper2() override;
75 
76  void DrawIBO(vtkRenderer* ren, vtkActor* actor, int primType, vtkOpenGLHelper& CellBO,
77  GLenum mode, int pointSize);
78 
79  virtual void SetShaderValues(
80  vtkShaderProgram* prog, vtkCompositeMapperHelperData* hdata, size_t primOffset);
81 
86  virtual void UpdateShaders(vtkOpenGLHelper& cellBO, vtkRenderer* ren, vtkActor* act) override;
87 
88  // Description:
89  // Perform string replacements on the shader templates, called from
90  // ReplaceShaderValues
91  void ReplaceShaderColor(
92  std::map<vtkShader::Type, vtkShader*> shaders, vtkRenderer* ren, vtkActor* act) override;
93 
94  // Description:
95  // Build the VBO/IBO, called by UpdateBufferObjects
96  void BuildBufferObjects(vtkRenderer* ren, vtkActor* act) override;
97  virtual void AppendOneBufferObject(vtkRenderer* ren, vtkActor* act,
98  vtkCompositeMapperHelperData* hdata, vtkIdType& flat_index, std::vector<unsigned char>& colors,
99  std::vector<float>& norms);
100 
101  // Description:
102  // Returns if we can use texture maps for scalar coloring. Note this doesn't
103  // say we "will" use scalar coloring. It says, if we do use scalar coloring,
104  // we will use a texture. Always off for this mapper.
106 
107  std::vector<unsigned int> VertexOffsets;
108 
109  // vert line poly strip edge stripedge
110  std::vector<unsigned int> IndexArray[PrimitiveEnd];
111 
112  void RenderPieceDraw(vtkRenderer* ren, vtkActor* act) override;
113 
116 
118 
119  // bookkeeping required by vtkValuePass
120  std::vector<vtkPolyData*> RenderedList;
121 
122  // used by the hardware selector
123  std::vector<std::vector<unsigned int> > PickPixels;
124 
125  std::map<vtkAbstractArray*, vtkDataArray*> ColorArrayMap;
126 
127 private:
129  void operator=(const vtkCompositeMapperHelper2&) = delete;
130 };
131 // VTK-HeaderTest-Exclude: vtkCompositePolyDataMapper2Internal.h
vtkOpenGLPolyDataMapper::BuildBufferObjects
virtual void BuildBufferObjects(vtkRenderer *ren, vtkActor *act)
Build the VBO/IBO, called by UpdateBufferObjects.
vtkCompositeMapperHelperData::NextVertex
unsigned int NextVertex
Definition: vtkCompositePolyDataMapper2Internal.h:19
vtkCompositeMapperHelper2::Data
std::map< vtkPolyData *, vtkCompositeMapperHelperData * > Data
Definition: vtkCompositePolyDataMapper2Internal.h:69
vtkCompositeMapperHelperData::StartVertex
unsigned int StartVertex
Definition: vtkCompositePolyDataMapper2Internal.h:18
vtkCompositeMapperHelperData::AmbientColor
vtkColor3d AmbientColor
Definition: vtkCompositePolyDataMapper2Internal.h:13
vtkCompositeMapperHelper2::SetParent
void SetParent(vtkCompositePolyDataMapper2 *p)
Definition: vtkCompositePolyDataMapper2Internal.h:37
vtkOpenGLPolyDataMapper::UpdateShaders
virtual void UpdateShaders(vtkOpenGLHelper &cellBO, vtkRenderer *ren, vtkActor *act)
Make sure appropriate shaders are defined, compiled and bound.
vtkIdType
int vtkIdType
Definition: vtkType.h:349
vtkCompositeMapperHelper2::OverideColorUsed
bool OverideColorUsed
Definition: vtkCompositePolyDataMapper2Internal.h:115
vtkCompositeMapperHelperData::FlatIndex
unsigned int FlatIndex
Definition: vtkCompositePolyDataMapper2Internal.h:7
vtkCompositeMapperHelperData::Data
vtkPolyData * Data
Definition: vtkCompositePolyDataMapper2Internal.h:6
vtkCompositeMapperHelperData::NextIndex
unsigned int NextIndex[vtkOpenGLPolyDataMapper::PrimitiveEnd]
Definition: vtkCompositePolyDataMapper2Internal.h:23
vtkOpenGLPolyDataMapper::New
static vtkOpenGLPolyDataMapper * New()
vtkOpenGLPolyDataMapper::RenderPieceDraw
virtual void RenderPieceDraw(vtkRenderer *ren, vtkActor *act)
vtkMapper::CanUseTextureMapForColoring
virtual int CanUseTextureMapForColoring(vtkDataObject *input)
Returns if we can use texture maps for scalar coloring.
vtkCompositeMapperHelper2::SetMarked
void SetMarked(bool v)
Definition: vtkCompositePolyDataMapper2Internal.h:50
vtkCompositePolyDataMapper2
mapper for composite dataset consisting of polygonal data.
Definition: vtkCompositePolyDataMapper2.h:41
vtkCompositeMapperHelperData
Definition: vtkCompositePolyDataMapper2Internal.h:3
vtkCompositeMapperHelper2::CurrentSelector
vtkHardwareSelector * CurrentSelector
Definition: vtkCompositePolyDataMapper2Internal.h:117
vtkCompositeMapperHelperData::Marked
bool Marked
Definition: vtkCompositePolyDataMapper2Internal.h:16
vtkOpenGLPolyDataMapper::PrimitiveEnd
Definition: vtkOpenGLPolyDataMapper.h:195
vtkCompositeMapperHelper2::Marked
bool Marked
Definition: vtkCompositePolyDataMapper2Internal.h:71
vtkCompositeMapperHelper2
Definition: vtkCompositePolyDataMapper2Internal.h:31
vtkCompositeMapperHelperData::DiffuseColor
vtkColor3d DiffuseColor
Definition: vtkCompositePolyDataMapper2Internal.h:14
vtkCompositeMapperHelper2::PickPixels
std::vector< std::vector< unsigned int > > PickPixels
Definition: vtkCompositePolyDataMapper2Internal.h:123
vtkShaderProgram
The ShaderProgram uses one or more Shader objects.
Definition: vtkShaderProgram.h:44
vtkHardwareSelector
Definition: vtkHardwareSelector.h:123
vtkOpenGLHelper
Definition: vtkOpenGLHelper.h:30
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
vtkCompositeMapperHelperData::CellCellMap
vtkNew< vtkOpenGLCellToVTKCellMap > CellCellMap
Definition: vtkCompositePolyDataMapper2Internal.h:26
vtkCompositeMapperHelperData::Opacity
double Opacity
Definition: vtkCompositePolyDataMapper2Internal.h:8
vtkCompositeMapperHelper2::ColorArrayMap
std::map< vtkAbstractArray *, vtkDataArray * > ColorArrayMap
Definition: vtkCompositePolyDataMapper2Internal.h:125
vtkCompositeMapperHelperData::IsOpaque
bool IsOpaque
Definition: vtkCompositePolyDataMapper2Internal.h:9
vtkNew< vtkOpenGLCellToVTKCellMap >
vtkCompositeMapperHelperData::StartIndex
unsigned int StartIndex[vtkOpenGLPolyDataMapper::PrimitiveEnd]
Definition: vtkCompositePolyDataMapper2Internal.h:22
vtkCompositeMapperHelper2::RenderedList
std::vector< vtkPolyData * > RenderedList
Definition: vtkCompositePolyDataMapper2Internal.h:120
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:47
vtkCompositeMapperHelperData::Pickability
bool Pickability
Definition: vtkCompositePolyDataMapper2Internal.h:11
vtkOpenGLPolyDataMapper::RenderPiece
void RenderPiece(vtkRenderer *ren, vtkActor *act) override
Implemented by sub classes.
vtkColor3d
Definition: vtkColor.h:246
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:58
vtkCompositeMapperHelperData::Visibility
bool Visibility
Definition: vtkCompositePolyDataMapper2Internal.h:10
vtkOpenGLPolyDataMapper::ProcessSelectorPixelBuffers
void ProcessSelectorPixelBuffers(vtkHardwareSelector *sel, std::vector< unsigned int > &pixeloffsets, vtkProp *prop) override
allows a mapper to update a selections color buffers Called from a prop which in turn is called from ...
vtkCompositeMapperHelper2::vtkCompositeMapperHelper2
vtkCompositeMapperHelper2()
Definition: vtkCompositePolyDataMapper2Internal.h:73
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
vtkCompositeMapperHelper2::VertexOffsets
std::vector< unsigned int > VertexOffsets
Definition: vtkCompositePolyDataMapper2Internal.h:107
vtkCompositeMapperHelper2::GetMarked
bool GetMarked()
Definition: vtkCompositePolyDataMapper2Internal.h:49
vtkX3D::mode
Definition: vtkX3D.h:253
vtkCompositeMapperHelper2::Parent
vtkCompositePolyDataMapper2 * Parent
Definition: vtkCompositePolyDataMapper2Internal.h:68
vtkOpenGLPolyDataMapper::ReplaceShaderColor
virtual void ReplaceShaderColor(std::map< vtkShader::Type, vtkShader * > shaders, vtkRenderer *ren, vtkActor *act)
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:58
vtkOpenGLPolyDataMapper
PolyDataMapper using OpenGL to render.
Definition: vtkOpenGLPolyDataMapper.h:51
vtkCompositeMapperHelperData::OverridesColor
bool OverridesColor
Definition: vtkCompositePolyDataMapper2Internal.h:12
vtkCompositeMapperHelper2::GetRenderedList
std::vector< vtkPolyData * > GetRenderedList()
Accessor to the ordered list of PolyData that we last drew.
Definition: vtkCompositePolyDataMapper2Internal.h:55
vtkCompositeMapperHelper2::PrimIDUsed
bool PrimIDUsed
Definition: vtkCompositePolyDataMapper2Internal.h:114