Package com.ardor3d.math

Examples of com.ardor3d.math.Vector3.subtractLocal()


    }

    public Vector3 computeVoxelNormal(int x, int y, int z, ReadOnlyVector3 position) {
       
        Vector3 local = new Vector3(position);
        local.subtractLocal(basePosition);
        local.divideLocal(pool.getLevel().getScale());
        try {
            float d000 = densities[x][y][z];
            float d100 = densities[x + 1][y][z];
            float d010 = densities[x][y + 1][z];
View Full Code Here


        double scale = level.getScale();
        int blockSize = VoxelWorld.BLOCK_SIZE;

        if (hasBoundingBox()) {
            Vector3 lower = getLowerBound();
            lower.subtractLocal(basePosition);
            Vector3 upper = getUpperBound();
            upper.subtractLocal(basePosition);
            minX = Math.max(0,(int)Math.floor(lower.getX() / scale));
            minY = Math.max(0,(int)Math.floor(lower.getY() / scale));
            minZ = Math.max(0,(int)Math.floor(lower.getZ() / scale));
View Full Code Here

        if (hasBoundingBox()) {
            Vector3 lower = getLowerBound();
            lower.subtractLocal(basePosition);
            Vector3 upper = getUpperBound();
            upper.subtractLocal(basePosition);
            minX = Math.max(0,(int)Math.floor(lower.getX() / scale));
            minY = Math.max(0,(int)Math.floor(lower.getY() / scale));
            minZ = Math.max(0,(int)Math.floor(lower.getZ() / scale));
            maxX = Math.min(blockSize+1,(int)Math.ceil(upper.getX() / scale));
            maxY = Math.min(blockSize+1,(int)Math.ceil(upper.getY() / scale));
View Full Code Here

        if (moveFB != 0 || strafeLR != 0) {
            final Vector3 loc = _workerStoreA.zero();
            if (moveFB == 1) {
                loc.addLocal(camera.getDirection());
            } else if (moveFB == -1) {
                loc.subtractLocal(camera.getDirection());
            }
            if (strafeLR == 1) {
                loc.addLocal(camera.getLeft());
            } else if (strafeLR == -1) {
                loc.subtractLocal(camera.getLeft());
View Full Code Here

                loc.subtractLocal(camera.getDirection());
            }
            if (strafeLR == 1) {
                loc.addLocal(camera.getLeft());
            } else if (strafeLR == -1) {
                loc.subtractLocal(camera.getLeft());
            }
            loc.normalizeLocal().multiplyLocal(_moveSpeed * tpf).addLocal(camera.getLocation());
            camera.setLocation(loc);
        }

View Full Code Here

            if (first.getVnIndex() == -1 || second.getVnIndex() == -1 || third.getVnIndex() == -1) {
                // Generate flat face normal.
                final Vector3 v = new Vector3(_dataStore.getVertices().get(second.getVIndex()));
                final Vector3 w = new Vector3(_dataStore.getVertices().get(third.getVIndex()));
                v.subtractLocal(_dataStore.getVertices().get(first.getVIndex()));
                w.subtractLocal(_dataStore.getVertices().get(first.getVIndex()));
                v.crossLocal(w);
                v.normalizeLocal();
                _dataStore.getGeneratedNormals().add(v);
                final int genIndex = -1 * (_dataStore.getGeneratedNormals().size() - 1) - 2;
                if (first.getVnIndex() == -1) {
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.