/** * 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()); }
@Override public int getGLName() { return this.texture.getGLName(); } }
@Override public int glName() { return this.texture.glName(); } }
NullCheck.notNull(area, "Area"); if (!area.isIncludedIn(t.textureGetArea())) { final String s = String.format( "Target area %s is not included within the texture's area %s", area, t.textureGetArea()); assert s != null; throw new RangeCheckException(s); final int bpp = t.textureGetFormat().getBytesPerPixel(); final long size = width * height * (long) bpp;
NullCheck.notNull(update_area, "Area"); final AreaL texture_area = AreaSizesL.area(t.size()); if (!AreasL.contains(texture_area, update_area)) { final StringBuilder sb = new StringBuilder(128); sb.append(System.lineSeparator()); sb.append(" Texture area: "); sb.append(t.size()); sb.append(System.lineSeparator()); sb.append(" Target area: "); final int bpp = t.format().getBytesPerPixel(); final long size = width * height * (long) bpp;
final AreaL texture_area = AreaSizesL.area(texture.size()); final int height = Math.toIntExact(update_area.height()); final JCGLTextureFormat format = texture.format(); final LWJGL3TextureSpec spec = LWJGL3TextureSpecs.getTextureSpec(format); final ByteBuffer buffer = data.data(); buffer); switch (texture.minificationFilter()) { case TEXTURE_FILTER_LINEAR: case TEXTURE_FILTER_NEAREST:
update_area.isIncludedIn(texture.textureGetArea()), ignored -> "Update area must be included in texture area"); final int width = (int) update_area.getRangeX().getInterval(); final int height = (int) update_area.getRangeY().getInterval(); final JCGLTextureFormat format = texture.textureGetFormat(); final LWJGL3TextureSpec spec = LWJGL3TextureSpecs.getTextureSpec(format); final ByteBuffer buffer = data.getData(); buffer); switch (texture.textureGetMinificationFilter()) { case TEXTURE_FILTER_LINEAR: case TEXTURE_FILTER_NEAREST:
@Override public Unit onTextureCube( final JCGLTextureCubeUsableType t, final JCGLCubeMapFaceLH face) throws JCGLException, UnreachableCodeException { if (LWJGL3Framebuffers.LOG.isDebugEnabled()) { LWJGL3Framebuffers.LOG.debug( "[{}] attach color {} {} (face {})", Integer.valueOf(f_id), Integer.valueOf(index), t, face); } LWJGL3Textures.checkTextureCube(c, t); final JCGLTextureFormat f = t.textureGetFormat(); JCGLTextureFormats.checkColorRenderableTexture2D(f); final int gface = LWJGL3TypeConversions.cubeFaceToGL(face); GL30.glFramebufferTexture2D( GL30.GL_DRAW_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0 + index, gface, t.getGLName(), 0); return Unit.unit(); } });
@Override public Unit onTextureCube( final JCGLTextureCubeUsableType t, final JCGLCubeMapFaceLH face) throws JCGLException, UnreachableCodeException { if (LOG.isDebugEnabled()) { LOG.debug( "[{}] attach color {} {} (face {})", Integer.valueOf(f_id), Integer.valueOf(index), t, face); } LWJGL3Textures.checkTextureCube(c, t); final JCGLTextureFormat f = t.format(); JCGLTextureFormats.checkColorRenderableTexture2D(f); final int gface = LWJGL3TypeConversions.cubeFaceToGL(face); GL30.glFramebufferTexture2D( GL30.GL_DRAW_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0 + index, gface, t.glName(), 0); return Unit.unit(); } });
@Override public Unit onTextureCube( final JCGLTextureCubeUsableType t, final JCGLCubeMapFaceLH face) throws JCGLException, UnreachableCodeException { FakeFramebuffers.LOG.debug( "[{}] attach {} (face {}) at color {}", Integer.valueOf(f_id), t, face, Integer.valueOf(index)); FakeTextures.checkTextureCube(FakeFramebuffers.this.context, t); final JCGLTextureFormat f = t.textureGetFormat(); JCGLTextureFormats.checkColorRenderableTexture2D(f); return Unit.unit(); } });
@Override public Unit onTextureCube( final JCGLTextureCubeUsableType t, final JCGLCubeMapFaceLH face) throws JCGLException, UnreachableCodeException { LOG.debug( "[{}] attach {} (face {}) at color {}", Integer.valueOf(f_id), t, face, Integer.valueOf(index)); FakeTextures.checkTextureCube(FakeFramebuffers.this.context, t); final JCGLTextureFormat f = t.format(); JCGLTextureFormats.checkColorRenderableTexture2D(f); return Unit.unit(); } });
@Override public JCGLTextureCubeUpdateType getTextureUpdateCube( final JCGLTextureCubeUsableType t, final JCGLTLTextureDataType data) { final JCGLTextureCubeUpdateType u = JCGLTextureUpdates.newUpdateReplacingAllCube(t); final int tw = (int) t.textureGetWidth(); final long dw = data.getWidth(); RangeCheck.checkGreaterEqualLong( (long) tw, "Texture size", dw, "Data size"); JCGLTLTextureUpdateProvider.populate( t.textureGetFormat(), data, u.getData(), tw, tw); return u; }
@Override public JCGLTextureCubeUpdateType createTextureUpdateCube( final JCGLTextureCubeUsableType t, final JCGLTLTextureDataType data) { final JCGLTextureCubeUpdateType u = JCGLTextureUpdates.newUpdateReplacingAllCube(t); final int tw = (int) t.width(); final long dw = data.width(); RangeCheck.checkGreaterEqualLong( (long) tw, "Texture size", dw, "Data size"); populate( t.format(), data, u.data(), tw, tw); return u; }
/** * 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())); }
@Override public ByteBuffer textureCubeGetImageLH( final JCGLTextureUnitType unit, final JCGLCubeMapFaceLH face, final JCGLTextureCubeUsableType texture) throws JCGLException { NullCheck.notNull(texture); NullCheck.notNull(face); NullCheck.notNull(unit); LWJGL3Textures.checkTextureUnit(this.context, unit); LWJGL3Textures.checkTextureCube(this.context, texture); final JCGLTextureFormat format = texture.textureGetFormat(); final LWJGL3TextureSpec spec = LWJGL3TextureSpecs.getTextureSpec(format); final AreaInclusiveUnsignedLType area = texture.textureGetArea(); final long width = area.getRangeX().getInterval(); final long height = area.getRangeY().getInterval(); final ByteBuffer data = ByteBuffer.allocateDirect( (int) (width * height * (long) format.getBytesPerPixel())); data.order(ByteOrder.nativeOrder()); final int gface = LWJGL3TypeConversions.cubeFaceToGL(face); this.textureCubeBind(unit, texture); GL11.glGetTexImage( gface, 0, spec.getFormat(), spec.getType(), data); return data; }
@Override public void attachColorTextureCubeAt( final JCGLFramebufferColorAttachmentPointType point, final JCGLFramebufferDrawBufferType buffer, final JCGLTextureCubeUsableType texture, final JCGLCubeMapFaceLH face) { NullCheck.notNull(point); NullCheck.notNull(face); LWJGL3Framebuffers.checkColorAttachmentPoint(this.context, point); LWJGL3Framebuffers.checkDrawBuffer(this.context, buffer); LWJGL3Textures.checkTextureCube(this.context, texture); JCGLTextureFormats.checkColorRenderableTexture2D( texture.textureGetFormat()); this.color_attaches.set( point.colorAttachmentPointGetIndex(), new CubeAttachment(texture, face)); this.draw_buffers.put(buffer, point); }
@Override public void attachColorTextureCubeAt( final JCGLFramebufferColorAttachmentPointType point, final JCGLFramebufferDrawBufferType buffer, final JCGLTextureCubeUsableType texture, final JCGLCubeMapFaceLH face) { NullCheck.notNull(point, "Point"); NullCheck.notNull(face, "Face"); checkColorAttachmentPoint(this.context, point); checkDrawBuffer(this.context, buffer); FakeTextures.checkTextureCube(this.context, texture); JCGLTextureFormats.checkColorRenderableTexture2D( texture.format()); this.color_attaches.set( point.colorAttachmentPointIndex(), new CubeAttachment(texture, face)); this.draw_buffers.put(buffer, point); }
final AreaInclusiveUnsignedLType texture_area = texture.textureGetArea(); final long target_width = target_range_x.getInterval(); final int bpp = texture.textureGetFormat().getBytesPerPixel(); FakeTextures.copyBytes( bpp,