當前位置: 首頁>>代碼示例>>Java>>正文


Java FloatBuffer.remaining方法代碼示例

本文整理匯總了Java中java.nio.FloatBuffer.remaining方法的典型用法代碼示例。如果您正苦於以下問題:Java FloatBuffer.remaining方法的具體用法?Java FloatBuffer.remaining怎麽用?Java FloatBuffer.remaining使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.nio.FloatBuffer的用法示例。


在下文中一共展示了FloatBuffer.remaining方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ensureLargeEnough

import java.nio.FloatBuffer; //導入方法依賴的package包/類
/**
 * Ensures there is at least the <code>required</code> number of entries left after the current position of the
 * buffer. If the buffer is too small a larger one is created and the old one copied to the new buffer.
 * @param buffer buffer that should be checked/copied (may be null)
 * @param required minimum number of elements that should be remaining in the returned buffer
 * @return a buffer large enough to receive at least the <code>required</code> number of entries, same position as
 * the input buffer, not null
 */
public static FloatBuffer ensureLargeEnough(FloatBuffer buffer, int required) {
    if (buffer != null) {
        buffer.limit(buffer.capacity());
    }
    if (buffer == null || (buffer.remaining() < required)) {
        int position = (buffer != null ? buffer.position() : 0);
        FloatBuffer newVerts = createFloatBuffer(position + required);
        if (buffer != null) {
            buffer.flip();
            newVerts.put(buffer);
            newVerts.position(position);
        }
        buffer = newVerts;
    }
    return buffer;
}
 
開發者ID:asiermarzo,項目名稱:Ultraino,代碼行數:25,代碼來源:BufferUtils.java

示例2: byteArrayToFloatArray

import java.nio.FloatBuffer; //導入方法依賴的package包/類
private float[] byteArrayToFloatArray(byte[] byteArray) {
	 FloatBuffer floatBuf =
			   ByteBuffer.wrap(byteArray)
			     .order(ByteOrder.LITTLE_ENDIAN)
			     .asFloatBuffer();
			 float[] array = new float[floatBuf.remaining()];
			 floatBuf.get(array);
	return array;
}
 
開發者ID:shenan4321,項目名稱:BIMplatform,代碼行數:10,代碼來源:GeometryInfoVo.java

示例3: glBufferStorage

import java.nio.FloatBuffer; //導入方法依賴的package包/類
public static void glBufferStorage(int target, FloatBuffer data, int flags) {
    org.lwjgl.opengl.ARBBufferStorage.glBufferStorage(target, data, flags);
    if (Properties.PROFILE.enabled) {
        Context ctx = CURRENT_CONTEXT.get();
        BufferObject bo = ctx.bufferObjectBindings.get(target);
        if (bo != null) {
            bo.size = data != null ? data.remaining() << 2 : 0L;
        }
    }
}
 
開發者ID:LWJGLX,項目名稱:debug,代碼行數:11,代碼來源:ARBBufferStorage.java

示例4: glBufferDataARB

import java.nio.FloatBuffer; //導入方法依賴的package包/類
public static void glBufferDataARB(int target, FloatBuffer data, int usage) {
    org.lwjgl.opengl.ARBVertexBufferObject.glBufferDataARB(target, data, usage);
    if (Properties.PROFILE.enabled) {
        Context ctx = CURRENT_CONTEXT.get();
        BufferObject bo = ctx.bufferObjectBindings.get(target);
        if (bo != null) {
            bo.size = data != null ? data.remaining() << 2 : 0L;
        }
    }
}
 
開發者ID:LWJGLX,項目名稱:debug,代碼行數:11,代碼來源:ARBVertexBufferObject.java

示例5: glBufferStorage

import java.nio.FloatBuffer; //導入方法依賴的package包/類
public static void glBufferStorage(int target, FloatBuffer data, int flags) {
    org.lwjgl.opengl.GL44.glBufferStorage(target, data, flags);
    if (Properties.PROFILE.enabled) {
        Context ctx = CURRENT_CONTEXT.get();
        BufferObject bo = ctx.bufferObjectBindings.get(target);
        if (bo != null) {
            bo.size = data != null ? data.remaining() << 2 : 0L;
        }
    }
}
 
開發者ID:LWJGLX,項目名稱:debug,代碼行數:11,代碼來源:GL44.java

示例6: glBufferData

import java.nio.FloatBuffer; //導入方法依賴的package包/類
public static void glBufferData(int target, FloatBuffer data, int usage) {
    org.lwjgl.opengl.GL15.glBufferData(target, data, usage);
    if (Properties.PROFILE.enabled) {
        Context ctx = CURRENT_CONTEXT.get();
        BufferObject bo = ctx.bufferObjectBindings.get(target);
        if (bo != null) {
            bo.size = data != null ? data.remaining() << 2 : 0L;
        }
    }
}
 
開發者ID:LWJGLX,項目名稱:debug,代碼行數:11,代碼來源:GL15.java

示例7: containAABB

import java.nio.FloatBuffer; //導入方法依賴的package包/類
/**
 * <code>containAABB</code> creates a minimum-volume axis-aligned bounding
 * box of the points, then selects the smallest enclosing sphere of the box
 * with the sphere centered at the boxes center.
 * 
 * @param points
 *            the list of points.
 */
public void containAABB(FloatBuffer points) {
    if (points == null) {
        return;
    }

    points.rewind();
    if (points.remaining() <= 2) // we need at least a 3 float vector
    {
        return;
    }

    TempVars vars = TempVars.get();
    
    float[] tmpArray = vars.skinPositions;

    float minX = Float.POSITIVE_INFINITY, minY = Float.POSITIVE_INFINITY, minZ = Float.POSITIVE_INFINITY;
    float maxX = Float.NEGATIVE_INFINITY, maxY = Float.NEGATIVE_INFINITY, maxZ = Float.NEGATIVE_INFINITY;
    
    int iterations = (int) M.ceil(points.limit() / ((float) tmpArray.length));
    for (int i = iterations - 1; i >= 0; i--) {
        int bufLength = Math.min(tmpArray.length, points.remaining());
        points.get(tmpArray, 0, bufLength);

        for (int j = 0; j < bufLength; j += 3) {
            vars.vect1.x = tmpArray[j];
            vars.vect1.y = tmpArray[j+1];
            vars.vect1.z = tmpArray[j+2];
            
            if (vars.vect1.x < minX) {
                minX = vars.vect1.x;
            }
            if (vars.vect1.x > maxX) {
                maxX = vars.vect1.x;
            }

            if (vars.vect1.y < minY) {
                minY = vars.vect1.y;
            }
            if (vars.vect1.y > maxY) {
                maxY = vars.vect1.y;
            }

            if (vars.vect1.z < minZ) {
                minZ = vars.vect1.z;
            }
            if (vars.vect1.z > maxZ) {
                maxZ = vars.vect1.z;
            }
        }
    }

    vars.release();

    center.set(minX + maxX, minY + maxY, minZ + maxZ);
    center.multLocal(0.5f);

    xExtent = maxX - center.x;
    yExtent = maxY - center.y;
    zExtent = maxZ - center.z;
}
 
開發者ID:asiermarzo,項目名稱:Ultraino,代碼行數:69,代碼來源:BoundingBox.java


注:本文中的java.nio.FloatBuffer.remaining方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。