/** * Create a new update that will replace the entirety of one face of {@code * t}. * * @param t The texture * * @return A new update */ public static JCGLTextureCubeUpdateType newUpdateReplacingAllCube( final JCGLTextureCubeUsableType t) { NullCheck.notNull(t); return JCGLTextureUpdates.newUpdateReplacingAreaCube(t, t.textureGetArea()); }
/** * Create a new update that will replace the entirety of one face of {@code * t}. * * @param t The texture * * @return A new update */ public static JCGLTextureCubeUpdateType newUpdateReplacingAllCube( final JCGLTextureCubeUsableType t) { NullCheck.notNull(t, "Texture"); return newUpdateReplacingAreaCube(t, AreaSizesL.area(t.size())); }
@Test public final void testTextureCubeUpdateAreaNonInclusive() { final JCGLTexturesType t = this.getTextures("main"); final List<JCGLTextureUnitType> us = t.textureGetUnits(); final JCGLTextureUnitType u = us.get(0); final JCGLTextureCubeType ta = t.textureCubeAllocate( u, 128L, JCGLTextureFormat.TEXTURE_FORMAT_RGBA_8_4BPP, JCGLTextureWrapR.TEXTURE_WRAP_REPEAT, JCGLTextureWrapS.TEXTURE_WRAP_REPEAT, JCGLTextureWrapT.TEXTURE_WRAP_REPEAT, JCGLTextureFilterMinification.TEXTURE_FILTER_LINEAR, JCGLTextureFilterMagnification.TEXTURE_FILTER_LINEAR); this.expected.expect(RangeCheckException.class); JCGLTextureUpdates.newUpdateReplacingAreaCube( ta, AreasL.create(0L, 0L, 513L, 513L)); }
JCGLTextureUpdates.newUpdateReplacingAreaCube(ta, area); final ByteBuffer data = up.data(); Assert.assertEquals(128L * 128L * 2L, (long) data.capacity());
@Test public final void testTextureCubeUpdateAreaNonInclusive() { final JCGLTexturesType t = this.getTextures("main"); final List<JCGLTextureUnitType> us = t.textureGetUnits(); final JCGLTextureUnitType u = us.get(0); final JCGLTextureCubeType ta = t.textureCubeAllocate( u, 128L, JCGLTextureFormat.TEXTURE_FORMAT_RGBA_8_4BPP, JCGLTextureWrapR.TEXTURE_WRAP_REPEAT, JCGLTextureWrapS.TEXTURE_WRAP_REPEAT, JCGLTextureWrapT.TEXTURE_WRAP_REPEAT, JCGLTextureFilterMinification.TEXTURE_FILTER_LINEAR, JCGLTextureFilterMagnification.TEXTURE_FILTER_LINEAR); this.expected.expect(RangeCheckException.class); JCGLTextureUpdates.newUpdateReplacingAreaCube( ta, AreaInclusiveUnsignedL.of( new UnsignedRangeInclusiveL(0L, 512L), new UnsignedRangeInclusiveL(0L, 512L))); }
JCGLTextureUpdates.newUpdateReplacingAreaCube(ta, area); final ByteBuffer data = up.data(); for (int index = 0; index < data.capacity(); ++index) {
JCGLTextureUpdates.newUpdateReplacingAreaCube(ta, area); final ByteBuffer data = up.data(); Assert.assertEquals(128L * 128L * 3L, (long) data.capacity());
JCGLTextureUpdates.newUpdateReplacingAreaCube(ta, area); final ByteBuffer data = up.getData(); Assert.assertEquals(128L * 128L * 3L, (long) data.capacity());
JCGLTextureUpdates.newUpdateReplacingAreaCube(ta, area); final ByteBuffer data = up.data(); Assert.assertEquals(128L * 128L * 4L, (long) data.capacity());
JCGLTextureUpdates.newUpdateReplacingAreaCube(ta, area); final ByteBuffer data = up.getData(); Assert.assertEquals(128L * 128L * 2L, (long) data.capacity());
JCGLTextureUpdates.newUpdateReplacingAreaCube(ta, area); final ByteBuffer data = up.getData(); for (int index = 0; index < data.capacity(); ++index) {
JCGLTextureUpdates.newUpdateReplacingAreaCube(ta, area); final ByteBuffer data = up.getData(); Assert.assertEquals(128L * 128L * 4L, (long) data.capacity());
@Test public final void testTextureCubeUpdateAreaIdentities() { final JCGLTexturesType t = this.getTextures("main"); final List<JCGLTextureUnitType> us = t.textureGetUnits(); final JCGLTextureUnitType u = us.get(0); final JCGLTextureCubeType ta = t.textureCubeAllocate( u, 512L, JCGLTextureFormat.TEXTURE_FORMAT_R_8_1BPP, JCGLTextureWrapR.TEXTURE_WRAP_REPEAT, 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 JCGLTextureCubeUpdateType up = JCGLTextureUpdates.newUpdateReplacingAreaCube(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.newUpdateReplacingAreaCube(ta, expected_area);