Package java.nio

Examples of java.nio.FloatBuffer.clear()


            buff = createFloatBuffer(data.length);
        } else {
            buff = reuseStore;
            buff.clear();
        }
        buff.clear();
        buff.put(data);
        buff.flip();
        return buff;
    }
View Full Code Here


        // Vertex buffer:
        FloatBuffer vertices = mesh.getMeshData().getVertexBuffer();
        if (vertices.capacity() < _splitVerts.length * 3) {
            vertices = BufferUtils.createFloatBuffer(_splitVerts);
        } else {
            vertices.clear();
            for (final Vector3 vertex : _splitVerts) {
                vertices.put((float) vertex.getX()).put((float) vertex.getY()).put((float) vertex.getZ());
            }
            vertices.flip();
        }
View Full Code Here

        // Normal buffer:
        FloatBuffer normals = mesh.getMeshData().getNormalBuffer();
        if (normals == null || normals.capacity() < _splitNormals.length * 3) {
            normals = BufferUtils.createFloatBuffer(_splitNormals);
        } else {
            normals.clear();
            for (final Vector3 normal : _splitNormals) {
                normals.put((float) normal.getX()).put((float) normal.getY()).put((float) normal.getZ());
            }
            normals.flip();
        }
View Full Code Here

        if (_splitColors != null) {
            colors = mesh.getMeshData().getColorBuffer();
            if (colors.capacity() < _splitColors.length * 4) {
                colors = BufferUtils.createFloatBuffer(_splitColors);
            } else {
                colors.clear();
                for (final ColorRGBA color : _splitColors) {
                    colors.put(color.getRed()).put(color.getGreen()).put(color.getBlue()).put(color.getAlpha());
                }
                colors.flip();
            }
View Full Code Here

        if (_splitTexCoords != null) {
            texCoords = mesh.getMeshData().getTextureCoords(0).getBuffer();
            if (texCoords.capacity() < _splitTexCoords.length * 2) {
                texCoords = BufferUtils.createFloatBuffer(_splitTexCoords);
            } else {
                texCoords.clear();
                for (final Vector2 texCoord : _splitTexCoords) {
                    texCoords.put((float) texCoord.getX()).put((float) texCoord.getY());
                }
                texCoords.flip();
            }
View Full Code Here

        quad.getSceneHints().setLightCombineMode(LightCombineMode.Off);
        quad.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
        quad.getSceneHints().setOrthoOrder(-1);

        final FloatBuffer tbuf = quad.getMeshData().getTextureCoords(0).getBuffer();
        tbuf.clear();
        tbuf.put(0).put(0);
        tbuf.put(0).put(maxV);
        tbuf.put(maxU).put(maxV);
        tbuf.put(maxU).put(0);
        tbuf.rewind();
View Full Code Here

                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();
                    lineVerts.limit(3 * 2 * mesh.getMeshData().getVertexCount());
                    normalLines.getMeshData().setVertexBuffer(lineVerts);
                }

                FloatBuffer lineColors = normalLines.getMeshData().getColorBuffer();
View Full Code Here

                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();
                }

                IndexBufferData<?> lineInds = normalLines.getMeshData().getIndices();
                if (lineInds == null || lineInds.getBufferCapacity() < (normalLines.getMeshData().getVertexCount())) {
                    normalLines.getMeshData().setIndices(null);
View Full Code Here

                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();
                    lineVerts.limit(3 * 2 * mesh.getMeshData().getVertexCount());
                    normalLines.getMeshData().setVertexBuffer(lineVerts);
                }

                FloatBuffer lineColors = normalLines.getMeshData().getColorBuffer();
View Full Code Here

                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();
                }

                IndexBufferData<?> lineInds = normalLines.getMeshData().getIndices();
                if (lineInds == null || lineInds.getBufferCapacity() < (normalLines.getMeshData().getVertexCount())) {
                    normalLines.getMeshData().setIndices(null);
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.