Skip to content

ShaderPassContext

final class ShaderPassContext
Package: dev.joid.lib.shader.pipeline · Module: core · Source: ShaderPassContext.java

What a shader pass needs to know about the area it runs on, the part of it rendered and the framebuffer that holds it.

ShaderPipeline builds it and passes it to IShaderPass.bind. The area is in the coordinates you draw in; the region is the part of the expanded area that is visible on screen, which is what the framebuffer holds.

ReturnsSignatureSummary
ShaderPassContextof(double x, double y, double width, double height, double expansion, double margin, PixelGrid grid) factoryCreates the context of the area at x, y of width × height, grown by expansion design pixels, rendering the part visible on grid plus margin screen pixels.

ReturnsSignatureSummary
doublegetX()Returns the left of the area, before the expansion.
doublegetY()Returns the top of the area, before the expansion.
doublegetWidth()Returns the width of the area, before the expansion.
doublegetHeight()Returns the height of the area, before the expansion.
ReturnsSignatureSummary
floatgetTexelWidth()Returns the width of one texel of the framebuffer, on 1: use it to step by one pixel in a pass.
floatgetTexelHeight()Returns the height of one texel of the framebuffer, on 1.
doublegetExpansion()Returns how far the area grows on each side, in design pixels.
PixelGridgetGrid()Returns the pixel grid of the screen, which gives the scale from design pixels to screen pixels.
doublegetRegionX()Returns the left of the rendered region.
doublegetRegionY()Returns the top of the rendered region.
doublegetRegionWidth()Returns the width of the rendered region.
doublegetRegionHeight()Returns the height of the rendered region.
intgetTextureWidth()Returns the width of the rendered region, in screen pixels.
intgetTextureHeight()Returns the height of the rendered region, in screen pixels.
intgetFrameBufferWidth()Returns the width of the framebuffer, at least the texture width.
intgetFrameBufferHeight()Returns the height of the framebuffer, at least the texture height.
ReturnsSignatureSummary
ShaderPassContextwithFrameBuffer(int frameBufferWidth, int frameBufferHeight)Returns the same context for a framebuffer of frameBufferWidth × frameBufferHeight.

ShaderPassContext of(double x, double y, double width, double height, double expansion, double margin, PixelGrid grid) factory

Creates the context of the area at x, y of width × height, grown by expansion design pixels, rendering the part visible on grid plus margin screen pixels.

double getX()

Returns the left of the area, before the expansion.

double getY()

Returns the top of the area, before the expansion.

double getWidth()

Returns the width of the area, before the expansion.

double getHeight()

Returns the height of the area, before the expansion.

float getTexelWidth()

Returns the width of one texel of the framebuffer, on 1: use it to step by one pixel in a pass.

float getTexelHeight()

Returns the height of one texel of the framebuffer, on 1.

double getExpansion()

Returns how far the area grows on each side, in design pixels.

PixelGrid getGrid()

Returns the pixel grid of the screen, which gives the scale from design pixels to screen pixels.

double getRegionX()

Returns the left of the rendered region.

double getRegionY()

Returns the top of the rendered region.

double getRegionWidth()

Returns the width of the rendered region.

double getRegionHeight()

Returns the height of the rendered region.

int getTextureWidth()

Returns the width of the rendered region, in screen pixels.

int getTextureHeight()

Returns the height of the rendered region, in screen pixels.

int getFrameBufferWidth()

Returns the width of the framebuffer, at least the texture width.

int getFrameBufferHeight()

Returns the height of the framebuffer, at least the texture height.

ShaderPassContext withFrameBuffer(int frameBufferWidth, int frameBufferHeight)

Returns the same context for a framebuffer of frameBufferWidth × frameBufferHeight.


fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses

Report a problem with this page