VTK
vtkOpenGLCellToVTKCellMap.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkOpenGLCellToVTKCellMap.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
24 #ifndef vtkOpenGLCellToVTKCellMap_h
25 #define vtkOpenGLCellToVTKCellMap_h
26 
27 #include "vtkRenderingOpenGL2Module.h" // For export macro
28 #include "vtkObject.h"
29 #include "vtkStateStorage.h" // used for ivars
30 #include "vtkNew.h" // for ivars
31 
32 class vtkCellArray;
33 class vtkPoints;
34 
35 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLCellToVTKCellMap : public vtkObject
36 {
37 public:
40  void PrintSelf(ostream& os, vtkIndent indent) override;
41 
42  // Create supporting arrays that are needed when rendering cell data
43  // Some VTK cells have to be broken into smaller cells for OpenGL
44  // When we have cell data we have to map cell attributes from the VTK
45  // cell number to the actual OpenGL cell
46  //
47  // The same concept applies to cell based picking
48  //
49  void BuildCellSupportArrays(
50  vtkCellArray *[4],
51  int representation,
52  vtkPoints *points);
53 
54  void BuildPrimitiveOffsetsIfNeeded(
55  vtkCellArray *[4],
56  int representation,
58  );
59 
60  vtkIdType ConvertOpenGLCellIdToVTKCellId(
61  bool pointPicking,
62  vtkIdType openGLId
63  );
64 
65  // rebuilds if needed
66  void Update(
67  vtkCellArray **prims, int representation,
68  vtkPoints *points);
69 
70  size_t GetSize() { return this->CellCellMap.size(); }
71 
73  return this->PrimitiveOffsets;
74  }
75 
76  vtkIdType GetValue(size_t i) { return this->CellCellMap[i]; }
77 
78  // what offset should verts start at
79  void SetStartOffset(vtkIdType start);
80 
82  return this->PrimitiveOffsets[3] + this->CellMapSizes[3];
83  }
84 
85 protected:
87  ~vtkOpenGLCellToVTKCellMap() override;
88 
89  std::vector<vtkIdType> CellCellMap;
90  vtkIdType CellMapSizes[4];
91  vtkIdType PrimitiveOffsets[4];
93  int StartOffset = 0;
96 
97 private:
99  void operator=(const vtkOpenGLCellToVTKCellMap&) = delete;
100 };
101 
102 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:59
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:349
std::vector< vtkIdType > CellCellMap
a simple class to control print indentation
Definition: vtkIndent.h:39
object to represent cell connectivity
Definition: vtkCellArray.h:50
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:39