Package com.ardor3d.math

Examples of com.ardor3d.math.Vector3


    private final Vector3 _boundsExtents = new Vector3();

    @Override
    public void updateWorldBound(final boolean recurse) {
        final BoundingBox worldBound = (BoundingBox) _worldBound;
        final Vector3 center = _boundsCenter.set(_terrainCamera.getLocation());
        final double distanceToEdge = _clipSideSize * MathUtils.pow2(_clips.size() - 1) * 0.5;
        final double heightScale = _clips.get(0).getHeightScale();
        final double heightMin = _clips.get(0).getHeightRangeMin() * heightScale;
        final double heightMax = _clips.get(0).getHeightRangeMax() * heightScale;

        final Vector3 extents = _boundsExtents.set(distanceToEdge, (heightMax - heightMin) * 0.5, distanceToEdge);
        worldToLocal(center, center);
        worldBound.setXExtent(extents.getX());
        worldBound.setYExtent(extents.getY());
        worldBound.setZExtent(extents.getZ());
        worldBound.setCenter(center.getX(), (heightMax + heightMin) * 0.5, center.getZ());
        worldBound.transform(_worldTransform, worldBound);
        clearDirty(DirtyType.Bounding);
    }
View Full Code Here


    }

    @Override
    public IntersectionRecord intersectsPrimitivesWhere(final Ray3 ray) {
        if (_picker != null) {
            final Vector3 normalStore = new Vector3();
            final Vector3 intersect = _picker.getTerrainIntersection(getWorldTransform(), _terrainCamera.getLocation(),
                    ray, null, normalStore);
            if (intersect != null) {
                final double distance = intersect.distance(ray.getOrigin());
                final IntersectionRecord record = new IntersectionRecord(new double[] { distance },
                        new Vector3[] { intersect }, new Vector3[] { normalStore }, null);
                return record;
            }
        }
View Full Code Here

        }
        return 0;
    }

    public float getHeightAt(final double x, final double z) {
        final Vector3 heightCalc = new Vector3(x, 0, z);
        worldToLocal(heightCalc, heightCalc);
        final float height = getClipmaps().get(0).getCache().getSubHeight(heightCalc.getXf(), heightCalc.getZf());
        heightCalc.set(x, height, z);
        localToWorld(heightCalc, heightCalc);
        return heightCalc.getYf();
    }
View Full Code Here

            _rotations[i++] = new Quaternion(q);
        }
        _translations = new ReadOnlyVector3[translations.length];
        i = 0;
        for (final ReadOnlyVector3 v : translations) {
            _translations[i++] = new Vector3(v);
        }
        _scales = new ReadOnlyVector3[scales.length];
        i = 0;
        for (final ReadOnlyVector3 v : scales) {
            _scales[i++] = new Vector3(v);
        }
    }
View Full Code Here

            if (!transform.isRotationMatrix()) {
                TransformChannel.logger.warning("TransformChannel '" + channelName
                        + "' supplied transform with non-rotational matrices.  May have unexpected results.");
            }
            _rotations[i] = new Quaternion().fromRotationMatrix(transform.getMatrix()).normalizeLocal();
            _translations[i] = new Vector3(transform.getTranslation());
            _scales[i] = new Vector3(transform.getScale());
        }
    }
View Full Code Here

        if (tData == null) {
            tData = new TransformData();
        }

        double weight, scaleX = 0.0, scaleY = 0.0, scaleZ = 0.0, transX = 0.0, transY = 0.0, transZ = 0.0;
        Vector3 vectorData;

        weight = 1 - blendWeight;

        vectorData = getTranslation();
        transX += vectorData.getX() * weight;
        transY += vectorData.getY() * weight;
        transZ += vectorData.getZ() * weight;

        vectorData = getScale();
        scaleX += vectorData.getX() * weight;
        scaleY += vectorData.getY() * weight;
        scaleZ += vectorData.getZ() * weight;

        weight = blendWeight;

        vectorData = blendTo.getTranslation();
        transX += vectorData.getX() * weight;
        transY += vectorData.getY() * weight;
        transZ += vectorData.getZ() * weight;

        vectorData = blendTo.getScale();
        scaleX += vectorData.getX() * weight;
        scaleY += vectorData.getY() * weight;
        scaleZ += vectorData.getZ() * weight;

        tData.setScale(scaleX, scaleY, scaleZ);
        tData.setTranslation(transX, transY, transZ);
        Quaternion.slerp(_rotation, blendTo.getRotation(), weight, tData._rotation);
        return tData;
View Full Code Here

        return this.getClass();
    }

    public void write(final OutputCapsule capsule) throws IOException {
        capsule.write(_rotation, "rotation", new Quaternion(Quaternion.IDENTITY));
        capsule.write(_scale, "scale", new Vector3(Vector3.ONE));
        capsule.write(_translation, "translation", new Vector3(Vector3.ZERO));
    }
View Full Code Here

        capsule.write(_translation, "translation", new Vector3(Vector3.ZERO));
    }

    public void read(final InputCapsule capsule) throws IOException {
        setRotation((Quaternion) capsule.readSavable("rotation", new Quaternion(Quaternion.IDENTITY)));
        setScale((Vector3) capsule.readSavable("scale", new Vector3(Vector3.ONE)));
        setTranslation((Vector3) capsule.readSavable("rotation", new Vector3(Vector3.ZERO)));
    }
View Full Code Here

        // Draw our text, if we have any
        if (_uiText != null) {
            final String text = getText();
            if (text.length() > 0) {
                // set our text location
                final Vector3 v = Vector3.fetchTempInstance();
                // note: we round to get the text pixel aligned... otherwise it can get blurry
                v.set(Math.round(x), Math.round(y), 0);
                final Transform t = Transform.fetchTempInstance();
                t.set(getWorldTransform());
                t.applyForwardVector(v);
                t.translate(v);
                Vector3.releaseTempInstance(v);
View Full Code Here

    @Override
    public void draw(final Renderer renderer, final UIComponent comp) {

        final float pAlpha = UIComponent.getCurrentOpacity();

        final Vector3 v = Vector3.fetchTempInstance();
        v.set(comp.getMargin().getLeft() + comp.getBorder().getLeft(), comp.getMargin().getBottom()
                + comp.getBorder().getBottom(), 0);

        final Transform t = Transform.fetchTempInstance();
        t.set(comp.getWorldTransform());
        t.applyForwardVector(v);
View Full Code Here

TOP

Related Classes of com.ardor3d.math.Vector3

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.