/** * Create a new update that will replace the entirety of {@code t}. * * @param t The texture * * @return A new update */ public static JCGLTexture2DUpdateType newUpdateReplacingAll2D( final JCGLTexture2DUsableType t) { NullCheck.notNull(t); return JCGLTextureUpdates.newUpdateReplacingArea2D(t, t.textureGetArea()); }
/** * Create a new update that will replace the entirety of {@code t}. * * @param t The texture * * @return A new update */ public static JCGLTexture2DUpdateType newUpdateReplacingAll2D( final JCGLTexture2DUsableType t) { NullCheck.notNull(t, "Texture"); return newUpdateReplacingArea2D(t, AreaSizesL.area(t.size())); }
@Test public final void testTexture2DUpdateAreaNonInclusive() { final JCGLTexturesType t = this.getTextures("main"); final List<JCGLTextureUnitType> us = t.textureGetUnits(); final JCGLTextureUnitType u = us.get(0); final JCGLTexture2DType ta = t.texture2DAllocate( u, 128L, 256L, JCGLTextureFormat.TEXTURE_FORMAT_RGBA_8_4BPP, JCGLTextureWrapS.TEXTURE_WRAP_REPEAT, JCGLTextureWrapT.TEXTURE_WRAP_REPEAT, JCGLTextureFilterMinification.TEXTURE_FILTER_LINEAR, JCGLTextureFilterMagnification.TEXTURE_FILTER_LINEAR); this.expected.expect(RangeCheckException.class); JCGLTextureUpdates.newUpdateReplacingArea2D( ta, AreasL.create(0L, 0L, 513L, 513L)); }
JCGLTextureUpdates.newUpdateReplacingArea2D(ta, area); final ByteBuffer data = up.data(); Assert.assertEquals(128L * 128L * 2L, (long) data.capacity());
JCGLTextureUpdates.newUpdateReplacingArea2D( this.texture, AreaInclusiveUnsignedL.of(
@Test public final void testTexture2DUpdateAreaNonInclusive() { final JCGLTexturesType t = this.getTextures("main"); final List<JCGLTextureUnitType> us = t.textureGetUnits(); final JCGLTextureUnitType u = us.get(0); final JCGLTexture2DType ta = t.texture2DAllocate( u, 128L, 256L, JCGLTextureFormat.TEXTURE_FORMAT_RGBA_8_4BPP, JCGLTextureWrapS.TEXTURE_WRAP_REPEAT, JCGLTextureWrapT.TEXTURE_WRAP_REPEAT, JCGLTextureFilterMinification.TEXTURE_FILTER_LINEAR, JCGLTextureFilterMagnification.TEXTURE_FILTER_LINEAR); this.expected.expect(RangeCheckException.class); JCGLTextureUpdates.newUpdateReplacingArea2D( ta, AreaInclusiveUnsignedL.of( new UnsignedRangeInclusiveL(0L, 512L), new UnsignedRangeInclusiveL(0L, 512L))); }
JCGLTextureUpdates.newUpdateReplacingArea2D(ta, area); final ByteBuffer data = up.data(); Assert.assertEquals(128L * 128L * 4L, (long) data.capacity());
JCGLTextureUpdates.newUpdateReplacingArea2D( this.texture, AreaL.of(16L, 32L, 16L, 32L));
JCGLTextureUpdates.newUpdateReplacingArea2D(ta, area); final ByteBuffer data = up.data(); Assert.assertEquals(128L * 128L * 3L, (long) data.capacity());
JCGLTextureUpdates.newUpdateReplacingArea2D(ta, area); final ByteBuffer data = up.data(); for (int index = 0; index < data.capacity(); ++index) {
JCGLTextureUpdates.newUpdateReplacingArea2D(ta, area); final ByteBuffer data = up.getData(); Assert.assertEquals(128L * 128L * 2L, (long) data.capacity());
JCGLTextureUpdates.newUpdateReplacingArea2D(ta, area); final ByteBuffer data = up.getData(); Assert.assertEquals(128L * 128L * 3L, (long) data.capacity());
JCGLTextureUpdates.newUpdateReplacingArea2D(ta, area); final ByteBuffer data = up.getData(); for (int index = 0; index < data.capacity(); ++index) {
JCGLTextureUpdates.newUpdateReplacingArea2D(ta, area); final ByteBuffer data = up.getData(); Assert.assertEquals(128L * 128L * 4L, (long) data.capacity());
@Test public final void testTexture2DUpdateAreaIdentities() { final JCGLTexturesType t = this.getTextures("main"); final List<JCGLTextureUnitType> us = t.textureGetUnits(); final JCGLTextureUnitType u = us.get(0); final JCGLTexture2DType ta = t.texture2DAllocate( u, 512L, 512L, JCGLTextureFormat.TEXTURE_FORMAT_R_8_1BPP, JCGLTextureWrapS.TEXTURE_WRAP_REPEAT, JCGLTextureWrapT.TEXTURE_WRAP_REPEAT, JCGLTextureFilterMinification.TEXTURE_FILTER_LINEAR, JCGLTextureFilterMagnification.TEXTURE_FILTER_LINEAR); final AreaL expected_area = AreasL.create(128L, 128L, 128L, 128L); final JCGLTexture2DUpdateType up = JCGLTextureUpdates.newUpdateReplacingArea2D(ta, expected_area); Assert.assertEquals(ta, up.texture()); Assert.assertEquals(expected_area, up.area()); final ByteBuffer data = up.data(); final long expected_size = 128L * 128L; Assert.assertEquals(expected_size, (long) data.capacity()); final UnsignedRangeInclusiveL expected_range = new UnsignedRangeInclusiveL(0L, expected_size - 1L); Assert.assertEquals(expected_range, up.dataUpdateRange()); }
JCGLTextureUpdates.newUpdateReplacingArea2D(ta, expected_area);