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 
27 class vtkActor;
28 class vtkImageData;
29 class vtkPolyData;
30 class vtkPolyDataMapper;
31 class vtkRenderer;
32 class vtkTextProperty;
33 class vtkTextRenderer;
34 class vtkTexture;
35 
36 class VTKRENDERINGCORE_EXPORT vtkBillboardTextActor3D: public vtkProp3D
37 {
38 public:
41  void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE;
42 
47  void SetInput(const char *in);
56  vtkGetVector2Macro(DisplayOffset, int)
57  vtkSetVector2Macro(DisplayOffset, int)
64  void SetTextProperty(vtkTextProperty *tprop);
65  vtkGetObjectMacro(TextProperty, vtkTextProperty)
71  int HasTranslucentPolygonalGeometry() VTK_OVERRIDE { return 1; }
72 
76  int RenderOpaqueGeometry(vtkViewport *vp) VTK_OVERRIDE;
77 
83 
84  void ReleaseGraphicsResources(vtkWindow *win) VTK_OVERRIDE;
85  double *GetBounds() VTK_OVERRIDE;
86  using Superclass::GetBounds;
87 
92  vtkGetVector3Macro(AnchorDC, double)
93 
94 protected:
97 
98  bool InputIsValid();
99 
100  bool TextureIsStale(vtkRenderer *ren);
101  void GenerateTexture(vtkRenderer *ren);
102 
103  bool QuadIsStale(vtkRenderer *ren);
104  void GenerateQuad(vtkRenderer *ren);
105 
106  // Used by the opaque pass to tell the translucent pass not to render.
107  void Invalidate();
108  bool IsValid();
109 
110  // Used to sync the internal actor's state.
111  void PreRender();
112 
113  // Text specification:
114  char *Input;
115  vtkTextProperty *TextProperty;
116 
117  // Offset in display coordinates.
118  int DisplayOffset[2];
119 
120  // Cached metadata to determine if things need rebuildin'
121  int RenderedDPI;
122  vtkTimeStamp InputMTime;
123 
124  // Rendering stuffies
125  vtkNew<vtkTextRenderer> TextRenderer;
127  vtkNew<vtkTexture> Texture;
130  vtkNew<vtkActor> QuadActor;
131 
132  // Display coordinate for anchor position. Z value is in NDC.
133  // Cached for GL2PS export on OpenGL2:
134  double AnchorDC[3];
135 
136 private:
137  vtkBillboardTextActor3D(const vtkBillboardTextActor3D&) VTK_DELETE_FUNCTION;
138  void operator=(const vtkBillboardTextActor3D&) VTK_DELETE_FUNCTION;
139 };
140 
141 #endif // vtkBillboardTextActor3D_h
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:52
Renders pixel-aligned text, facing the camera, anchored at a 3D point.
int RenderTranslucentPolygonalGeometry(vtkViewport *vp) override
Just render in translucent pass, since it can execute multiple times (depth peeling,...
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...
double * GetBounds() override
Get the bounds for this Prop as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
static vtkBillboardTextActor3D * New()
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
a simple class to control print indentation
Definition: vtkIndent.h:40
Allocate and hold a VTK object.
Definition: vtkNew.h:68
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:86
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:47
abstract specification for renderers
Definition: vtkRenderer.h:64
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:71
record modification and/or execution time
Definition: vtkTimeStamp.h:36
abstract specification for Viewports
Definition: vtkViewport.h:48
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.