@Override public ByteBuffer indexBufferRead( final JCGLIndexBufferUsableType i, final JCGLByteBufferProducerType f) throws JCGLException, JCGLExceptionDeleted, JCGLExceptionBufferNotBound { NullCheck.notNull(i); this.checkIndexBuffer(i); final JCGLArrayObjectUsableType ao = this.array_objects.arrayObjectGetCurrentlyBound(); final Optional<JCGLIndexBufferUsableType> i_opt = ao.getIndexBufferBound(); if (i_opt.isPresent()) { final JCGLIndexBufferUsableType current_ib = i_opt.get(); if (i.equals(current_ib)) { final long size = i.getRange().getInterval(); final ByteBuffer b = f.apply(size); GL15.glGetBufferSubData(GL15.GL_ELEMENT_ARRAY_BUFFER, 0L, b); return b; } } throw LWJGL3IndexBuffers.notBound(i, i_opt); }
@Override public ByteBuffer indexBufferRead( final JCGLIndexBufferUsableType i, final JCGLByteBufferProducerType f) throws JCGLException, JCGLExceptionDeleted, JCGLExceptionBufferNotBound { NullCheck.notNull(i, "Index buffer"); this.checkIndexBuffer(i); final JCGLArrayObjectUsableType ao = this.array_objects.arrayObjectGetCurrentlyBound(); final Optional<JCGLIndexBufferUsableType> i_opt = ao.indexBufferBound(); if (i_opt.isPresent()) { final JCGLIndexBufferUsableType current_ib = i_opt.get(); if (Objects.equals(i, current_ib)) { final long size = i.byteRange().getInterval(); final ByteBuffer b = f.apply(size); GL15.glGetBufferSubData(GL15.GL_ELEMENT_ARRAY_BUFFER, 0L, b); return b; } } throw notBound(i, i_opt); }
@Override public ByteBuffer arrayBufferRead( final JCGLArrayBufferUsableType a, final JCGLByteBufferProducerType f) throws JCGLException, JCGLExceptionDeleted, JCGLExceptionBufferNotBound { NullCheck.notNull(a, "Array"); this.checkArray(a); if (Objects.equals(a, this.bind)) { final UnsignedRangeInclusiveL r = a.byteRange(); final long size = r.getInterval(); final ByteBuffer b = f.apply(size); b.rewind(); final FakeArrayBuffer fa = (FakeArrayBuffer) a; final ByteBuffer fa_data = fa.getData(); /* * XXX: Clearly overflowing integers. */ final long lo = r.getLower(); final long hi = r.getUpper(); for (long index = lo; Long.compareUnsigned(index, hi) <= 0; ++index) { final int ii = (int) index; final byte x = fa_data.get(ii); b.put(ii, x); } return b; } throw this.notBound(a); }
@Override public ByteBuffer arrayBufferRead( final JCGLArrayBufferUsableType a, final JCGLByteBufferProducerType f) throws JCGLException, JCGLExceptionDeleted, JCGLExceptionBufferNotBound { NullCheck.notNull(a); this.checkArray(a); if (a.equals(this.bind)) { final UnsignedRangeInclusiveL r = a.getRange(); final long size = r.getInterval(); final ByteBuffer b = f.apply(size); b.rewind(); final FakeArrayBuffer fa = (FakeArrayBuffer) a; final ByteBuffer fa_data = fa.getData(); /** * XXX: Clearly overflowing integers. */ final long lo = r.getLower(); final long hi = r.getUpper(); for (long index = lo; Long.compareUnsigned(index, hi) <= 0; ++index) { final int ii = (int) index; final byte x = fa_data.get(ii); b.put(ii, x); } return b; } throw this.notBound(a); }
final UnsignedRangeInclusiveL r = i.getRange(); final long size = r.getInterval(); final ByteBuffer b = f.apply(size); b.rewind(); final FakeIndexBuffer fa = (FakeIndexBuffer) i;
@Override public ByteBuffer arrayBufferRead( final JCGLArrayBufferUsableType a, final JCGLByteBufferProducerType f) throws JCGLException, JCGLExceptionDeleted, JCGLExceptionBufferNotBound { NullCheck.notNull(a, "Array buffer"); NullCheck.notNull(f, "Buffer producer"); this.checkArray(a); if (Objects.equals(a, this.bind)) { final long size = a.byteRange().getInterval(); final ByteBuffer b = f.apply(size); GL15.glGetBufferSubData(GL15.GL_ARRAY_BUFFER, 0L, b); return b; } throw this.notBound(a); }
final UnsignedRangeInclusiveL r = i.byteRange(); final long size = r.getInterval(); final ByteBuffer b = f.apply(size); b.rewind(); final FakeIndexBuffer fa = (FakeIndexBuffer) i;
@Override public ByteBuffer arrayBufferRead( final JCGLArrayBufferUsableType a, final JCGLByteBufferProducerType f) throws JCGLException, JCGLExceptionDeleted, JCGLExceptionBufferNotBound { NullCheck.notNull(a); NullCheck.notNull(f); this.checkArray(a); if (a.equals(this.bind)) { final long size = a.getRange().getInterval(); final ByteBuffer b = f.apply(size); GL15.glGetBufferSubData(GL15.GL_ARRAY_BUFFER, 0L, b); return b; } throw this.notBound(a); }