Undo invalidate back to delete

- Makes more sense given how the method is used.
This commit is contained in:
Jozufozu 2023-11-24 21:21:10 -08:00
parent 055ac161d8
commit 791c2ddf5c
6 changed files with 26 additions and 6 deletions

View file

@ -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<RenderContext> 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.
* <br>
* This engine will not be used again after this method is called.
*/
void delete();
}

View file

@ -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.
* <br>
* 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.
*/

View file

@ -104,7 +104,7 @@ public class BatchingEngine extends AbstractEngine implements SimplyComposedPlan
}
@Override
public void invalidate() {
public void delete() {
instancers.clear();
meshPools.values()

View file

@ -90,7 +90,7 @@ public class IndirectEngine extends AbstractEngine {
}
@Override
public void invalidate() {
public void delete() {
drawManager.invalidate();
}
}

View file

@ -135,7 +135,7 @@ public class InstancingEngine extends AbstractEngine {
}
@Override
public void invalidate() {
public void delete() {
drawManager.invalidate();
}
}

View file

@ -249,6 +249,6 @@ public class VisualizationManagerImpl implements VisualizationManager {
blockEntities.invalidate();
entities.invalidate();
effects.invalidate();
engine.invalidate();
engine.delete();
}
}