VTK
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 =========================================================================*/
20 #ifndef vtkBillboardTextActor3D_h
21 #define vtkBillboardTextActor3D_h
22 
23 #include "vtkRenderingCoreModule.h" // For export macro
24 #include "vtkProp3D.h"
25 #include "vtkNew.h" // For.... vtkNew!
26 #include "vtkSmartPointer.h" // For.... vtkSmartPointer!
27 
28 class vtkActor;
29 class vtkImageData;
30 class vtkPolyData;
31 class vtkPolyDataMapper;
32 class vtkRenderer;
33 class vtkTextProperty;
34 class vtkTextRenderer;
35 class vtkTexture;
36 
37 class VTKRENDERINGCORE_EXPORT vtkBillboardTextActor3D: public vtkProp3D
38 {
39 public:
40  static vtkBillboardTextActor3D* New();
42  void PrintSelf(ostream &os, vtkIndent indent) override;
43 
48  void SetInput(const char *in);
49  vtkGetStringMacro(Input)
57  vtkGetVector2Macro(DisplayOffset, int)
58  vtkSetVector2Macro(DisplayOffset, int)
65  void SetTextProperty(vtkTextProperty *tprop);
66  vtkGetObjectMacro(TextProperty, vtkTextProperty)
73  virtual void SetForceOpaque(bool opaque);
74  virtual bool GetForceOpaque();
75  virtual void ForceOpaqueOn();
76  virtual void ForceOpaqueOff();
77  virtual void SetForceTranslucent(bool trans);
78  virtual bool GetForceTranslucent();
79  virtual void ForceTranslucentOn();
80  virtual void ForceTranslucentOff();
87 
91  int RenderOpaqueGeometry(vtkViewport *vp) override;
92 
98 
99  void ReleaseGraphicsResources(vtkWindow *win) override;
100  double *GetBounds() override;
101  using Superclass::GetBounds;
102 
107  vtkGetVector3Macro(AnchorDC, double)
108 
109 protected:
111  ~vtkBillboardTextActor3D() override;
112 
113  bool InputIsValid();
114 
115  void UpdateInternals(vtkRenderer *ren);
116 
117  bool TextureIsStale(vtkRenderer *ren);
118  void GenerateTexture(vtkRenderer *ren);
119 
120  bool QuadIsStale(vtkRenderer *ren);
121  void GenerateQuad(vtkRenderer *ren);
122 
123  // Used by the opaque pass to tell the translucent pass not to render.
124  void Invalidate();
125  bool IsValid();
126 
127  // Used to sync the internal actor's state.
128  void PreRender();
129 
130  // Text specification:
131  char *Input;
133 
134  // Offset in display coordinates.
135  int DisplayOffset[2];
136 
137  // Cached metadata to determine if things need rebuildin'
140 
141  // We cache this so we can recompute the bounds between renders, if needed.
143 
144  // Rendering stuffies
151 
152  // Display coordinate for anchor position. Z value is in NDC.
153  // Cached for GL2PS export on OpenGL2:
154  double AnchorDC[3];
155 
156 private:
158  void operator=(const vtkBillboardTextActor3D&) = delete;
159 };
160 
161 #endif // vtkBillboardTextActor3D_h
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:42
vtkBillboardTextActor3D::QuadMapper
vtkNew< vtkPolyDataMapper > QuadMapper
Definition: vtkBillboardTextActor3D.h:149
vtkProp3D
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:46
vtkProp3D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:35
vtkProp::RenderOpaqueGeometry
virtual int RenderOpaqueGeometry(vtkViewport *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
Definition: vtkProp.h:224
vtkSmartPointer< vtkRenderer >
vtkBillboardTextActor3D
Renders pixel-aligned text, facing the camera, anchored at a 3D point.
Definition: vtkBillboardTextActor3D.h:37
vtkBillboardTextActor3D::Image
vtkNew< vtkImageData > Image
Definition: vtkBillboardTextActor3D.h:146
vtkProp3D::GetBounds
double * GetBounds() override=0
Get the bounds for this Prop as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkProp::HasTranslucentPolygonalGeometry
virtual vtkTypeBool HasTranslucentPolygonalGeometry()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
Definition: vtkProp.h:296
vtkBillboardTextActor3D::QuadActor
vtkNew< vtkActor > QuadActor
Definition: vtkBillboardTextActor3D.h:150
vtkBillboardTextActor3D::RenderedRenderer
vtkSmartPointer< vtkRenderer > RenderedRenderer
Definition: vtkBillboardTextActor3D.h:142
vtkTexture
handles properties associated with a texture map
Definition: vtkTexture.h:71
vtkBillboardTextActor3D::InputMTime
vtkTimeStamp InputMTime
Definition: vtkBillboardTextActor3D.h:139
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkSmartPointer.h
vtkNew< vtkTextRenderer >
vtkProp::GetBounds
virtual double * GetBounds()
Get the bounds for this Prop as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
Definition: vtkProp.h:132
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:47
vtkBillboardTextActor3D::RenderedDPI
int RenderedDPI
Definition: vtkBillboardTextActor3D.h:138
vtkProp::RenderTranslucentPolygonalGeometry
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
Definition: vtkProp.h:226
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:39
vtkBillboardTextActor3D::Quad
vtkNew< vtkPolyData > Quad
Definition: vtkBillboardTextActor3D.h:148
vtkBillboardTextActor3D::TextRenderer
vtkNew< vtkTextRenderer > TextRenderer
Definition: vtkBillboardTextActor3D.h:145
vtkNew.h
vtkTextRenderer
Interface for generating images and path data from string data, using multiple backends.
Definition: vtkTextRenderer.h:75
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:63
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
vtkBillboardTextActor3D::Input
char * Input
Definition: vtkBillboardTextActor3D.h:131
vtkBillboardTextActor3D::TextProperty
vtkTextProperty * TextProperty
Definition: vtkBillboardTextActor3D.h:132
vtkProp::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
Definition: vtkProp.h:305
vtkBillboardTextActor3D::Texture
vtkNew< vtkTexture > Texture
Definition: vtkBillboardTextActor3D.h:147
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkProp3D.h