VTK  9.3.1
vtkBillboardTextActor3D.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
11 #ifndef vtkBillboardTextActor3D_h
12 #define vtkBillboardTextActor3D_h
13 
14 #include "vtkNew.h" // For.... vtkNew!
15 #include "vtkProp3D.h"
16 #include "vtkRenderingCoreModule.h" // For export macro
17 #include "vtkSmartPointer.h" // For.... vtkSmartPointer!
18 
19 VTK_ABI_NAMESPACE_BEGIN
20 class vtkActor;
21 class vtkImageData;
22 class vtkPolyData;
23 class vtkPolyDataMapper;
24 class vtkRenderer;
25 class vtkTextProperty;
26 class vtkTextRenderer;
27 class vtkTexture;
28 
29 class VTKRENDERINGCORE_EXPORT vtkBillboardTextActor3D : public vtkProp3D
30 {
31 public:
32  static vtkBillboardTextActor3D* New();
34  void PrintSelf(ostream& os, vtkIndent indent) override;
35 
44  void GetActors(vtkPropCollection*) override;
45 
50  void UpdateGeometry(vtkViewport* vp);
51 
56  void SetInput(const char* in);
57  vtkGetStringMacro(Input);
65  vtkGetVector2Macro(DisplayOffset, int);
66  vtkSetVector2Macro(DisplayOffset, int);
73  void SetTextProperty(vtkTextProperty* tprop);
74  vtkGetObjectMacro(TextProperty, vtkTextProperty);
81  virtual void SetForceOpaque(bool opaque);
82  virtual bool GetForceOpaque();
83  virtual void ForceOpaqueOn();
84  virtual void ForceOpaqueOff();
85  virtual void SetForceTranslucent(bool trans);
86  virtual bool GetForceTranslucent();
87  virtual void ForceTranslucentOn();
88  virtual void ForceTranslucentOff();
95 
99  int RenderOpaqueGeometry(vtkViewport* vp) override;
100 
106 
107  void ReleaseGraphicsResources(vtkWindow* win) override;
108  double* GetBounds() override;
109  using Superclass::GetBounds;
110 
115  vtkGetVector3Macro(AnchorDC, double);
116 
117 protected:
119  ~vtkBillboardTextActor3D() override;
120 
121  bool InputIsValid();
122 
123  void UpdateInternals(vtkRenderer* ren);
124 
125  bool TextureIsStale(vtkRenderer* ren);
126  void GenerateTexture(vtkRenderer* ren);
127 
128  bool QuadIsStale(vtkRenderer* ren);
129  void GenerateQuad(vtkRenderer* ren);
130 
131  // Used by the opaque pass to tell the translucent pass not to render.
132  void Invalidate();
133  bool IsValid();
134 
135  // Used to sync the internal actor's state.
136  void PreRender();
137 
138  // Text specification:
139  char* Input;
141 
142  // Offset in display coordinates.
143  int DisplayOffset[2];
144 
145  // Cached metadata to determine if things need rebuildin'
148 
149  // We cache this so we can recompute the bounds between renders, if needed.
151 
152  // Rendering stuffies
159 
160  // Display coordinate for anchor position. Z value is in NDC.
161  // Cached for GL2PS export on OpenGL2:
162  double AnchorDC[3];
163 
164 private:
166  void operator=(const vtkBillboardTextActor3D&) = delete;
167 };
168 
169 VTK_ABI_NAMESPACE_END
170 #endif // vtkBillboardTextActor3D_h
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:40
double * GetBounds() override=0
Return a reference to the Prop3D's composite transform.
abstract specification for Viewports
Definition: vtkViewport.h:44
virtual int RenderOpaqueGeometry(vtkViewport *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
Definition: vtkProp.h:213
Renders pixel-aligned text, facing the camera, anchored at a 3D point.
virtual vtkTypeBool HasTranslucentPolygonalGeometry()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
Definition: vtkProp.h:277
record modification and/or execution time
Definition: vtkTimeStamp.h:24
abstract specification for renderers
Definition: vtkRenderer.h:61
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:38
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
an ordered list of Props
int vtkTypeBool
Definition: vtkABI.h:64
virtual void ReleaseGraphicsResources(vtkWindow *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
Definition: vtkProp.h:298
virtual double * GetBounds()
Get the bounds for this Prop as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
Definition: vtkProp.h:124
window superclass for vtkRenderWindow
Definition: vtkWindow.h:27
vtkSmartPointer< vtkRenderer > RenderedRenderer
vtkNew< vtkImageData > Image
a simple class to control print indentation
Definition: vtkIndent.h:28
topologically and geometrically regular array of data
Definition: vtkImageData.h:42
handles properties associated with a texture map
Definition: vtkTexture.h:57
represent text properties.
map vtkPolyData to graphics primitives
Interface for generating images and path data from string data, using multiple backends.
vtkNew< vtkTextRenderer > TextRenderer
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
Definition: vtkProp.h:214
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
virtual void GetActors(vtkPropCollection *)
For some exporters and other other operations we must be able to collect all the actors or volumes...
Definition: vtkProp.h:56
vtkNew< vtkPolyDataMapper > QuadMapper