Package java.nio

Examples of java.nio.FloatBuffer.flip()


            buff = reuseStore;
            buff.clear();
        }
        buff.clear();
        buff.put(data);
        buff.flip();
        return buff;
    }

    public static IntBuffer createIntBuffer(final IntBuffer reuseStore, final int... data) {
        if (data == null) {
View Full Code Here


        } else {
            vertices.clear();
            for (final Vector3 vertex : _splitVerts) {
                vertices.put((float) vertex.getX()).put((float) vertex.getY()).put((float) vertex.getZ());
            }
            vertices.flip();
        }

        // Normal buffer:
        FloatBuffer normals = mesh.getMeshData().getNormalBuffer();
        if (normals == null || normals.capacity() < _splitNormals.length * 3) {
View Full Code Here

        } else {
            normals.clear();
            for (final Vector3 normal : _splitNormals) {
                normals.put((float) normal.getX()).put((float) normal.getY()).put((float) normal.getZ());
            }
            normals.flip();
        }

        // Color buffer:
        FloatBuffer colors = null;
        if (_splitColors != null) {
View Full Code Here

            } else {
                colors.clear();
                for (final ColorRGBA color : _splitColors) {
                    colors.put(color.getRed()).put(color.getGreen()).put(color.getBlue()).put(color.getAlpha());
                }
                colors.flip();
            }
        }

        // Tex coord buffer:
        FloatBuffer texCoords = null;
View Full Code Here

            } else {
                texCoords.clear();
                for (final Vector2 texCoord : _splitTexCoords) {
                    texCoords.put((float) texCoord.getX()).put((float) texCoord.getY());
                }
                texCoords.flip();
            }
        }

        // Index buffer:
        IndexBufferData<?> indices = mesh.getMeshData().getIndices();
View Full Code Here

            if (size > 0) {
                final String[] strings = tmpEl.getAttribute("data").split("\\s+");
                for (final String s : strings) {
                    tmp.put(Float.parseFloat(s));
                }
                tmp.flip();
            }
            ret = tmp;
        } catch (final Exception e) {
            final IOException ex = new IOException();
            ex.initCause(e);
View Full Code Here

        matrixBuffer.clear();
        for (final ReadOnlyMatrix4 value : values) {
            value.toFloatBuffer(matrixBuffer);
        }
        matrixBuffer.flip();

        // prepare buffer for reading
        shaderUniform.rowMajor = rowMajor;

        setNeedsRefresh(true);
View Full Code Here

            colorBuf.put(color.getRed());
            colorBuf.put(color.getGreen());
            colorBuf.put(color.getBlue());
            colorBuf.put(color.getAlpha());
        }
        colorBuf.flip();
    }

    /**
     * Sets every color of this geometry's color array to a random color.
     */
 
View Full Code Here

            colorBuf.put(MathUtils.nextRandomFloat());
            colorBuf.put(MathUtils.nextRandomFloat());
            colorBuf.put(MathUtils.nextRandomFloat());
            colorBuf.put(1);
        }
        colorBuf.flip();
    }

    // PICKABLE INTERFACE

    @Override
View Full Code Here

            new float[] { 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f });
        FloatBuffer listenerVel = BufferUtils.createFloatBuffer(3).put(
            new float[] { 0.0f, 0.0f, 0.0f });
        FloatBuffer listenerPos = BufferUtils.createFloatBuffer(3).put(
            new float[] { 0.0f, 0.0f, 0.0f });
        listenerPos.flip();
        listenerVel.flip();
        listenerOri.flip();
        AL10.alListener(AL10.AL_POSITION, listenerPos);
        AL10.alListener(AL10.AL_VELOCITY, listenerVel);
        AL10.alListener(AL10.AL_ORIENTATION, listenerOri);
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.