Package java.nio

Examples of java.nio.FloatBuffer.capacity()


        final FloatBuffer verts = BufferUtils.createVector3Buffer((100 / majorHBar) * 2);

        final float div = texHeight * majorHBar / 100f;

        for (int y = 0, i = 0; i < verts.capacity(); i += 6, y += div) {
            verts.put(0).put(y).put(0);
            verts.put(texWidth).put(y).put(0);
        }

        _horizontals = new Line("horiz", verts, null, null, null);
View Full Code Here


            final FloatBuffer norms = mesh.getMeshData().getNormalBuffer();
            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);
                } else {
                    lineVerts.clear();
View Full Code Here

                    lineVerts.limit(3 * 2 * mesh.getMeshData().getVertexCount());
                    normalLines.getMeshData().setVertexBuffer(lineVerts);
                }

                FloatBuffer lineColors = normalLines.getMeshData().getColorBuffer();
                if (lineColors.capacity() < (4 * (2 * mesh.getMeshData().getVertexCount()))) {
                    normalLines.getMeshData().setColorBuffer(null);
                    lineColors = BufferUtils.createColorBuffer(mesh.getMeshData().getVertexCount() * 2);
                    normalLines.getMeshData().setColorBuffer(lineColors);
                } else {
                    lineColors.clear();
View Full Code Here

            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);
                } else {
                    lineVerts.clear();
View Full Code Here

                    lineVerts.limit(3 * 2 * mesh.getMeshData().getVertexCount());
                    normalLines.getMeshData().setVertexBuffer(lineVerts);
                }

                FloatBuffer lineColors = normalLines.getMeshData().getColorBuffer();
                if (lineColors.capacity() < (4 * (2 * mesh.getMeshData().getVertexCount()))) {
                    normalLines.getMeshData().setColorBuffer(null);
                    lineColors = BufferUtils.createColorBuffer(mesh.getMeshData().getVertexCount() * 2);
                    normalLines.getMeshData().setColorBuffer(lineColors);
                } else {
                    lineColors.clear();
View Full Code Here

        final FloatBuffer verts = BufferUtils.createVector3Buffer((100 / majorHBar) * 2);

        final float div = texHeight * majorHBar / 100f;

        for (int y = 0, i = 0; i < verts.capacity(); i += 6, y += div) {
            verts.put(0).put(y).put(0);
            verts.put(texWidth).put(y).put(0);
        }

        _horizontals = new Line("horiz", verts, null, null, null);
View Full Code Here

     */
    public void setUniform(final String name, final ReadOnlyMatrix4[] values, final boolean rowMajor) {
        final ShaderVariableMatrix4Array shaderUniform = getShaderUniform(name, ShaderVariableMatrix4Array.class);
        // prepare buffer for writing
        FloatBuffer matrixBuffer = shaderUniform.matrixBuffer;
        if (matrixBuffer == null || matrixBuffer.capacity() < values.length * 16) {
            matrixBuffer = BufferUtils.createFloatBuffer(values.length * 16);
            shaderUniform.matrixBuffer = matrixBuffer;
        }

        matrixBuffer.clear();
View Full Code Here

        array.setAll(FloatArray.unsafeValueOf());
        assertArrayEquals(new float[]{}, array.toArray(), 0);
        assertEquals(0, array.length());
        assertEquals(offset, array.offset());
        FloatBuffer buffer = array.buffer();
        buffer.rewind().limit(buffer.capacity());
        while (buffer.hasRemaining()) {
            assertEquals(0, buffer.get(), 0);
        }
    }
View Full Code Here

        }
        assertArrayEquals(new float[]{}, array.toArray(), 0);
        assertEquals(0, array.length());
        assertEquals(offset, array.offset());
        FloatBuffer buffer = array.buffer();
        buffer.rewind().limit(buffer.capacity());
        while (buffer.hasRemaining()) {
            assertEquals(0, buffer.get(), 0);
        }
    }
View Full Code Here

        array.clear();
        assertArrayEquals(new float[]{}, array.toArray(), 0);
        assertEquals(0, array.length());
        assertEquals(offset, array.offset());
        FloatBuffer buffer = array.buffer();
        buffer.rewind().limit(buffer.capacity());
        while (buffer.hasRemaining()) {
            assertEquals(0, buffer.get(), 0);
        }
    }
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.