PrimitiveRenderer as ModSystem

This commit is contained in:
Flowaria authored and Cameron Ewell committed 2024-09-30 03:37:06 -04:00
1 parent 73c31f9d86
commit a428a3056e
2 files changed
+4 -4

No files matched your search

-2
View File
@@ -110,8 +110,6 @@ namespace CalamityMod
if (!Main.dedServ)
{
PrimitiveRenderer.Initialize();
// This must be done separately from immediate loading, as loading is now multithreaded.
// However, render targets and certain other graphical objects can only be created on the main thread.
Main.QueueMainThreadAction(() => Main.OnPreDraw += PrepareRenderTargets);
+4 -2
View File
@@ -5,6 +5,7 @@ using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Graphics.Shaders;
using Terraria.ModLoader;
namespace CalamityMod.Graphics.Primitives
{
@@ -19,7 +20,8 @@ namespace CalamityMod.Graphics.Primitives
/// If you wish to use pixelation, you <b>MUST</b> make the NPC/Projectile inherit <see cref="IPixelatedPrimitiveRenderer"/> and use <see cref="IPixelatedPrimitiveRenderer.RenderPixelatedPrimitives"/> instead of predraw..<br/>
/// You can also optionally specify a render layer with <see cref="IPixelatedPrimitiveRenderer.LayerToRenderTo"/>. It is <see cref="PixelationPrimitiveLayer.BeforeNPCs"/> by default.
/// </summary>
public static class PrimitiveRenderer
[Autoload(Side = ModSide.Client)]
public sealed class PrimitiveRenderer : ModSystem
{
#region Static Members
private static DynamicVertexBuffer VertexBuffer;
@@ -46,7 +48,7 @@ namespace CalamityMod.Graphics.Primitives
private static short IndicesIndex;
internal static void Initialize()
public override void OnModLoad()
{
Main.QueueMainThreadAction(() =>
{