VTK  9.3.0
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:
34  void PrintSelf(ostream& os, vtkIndent indent) override;
35 
44  void GetActors(vtkPropCollection*) override;
45 
51 
56  void SetInput(const char* in);
57  vtkGetStringMacro(Input);
65  vtkGetVector2Macro(DisplayOffset, int);
66  vtkSetVector2Macro(DisplayOffset, int);
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:
120 
121  bool InputIsValid();
122 
124 
127 
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:41
Renders pixel-aligned text, facing the camera, anchored at a 3D point.
void SetTextProperty(vtkTextProperty *tprop)
The vtkTextProperty object that controls the rendered text.
vtkNew< vtkTextRenderer > TextRenderer
virtual bool GetForceOpaque()
Force the actor to render during the opaque or translucent pass.
bool TextureIsStale(vtkRenderer *ren)
void SetInput(const char *in)
The UTF-8 encoded string to display.
int RenderTranslucentPolygonalGeometry(vtkViewport *vp) override
Just render in translucent pass, since it can execute multiple times (depth peeling,...
virtual bool GetForceTranslucent()
Force the actor to render during the opaque or translucent pass.
int RenderOpaqueGeometry(vtkViewport *vp) override
Check/update geometry/texture in opaque pass, since it only happens once.
void ReleaseGraphicsResources(vtkWindow *win) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
virtual void SetForceTranslucent(bool trans)
Force the actor to render during the opaque or translucent pass.
bool QuadIsStale(vtkRenderer *ren)
virtual void ForceOpaqueOff()
Force the actor to render during the opaque or translucent pass.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void ForceOpaqueOn()
Force the actor to render during the opaque or translucent pass.
void GenerateQuad(vtkRenderer *ren)
vtkSmartPointer< vtkRenderer > RenderedRenderer
virtual void ForceTranslucentOff()
Force the actor to render during the opaque or translucent pass.
virtual void SetForceOpaque(bool opaque)
Force the actor to render during the opaque or translucent pass.
double * GetBounds() override
Return a reference to the Prop3D's composite transform.
virtual void ForceTranslucentOn()
Force the actor to render during the opaque or translucent pass.
vtkNew< vtkImageData > Image
void GenerateTexture(vtkRenderer *ren)
vtkNew< vtkPolyDataMapper > QuadMapper
void UpdateInternals(vtkRenderer *ren)
static vtkBillboardTextActor3D * New()
void UpdateGeometry(vtkViewport *vp)
Updates the billboard geometry without performing any rendering, to assist GetActors().
vtkTypeBool HasTranslucentPolygonalGeometry() override
Defers to internal actor.
void GetActors(vtkPropCollection *) override
For some exporters and other other operations we must be able to collect all the actors or volumes.
~vtkBillboardTextActor3D() override
topologically and geometrically regular array of data
Definition: vtkImageData.h:43
a simple class to control print indentation
Definition: vtkIndent.h:29
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:80
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:39
an ordered list of Props
virtual double * GetBounds()
Get the bounds for this Prop as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
Definition: vtkProp.h:124
abstract specification for renderers
Definition: vtkRenderer.h:62
represent text properties.
Interface for generating images and path data from string data, using multiple backends.
handles properties associated with a texture map
Definition: vtkTexture.h:58
record modification and/or execution time
Definition: vtkTimeStamp.h:25
abstract specification for Viewports
Definition: vtkViewport.h:45
window superclass for vtkRenderWindow
Definition: vtkWindow.h:28
int vtkTypeBool
Definition: vtkABI.h:64