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.
Description
Section titled “Description”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.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
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. |
Methods
Section titled “Methods”Position and size
Section titled “Position and size”| Returns | Signature | Summary |
|---|---|---|
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. |
Queries
Section titled “Queries”| Returns | Signature | Summary |
|---|---|---|
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. |
Actions
Section titled “Actions”| Returns | Signature | Summary |
|---|---|---|
ShaderPassContext | withFrameBuffer(int frameBufferWidth, int frameBufferHeight) | Returns the same context for a framebuffer of frameBufferWidth × frameBufferHeight. |
Creation details
Section titled “Creation details”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.
Method details
Section titled “Method details”double getX()
Returns the left of the area, before the expansion.
double getY()
Returns the top of the area, before the expansion.
getWidth
Section titled “getWidth”double getWidth()
Returns the width of the area, before the expansion.
getHeight
Section titled “getHeight”double getHeight()
Returns the height of the area, before the expansion.
getTexelWidth
Section titled “getTexelWidth”float getTexelWidth()
Returns the width of one texel of the framebuffer, on 1: use it to step by one pixel in a pass.
getTexelHeight
Section titled “getTexelHeight”float getTexelHeight()
Returns the height of one texel of the framebuffer, on 1.
getExpansion
Section titled “getExpansion”double getExpansion()
Returns how far the area grows on each side, in design pixels.
getGrid
Section titled “getGrid”PixelGrid getGrid()
Returns the pixel grid of the screen, which gives the scale from design pixels to screen pixels.
getRegionX
Section titled “getRegionX”double getRegionX()
Returns the left of the rendered region.
getRegionY
Section titled “getRegionY”double getRegionY()
Returns the top of the rendered region.
getRegionWidth
Section titled “getRegionWidth”double getRegionWidth()
Returns the width of the rendered region.
getRegionHeight
Section titled “getRegionHeight”double getRegionHeight()
Returns the height of the rendered region.
getTextureWidth
Section titled “getTextureWidth”int getTextureWidth()
Returns the width of the rendered region, in screen pixels.
getTextureHeight
Section titled “getTextureHeight”int getTextureHeight()
Returns the height of the rendered region, in screen pixels.
getFrameBufferWidth
Section titled “getFrameBufferWidth”int getFrameBufferWidth()
Returns the width of the framebuffer, at least the texture width.
getFrameBufferHeight
Section titled “getFrameBufferHeight”int getFrameBufferHeight()
Returns the height of the framebuffer, at least the texture height.
withFrameBuffer
Section titled “withFrameBuffer”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
