VTK  9.2.20230320
vtkBillboardTextActor3D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkBillboardTextActor3D.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 =========================================================================*/
42 #ifndef vtkBillboardTextActor3D_h
43 #define vtkBillboardTextActor3D_h
44 
45 #include "vtkNew.h" // For.... vtkNew!
46 #include "vtkProp3D.h"
47 #include "vtkRenderingCoreModule.h" // For export macro
48 #include "vtkSmartPointer.h" // For.... vtkSmartPointer!
49 
50 VTK_ABI_NAMESPACE_BEGIN
51 class vtkActor;
52 class vtkImageData;
53 class vtkPolyData;
54 class vtkPolyDataMapper;
55 class vtkRenderer;
56 class vtkTextProperty;
57 class vtkTextRenderer;
58 class vtkTexture;
59 
60 class VTKRENDERINGCORE_EXPORT vtkBillboardTextActor3D : public vtkProp3D
61 {
62 public:
65  void PrintSelf(ostream& os, vtkIndent indent) override;
66 
75  void GetActors(vtkPropCollection*) override;
76 
82 
87  void SetInput(const char* in);
88  vtkGetStringMacro(Input);
96  vtkGetVector2Macro(DisplayOffset, int);
97  vtkSetVector2Macro(DisplayOffset, int);
105  vtkGetObjectMacro(TextProperty, vtkTextProperty);
112  virtual void SetForceOpaque(bool opaque);
113  virtual bool GetForceOpaque();
114  virtual void ForceOpaqueOn();
115  virtual void ForceOpaqueOff();
116  virtual void SetForceTranslucent(bool trans);
117  virtual bool GetForceTranslucent();
118  virtual void ForceTranslucentOn();
119  virtual void ForceTranslucentOff();
126 
131 
137 
138  void ReleaseGraphicsResources(vtkWindow* win) override;
139  double* GetBounds() override;
140  using Superclass::GetBounds;
141 
146  vtkGetVector3Macro(AnchorDC, double);
147 
148 protected:
151 
152  bool InputIsValid();
153 
155 
158 
161 
162  // Used by the opaque pass to tell the translucent pass not to render.
163  void Invalidate();
164  bool IsValid();
165 
166  // Used to sync the internal actor's state.
167  void PreRender();
168 
169  // Text specification:
170  char* Input;
172 
173  // Offset in display coordinates.
174  int DisplayOffset[2];
175 
176  // Cached metadata to determine if things need rebuildin'
179 
180  // We cache this so we can recompute the bounds between renders, if needed.
182 
183  // Rendering stuffies
190 
191  // Display coordinate for anchor position. Z value is in NDC.
192  // Cached for GL2PS export on OpenGL2:
193  double AnchorDC[3];
194 
195 private:
197  void operator=(const vtkBillboardTextActor3D&) = delete;
198 };
199 
200 VTK_ABI_NAMESPACE_END
201 #endif // vtkBillboardTextActor3D_h
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:162
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:164
a simple class to control print indentation
Definition: vtkIndent.h:120
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:201
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:100
an ordered list of Props
virtual double * GetBounds()
Get the bounds for this Prop as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
Definition: vtkProp.h:155
abstract specification for renderers
Definition: vtkRenderer.h:183
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:179
record modification and/or execution time
Definition: vtkTimeStamp.h:56
abstract specification for Viewports
Definition: vtkViewport.h:57
window superclass for vtkRenderWindow
Definition: vtkWindow.h:40
int vtkTypeBool
Definition: vtkABI.h:71