Package java.nio

Examples of java.nio.FloatBuffer.limit()


                }
            }

            final FloatBuffer norms = mesh.getMeshData().getTangentBuffer();
            final FloatBuffer verts = mesh.getMeshData().getVertexBuffer();
            if (norms != null && verts != null && norms.limit() == verts.limit()) {
                FloatBuffer lineVerts = normalLines.getMeshData().getVertexBuffer();
                if (lineVerts.capacity() < (3 * (2 * mesh.getMeshData().getVertexCount()))) {
                    normalLines.getMeshData().setVertexBuffer(null);
                    lineVerts = BufferUtils.createVector3Buffer(mesh.getMeshData().getVertexCount() * 2);
                    normalLines.getMeshData().setVertexBuffer(lineVerts);
View Full Code Here


                    normalLines.getMeshData().setVertexBuffer(null);
                    lineVerts = BufferUtils.createVector3Buffer(mesh.getMeshData().getVertexCount() * 2);
                    normalLines.getMeshData().setVertexBuffer(lineVerts);
                } else {
                    lineVerts.clear();
                    lineVerts.limit(3 * 2 * mesh.getMeshData().getVertexCount());
                    normalLines.getMeshData().setVertexBuffer(lineVerts);
                }

                FloatBuffer lineColors = normalLines.getMeshData().getColorBuffer();
                if (lineColors.capacity() < (4 * (2 * mesh.getMeshData().getVertexCount()))) {
View Full Code Here

            texCrdBuffer = BufferUtils.createVector2Buffer(required);
            getMeshData().setVertexBuffer(vertexBuffer);
            getMeshData().setTextureBuffer(texCrdBuffer, 0);
        }
        vertexBuffer.limit(vertices * 3).rewind();
        texCrdBuffer.limit(vertices * 2).rewind();
    }

    protected float getJustificationXOffset(final int lineIndex) {
        float cursorX = 0;
        switch (_justify) {
View Full Code Here

     *            the FloatBuffer to store the results in, or null if you want one created.
     * @return store or new FloatBuffer if store == null.
     */
    public FloatBuffer getWorldVectors(FloatBuffer store) {
        final FloatBuffer vertBuf = _meshData.getVertexBuffer();
        if (store == null || store.capacity() != vertBuf.limit()) {
            store = BufferUtils.createFloatBuffer(vertBuf.limit());
        }

        final Vector3 compVect = Vector3.fetchTempInstance();
        for (int v = 0, vSize = store.capacity() / 3; v < vSize; v++) {
View Full Code Here

     * @return store or new FloatBuffer if store == null.
     */
    public FloatBuffer getWorldVectors(FloatBuffer store) {
        final FloatBuffer vertBuf = _meshData.getVertexBuffer();
        if (store == null || store.capacity() != vertBuf.limit()) {
            store = BufferUtils.createFloatBuffer(vertBuf.limit());
        }

        final Vector3 compVect = Vector3.fetchTempInstance();
        for (int v = 0, vSize = store.capacity() / 3; v < vSize; v++) {
            BufferUtils.populateFromBuffer(compVect, vertBuf, v);
View Full Code Here

     *            the FloatBuffer to store the results in, or null if you want one created.
     * @return store or new FloatBuffer if store == null.
     */
    public FloatBuffer getWorldNormals(FloatBuffer store) {
        final FloatBuffer normBuf = _meshData.getNormalBuffer();
        if (store == null || store.capacity() != normBuf.limit()) {
            store = BufferUtils.createFloatBuffer(normBuf.limit());
        }

        final Vector3 compVect = Vector3.fetchTempInstance();
        for (int v = 0, vSize = store.capacity() / 3; v < vSize; v++) {
View Full Code Here

     * @return store or new FloatBuffer if store == null.
     */
    public FloatBuffer getWorldNormals(FloatBuffer store) {
        final FloatBuffer normBuf = _meshData.getNormalBuffer();
        if (store == null || store.capacity() != normBuf.limit()) {
            store = BufferUtils.createFloatBuffer(normBuf.limit());
        }

        final Vector3 compVect = Vector3.fetchTempInstance();
        for (int v = 0, vSize = store.capacity() / 3; v < vSize; v++) {
            BufferUtils.populateFromBuffer(compVect, normBuf, v);
View Full Code Here

            _meshData.setColorBuffer(colorBuf);
        } else {
            colorBuf.rewind();
        }

        for (int x = 0, cLength = colorBuf.limit(); x < cLength; x += 4) {
            colorBuf.put(MathUtils.nextRandomFloat());
            colorBuf.put(MathUtils.nextRandomFloat());
            colorBuf.put(MathUtils.nextRandomFloat());
            colorBuf.put(1);
        }
View Full Code Here

            return this;
        }
        int offset = elements.position();
        subArrayCheck(offset, length);
        FloatBuffer copy = elements.duplicate();
        copy.limit(offset + length);
        return new SubMutableFloatBufferArrayImpl(this, copy);
    }

    /**
     * Convenience method, combining {@code offset(int)} and {@code length(int)}.
View Full Code Here

            return this;
        }
        subArrayCheck(newOffset, newLength);
        FloatBuffer copy = elements.duplicate();
        copy.position(newOffset);
        copy.limit(newOffset + newLength);
        return new SubMutableFloatBufferArrayImpl(this, copy);
    }

    @SuppressWarnings({"MissingMethodJavaDoc", "MissingFieldJavaDoc"})
    private class ArrayIteratorImpl implements ArrayIterator.OfFloat {
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.