Package java.nio

Examples of java.nio.FloatBuffer.clear()


    return buffer.order() == ByteOrder.LITTLE_ENDIAN ? buffers.float_buffer_little : buffers.float_buffer_big;
  }

  private static FloatBuffer doWrap(FloatBuffer buffer) {
    FloatBuffer direct_buffer = lookupBuffer(buffer);
    direct_buffer.clear();
    int saved_position = buffer.position();
    direct_buffer.put(buffer);
    buffer.position(saved_position);
    direct_buffer.flip();
    return direct_buffer;
View Full Code Here


    glShadeModel(GL_SMOOTH);

    final FloatBuffer vectorBuffer = BufferUtils.createFloatBuffer(4);

    vectorBuffer.clear();
    vectorBuffer.put(0, 1.0f).put(1, 1.0f).put(2, 1.0f).put(3, 1.0f);
    glLight(GL_LIGHT0, GL_DIFFUSE, vectorBuffer);

    vectorBuffer.put(0, 1.0f).put(1, 1.0f).put(2, 1.0f).put(3, 1.0f);
    glLight(GL_LIGHT0, GL_AMBIENT, vectorBuffer);
View Full Code Here

    TriangleBatch batch = getBatch(0);

    FloatBuffer texs = BufferUtils.createVector2Buffer(batch
        .getTextureBuffers().get(0), batch.getVertexCount());
    batch.getTextureBuffers().set(0, texs);
    texs.clear();

    batch.getVertexBuffer().rewind();
    float firstX = -1.0f;
    float firstY = -1.0f;
    for (int i = 0; i < batch.getVertexCount(); i++) {
View Full Code Here

    //setting to default value just to show
    waterEffectRenderPass.setWaterPlane( new Plane( new Vector3f( 0.0f, 1.0f, 0.0f ), 0.0f ) );

    waterQuad = new Quad( "waterQuad", 1, 1 );
    FloatBuffer normBuf = waterQuad.getNormalBuffer( 0 );
    normBuf.clear();
    normBuf.put( 0 ).put( 1 ).put( 0 );
    normBuf.put( 0 ).put( 1 ).put( 0 );
    normBuf.put( 0 ).put( 1 ).put( 0 );
    normBuf.put( 0 ).put( 1 ).put( 0 );
View Full Code Here

    fpsNode.setRenderQueueMode( Renderer.QUEUE_OPAQUE );
  }

  private void setVertexCoords( float x, float y, float z ) {
    FloatBuffer vertBuf = waterQuad.getVertexBuffer( 0 );
    vertBuf.clear();

    vertBuf.put( x - farPlane ).put( y ).put( z - farPlane );
    vertBuf.put( x - farPlane ).put( y ).put( z + farPlane );
    vertBuf.put( x + farPlane ).put( y ).put( z + farPlane );
    vertBuf.put( x + farPlane ).put( y ).put( z - farPlane );
View Full Code Here

    x *= textureScale * 0.5f;
    y *= textureScale * 0.5f;
    textureScale = farPlane * textureScale;
    FloatBuffer texBuf;
    texBuf = waterQuad.getTextureBuffer( 0, buffer );
    texBuf.clear();
    texBuf.put( x ).put( textureScale + y );
    texBuf.put( x ).put( y );
    texBuf.put( textureScale + x ).put( y );
    texBuf.put( textureScale + x ).put( textureScale + y );
  }
View Full Code Here

        // Create a quad to use as geometry for the water.
        waterQuad = new Quad("waterQuad", 1, 1);
        // Hack the quad normals to point up in the y-axis. Since we are manipulating the vertices as
        // we move this is more convenient than rotating the quad.
        final FloatBuffer normBuf = waterQuad.getMeshData().getNormalBuffer();
        normBuf.clear();
        normBuf.put(0).put(1).put(0);
        normBuf.put(0).put(1).put(0);
        normBuf.put(0).put(1).put(0);
        normBuf.put(0).put(1).put(0);
View Full Code Here

        update(timer.getTimePerFrame());
    }

    private void setVertexCoords(final float x, final float y, final float z) {
        final FloatBuffer vertBuf = waterQuad.getMeshData().getVertexBuffer();
        vertBuf.clear();

        vertBuf.put(x - quadHalfSize).put(y).put(z - quadHalfSize);
        vertBuf.put(x - quadHalfSize).put(y).put(z + quadHalfSize);
        vertBuf.put(x + quadHalfSize).put(y).put(z + quadHalfSize);
        vertBuf.put(x + quadHalfSize).put(y).put(z - quadHalfSize);
View Full Code Here

        x *= textureScale * 0.5f;
        y *= textureScale * 0.5f;
        textureScale = quadHalfSize * textureScale;
        FloatBuffer texBuf;
        texBuf = waterQuad.getMeshData().getTextureBuffer(buffer);
        texBuf.clear();
        texBuf.put((float) x).put((float) (textureScale + y));
        texBuf.put((float) x).put((float) y);
        texBuf.put((float) (textureScale + x)).put((float) y);
        texBuf.put((float) (textureScale + x)).put((float) (textureScale + y));
    }
View Full Code Here

        up.getNormal();
        float minNormalY = (float)Math.cos(Math.abs(maxSlope)/180 * Math.PI);

        IndexBuffer ib = mesh.getIndexBuffer();
        FloatBuffer pb = mesh.getFloatBuffer(Type.Position);
        pb.clear();
        for (int i = 0; i < mesh.getTriangleCount()*3; i+=3){
          total++;
            int i1 = ib.get(i+0);
            int i2 = ib.get(i+1);
            int i3 = ib.get(i+2);
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.