private R2UnitSphere( final JCGLArrayBufferType ab, final JCGLArrayObjectType ao, final JCGLIndexBufferType ib) { this.array_buffer = NullCheck.notNull(ab); this.index_buffer = NullCheck.notNull(ib); this.array_object = NullCheck.notNull(ao); long size = 0L; size += ab.getRange().getInterval(); size += ib.getRange().getInterval(); this.range = new UnsignedRangeInclusiveL(0L, size - 1L); }
private R2UnitQuad( final JCGLArrayObjectType in_array_object, final JCGLArrayBufferType in_array, final JCGLIndexBufferType in_index) { this.array = NullCheck.notNull(in_array); this.array_object = NullCheck.notNull(in_array_object); this.index = NullCheck.notNull(in_index); this.deleted = false; long size = 0L; size += this.array.getRange().getInterval(); size += this.index.getRange().getInterval(); this.range = new UnsignedRangeInclusiveL(0L, size - 1L); }
private R2DebugCube( final JCGLArrayObjectType in_array_object, final JCGLArrayBufferType in_array, final JCGLIndexBufferType in_index) { this.array = NullCheck.notNull(in_array); this.array_object = NullCheck.notNull(in_array_object); this.index = NullCheck.notNull(in_index); this.deleted = false; long size = 0L; size += this.array.getRange().getInterval(); size += this.index.getRange().getInterval(); this.range = new UnsignedRangeInclusiveL(0L, size - 1L); }
private R2UnitCube( final JCGLArrayBufferType ab, final JCGLArrayObjectType ao, final JCGLIndexBufferType ib) { this.array_buffer = NullCheck.notNull(ab); this.index_buffer = NullCheck.notNull(ib); this.array_object = NullCheck.notNull(ao); long size = 0L; size += ab.getRange().getInterval(); size += ib.getRange().getInterval(); this.range = new UnsignedRangeInclusiveL(0L, size - 1L); }
@Test public final void testBufferUpdateAllIdentities() { final JCGLArrayBuffersType ga = this.getArrayBuffers("main"); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLBufferUpdateType<JCGLArrayBufferType> u = JCGLBufferUpdates.newUpdateReplacingAll(a); Assert.assertSame(a, u.getBuffer()); final UnsignedRangeInclusiveL u_range = u.getDataUpdateRange(); final ByteBuffer u_data = u.getData(); Assert.assertEquals(a.getRange(), u_range); Assert.assertEquals(u_range.getInterval(), (long) u_data.capacity()); }
@Test public final void testLoadArrayIndexOK() throws Exception { final JCGLAsyncResourceLoaderType loader = this.getLoader("main"); final CompletableFuture<JCGLAsyncBufferPairType> f = loader.loadArrayIndexBuffers( () -> "Data", (data) -> Long.valueOf(200L), JCGLUsageHint.USAGE_STATIC_DRAW, (data) -> Long.valueOf(100L), JCGLUnsignedType.TYPE_UNSIGNED_BYTE, JCGLUsageHint.USAGE_DYNAMIC_DRAW, (data, array) -> JCGLBufferUpdates.newUpdateReplacingAll(array), (data, index) -> JCGLBufferUpdates.newUpdateReplacingAll(index) ); final JCGLAsyncBufferPairType p = f.get(30L, TimeUnit.SECONDS); final JCGLArrayBufferType a = p.getArrayBuffer(); final JCGLIndexBufferType i = p.getIndexBuffer(); Assert.assertEquals(200L, a.getRange().getInterval()); Assert.assertEquals(JCGLUsageHint.USAGE_STATIC_DRAW, a.getUsageHint()); Assert.assertEquals(100L, i.getRange().getInterval()); Assert.assertEquals(JCGLUnsignedType.TYPE_UNSIGNED_BYTE, i.getType()); Assert.assertEquals(JCGLUsageHint.USAGE_DYNAMIC_DRAW, i.getUsageHint()); }
@Test public final void testArrayAllocateIdentities() { final JCGLArrayBuffersType ga = this.getArrayBuffers("main"); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final UnsignedRangeInclusiveL r = a.getRange(); Assert.assertEquals(0L, r.getLower()); Assert.assertEquals(99L, r.getUpper()); Assert.assertEquals(JCGLUsageHint.USAGE_STATIC_DRAW, a.getUsageHint()); Assert.assertFalse(a.isDeleted()); }
@Test public final void testArrayReallocateIdentities() { final JCGLArrayBuffersType ga = this.getArrayBuffers("main"); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final UnsignedRangeInclusiveL r = a.getRange(); Assert.assertEquals(0L, r.getLower()); Assert.assertEquals(99L, r.getUpper()); Assert.assertEquals(JCGLUsageHint.USAGE_STATIC_DRAW, a.getUsageHint()); Assert.assertFalse(a.isDeleted()); ga.arrayBufferReallocate(a); Assert.assertEquals(0L, r.getLower()); Assert.assertEquals(99L, r.getUpper()); Assert.assertEquals(JCGLUsageHint.USAGE_STATIC_DRAW, a.getUsageHint()); Assert.assertFalse(a.isDeleted()); }
Assert.assertEquals(ci.vertexSize(), ab.getRange().getInterval());
Assert.assertEquals(ci.vertexSize(), ab.getRange().getInterval());
Assert.assertEquals(ci.vertexSize(), ab.getRange().getInterval());
Assert.assertEquals( (long) (type.getSizeBytes() * component_count * vertex_count), array_buffer.getRange().getInterval()); Assert.assertEquals( 3L, index_buffer.getRange().getInterval());