VTK  9.3.20240329
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
55 
56  vtkIdType GetFinalOffset() { return this->PrimitiveOffsets[3] + this->CellMapSizes[3]; }
57 
58 protected:
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
object to represent cell connectivity
Definition: vtkCellArray.h:286
a simple class to control print indentation
Definition: vtkIndent.h:108
abstract base class for most VTK objects
Definition: vtkObject.h:162
OpenGL rendering utility functions.
void BuildPrimitiveOffsetsIfNeeded(vtkCellArray *[4], int representation, vtkPoints *points)
void Update(vtkCellArray **prims, int representation, vtkPoints *points)
void SetStartOffset(vtkIdType start)
static vtkOpenGLCellToVTKCellMap * New()
std::vector< vtkIdType > CellCellMap
~vtkOpenGLCellToVTKCellMap() override
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkIdType ConvertOpenGLCellIdToVTKCellId(bool pointPicking, vtkIdType openGLId)
void BuildCellSupportArrays(vtkCellArray *[4], int representation, vtkPoints *points)
represent and manipulate 3D points
Definition: vtkPoints.h:139
Class to make storing and comparing state quick and easy.
@ points
Definition: vtkX3D.h:446
int vtkIdType
Definition: vtkType.h:315