Class Helios
java.lang.Object
lol.trq.helios.Helios
- All Implemented Interfaces:
AutoCloseable
One Helios instance per GL context: the backend, the host's state cache, shaders, the framebuffer pool and the
renderers. Create it and use it on the render thread, after the context exists.
On Minecraft, MinecraftHelios.create() wires the backend, the
GlStateManager cache and the window size.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intShapes per draw call in the default batch.static final StringClass path location of the bundled font, Inter Regular (SIL Open Font License 1.1).static final StringThe one GLSL version every shader uses: GLSL 4.10 core, for the OpenGL 4.1 core profile.static final StringClass path root of the built-in shaders. -
Method Summary
Modifier and TypeMethodDescriptionstatic SourceResolverReturns the resolver for the shaders inside the Helios jar.voidclose()Deletes every GL object this instance owns.static Helioscreate(GlBackend gl, GlStateCache cache, SurfaceSize surface) Creates an instance with the built-in shaders.static Helioscreate(GlBackend gl, GlStateCache cache, SurfaceSize surface, SourceResolver resolver) Creates an instance with a custom shader source, for example a source directory first for hot reload.static HelioscreateWithHotReload(GlBackend gl, GlStateCache cache, SurfaceSize surface, Path shaderDir) Creates an instance that loads shaders from a source directory first and reloads them when they change.Returns the bundled font, Inter Regular, loading it on first use.effects()Returns the screen effects: blur behind a shape, bloom.Returns the framebuffer pool.gl()Returns the backend.guard()Opens a state guard bound to this instance's backend and cache.meshes()Returns the 3D mesh renderer: coloured quads, anti-aliased lines and textured, lit quads.passes()Returns the full-screen passes: screen capture, blur, compositing, custom passes.Starts a new post-processing chain.scissor()Returns the scissor stack.shaders()Returns the shader loader.shapes()Returns the shape batch.stencil()Returns the stencil clipping helper.text()Returns the text renderer.tick()Per-frame housekeeping: rotates the streamed vertex buffers of the shapes and meshes and polls shader hot reload when it is on.static Stringversion()Returns the library version from the jar manifest.
-
Field Details
-
GLSL_VERSION
The one GLSL version every shader uses: GLSL 4.10 core, for the OpenGL 4.1 core profile.- See Also:
-
SHADER_ROOT
-
DEFAULT_FONT
Class path location of the bundled font, Inter Regular (SIL Open Font License 1.1).- See Also:
-
BATCH_CAPACITY
public static final int BATCH_CAPACITYShapes per draw call in the default batch.- See Also:
-
-
Method Details
-
create
Creates an instance with the built-in shaders.- Parameters:
gl- the backendcache- the host's state cachesurface- the window framebuffer size- Returns:
- the instance
-
create
public static Helios create(GlBackend gl, GlStateCache cache, SurfaceSize surface, SourceResolver resolver) Creates an instance with a custom shader source, for example a source directory first for hot reload.- Parameters:
gl- the backendcache- the host's state cachesurface- the window framebuffer sizeresolver- where shader sources come from; must provide the built-in ones- Returns:
- the instance
-
createWithHotReload
public static Helios createWithHotReload(GlBackend gl, GlStateCache cache, SurfaceSize surface, Path shaderDir) Creates an instance that loads shaders from a source directory first and reloads them when they change. Calltick()once per frame. For development only.- Parameters:
gl- the backendcache- the host's state cachesurface- the window framebuffer sizeshaderDir- a copy of the shader sources, laid out likeSHADER_ROOT- Returns:
- the instance
-
tick
Per-frame housekeeping: rotates the streamed vertex buffers of the shapes and meshes and polls shader hot reload when it is on. Call it once per frame, after the frame's Helios drawing.- Returns:
- what hot reload did, or a result with nothing reloaded
-
builtinShaders
Returns the resolver for the shaders inside the Helios jar.- Returns:
- the resolver
-
guard
Opens a state guard bound to this instance's backend and cache.- Returns:
- a new guard; close it when the draw ends
-
gl
-
shaders
-
meshes
Returns the 3D mesh renderer: coloured quads, anti-aliased lines and textured, lit quads.- Returns:
- the renderer
-
framebuffers
-
shapes
-
passes
Returns the full-screen passes: screen capture, blur, compositing, custom passes.- Returns:
- the passes
-
effects
Returns the screen effects: blur behind a shape, bloom.- Returns:
- the effects
-
scissor
-
stencil
-
text
-
defaultFont
Returns the bundled font, Inter Regular, loading it on first use.- Returns:
- the font
-
postChain
-
version
Returns the library version from the jar manifest.- Returns:
- the version, or
"dev"when running from classes outside a jar
-
close
public void close()Deletes every GL object this instance owns.- Specified by:
closein interfaceAutoCloseable
-