Package javax.media.j3d

Examples of javax.media.j3d.TransformGroup


        }

        _branchRoot = new BranchGroup();
        _branchRoot.setCapability(BranchGroup.ALLOW_DETACH);

        _userTransformation = new TransformGroup(_lastTransform);
        _userTransformation.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
        _userTransformation.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
        _userTransformation.setCapability(Group.ALLOW_CHILDREN_EXTEND);
        _branchRoot.addChild(_userTransformation);

        //To allow multiple shapes to be added
        /*        _root = new BranchGroup();
         _root.setCapability(BranchGroup.ALLOW_DETACH);
         _root.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE);
         _root.setCapability(BranchGroup.ALLOW_CHILDREN_READ);
         _root.setCapability(BranchGroup.ALLOW_CHILDREN_EXTEND);
         _userTransformation.addChild(_root); */
        _bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0);

        Background backg = _makeBackground();
        backg.setApplicationBounds(_bounds);
        _branchRoot.addChild(backg);

        if (_isRotatable()) {
            _mouseRotate = new MouseRotateView(this);
            _mouseRotate.setTransformGroup(_userTransformation);
            _mouseRotate.setSchedulingBounds(_bounds);
            _branchRoot.addChild(_mouseRotate);
        }

        if (_isScalable()) {
            MouseZoom mouseZoom = new MouseZoom();
            mouseZoom.setTransformGroup(_userTransformation);
            mouseZoom.setSchedulingBounds(_bounds);
            _branchRoot.addChild(mouseZoom);
        }

        if (_isTranslatable()) {
            MouseTranslate mouseTranslate = new MouseTranslate();
            mouseTranslate.setTransformGroup(_userTransformation);
            _userTransformation.addChild(mouseTranslate);
            mouseTranslate.setSchedulingBounds(_bounds);
        }

        // FIXME: should implement this so that user can dynamically
        // modify this value during design-time and run-time
        // right now this is only user-changeable during initialization
        if (_isIterationSynchronized()) {
            _iterationSynchronized = true;
        } else {
            _iterationSynchronized = false;
        }

        if (_shouldShowAxes()) {
            Sphere origin = new Sphere((float) 0.05);
            _userTransformation.addChild(origin);

            Cylinder yAxis = new Cylinder((float) 0.01, (float) 6.0);
            _userTransformation.addChild(yAxis);

            Cylinder xAxis = new Cylinder((float) 0.01, (float) 6.0);
            Transform3D rotation = new Transform3D();
            Quat4d quat = new Quat4d();
            quat.set(new AxisAngle4d(0.0, 0.0, 1.0, Math.PI / 2.0));
            rotation.set(quat);

            TransformGroup xAxisGroup = new TransformGroup(rotation);
            xAxisGroup.addChild(xAxis);
            _userTransformation.addChild(xAxisGroup);

            Cylinder zAxis = new Cylinder((float) 0.01, (float) 6.0);
            Transform3D rotation2 = new Transform3D();
            Quat4d quat2 = new Quat4d();
            quat2.set(new AxisAngle4d(1.0, 0.0, 0.0, Math.PI / 2.0));
            rotation2.set(quat2);

            TransformGroup zAxisGroup = new TransformGroup(rotation2);
            zAxisGroup.addChild(zAxis);
            _userTransformation.addChild(zAxisGroup);
        }

        // Setup the lights.
        BranchGroup lightRoot = new BranchGroup();
View Full Code Here


        if (allowChanges) {
            Cylinder cylinder = new Cylinder(1.0f, 1.0f, primitiveFlags,
                    circleDivisionsValue, sideDivisionsValue, _appearance);

            TransformGroup scaler = new TransformGroup();
            scaler.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
            _scaleTransform = new Transform3D();
            _scaleTransform.setScale(new Vector3d(radiusValue, heightValue,
                    radiusValue));
            scaler.setTransform(_scaleTransform);
            scaler.addChild(cylinder);
            _containedNode = scaler;
        } else {
            _containedNode = new Cylinder(radiusValue, heightValue,
                    primitiveFlags, circleDivisionsValue, sideDivisionsValue,
                    _appearance);
View Full Code Here

            Quat4d quaternion = new Quat4d();
            quaternion.set(new AxisAngle4d(axisX, axisY, axisZ, angle));

            Vector3d vector = new Vector3d(xPosition, yPosition, zPosition);
            Transform3D t = new Transform3D(quaternion, vector, 1.0);
            TransformGroup group = _simpleUniverse.getViewingPlatform()
                    .getViewPlatformTransform();
            group.setTransform(t);
        }
    }
View Full Code Here

        if (_changesAllowedNow) {
            Cone cone = new Cone(1.0f, 1.0f, primitiveFlags,
                    circleDivisionsValue, sideDivisionsValue, _appearance);

            TransformGroup scaler = new TransformGroup();
            scaler.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
            _scaleTransform = new Transform3D();
            _scaleTransform.setScale(new Vector3d(radiusValue, heightValue,
                    radiusValue));
            scaler.setTransform(_scaleTransform);
            scaler.addChild(cone);
            _containedNode = scaler;
        } else {
            _containedNode = new Cone(radiusValue, heightValue, primitiveFlags,
                    circleDivisionsValue, sideDivisionsValue, _appearance);
            _scaleTransform = null;
View Full Code Here

        _accumulatedAngle = originalAngle;

        _rotation = new Transform3D();

        _topTranslate = new TransformGroup();

        _middleRotate = new TransformGroup();
        _middleRotate.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
        _bottomTranslate = new TransformGroup();
        _bottomTranslate.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
        _bottomTranslate.setCapability(Group.ALLOW_CHILDREN_WRITE);
        _bottomTranslate.setCapability(Group.ALLOW_CHILDREN_EXTEND);

        Transform3D topTransform = new Transform3D();
View Full Code Here

    /** Setup the transformation needed for scaling.
     */
    public void initialize() throws IllegalActionException {
        super.initialize();
        _transformNode = new TransformGroup();
        _transformNode.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);

        Transform3D scaleTransform = new Transform3D();
        scaleTransform.setScale(new Vector3d(_getScaleX(), _getScaleY(),
                _getScaleZ()));
View Full Code Here

        float width = (float) (((DoubleToken) zWidth.getToken()).doubleValue() / 2.0);

        if (_changesAllowedNow) {
            Box box = new Box(1.0f, 1.0f, 1.0f, primitiveFlags, _appearance);

            TransformGroup scaler = new TransformGroup();
            scaler.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
            _scaleTransform = new Transform3D();
            _scaleTransform.setScale(new Vector3d(length, height, width));
            scaler.setTransform(_scaleTransform);
            scaler.addChild(box);
            _containedNode = scaler;
        } else {
            _containedNode = new Box(length, height, width, primitiveFlags,
                    _appearance);
            _scaleTransform = null;
View Full Code Here

        Quat4d quaternion = new Quat4d();
        quaternion.set(new AxisAngle4d(axisX, axisY, axisZ, angle));

        Vector3d vector = new Vector3d(xPosition, yPosition, zPosition);
        Transform3D t = new Transform3D(quaternion, vector, 1.0);
        TransformGroup group = _simpleUniverse.getViewingPlatform()
                .getViewPlatformTransform();
        group.setTransform(t);
        _initialPosition = _position;
        _initialAxis = _axis;
        _initialAngle = _angle;
    }
View Full Code Here

        Shape3D shape = new Shape3D();
        shape.setGeometry(_textGeometry);
        shape.setAppearance(_appearance);

        TransformGroup scaler = new TransformGroup();
        scaler.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
        _scaleTransform = new Transform3D();

        float size = (float) (((DoubleToken) fontSize.getToken()).doubleValue());
        _scaleTransform.setScale(new Vector3d(size, size, 1.0f));
        scaler.setTransform(_scaleTransform);
        scaler.addChild(shape);
        _containedNode = scaler;

        if (_changesAllowedNow) {
            _textGeometry.setCapability(Text3D.ALLOW_FONT3D_WRITE);
            _textGeometry.setCapability(Text3D.ALLOW_ALIGNMENT_WRITE);
View Full Code Here

    }

    private void attachLeaf3DIn3dStructure() {
        BranchGroup leafBranchGroup = leaf.getTreeLeaf3D().getBranchGroup();
        bg = new BranchGroup();
        TransformGroup tg = new TransformGroup();
        bg.addChild(tg);
        tg.addChild(leafBranchGroup);
    }
View Full Code Here

TOP

Related Classes of javax.media.j3d.TransformGroup

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.