diff --git a/src/main/java/com/jozufozu/flywheel/api/backend/Engine.java b/src/main/java/com/jozufozu/flywheel/api/backend/Engine.java index 4f0c75bac..d17d54474 100644 --- a/src/main/java/com/jozufozu/flywheel/api/backend/Engine.java +++ b/src/main/java/com/jozufozu/flywheel/api/backend/Engine.java @@ -11,8 +11,18 @@ import net.minecraft.client.Camera; import net.minecraft.core.Vec3i; public interface Engine extends InstancerProvider { + /** + * Create a plan that will be executed every frame. + * @return A new plan. + */ Plan createFramePlan(); + /** + * Render all instances necessary for the given stage. + * @param executor The task executor running the frame plan. + * @param context The render context for this frame. + * @param stage The stage to render. + */ void renderStage(TaskExecutor executor, RenderContext context, RenderStage stage); void renderCrumblingInstance(TaskExecutor taskExecutor, RenderContext context, Instance instance, int progress); @@ -25,7 +35,15 @@ public interface Engine extends InstancerProvider { */ boolean updateRenderOrigin(Camera camera); + /** + * @return The current render origin. + */ Vec3i renderOrigin(); - void invalidate(); + /** + * Free all resources associated with this engine. + *
+ * This engine will not be used again after this method is called. + */ + void delete(); } diff --git a/src/main/java/com/jozufozu/flywheel/api/instance/InstancerProvider.java b/src/main/java/com/jozufozu/flywheel/api/instance/InstancerProvider.java index 27d4e26fa..f20c17e2d 100644 --- a/src/main/java/com/jozufozu/flywheel/api/instance/InstancerProvider.java +++ b/src/main/java/com/jozufozu/flywheel/api/instance/InstancerProvider.java @@ -5,7 +5,9 @@ import com.jozufozu.flywheel.api.model.Model; public interface InstancerProvider { /** - * Get an instancer for the given instance type, model, and render stage. Calling this method twice with the same arguments will return the same instancer. + * Get an instancer for the given instance type, model, and render stage. + *
+ * Calling this method twice with the same arguments will return the same instancer. * * @return An instancer for the given instance type, model, and render stage. */ diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/batching/BatchingEngine.java b/src/main/java/com/jozufozu/flywheel/backend/engine/batching/BatchingEngine.java index 428bf5f29..3ac290390 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/engine/batching/BatchingEngine.java +++ b/src/main/java/com/jozufozu/flywheel/backend/engine/batching/BatchingEngine.java @@ -104,7 +104,7 @@ public class BatchingEngine extends AbstractEngine implements SimplyComposedPlan } @Override - public void invalidate() { + public void delete() { instancers.clear(); meshPools.values() diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectEngine.java b/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectEngine.java index 5ccf5308a..f1a7077d9 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectEngine.java +++ b/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectEngine.java @@ -90,7 +90,7 @@ public class IndirectEngine extends AbstractEngine { } @Override - public void invalidate() { + public void delete() { drawManager.invalidate(); } } diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancingEngine.java b/src/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancingEngine.java index 54951a074..980d46fa2 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancingEngine.java +++ b/src/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancingEngine.java @@ -135,7 +135,7 @@ public class InstancingEngine extends AbstractEngine { } @Override - public void invalidate() { + public void delete() { drawManager.invalidate(); } } diff --git a/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationManagerImpl.java b/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationManagerImpl.java index ec4ede546..195bff687 100644 --- a/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationManagerImpl.java +++ b/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationManagerImpl.java @@ -249,6 +249,6 @@ public class VisualizationManagerImpl implements VisualizationManager { blockEntities.invalidate(); entities.invalidate(); effects.invalidate(); - engine.invalidate(); + engine.delete(); } }