VTK  9.3.1
vtkContext3D.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
3 
15 #ifndef vtkContext3D_h
16 #define vtkContext3D_h
17 
18 #include "vtkObject.h"
19 #include "vtkRenderingContext2DModule.h" // For export macro
20 #include "vtkSmartPointer.h" // For SP ivars.
21 #include "vtkVector.h" // For the vector coordinates.
22 
23 #include <cstdint> // For std::uintptr_t
24 
25 VTK_ABI_NAMESPACE_BEGIN
26 class vtkContextDevice3D;
27 class vtkPen;
28 class vtkDataArray;
29 class vtkBrush;
30 class vtkTransform;
32 
33 class VTKRENDERINGCONTEXT2D_EXPORT vtkContext3D : public vtkObject
34 {
35 public:
36  vtkTypeMacro(vtkContext3D, vtkObject);
37  void PrintSelf(ostream& os, vtkIndent indent) override;
38 
42  static vtkContext3D* New();
43 
49  bool Begin(vtkContextDevice3D* device);
50 
54  vtkContextDevice3D* GetDevice();
55 
61  bool End();
62 
66  void DrawLine(const vtkVector3f& start, const vtkVector3f& end);
67 
71  void DrawPoly(const float* points, int n);
72 
76  void DrawPoint(const vtkVector3f& point);
77 
81  void DrawPoints(const float* points, int n);
82 
88  void DrawPoints(const float* points, int n, unsigned char* colors, int nc_comps);
89  void DrawPoints(
90  vtkDataArray* positions, vtkUnsignedCharArray* colors, std::uintptr_t cacheIdentifier);
91 
95  void DrawTriangleMesh(const float* mesh, int n, const unsigned char* colors, int nc);
96  void DrawTriangleMesh(
97  vtkDataArray* positions, vtkUnsignedCharArray* colors, std::uintptr_t cacheIdentifier);
98 
104  void ApplyPen(vtkPen* pen);
105 
111  void ApplyBrush(vtkBrush* brush);
112 
118  void SetTransform(vtkTransform* transform);
119 
123  vtkTransform* GetTransform();
124 
131  void AppendTransform(vtkTransform* transform);
132 
134 
138  void PushMatrix();
139  void PopMatrix();
141 
143 
150  void EnableClippingPlane(int i, double* planeEquation);
151  void DisableClippingPlane(int i);
153 
154 protected:
155  vtkContext3D();
156  ~vtkContext3D() override;
157 
158  vtkSmartPointer<vtkContextDevice3D> Device; // The underlying device
160 
161 private:
162  vtkContext3D(const vtkContext3D&) = delete;
163  void operator=(const vtkContext3D&) = delete;
164 };
165 
166 VTK_ABI_NAMESPACE_END
167 #endif // VTKCONTEXT3D_H
abstract base class for most VTK objects
Definition: vtkObject.h:51
Abstract class for drawing 3D primitives.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:49
vtkSmartPointer< vtkTransform > Transform
Definition: vtkContext3D.h:159
provides a brush that fills shapes drawn by vtkContext2D.
Definition: vtkBrush.h:29
a simple class to control print indentation
Definition: vtkIndent.h:28
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
provides a pen that draws the outlines of shapes drawn by vtkContext2D.
Definition: vtkPen.h:28
dynamic, self-adjusting array of unsigned char
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
vtkSmartPointer< vtkContextDevice3D > Device
Definition: vtkContext3D.h:158
Class for drawing 3D primitives to a graphical context.
Definition: vtkContext3D.h:33