Package java.nio

Examples of java.nio.ShortBuffer.limit()


    return direct_buffer;
  }

  private static ShortBuffer doNoCopyWrap(ShortBuffer buffer) {
    ShortBuffer direct_buffer = lookupBuffer(buffer);
    direct_buffer.limit(buffer.limit());
    direct_buffer.position(buffer.position());
    return direct_buffer;
  }

  private static IntBuffer doNoCopyWrap(IntBuffer buffer) {
View Full Code Here


        bcb.limit(vertCount * 4);
        cb.updateData(bcb);

        sib.rewind();
        sib = BufferUtils.ensureLargeEnough(sib, triCount * 3);
        sib.limit(triCount * 3);
        ib.updateData(sib);

        m.updateCounts();

        // go for each quad and append it to the buffers
View Full Code Here

            numOfVertices = g.getVertexCount();
            for (int i = 0; i < lodLevels; i++) {
                boolean isShortBuffer = g.getMesh().getLodLevel(i).getFormat() == VertexBuffer.Format.UnsignedShort;
                if(isShortBuffer){
                    ShortBuffer buffer = (ShortBuffer) g.getMesh().getLodLevel(i).getDataReadOnly();
                    for (int j = 0; j < buffer.limit(); j++) {
                        lodData[i][bufferPos[i]] = (buffer.get()& 0xffff) + indexPos[i];
                        bufferPos[i]++;
                    }
                }else{
                    IntBuffer buffer = (IntBuffer) g.getMesh().getLodLevel(i).getDataReadOnly();
View Full Code Here

                        lodData[i][bufferPos[i]] = (buffer.get()& 0xffff) + indexPos[i];
                        bufferPos[i]++;
                    }
                }else{
                    IntBuffer buffer = (IntBuffer) g.getMesh().getLodLevel(i).getDataReadOnly();
                    for (int j = 0; j < buffer.limit(); j++) {
                        lodData[i][bufferPos[i]] = buffer.get() + indexPos[i];
                        bufferPos[i]++;
                    }
                }
                indexPos[i] += numOfVertices;
View Full Code Here

    @Override
    public IntBuffer asIntBuffer() {
        final ShortBuffer source = getBuffer().duplicate();
        source.rewind();
        final IntBuffer buff = BufferUtils.createIntBufferOnHeap(source.limit());
        for (int i = 0, max = source.limit(); i < max; i++) {
            buff.put(source.get() & 0xFFFF);
        }
        buff.flip();
        return buff;
View Full Code Here

    @Override
    public IntBuffer asIntBuffer() {
        final ShortBuffer source = getBuffer().duplicate();
        source.rewind();
        final IntBuffer buff = BufferUtils.createIntBufferOnHeap(source.limit());
        for (int i = 0, max = source.limit(); i < max; i++) {
            buff.put(source.get() & 0xFFFF);
        }
        buff.flip();
        return buff;
    }
View Full Code Here

            return this;
        }
        int offset = elements.position();
        subArrayCheck(offset, length);
        ShortBuffer copy = elements.duplicate();
        copy.limit(offset + length);
        return new ShortBufferArrayImpl(copy, characteristics, false);
    }

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

            return this;
        }
        subArrayCheck(newOffset, newLength);
        ShortBuffer copy = elements.duplicate();
        copy.position(newOffset);
        copy.limit(newOffset + newLength);
        return new ShortBufferArrayImpl(copy, characteristics, false);
    }

    @SuppressWarnings({"MissingMethodJavaDoc", "MissingFieldJavaDoc"})
    private class ArrayIteratorImpl implements ArrayIterator.OfShort {
View Full Code Here

    @Override
    public MutableShortArray length(int length) {
        int offset = elements.position();
        subArrayCheck(offset, length);
        ShortBuffer copy = elements.duplicate();
        copy.limit(offset + length);
        return new SubBoundedShortBufferArrayImpl(this, copy);
    }

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

        int newOffset = offset + fromIndex;
        int newLength = toIndex - fromIndex;
        subArrayCheck(newOffset, newLength);
        ShortBuffer copy = elements.duplicate();
        copy.position(newOffset);
        copy.limit(newOffset + newLength);
        return new SubBoundedShortBufferArrayImpl(this, copy);
    }

    /**
     * Tells whether or not the array's content is resident in physical memory.
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.