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:
39  static vtkBillboardTextActor3D* New();
41  void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE;
42 
47  void SetInput(const char *in);
48  vtkGetStringMacro(Input)
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 
82  int RenderTranslucentPolygonalGeometry(vtkViewport *vp) VTK_OVERRIDE;
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:
96  ~vtkBillboardTextActor3D();
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:51
abstract specification for Viewports
Definition: vtkViewport.h:47
virtual int RenderOpaqueGeometry(vtkViewport *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
Definition: vtkProp.h:222
Renders pixel-aligned text, facing the camera, anchored at a 3D point.
record modification and/or execution time
Definition: vtkTimeStamp.h:35
abstract specification for renderers
Definition: vtkRenderer.h:63
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:46
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
virtual void ReleaseGraphicsResources(vtkWindow *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
Definition: vtkProp.h:303
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
a simple class to control print indentation
Definition: vtkIndent.h:39
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
handles properties associated with a texture map
Definition: vtkTexture.h:70
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
represent text properties.
map vtkPolyData to graphics primitives
Interface for generating images and path data from string data, using multiple backends.
Allocate and hold a VTK object.
Definition: vtkNew.h:67
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
Definition: vtkProp.h:224
virtual double * GetBounds()=0
Return a reference to the Prop3D's composite transform.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...