VTK  9.3.1
vtkOpenGLCellToVTKCellMap.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
12 #ifndef vtkOpenGLCellToVTKCellMap_h
13 #define vtkOpenGLCellToVTKCellMap_h
14 
15 #include "vtkNew.h" // for ivars
16 #include "vtkObject.h"
17 #include "vtkRenderingOpenGL2Module.h" // For export macro
18 #include "vtkStateStorage.h" // used for ivars
19 
20 VTK_ABI_NAMESPACE_BEGIN
21 class vtkCellArray;
22 class vtkPoints;
23 
24 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLCellToVTKCellMap : public vtkObject
25 {
26 public:
29  void PrintSelf(ostream& os, vtkIndent indent) override;
30 
31  // Create supporting arrays that are needed when rendering cell data
32  // Some VTK cells have to be broken into smaller cells for OpenGL
33  // When we have cell data we have to map cell attributes from the VTK
34  // cell number to the actual OpenGL cell
35  //
36  // The same concept applies to cell based picking
37  //
38  void BuildCellSupportArrays(vtkCellArray * [4], int representation, vtkPoints* points);
39 
40  void BuildPrimitiveOffsetsIfNeeded(vtkCellArray * [4], int representation, vtkPoints* points);
41 
42  vtkIdType ConvertOpenGLCellIdToVTKCellId(bool pointPicking, vtkIdType openGLId);
43 
44  // rebuilds if needed
45  void Update(vtkCellArray** prims, int representation, vtkPoints* points);
46 
47  size_t GetSize() { return this->CellCellMap.size(); }
48 
49  vtkIdType* GetPrimitiveOffsets() { return this->PrimitiveOffsets; }
50 
51  vtkIdType GetValue(size_t i) { return this->CellCellMap[i]; }
52 
53  // what offset should verts start at
54  void SetStartOffset(vtkIdType start);
55 
56  vtkIdType GetFinalOffset() { return this->PrimitiveOffsets[3] + this->CellMapSizes[3]; }
57 
58 protected:
60  ~vtkOpenGLCellToVTKCellMap() override;
61 
62  std::vector<vtkIdType> CellCellMap;
63  vtkIdType CellMapSizes[4];
64  vtkIdType PrimitiveOffsets[4];
66  int StartOffset = 0;
69 
70 private:
72  void operator=(const vtkOpenGLCellToVTKCellMap&) = delete;
73 };
74 
75 VTK_ABI_NAMESPACE_END
76 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:51
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
OpenGL rendering utility functions.
int vtkIdType
Definition: vtkType.h:315
std::vector< vtkIdType > CellCellMap
a simple class to control print indentation
Definition: vtkIndent.h:28
object to represent cell connectivity
Definition: vtkCellArray.h:175
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
Class to make storing and comparing state quick and easy.
represent and manipulate 3D points
Definition: vtkPoints.h:28