本文整理汇总了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;
}
示例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;
}
示例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;
}
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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;
}