Package barsuift.simLife.j3d.tree

Examples of barsuift.simLife.j3d.tree.TreeLeaf3D


        addElement3D(treeBranchGroup);
    }

    private void addFallenLeaf(TreeLeaf treeLeaf) {
        TreeLeaf3D treeLeaf3D = treeLeaf.getTreeLeaf3D();
        Point3d treeLeafOriginPoint = treeLeaf3D.getState().getLeafAttachPoint().toPointValue();
        double treeLeafRotation = treeLeaf3D.getState().getRotation();
        Transform3D translation = TransformerHelper.getTranslationTransform3D(new Vector3d(treeLeafOriginPoint));
        Transform3D rotation = TransformerHelper.getRotationTransform3D(treeLeafRotation, Axis.Y);
        translation.mul(rotation);
        TransformGroup transformGroup = new TransformGroup(translation);

        BranchGroup treeLeafBranchGroup = new BranchGroup();
        treeLeafBranchGroup.addChild(transformGroup);
        transformGroup.addChild(treeLeaf3D.getBranchGroup());

        addElement3D(treeLeafBranchGroup);
    }
View Full Code Here


        assertEquals(1, universe.getPhysics().getGravity().getFallingLeaves().size());
        assertTrue(universe.getPhysics().getGravity().getFallingLeaves().contains(leaf));
    }

    public void testUpdate() {
        TreeLeaf3D leaf3D = leaf.getTreeLeaf3D();
        // the leaf should be a subscriber of the leaf3D
        assertEquals(1, leaf3D.countSubscribers());
        // assert the leaf is really one of the subscribers of the leaf3D
        leaf3D.deleteSubscriber(leaf);
        assertEquals(0, leaf3D.countSubscribers());


        publisherHelper.addSubscriberTo(leaf);

        // test with wrong argument
View Full Code Here

        BasicGravity gravity = new BasicGravity(gravityState, universe);
        assertEquals(2, gravity.getFallingLeaves().size());
        assertEquals(2, gravity.getGravity3D().getGroup().numChildren());
        for (TreeLeaf treeLeaf : gravity.getFallingLeaves()) {
            TreeLeaf3D treeLeaf3D = treeLeaf.getTreeLeaf3D();

            // leaf3D and gravity are subscribers of the leaf
            assertEquals(2, treeLeaf.countSubscribers());

            // leaf is subscriber of the leaf3D
            assertEquals(1, treeLeaf3D.countSubscribers());

            // assert the gravity is really one of the subscribers of the leaf
            treeLeaf.deleteSubscriber(gravity);
            assertEquals(1, treeLeaf.countSubscribers());
            // assert the leaf3D is really one of the subscribers of the leaf
            treeLeaf.deleteSubscriber(treeLeaf3D);
            assertEquals(0, treeLeaf.countSubscribers());

            // assert the leaf is really one of the subscribers of the leaf3D
            treeLeaf3D.deleteSubscriber(treeLeaf);
            assertEquals(0, treeLeaf3D.countSubscribers());

        }

        MockTreeLeaf treeLeaf = new MockTreeLeaf();
        gravity.addFallingLeaf(treeLeaf);
View Full Code Here

TOP

Related Classes of barsuift.simLife.j3d.tree.TreeLeaf3D

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.