Fixed pixelated assets being offset by camera movements

* Pixelated assets are now drawn to render targets during Main.CheckMonoliths instead of Main.PreDraw. The latter drew them to early and caused them to be offset incorrectly whenever the camera moved
This commit is contained in:
fryzahh committed 2025-11-17 21:31:58 -04:00
1 parent fd58ab04da
commit 570da6961b
1 file changed
+4 -2
@@ -81,7 +81,7 @@ namespace CalamityMod.Systems.Graphic.PixelationSystem
ActivePixelatedDrawers_AfterDusts = [];
ActivePixelatedDrawers_AfterEverything = [];
RenderTargetManager.RenderTargetUpdateLoopEvent += PrepareTargets;
On_Main.CheckMonoliths += PrepareTargets;
}
public override void Unload()
@@ -148,7 +148,7 @@ namespace CalamityMod.Systems.Graphic.PixelationSystem
ReturnAssociatedDrawerCollection(drawLayer).Add(drawer);
}
private static void PrepareTargets()
private static void PrepareTargets(On_Main.orig_CheckMonoliths orig)
{
if (!Main.gameMenu && !Main.dedServ)
{
@@ -165,6 +165,8 @@ namespace CalamityMod.Systems.Graphic.PixelationSystem
Main.graphics.GraphicsDevice.SetRenderTarget(null);
}
orig();
}
private static void DrawCollectionsToTarget(Dictionary<BlendState, ManagedRenderTarget> targetCollection, Matrix pixelationMatrix, List<PixelatedDrawer> drawerCollection)