VTK  9.3.0
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 
24 #ifndef vtkContext3D_h
25 #define vtkContext3D_h
26 
27 #include "vtkObject.h"
28 #include "vtkRenderingContext2DModule.h" // For export macro
29 #include "vtkSmartPointer.h" // For SP ivars.
30 #include "vtkVector.h" // For the vector coordinates.
31 
32 #include <cstdint> // For std::uintptr_t
33 
34 VTK_ABI_NAMESPACE_BEGIN
35 class vtkContextDevice3D;
36 class vtkPen;
37 class vtkDataArray;
38 class vtkBrush;
39 class vtkTransform;
41 
42 class VTKRENDERINGCONTEXT2D_EXPORT vtkContext3D : public vtkObject
43 {
44 public:
45  vtkTypeMacro(vtkContext3D, vtkObject);
46  void PrintSelf(ostream& os, vtkIndent indent) override;
47 
51  static vtkContext3D* New();
52 
58  bool Begin(vtkContextDevice3D* device);
59 
64 
70  bool End();
71 
75  void DrawLine(const vtkVector3f& start, const vtkVector3f& end);
76 
80  void DrawPoly(const float* points, int n);
81 
85  void DrawPoint(const vtkVector3f& point);
86 
90  void DrawPoints(const float* points, int n);
91 
97  void DrawPoints(const float* points, int n, unsigned char* colors, int nc_comps);
98  void DrawPoints(
99  vtkDataArray* positions, vtkUnsignedCharArray* colors, std::uintptr_t cacheIdentifier);
100 
104  void DrawTriangleMesh(const float* mesh, int n, const unsigned char* colors, int nc);
106  vtkDataArray* positions, vtkUnsignedCharArray* colors, std::uintptr_t cacheIdentifier);
107 
113  void ApplyPen(vtkPen* pen);
114 
120  void ApplyBrush(vtkBrush* brush);
121 
127  void SetTransform(vtkTransform* transform);
128 
133 
140  void AppendTransform(vtkTransform* transform);
141 
143 
147  void PushMatrix();
148  void PopMatrix();
150 
152 
159  void EnableClippingPlane(int i, double* planeEquation);
160  void DisableClippingPlane(int i);
162 
163 protected:
165  ~vtkContext3D() override;
166 
167  vtkSmartPointer<vtkContextDevice3D> Device; // The underlying device
169 
170 private:
171  vtkContext3D(const vtkContext3D&) = delete;
172  void operator=(const vtkContext3D&) = delete;
173 };
174 
175 VTK_ABI_NAMESPACE_END
176 #endif // VTKCONTEXT3D_H
provides a brush that fills shapes drawn by vtkContext2D.
Definition: vtkBrush.h:39
Class for drawing 3D primitives to a graphical context.
Definition: vtkContext3D.h:43
~vtkContext3D() override
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
bool Begin(vtkContextDevice3D *device)
Begin painting on a vtkContextDevice3D, no painting can occur before this call has been made.
void DrawLine(const vtkVector3f &start, const vtkVector3f &end)
Draw a line between the specified points.
void DrawPoly(const float *points, int n)
Draw a poly line between the specified points.
vtkContextDevice3D * GetDevice()
Get access to the underlying 3D context.
vtkTransform * GetTransform()
Compute the current transform applied to the context.
void EnableClippingPlane(int i, double *planeEquation)
Enable/Disable the specified clipping plane.
vtkSmartPointer< vtkTransform > Transform
Definition: vtkContext3D.h:168
void SetTransform(vtkTransform *transform)
Set the transform for the context, the underlying device will use the matrix of the transform.
void DrawTriangleMesh(vtkDataArray *positions, vtkUnsignedCharArray *colors, std::uintptr_t cacheIdentifier)
void DrawPoints(vtkDataArray *positions, vtkUnsignedCharArray *colors, std::uintptr_t cacheIdentifier)
void DisableClippingPlane(int i)
Enable/Disable the specified clipping plane.
void AppendTransform(vtkTransform *transform)
Append the transform for the context, the underlying device will use the matrix of the transform.
void DrawPoints(const float *points, int n)
Draw a sequence of points at the specified locations.
void PopMatrix()
Push/pop the transformation matrix for the painter (sets the underlying matrix for the device when av...
vtkSmartPointer< vtkContextDevice3D > Device
Definition: vtkContext3D.h:167
void PushMatrix()
Push/pop the transformation matrix for the painter (sets the underlying matrix for the device when av...
void DrawTriangleMesh(const float *mesh, int n, const unsigned char *colors, int nc)
Draw triangles to generate the specified mesh.
void DrawPoints(const float *points, int n, unsigned char *colors, int nc_comps)
Draw a sequence of points at the specified locations.
bool End()
Ends painting on the device, you would not usually need to call this as it should be called by the de...
void ApplyPen(vtkPen *pen)
Apply the supplied pen which controls the outlines of shapes, as well as lines, points and related pr...
static vtkContext3D * New()
Creates a 3D context object.
void ApplyBrush(vtkBrush *brush)
Apply the supplied brush which controls the outlines of shapes, as well as lines, points and related ...
void DrawPoint(const vtkVector3f &point)
Draw a point at the point in 3D space.
Abstract class for drawing 3D primitives.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
a simple class to control print indentation
Definition: vtkIndent.h:38
abstract base class for most VTK objects
Definition: vtkObject.h:61
provides a pen that draws the outlines of shapes drawn by vtkContext2D.
Definition: vtkPen.h:38
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:59
dynamic, self-adjusting array of unsigned char
@ point
Definition: vtkX3D.h:236
@ points
Definition: vtkX3D.h:446