org.jzy3d.plot3d.text.renderers
Class TextBillboardRenderer
- java.lang.Object
-
- org.jzy3d.plot3d.text.AbstractTextRenderer
-
- org.jzy3d.plot3d.text.renderers.TextBillboardRenderer
-
- All Implemented Interfaces:
- ITextRenderer
public class TextBillboardRenderer extends AbstractTextRenderer implements ITextRenderer
ATextBillboardRendererallows writing 2d text always facing the Camera of a 3d Scene.
TextBillboard provides the pixel definition of all characters of the ASCII alphabet. A default bitmap (plain rectangle) is provided for unrecognized characters (those that do not have an ASCII code). The bitmap library is static, and thus no overhead is generated by the use of several instances of TextBillboard.
It is however not necessary to have an instance of TextBillboard for each drawn string.
String s = new String("2d text in 3d Scene");
TextBillboard txt = new TextBillboard();
BoundingBox3d box;
txt.drawText(gl, s, Coord3d.ORIGIN, Halign.LEFT, Valign.GROUND, Color.BLACK);
box = txt.drawText(gl, glu, cam, s, Coord3d.ORIGIN, Halign.LEFT, Valign.GROUND, Color.BLACK);
Layout constants
As demonstrated in the previous example, theTextBillboardRendererhandles vertical and horizontal layout of text according to the given text coordinate.
The following picture illustrates the text layout when using the various layout constants
-
-
Constructor Summary
Constructors Constructor and Description TextBillboardRenderer()The TextBillboard class provides support for drawing ASCII characters Any non ascii caracter will be replaced by a square.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description BoundingBox3dcomputeTextBounds(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu, Camera cam, Coord3d position, org.jzy3d.plot3d.text.renderers.TextBillboardRenderer.BillBoardSize dims)voiddrawSimpleText(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu, Camera cam, java.lang.String s, Coord3d position, Color color, int fonttype)BoundingBox3ddrawText(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu, Camera cam, java.lang.String s, Coord3d position, Halign halign, Valign valign, Color color, Coord2d screenOffset, Coord3d sceneOffset, int fonttype)Draw a string at the specified position and compute the 3d volume occupied by the string according to the current Camera configuration.voiddrawText(com.jogamp.opengl.GL gl, java.lang.String s, Coord3d position, Halign halign, Valign valign, Color color)Draw a string at the specified position.voidglRaster(com.jogamp.opengl.GL gl, Coord3d position, Color color)-
Methods inherited from class org.jzy3d.plot3d.text.AbstractTextRenderer
drawText, drawText, drawText
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jzy3d.plot3d.text.ITextRenderer
drawText, drawText, drawText
-
-
-
-
Constructor Detail
-
TextBillboardRenderer
public TextBillboardRenderer()
The TextBillboard class provides support for drawing ASCII characters Any non ascii caracter will be replaced by a square.
-
-
Method Detail
-
drawSimpleText
public void drawSimpleText(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu, Camera cam, java.lang.String s, Coord3d position, Color color, int fonttype)- Specified by:
drawSimpleTextin interfaceITextRenderer
-
drawText
public void drawText(com.jogamp.opengl.GL gl, java.lang.String s, Coord3d position, Halign halign, Valign valign, Color color)Draw a string at the specified position.
-
drawText
public BoundingBox3d drawText(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu, Camera cam, java.lang.String s, Coord3d position, Halign halign, Valign valign, Color color, Coord2d screenOffset, Coord3d sceneOffset, int fonttype)
Draw a string at the specified position and compute the 3d volume occupied by the string according to the current Camera configuration.- Specified by:
drawTextin interfaceITextRenderer
-
computeTextBounds
public BoundingBox3d computeTextBounds(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu, Camera cam, Coord3d position, org.jzy3d.plot3d.text.renderers.TextBillboardRenderer.BillBoardSize dims)
-
-
DMelt 3.0 © DataMelt by jWork.ORG