List of usage examples for java.nio FloatBuffer limit
public final int limit()
From source file:Main.java
public static FloatBuffer createVector4Buffer(final FloatBuffer buf, final int vertices) { if (buf != null && buf.limit() == 4 * vertices) { buf.rewind();/*ww w . j a va 2s . co m*/ return buf; } return createFloatBuffer(4 * vertices); }
From source file:Main.java
public static FloatBuffer createVector3Buffer(final FloatBuffer buf, final int vertices) { if (buf != null && buf.limit() == 3 * vertices) { buf.rewind();/*from www .j a v a 2s.com*/ return buf; } return createFloatBuffer(3 * vertices); }
From source file:Main.java
public static FloatBuffer createVector4Buffer(final FloatBuffer buf, final int vertices) { if (buf != null && buf.limit() == SIZEOF_FLOAT * vertices) { buf.rewind();//from w w w . j av a2 s . c o m return buf; } return createFloatBuffer(SIZEOF_FLOAT * vertices); }
From source file:Main.java
public static FloatBuffer createVector2Buffer(final FloatBuffer buf, final int vertices) { if (buf != null && buf.limit() == 2 * vertices) { buf.rewind();/*from ww w .jav a 2 s. c o m*/ return buf; } return createFloatBuffer(2 * vertices); }
From source file:Main.java
public static FloatBuffer createFloatBuffer(FloatBuffer buffer, int start, int end) { final float[] inds = new float[buffer.limit()]; for (int x = start - 1; x < end - 1; x++) { inds[x] = buffer.get();//from w ww . j av a 2 s . c om } return createFloatBuffer(inds); }
From source file:Main.java
public static FloatBuffer createFloatBuffer(FloatBuffer buf, int start, int end) { final float[] inds = new float[buf.limit()]; for (int x = start - 1; x < end - 1; x++) { inds[x] = buf.get();/*from w ww. j av a 2 s . c o m*/ } return createFloatBuffer(inds); }
From source file:Main.java
/** * Create a new float[] array and populate it with the given FloatBuffer's * contents./*ww w . j a v a2 s . c o m*/ * * @param buff * the FloatBuffer to read from * @return a new float array populated from the FloatBuffer */ public static float[] getFloatArray(FloatBuffer buff) { if (buff == null) { return null; } buff.clear(); float[] inds = new float[buff.limit()]; for (int x = 0; x < inds.length; x++) { inds[x] = buff.get(); } return inds; }
From source file:Main.java
public static float[] getFloatArray(final FloatBuffer buff) { if (buff == null) { return null; }/* w w w . ja v a2 s .c om*/ buff.clear(); final float[] inds = new float[buff.limit()]; for (int x = 0; x < inds.length; x++) { inds[x] = buff.get(); } return inds; }
From source file:Main.java
public static FloatBuffer clone(final FloatBuffer buf) { if (buf == null) { return null; }/*w w w.j a v a 2s .c om*/ buf.rewind(); final FloatBuffer copy; if (buf.isDirect()) { copy = createFloatBuffer(buf.limit()); } else { copy = createFloatBufferOnHeap(buf.limit()); } copy.put(buf); return copy; }
From source file:Main.java
public static FloatBuffer clone(final FloatBuffer buf) { if (buf == null) { return null; }/*from w w w . j av a2 s. c o m*/ buf.rewind(); final FloatBuffer copy; if (buf.isDirect()) { copy = createFloatBuffer(buf.limit()); } else { copy = createFloatBufferOnHeap(buf.limit()); } copy.put(buf); return copy; }