WorldRenderEnvironment

Context representing the rendering environment.

Parameters

renderTarget

The render target framebuffer.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val camera: Camera
Link copied to clipboard
val poseStack: PoseStack
Link copied to clipboard
val renderTarget: RenderTarget

Functions

Link copied to clipboard
inline fun batch(block: WorldRenderEnvironment.() -> Unit)

Temporarily switches the environment to batch mode.

Link copied to clipboard
fun WorldRenderEnvironment.drawBox(box: AABB, faceColor: Color4b? = Color4b.TRANSPARENT, outlineColor: Color4b? = Color4b.TRANSPARENT, faceVertices: Int = -1, outlineVertices: Int = -1)

Function to draw a colored box.

Link copied to clipboard
fun WorldRenderEnvironment.drawBoxSide(box: AABB, side: Direction, faceColor: Color4b? = Color4b.TRANSPARENT, outlineColor: Color4b? = Color4b.TRANSPARENT)

Function to draw a colored box with specified side.

Link copied to clipboard
fun WorldRenderEnvironment.drawBoxSides(box: AABB, sides: Iterable<Direction>, faceColor: Color4b? = Color4b.TRANSPARENT, outlineColor: Color4b? = Color4b.TRANSPARENT)

Function to draw a colored box with specified sides.

Link copied to clipboard
Link copied to clipboard
fun WorldRenderEnvironment.drawCircleOutline(radius: Float, color: Color4b, noDepthTest: Boolean = true)

Function to draw the outline of a circle of the size radius

Link copied to clipboard
inline fun WorldRenderEnvironment.drawCustomMesh(pipeline: RenderPipeline, textures: Map<String, AbstractTexture> = emptyMap(), uniforms: Map<String, GpuBufferSlice> = emptyMap(), drawer: VertexConsumer.(PoseStack.Pose) -> Unit)

Preferred mesh draw helper for world rendering code.

Link copied to clipboard
inline fun WorldRenderEnvironment.drawCustomMeshTextured(sampler0: AbstractTexture, pipeline: RenderPipeline = ClientRenderPipelines.TexQuads, uniforms: Map<String, GpuBufferSlice> = emptyMap(), drawer: VertexConsumer.(PoseStack.Pose) -> Unit)

Variant of drawCustomMesh that binds sampler0 as Sampler0.

Link copied to clipboard
fun WorldRenderEnvironment.drawGradientCircle(outerRadius: Float, innerRadius: Float, outerColor: Color4b, innerColor: Color4b, innerOffset: Vector3fc = Vector3f(), noDepthTest: Boolean = true)

Function to draw a circle of the size outerRadius with a cutout of size innerRadius

Link copied to clipboard
fun WorldRenderEnvironment.drawGradientSides(height: Double, baseColor: Color4b, topColor: Color4b, box: AABB)
Link copied to clipboard
fun WorldRenderEnvironment.drawLegacy2DMarker(pos: Vec3, entityHeight: Double, scale: Float, foregroundArgb: Int, backgroundArgb: Int)
Link copied to clipboard

Draws a line with endpoint p1 and p2 and color argb.

Link copied to clipboard
fun WorldRenderEnvironment.drawLines(argb: Int, vararg positions: Vec3f)

Function to draw lines using the specified positions vectors.

Link copied to clipboard
fun WorldRenderEnvironment.drawLineStrip(argb: Int, vararg positions: Vec3f)

Function to draw a line strip using the specified positions vectors.

Link copied to clipboard

Function to draw a 'line strip' using the specified positions vectors, actual pipeline is ClientRenderPipelines.Lines.

Link copied to clipboard
fun WorldRenderEnvironment.drawLinesWithWidth(argb: Int, width: Float, vararg positions: Vec3f)

Draws lines with width. Modern GL doesn't support glLineWidth well, so draw with shader simulation.

Link copied to clipboard
fun WorldRenderEnvironment.drawPlane(sizeX: Float, sizeZ: Float, fillColor: Color4b? = Color4b.TRANSPARENT, outlineColor: Color4b? = Color4b.TRANSPARENT)

Function to draw a flat plane on the XZ axis with an optional outline.

Link copied to clipboard
fun WorldRenderEnvironment.drawSquareTexture(sampler0: AbstractTexture, size: Float, argb: Int)
Link copied to clipboard
fun WorldRenderEnvironment.drawTexQuad(sampler0: AbstractTexture, argb: Int)
Link copied to clipboard
Link copied to clipboard
fun finish(consumer: VertexConsumer, submit: Boolean = true)

Low-level completion for a VertexConsumer obtained from start.

Link copied to clipboard
inline fun immediate(block: WorldRenderEnvironment.() -> Unit)

Temporarily switches the environment to immediate mode.

Link copied to clipboard

Disables GL11C.GL_LINE_SMOOTH if HAS_AMD_VEGA_APU.

Link copied to clipboard
fun relativeToCamera(pos: Vec3f): Vec3
fun relativeToCamera(pos: Position): Vec3
fun relativeToCamera(pos: Vec3i): Vec3

Converts a world-space position to the camera-relative coordinate system.

Link copied to clipboard
fun start(pipeline: RenderPipeline, textures: Map<String, AbstractTexture> = emptyMap(), uniforms: Map<String, GpuBufferSlice> = emptyMap()): VertexConsumer

Low-level draw entrypoint.

Link copied to clipboard

Shortcut of withPositionRelativeToCamera(Vec3d.of(pos))

Shorthand for withPosition(relativeToCamera(pos))