Package com.ardor3d.math

Examples of com.ardor3d.math.Vector4


    private Voxel addVoxel(int x, int y, int z) {
        if (x>=0 && y>=0 && z>=0 && x<voxelArraySize && y<voxelArraySize && z<voxelArraySize) {
            Voxel voxel = voxels[x][y][z];
            Vector3 vertexPosition = new Vector3(crossingPoint).multiplyLocal(levelScale).addLocal(basePosition);
            Vector4 material = new Vector4(x/32.0f,y/32.0f,z/32.0f,1.0);
            if (voxel == null) {              
                voxels[x][y][z] = new Voxel(vertexPosition,material,voxelCounter);
                voxelCounter++;
            } else {
                voxels[x][y][z].add(vertexPosition,material);
View Full Code Here


    public abstract void drawTo(BufferedImage image, ReadOnlyTransform localTransform, int clipmapLevel);

    public abstract void updateBoundsFromElement();

    public void updateBounds() {
        final Vector4 oldBounds = new Vector4(_awtBounds);
        // update using size of element
        updateBoundsFromElement();

        // So apply transform
        final double x = _awtBounds.getX(), y = _awtBounds.getY(), width = _awtBounds.getZ(), height = _awtBounds
View Full Code Here

        _corners[7].addLocal(-_extents.getX(), -_extents.getY(), -_extents.getZ());

        final ReadOnlyMatrix4 mvMatrix = getModelViewMatrix();
        double optimalCameraNear = Double.MAX_VALUE;
        double optimalCameraFar = -Double.MAX_VALUE;
        final Vector4 position = Vector4.fetchTempInstance();
        for (int i = 0; i < _corners.length; i++) {
            position.set(_corners[i].getX(), _corners[i].getY(), _corners[i].getZ(), 1);
            mvMatrix.applyPre(position, position);

            optimalCameraNear = Math.min(-position.getZ(), optimalCameraNear);
            optimalCameraFar = Math.max(-position.getZ(), optimalCameraFar);
        }
        Vector4.releaseTempInstance(position);

        // XXX: use of getFrustumNear and getFrustumFar seems suspicious...
        // XXX: It depends on the frustum being reset each update
View Full Code Here

     */
    public static Vector4[] getVector4Array(final FloatBuffer buff) {
        buff.clear();
        final Vector4[] verts = new Vector4[buff.limit() / 4];
        for (int x = 0; x < verts.length; x++) {
            final Vector4 v = new Vector4(buff.get(), buff.get(), buff.get(), buff.get());
            verts[x] = v;
        }
        return verts;
    }
View Full Code Here

        final FloatBuffer buff = data.getBuffer();
        buff.clear();
        final Vector4[] verts = new Vector4[data.getTupleCount()];
        final int tupleSize = data.getValuesPerTuple();
        for (int x = 0; x < verts.length; x++) {
            final Vector4 v = new Vector4(defaults);
            v.setX(buff.get());
            if (tupleSize > 1) {
                v.setY(buff.get());
            }
            if (tupleSize > 2) {
                v.setZ(buff.get());
            }
            if (tupleSize > 3) {
                v.setW(buff.get());
            }
            if (tupleSize > 4) {
                buff.position(buff.position() + tupleSize - 4);
            }
            verts[x] = v;
View Full Code Here

     *            the buffer to find the Vector4 within
     * @param index
     *            the position (in terms of vectors, not floats) of the vector to normalize
     */
    public static void normalizeVector4(final FloatBuffer buf, final int index) {
        final Vector4 temp = Vector4.fetchTempInstance();
        populateFromBuffer(temp, buf, index);
        temp.normalizeLocal();
        setInBuffer(temp, buf, index);
        Vector4.releaseTempInstance(temp);
    }
View Full Code Here

     *            the buffer to find the Vector4 within
     * @param index
     *            the position (in terms of vectors, not floats) of the vector to add to
     */
    public static void addInBuffer(final ReadOnlyVector4 toAdd, final FloatBuffer buf, final int index) {
        final Vector4 temp = Vector4.fetchTempInstance();
        populateFromBuffer(temp, buf, index);
        temp.addLocal(toAdd);
        setInBuffer(temp, buf, index);
        Vector4.releaseTempInstance(temp);
    }
View Full Code Here

     *            the buffer to find the Vector3 within
     * @param index
     *            the position (in terms of vectors, not floats) of the vector to multiply
     */
    public static void multInBuffer(final ReadOnlyVector4 toMult, final FloatBuffer buf, final int index) {
        final Vector4 temp = Vector4.fetchTempInstance();
        populateFromBuffer(temp, buf, index);
        temp.multiplyLocal(toMult);
        setInBuffer(temp, buf, index);
        Vector4.releaseTempInstance(temp);
    }
View Full Code Here

     * @param index
     *            the position (in terms of vectors, not floats) of the vector in the buffer to check against
     * @return
     */
    public static boolean equals(final ReadOnlyVector4 check, final FloatBuffer buf, final int index) {
        final Vector4 temp = Vector4.fetchTempInstance();
        populateFromBuffer(temp, buf, index);
        final boolean equals = temp.equals(check);
        Vector4.releaseTempInstance(temp);
        return equals;
    }
View Full Code Here

    public void setEnvPlaneS(final ReadOnlyVector4 plane) {
        if (plane == null) {
            _envPlaneS = null;
            return;
        } else if (_envPlaneS == null) {
            _envPlaneS = new Vector4(plane);
        } else {
            _envPlaneS.set(plane);
        }
    }
View Full Code Here

TOP

Related Classes of com.ardor3d.math.Vector4

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.