Package com.ardor3d.math

Examples of com.ardor3d.math.Vector3


        // check if this example worries about input at all
        if (_logicalLayer == null) {
            return;
        }

        _controlHandle = FirstPersonControl.setupTriggers(_logicalLayer, new Vector3(0, 1, 0), true);


        _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ESCAPE), new TriggerAction()                       {

            public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) {
View Full Code Here


     *         src.eval.
     */
    public static Function3D rotateInput(final Function3D source, final ReadOnlyMatrix3 rotation) {
        return new Function3D() {
            public double eval(final double x, final double y, final double z) {
                final Vector3 temp = Vector3.fetchTempInstance();
                temp.set(x, y, z);
                rotation.applyPost(temp, temp);
                final double val = source.eval(temp.getX(), temp.getY(), temp.getZ());
                Vector3.releaseTempInstance(temp);
                return val;
            }
        };
    }
View Full Code Here

        // find which integer based unit cube we're in
        final int ix = (int) MathUtils.floor(dx), iy = (int) MathUtils.floor(dy), iz = (int) MathUtils.floor(dz);

        final Key k = new Key();
        final Vector3 minPoint = new Vector3();
        double nearestSq = Double.MAX_VALUE;
        // Each cube has a point... Walk through all nearby cubes and see where our closest point lies.
        for (int a = ix - SEARCH_RADIUS; a <= ix + SEARCH_RADIUS; a++) {
            k.x = a;
            for (int b = iy - SEARCH_RADIUS; b <= iy + SEARCH_RADIUS; b++) {
                k.y = b;
                for (int c = iz - SEARCH_RADIUS; c <= iz + SEARCH_RADIUS; c++) {
                    k.z = c;
                    Vector3 point = _points.get(k);
                    if (point == null) {
                        final double pX = a + point(a, b, c, _seed);
                        final double pY = b + point(a, b, c, _seed + 1);
                        final double pZ = c + point(a, b, c, _seed + 2);
                        point = new Vector3(pX, pY, pZ);
                        // cache for future lookups
                        _points.put(new Key(k), point);
                    }
                    final double xDist = point.getX() - dx;
                    final double yDist = point.getY() - dy;
                    final double zDist = point.getZ() - dz;
                    final double distSq = xDist * xDist + yDist * yDist + zDist * zDist;

                    // check distance
                    if (distSq < nearestSq) {
                        nearestSq = distSq;
View Full Code Here

            /** Set up how our camera sees. */
            _camera = new Camera(settings.getWidth(), settings.getHeight());
            _camera.setFrustumPerspective(45.0f, (float) settings.getWidth() / (float) settings.getHeight(), 1, 1000);
            _camera.setProjectionMode(ProjectionMode.Perspective);

            final Vector3 loc = new Vector3(0.0f, 0.0f, 10.0f);
            final Vector3 left = new Vector3(-1.0f, 0.0f, 0.0f);
            final Vector3 up = new Vector3(0.0f, 1.0f, 0.0f);
            final Vector3 dir = new Vector3(0.0f, 0f, -1.0f);
            /** Move our camera to a correct place and orientation. */
            _camera.setFrame(loc, left, up, dir);
        } else {
            // use new width and height to set ratio.
            _camera.setFrustumPerspective(_camera.getFovY(),
View Full Code Here

        _camera = new Camera(width, _settings.getHeight());
        _camera.setFrustumPerspective(45.0f, (float) width / (float) _settings.getHeight(), 1, 1000);
        _camera.setProjectionMode(ProjectionMode.Perspective);

        // setup camera orientation and position.
        final Vector3 loc = new Vector3(0.0f, 0.0f, 0.0f);
        final Vector3 left = new Vector3(-1.0f, 0.0f, 0.0f);
        final Vector3 up = new Vector3(0.0f, 1.0f, 0.0f);
        final Vector3 dir = new Vector3(0.0f, 0f, -1.0f);
        _camera.setFrame(loc, left, up, dir);

        // release our FBO(s) until used.
        EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, 0);
    }
View Full Code Here

        this.length = length;
        this.startRadius = startRadius;
        this.endRadius = endRadius;
       
        this.startPoint = position.getTranslation();
        this.endPoint = new Vector3 (0,length,0);
        position.applyPost(endPoint, endPoint);
       
        //position.invert(this.transform);
        transform.set(position);
       
View Full Code Here

        return true;
    }

    @Override
    public Vector3 getLowerBound() {
        return new Vector3(
                Math.min(startPoint.getX() - startRadius, endPoint.getX() - endRadius),
                Math.min(startPoint.getY() - startRadius, endPoint.getY() - endRadius),
                Math.min(startPoint.getZ() - startRadius, endPoint.getZ() - endRadius) );
    }
View Full Code Here

                Math.min(startPoint.getZ() - startRadius, endPoint.getZ() - endRadius) );
    }

    @Override
    public Vector3 getUpperBound() {
        return new Vector3(
                Math.max(startPoint.getX() + startRadius, endPoint.getX() + endRadius),
                Math.max(startPoint.getY() + startRadius, endPoint.getY() + endRadius),
                Math.max(startPoint.getZ() + startRadius, endPoint.getZ() + endRadius) );
    }
View Full Code Here

        super.attachAdditionalNonVoxelModels(level, block);
    }

    public float getDensity(ReadOnlyVector3 point, LayerBlock layerBlock, int lx, int ly, int lz, DetailLevel level) {
       
        Vector3 pointLocal = transform.applyPost(point, null);

        double y = pointLocal.getY();
        double x = pointLocal.getX();
        double z = pointLocal.getZ();
       
        double localRadius;
        double distance;
       
        if (y <= 0) {
View Full Code Here

        voxelPoolContainer.update(camera);
    }
   
    protected void initCamera(Camera camera) {
        camera.setLocation(new Vector3(32, 40, 32));
        camera.lookAt(new Vector3(64, 40, 64), Vector3.UNIT_Y);
        camera.setFrustumPerspective(70.0, (float) camera.getWidth() / camera.getHeight(), 1.0f, FAR_PLANE);
    }
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.