Package com.ardor3d.bounding

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


     * @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

        if (element instanceof Mesh && element.getSceneHints().getCullHint() != CullHint.Always) {
            final Mesh mesh = (Mesh) element;

            double rSize = size;
            if (rSize == -1) {
                final BoundingVolume vol = element.getWorldBound();
                if (vol != null) {
                    measureBox.setCenter(vol.getCenter());
                    measureBox.setXExtent(0);
                    measureBox.setYExtent(0);
                    measureBox.setZExtent(0);
                    measureBox.mergeLocal(vol);
                    rSize = AUTO_NORMAL_RATIO
View Full Code Here

        if (element instanceof Mesh && element.getSceneHints().getCullHint() != CullHint.Always) {
            final Mesh mesh = (Mesh) element;

            double rSize = size;
            if (rSize == -1) {
                final BoundingVolume vol = element.getWorldBound();
                if (vol != null) {
                    measureBox.setCenter(vol.getCenter());
                    measureBox.setXExtent(0);
                    measureBox.setYExtent(0);
                    measureBox.setZExtent(0);
                    measureBox.mergeLocal(vol);
                    rSize = AUTO_NORMAL_RATIO
View Full Code Here

        }

        if (drawAll || (spat instanceof Mesh)) {
            if (spat.getWorldBound() != null) {
                double rSize;
                final BoundingVolume vol = spat.getWorldBound();
                if (vol != null) {
                    measureBox.setCenter(vol.getCenter());
                    measureBox.setXExtent(0);
                    measureBox.setYExtent(0);
                    measureBox.setZExtent(0);
                    measureBox.mergeLocal(vol);
                    rSize = 1 * ((measureBox.getXExtent() + measureBox.getYExtent() + measureBox.getZExtent()) / 3);
View Full Code Here

     *
     * @see com.ardor3d.scenegraph.Spatial#updateWorldBound(boolean)
     */
    @Override
    public void updateWorldBound(final boolean recurse) {
        BoundingVolume worldBound = null;
        for (int i = getNumberOfChildren() - 1; i >= 0; i--) {
            final Spatial child = _children.get(i);
            if (child != null) {
                if (recurse) {
                    child.updateWorldBound(true);
                }
                if (worldBound != null) {
                    // merge current world bound with child world bound
                    worldBound.mergeLocal(child.getWorldBound());

                    // simple check to catch NaN issues
                    if (!Vector3.isValid(worldBound.getCenter())) {
                        throw new Ardor3dException("WorldBound center is invalid after merge between " + this + " and "
                                + child);
                    }
                } else {
                    // set world bound to first non-null child world bound
View Full Code Here

                    _cam.getFrustumRight(), _cam.getFrustumTop(), _cam.getFrustumBottom());
            _tRenderer.getCamera().setFrame(_cam.getLocation(), _cam.getLeft(), _cam.getUp(), _cam.getDirection());
        }

        if (_doUpdate && (!_haveDrawn || shouldDoUpdate(_cam)) && _targetScene.getWorldBound() != null) {
            final BoundingVolume b = _targetScene.getWorldBound();
            _center.set(b.getCenter());

            updateCameraLookat();

            calculateImposter();
View Full Code Here

            _targetScene.updateGeometricState(time, false);
        }
    }

    private void calculateImposter() {
        final BoundingVolume worldBound = _targetScene.getWorldBound();
        _center.set(worldBound.getCenter());

        for (int i = 0; i < _corners.length; i++) {
            _corners[i].set(_center);
        }
View Full Code Here

        manager.getBaseAnimationLayer().setCurrentState("anim_state", true);
    }

    private void positionCamera(final ReadOnlyVector3 upAxis) {
        colladaNode.updateGeometricState(0.0);
        final BoundingVolume bounding = colladaNode.getWorldBound();
        if (bounding != null) {
            final ReadOnlyVector3 center = bounding.getCenter();
            double radius = 0;
            if (bounding instanceof BoundingSphere) {
                radius = ((BoundingSphere) bounding).getRadius();
            } else if (bounding instanceof BoundingBox) {
                final BoundingBox boundingBox = (BoundingBox) bounding;
View Full Code Here

        _root.attachChild(frameRateLabel);
    }

    private void positionCamera() {
        colladaNode.updateGeometricState(0.0);
        final BoundingVolume bounding = colladaNode.getWorldBound();
        if (bounding != null) {
            final ReadOnlyVector3 center = bounding.getCenter();
            double radius = 0;
            if (bounding instanceof BoundingSphere) {
                radius = ((BoundingSphere) bounding).getRadius();
            } else if (bounding instanceof BoundingBox) {
                final BoundingBox boundingBox = (BoundingBox) bounding;
View Full Code Here

TOP

Related Classes of com.ardor3d.bounding.BoundingVolume

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.