*
* @param topNode
*/
// -----------------------------------------------------
void addTextTestNodes(final Node topNode) {
final Node zup = new Node("zup");
rotate.fromAngleNormalAxis(-Math.PI / 2, Vector3.UNIT_X);
zup.setRotation(rotate);
final Node textMoveNode = new Node("textModeNode");
final CullState cs = new CullState();
cs.setCullFace(Face.Back);
textMoveNode.setRenderState(cs);
final Node textExampleNode = new Node("textExampleNode");
textExampleNode.setTranslation(0, 0, 0);
final double a = 9.0;
final double b = 4.5;
newBox(textExampleNode, 0, 1, 0);
newBox(textExampleNode, -a, 1, -b);
newBox(textExampleNode, -a, 1, b);
newBox(textExampleNode, a, 1, b);
newBox(textExampleNode, a, 1, -b);
topNode.attachChild(zup);
zup.attachChild(textMoveNode);
textMoveNode.attachChild(textExampleNode);
final SpatialController<BMText> fontChanger = createFontChanger();
final SpatialController<Node> nodeMover = createNodeMover();
textMoveNode.addController(nodeMover);
final BMFont font = BMFontLoader.defaultFont();
final String initialString = font.getStyleName() + "\nThe Quick Brown Fox...";
final double fontScale = 1.0;
if (true) {
final BMText text = new BMText("textSpatial1", initialString, font, BMText.Align.SouthWest,
BMText.Justify.Right);
text.setFontScale(fontScale);
text.setAutoFade(AutoFade.CapScreenSize);
text.setAutoFadeFalloff(1.0f);
text.setAutoScale(AutoScale.CapScreenSize);
text.setAutoRotate(true);
textExampleNode.attachChild(text);
text.addController(fontChanger);
}
if (true) {
final BMText text = new BMText("textSpatial2", initialString, font, BMText.Align.SouthEast,
BMText.Justify.Left);
text.setFontScale(fontScale);
text.setAutoFade(AutoFade.FixedPixelSize);
text.setAutoFadeFalloff(0.5f);
text.setAutoFadeFixedPixelSize(15);
text.setAutoScale(AutoScale.CapScreenSize);
text.setAutoRotate(true);
textExampleNode.attachChild(text);
text.addController(fontChanger);
}
if (true) {
final BMText text = new BMText("textSpatial3", initialString, font, BMText.Align.NorthEast,
BMText.Justify.Left);
text.setFontScale(fontScale);
text.setAutoFade(AutoFade.Off);
text.setAutoScale(AutoScale.FixedScreenSize);
text.setAutoRotate(true);
textExampleNode.attachChild(text);
text.addController(fontChanger);
}
if (true) {
final BMText text = new BMText("textSpatial4", initialString, font, BMText.Align.NorthWest,
BMText.Justify.Center);
text.setFontScale(fontScale);
text.setAutoFade(AutoFade.DistanceRange);
text.setAutoFadeDistanceRange(10, 100); // start fading distance to camera > 10
text.setAutoScale(AutoScale.Off);
text.setAutoRotate(true);
textExampleNode.attachChild(text);
text.addController(fontChanger);
}
}