Interface Engine
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA block to be rendered as a crumbling overlay. -
Method Summary
Modifier and TypeMethodDescriptionCreate a plan that will start execution after the start of the level render and finish execution beforesetupRender(dev.engine_room.flywheel.api.RenderContext)is called.createVisualizationContext(VisualType visualType) Create a visualization context that will be used to create visuals of the given type.voiddelete()Free all resources associated with this engine.voidlightSections(it.unimi.dsi.fastutil.longs.LongSet sections) Assign the set of sections that visuals have requested GPU light for.voidonLightUpdate(net.minecraft.core.SectionPos sectionPos, net.minecraft.world.level.LightLayer layer) voidrender(RenderContext context, VisualType visualType) Render all instances necessary for the given visual type.voidrenderCrumbling(RenderContext context, List<Engine.CrumblingBlock> crumblingBlocks) Render the given instances as a crumbling overlay.net.minecraft.core.Vec3ivoidsetupRender(RenderContext context) Set up rendering for the current level render.booleanupdateRenderOrigin(net.minecraft.client.Camera camera) Maintain the render origin to be within a certain distance from the camera in all directions, preventing floating point precision issues at high coordinates.
-
Method Details
-
createVisualizationContext
Create a visualization context that will be used to create visuals of the given type.- Parameters:
visualType- The type of visual.- Returns:
- A new visualization context.
-
createFramePlan
Plan<RenderContext> createFramePlan()Create a plan that will start execution after the start of the level render and finish execution beforesetupRender(dev.engine_room.flywheel.api.RenderContext)is called.- Returns:
- A new plan.
-
renderOrigin
net.minecraft.core.Vec3i renderOrigin()- Returns:
- The current render origin.
-
updateRenderOrigin
boolean updateRenderOrigin(net.minecraft.client.Camera camera) Maintain the render origin to be within a certain distance from the camera in all directions, preventing floating point precision issues at high coordinates.- Returns:
trueif the render origin changed,falseotherwise.
-
lightSections
void lightSections(it.unimi.dsi.fastutil.longs.LongSet sections) Assign the set of sections that visuals have requested GPU light for.This will be called at most once per frame, and not necessarily every frame.
- Parameters:
sections- The set of sections.
-
onLightUpdate
void onLightUpdate(net.minecraft.core.SectionPos sectionPos, net.minecraft.world.level.LightLayer layer) -
setupRender
Set up rendering for the current level render.This method is guaranteed to be called after the frame plan has finished execution and before
render(dev.engine_room.flywheel.api.RenderContext, dev.engine_room.flywheel.api.visualization.VisualType)andrenderCrumbling(dev.engine_room.flywheel.api.RenderContext, java.util.List<dev.engine_room.flywheel.api.backend.Engine.CrumblingBlock>)are called. This method is guaranteed to be called on the render thread.- Parameters:
context- The context for the current level render.
-
render
Render all instances necessary for the given visual type.This method is guaranteed to be called after
setupRender(dev.engine_room.flywheel.api.RenderContext)for the current level render. This method is guaranteed to be called on the render thread.- Parameters:
context- The context for the current level render.visualType- The type of visual.
-
renderCrumbling
Render the given instances as a crumbling overlay.This method is guaranteed to be called after
setupRender(dev.engine_room.flywheel.api.RenderContext)for the current level render. This method is guaranteed to be called on the render thread.- Parameters:
context- The context for the current level render.crumblingBlocks- The instances to render. This list is never empty.
-
delete
void delete()Free all resources associated with this engine.This engine will not be used again after this method is called.
This method is guaranteed to be called on the render thread.
-