Java Code Examples for javax.media.j3d.TransformGroup#setCapability()

The following examples show how to use javax.media.j3d.TransformGroup#setCapability() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Java3DWindow.java    From GpsPrune with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a text object for compass point, N S E or W
 * @param inText text to display
 * @param inLocn position at which to display
 * @param inFont 3d font to use
 * @return compound object
 */
private TransformGroup 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);

	// Make transform group with billboard behaviour
	TransformGroup subGroup = new TransformGroup();
	subGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
	subGroup.addChild(shape);
	Billboard billboard = new Billboard(subGroup, Billboard.ROTATE_ABOUT_POINT, inLocn);
	BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0);
	billboard.setSchedulingBounds(bounds);
	subGroup.addChild(billboard);
	return subGroup;
}
 
Example 2
Source File: Main3D.java    From javagame with MIT License 5 votes vote down vote up
/**
 * �V�[�����\�z����
 * @return BG
 */
public BranchGroup createSceneGraph() {
    BranchGroup bg = new BranchGroup();

    // ��]�pTG
    TransformGroup spinTG = new TransformGroup();
    spinTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);

    // ��]�^��
    Alpha rotationAlpha = new Alpha(-1, 4000);
    RotationInterpolator rotator = new RotationInterpolator(rotationAlpha,
            spinTG);

    // �͈͂��w��
    BoundingSphere bounds = new BoundingSphere();
    rotator.setSchedulingBounds(bounds);

    spinTG.addChild(rotator);

    // �g���C�t�H�[�X
    Triforce triforce = new Triforce();
    spinTG.addChild(triforce.getBG()); // spinTG�ɒlj��I

    bg.addChild(spinTG);

    return bg;
}
 
Example 3
Source File: RotatingCube.java    From javagame with MIT License 5 votes vote down vote up
public BranchGroup createSceneGraph() {
    BranchGroup bg = new BranchGroup();

    // �L���[�u���X����
    Transform3D rotate = new Transform3D();
    Transform3D tempRotate = new Transform3D();

    rotate.rotX(Math.PI / 4.0);
    tempRotate.rotY(Math.PI / 4.0);
    rotate.mul(tempRotate);

    TransformGroup rotateTG = new TransformGroup(rotate);

    // �L���[�u����]����
    TransformGroup spinTG = new TransformGroup();
    spinTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    // �J���[�L���[�u���쐬����spinTG�ɒlj�
    ColorCube cube = new ColorCube(0.4);
    spinTG.addChild(cube);

    // ��]�^��
    Alpha rotationAlpha = new Alpha(-1, 4000);
    RotationInterpolator rotator = new RotationInterpolator(rotationAlpha, spinTG);
    // �͈͂��w��
    BoundingSphere bounds = new BoundingSphere();
    rotator.setSchedulingBounds(bounds);
    spinTG.addChild(rotator);

    rotateTG.addChild(spinTG);
    bg.addChild(rotateTG);

    return bg;
}
 
Example 4
Source File: KinematicObject.java    From jMAVSim with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public KinematicObject(World world) {
    super(world);
    rotation.setIdentity();
    transformGroup = new TransformGroup();
    transformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    transform = new Transform3D();
    transformGroup.setTransform(transform);
    branchGroup = new BranchGroup();
    branchGroup.addChild(transformGroup);
}