Class EngineImpl

java.lang.Object
dev.engine_room.flywheel.backend.engine.EngineImpl
All Implemented Interfaces:
Engine

public class EngineImpl extends Object implements Engine
  • Constructor Details

    • EngineImpl

      public EngineImpl(net.minecraft.world.level.LevelAccessor level, DrawManager<? extends AbstractInstancer<?>> drawManager, int maxOriginDistance)
  • Method Details

    • createVisualizationContext

      public VisualizationContext createVisualizationContext()
      Description copied from interface: Engine
      Create a visualization context that will be used to create visuals of the given type.
      Specified by:
      createVisualizationContext in interface Engine
      Returns:
      A new visualization context.
    • createFramePlan

      public Plan<RenderContext> createFramePlan()
      Description copied from interface: Engine
      Create a plan that will start execution after the start of the level render and finish execution before Engine.render(dev.engine_room.flywheel.api.backend.RenderContext) is called.
      Specified by:
      createFramePlan in interface Engine
      Returns:
      A new plan.
    • renderOrigin

      public net.minecraft.core.Vec3i renderOrigin()
      Specified by:
      renderOrigin in interface Engine
      Returns:
      The current render origin.
    • updateRenderOrigin

      public boolean updateRenderOrigin(net.minecraft.client.Camera camera)
      Description copied from interface: Engine
      Maintain the render origin to be within a certain distance from the camera in all directions, preventing floating point precision issues at high coordinates.
      Specified by:
      updateRenderOrigin in interface Engine
      Returns:
      true if the render origin changed, false otherwise.
    • lightSections

      public void lightSections(it.unimi.dsi.fastutil.longs.LongSet sections)
      Description copied from interface: Engine
      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.

      Specified by:
      lightSections in interface Engine
      Parameters:
      sections - The set of sections.
    • onLightUpdate

      public void onLightUpdate(net.minecraft.core.SectionPos sectionPos, net.minecraft.world.level.LightLayer layer)
      Specified by:
      onLightUpdate in interface Engine
    • render

      public void render(RenderContext context)
      Description copied from interface: Engine
      Render all instances necessary for the given visual type.

      This method is guaranteed to be called after the frame plan has finished execution and before Engine.renderCrumbling(dev.engine_room.flywheel.api.backend.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.

      Specified by:
      render in interface Engine
      Parameters:
      context - The context for the current level render.
    • renderCrumbling

      public void renderCrumbling(RenderContext context, List<Engine.CrumblingBlock> crumblingBlocks)
      Description copied from interface: Engine
      Render the given instances as a crumbling overlay.

      This method is guaranteed to be called after Engine.render(dev.engine_room.flywheel.api.backend.RenderContext) for the current level render. This method is guaranteed to be called on the render thread.

      Specified by:
      renderCrumbling in interface Engine
      Parameters:
      context - The context for the current level render.
      crumblingBlocks - The instances to render. This list is never empty.
    • delete

      public void delete()
      Description copied from interface: Engine
      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.

      Specified by:
      delete in interface Engine
    • instancer

      public <I extends Instance> Instancer<I> instancer(Environment environment, InstanceType<I> type, Model model, int bias)
    • environmentStorage

      public EnvironmentStorage environmentStorage()
    • lightStorage

      public LightStorage lightStorage()
    • drawManager

      public DrawManager<? extends AbstractInstancer<?>> drawManager()