本文整理汇总了Java中javax.media.j3d.Text3D.PATH_RIGHT属性的典型用法代码示例。如果您正苦于以下问题:Java Text3D.PATH_RIGHT属性的具体用法?Java Text3D.PATH_RIGHT怎么用?Java Text3D.PATH_RIGHT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.media.j3d.Text3D
的用法示例。
在下文中一共展示了Text3D.PATH_RIGHT属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCompassPoint
/**
* Create a text object for compass point, N S E or W
* @param text text to display
* @param locn position at which to display
* @param font 3d font to use
* @return Shape3D object
*/
private Shape3D createCompassPoint(String inText, Point3f inLocn, Font3D inFont)
{
Text3D txt = new Text3D(inFont, inText, inLocn, Text3D.ALIGN_FIRST, Text3D.PATH_RIGHT);
Material mat = new Material(new Color3f(0.5f, 0.5f, 0.55f),
new Color3f(0.05f, 0.05f, 0.1f), new Color3f(0.3f, 0.4f, 0.5f),
new Color3f(0.4f, 0.5f, 0.7f), 70.0f);
mat.setLightingEnable(true);
Appearance app = new Appearance();
app.setMaterial(mat);
Shape3D shape = new Shape3D(txt, app);
return shape;
}
示例2: generateLabel
/**
* Fonction permettant de créer un label
*
* @param x
* @param y
* @param text
* @param color
* @param distance distance d'apparition
* @param textSize taille du texte
* @return distance à partir de laquelle apparaitra l'objet
*/
private static Group generateLabel(double x, double y, String text,
Color color, float distance, int textSize) {
// On prend une font de type Arial
Font3D f3d = new Font3D(new Font("Arial", Font.PLAIN, 1),
new FontExtrusion());
// On crée le texte 3D
Text3D t = new Text3D(f3d, text, new Point3f(0, 0, 0), Text3D.ALIGN_CENTER,
Text3D.PATH_RIGHT);
// On le dimensionne
Transform3D trans1 = new Transform3D();
trans1.setScale(new Vector3d(textSize, textSize, textSize / 3));
TransformGroup tg = new TransformGroup(trans1);
// On le place au bon endroit
Transform3D trans = new Transform3D();
trans.setTranslation(new Vector3d(x, y, 0));
TransformGroup tg2 = new TransformGroup(trans);
// On lui applique une apparence
Appearance ap = Level.generateApparence(color, 1, true);
Shape3D s = new Shape3D(t, ap);
// Create the transformgroup used for the billboard
TransformGroup billBoardGroup = new TransformGroup();
// Set the access rights to the group
billBoardGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
// Add the cube to the group
billBoardGroup.addChild(s);
// Gestion du Billboard pour le voir toujours de face
Billboard myBillboard = new Billboard(billBoardGroup,
Billboard.ROTATE_ABOUT_POINT, new Vector3f());
myBillboard.setSchedulingBounds(billBoardGroup.getBounds());
tg.addChild(billBoardGroup);
tg.addChild(myBillboard);
// Création d'un switch permettant de gérer le LOD (disparition lorsque
// l'objet est trop loin)
Switch targetSwitch = new Switch();
targetSwitch.setCapability(Switch.ALLOW_SWITCH_WRITE);
// add visual objects to the target switch
targetSwitch.addChild(tg);
BoundingSphere bounds = new BoundingSphere();
// create DistanceLOD object
float[] distances = { distance };
DistanceLOD dLOD = new DistanceLOD(distances);
dLOD.setSchedulingBounds(bounds);
dLOD.addSwitch(targetSwitch);
tg2.addChild(targetSwitch);
tg2.addChild(dLOD);
return tg2;
}