Examples of BoundingVolume


Examples of com.ardor3d.bounding.BoundingVolume

        // determine distance and use as a scale to elongate the bone
        double scale = stPnt.distance(endPnt);
        if (scale == 0) {
            scale = MathUtils.ZERO_TOLERANCE;
        }
        final BoundingVolume vol = scene.getWorldBound();
        double size = 1.0;
        if (vol != null) {
            SkeletalDebugger.measureSphere.setCenter(vol.getCenter());
            SkeletalDebugger.measureSphere.setRadius(0);
            SkeletalDebugger.measureSphere.mergeLocal(vol);
            size = SkeletalDebugger.BONE_RATIO * SkeletalDebugger.measureSphere.getRadius();
        }
        SkeletalDebugger.bone.setWorldTransform(Transform.IDENTITY);
View Full Code Here

Examples of com.ardor3d.bounding.BoundingVolume

     * @param scene
     * @param renderer
     *            the Renderer to draw with.
     */
    private static void drawJoint(final Transform jntTransform, final Spatial scene, final Renderer renderer) {
        final BoundingVolume vol = scene.getWorldBound();
        double size = 1.0;
        if (vol != null) {
            SkeletalDebugger.measureSphere.setCenter(vol.getCenter());
            SkeletalDebugger.measureSphere.setRadius(0);
            SkeletalDebugger.measureSphere.mergeLocal(vol);
            size = SkeletalDebugger.BONE_RATIO * SkeletalDebugger.measureSphere.getRadius();
        }
        scene.getWorldTransform().multiply(jntTransform, SkeletalDebugger.spTransform);
View Full Code Here

Examples of com.jme.bounding.BoundingVolume

        return ret;
    }

    public BoundingVolume getWorldBounds(CellMO cell, BoundingVolume result) {
        SpatialCellImpl spatial = (SpatialCellImpl) universe.getSpatialCell(cell.getCellID());
        BoundingVolume ret;

        // issue #727: if the cell has not yet been added (because the job to
        // add it is scheduled but hasn't run yet), we should gracefully return
        // null here
        if (spatial == null) {
View Full Code Here

Examples of com.jme.bounding.BoundingVolume

        }
    }//GEN-LAST:event_goToButtonActionPerformed

    private CellTransform getGotoLocation(Cell cell) {
        // get the bounds of the cell we are going to
        BoundingVolume bv = cell.getWorldBounds();
        if (isLarge(bv)) {
            // if the cell is big, go to the center rather than very
            // far away
            return cell.getWorldTransform();
        }
View Full Code Here

Examples of com.jme.bounding.BoundingVolume

            ModelCellComponentServerState setup = new ModelCellComponentServerState();
            cellSetup.addComponentServerState(setup);
            cellSetup.setName(importedModel.getWonderlandName());
           
           
            BoundingVolume modelBounds = importedModel.getModelBG().getWorldBound();
            float scale = scaleBounds(modelBounds);
            modelBounds = modelBounds.transform(new Quaternion(), Vector3f.ZERO,
                                                new Vector3f(scale, scale, scale));
           
            cellSetup.setBoundingVolumeHint(new BoundingVolumeHint(false, modelBounds));
            deployedModel.setModelBounds(modelBounds);

            Vector3f offset = importedModel.getRootBG().getLocalTranslation();
            PositionComponentServerState position = new PositionComponentServerState();
            Vector3f boundsCenter = modelBounds.getCenter();

            offset.subtractLocal(boundsCenter);
            deployedModel.setModelTranslation(offset);
            deployedModel.setModelRotation(importedModel.getModelBG().getLocalRotation());
            deployedModel.setModelScale(importedModel.getModelBG().getLocalScale().multLocal(scale));

//            System.err.println("BOUNDS CENTER "+boundsCenter);
//            System.err.println("OFfset "+offset);
//            System.err.println("Cell origin "+boundsCenter);
            position.setTranslation(boundsCenter);

            // The cell bounds already have the rotation and scale applied, so these
            // values must not go in the Cell transform. Instead they go in the
            // deployedModel so that the model is correctly oriented and thus
            // matches the bounds in the cell.

            // Center the worldBounds on the cell (ie 0,0,0)
            BoundingVolume worldBounds = modelBounds.clone(null);
            worldBounds.setCenter(new Vector3f(0,0,0));
            position.setBounds(worldBounds);
            cellSetup.addComponentServerState(position);

            deployedModel.addCellServerState(cellSetup);
View Full Code Here

Examples of com.jme.bounding.BoundingVolume

    }

    public void setLocalTransform(CellTransform transform, Identity identity) {
        acquireRootWriteLock();

        BoundingVolume newWorldBounds = null;

        try {
            this.localTransform = transform;

            if (rootNode!=null) {
View Full Code Here

Examples of com.jme.bounding.BoundingVolume

                this.viewCacheSet = new ViewCacheSet();
                isRoot = true;
                spaces = new HashSet();
            }
               
            BoundingVolume newWorldBounds;
            try {
                acquireRootWriteLock();

                // This node is the root of a graph, so set the world transform & bounds
                newWorldBounds = updateWorldTransform(identity);
View Full Code Here

Examples of com.jme.bounding.BoundingVolume

        super("Rotate");
       
        // Figure out the bounds of the root entity of the cell and create a
        // tube to be just a bit larger than that
        this.sceneRoot = sceneRoot;
        BoundingVolume bounds = sceneRoot.getWorldBound();
        float outerRadius = 0.0f;
        if (bounds instanceof BoundingSphere) {
            innerRadius = ((BoundingSphere) bounds).radius;
            outerRadius = innerRadius + RADIUS_WIDTH;
        }
View Full Code Here

Examples of com.jme.bounding.BoundingVolume

        // To set the scale properly, we need to compute the scale w.r.t the
        // current size of the object as a ratio of the original size of the
        // object (in case the size of the object has changed).
        currentScale = size;
        float scale = 0.0f;
        BoundingVolume bounds = sceneRoot.getWorldBound();
        if (bounds instanceof BoundingSphere) {
            float newInnerRadius = ((BoundingSphere)bounds).radius;
            scale = (newInnerRadius / innerRadius) * currentScale;
        }
        else if (bounds instanceof BoundingBox) {
View Full Code Here

Examples of com.jme.bounding.BoundingVolume

        super("Translate");

        // Figure out the bounds of the root entity of the cell and create an
        // arrow to be just a bit larger than that
        this.sceneRoot = sceneRoot;
        BoundingVolume bounds = sceneRoot.getWorldBound();
        if (bounds instanceof BoundingSphere) {
            extent = ((BoundingSphere)bounds).radius;
        }
        else if (bounds instanceof BoundingBox) {
            float xExtent = ((BoundingBox)bounds).xExtent;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.