diff --git a/Source/DynamicDrawPatches.cs b/Source/DynamicDrawPatches.cs index 03d7ae0..c04f00f 100644 --- a/Source/DynamicDrawPatches.cs +++ b/Source/DynamicDrawPatches.cs @@ -115,7 +115,6 @@ static void Postfix() } } - // todo handle DrawBatch [HarmonyPatch] static class OverlayDrawerPatch { @@ -141,6 +140,7 @@ static void Postfix() [HarmonyPatch] static class GraphicsDrawMeshPatch { + // Rotation angle and center public static (float, Vector3)? data; static IEnumerable TargetMethods() @@ -148,6 +148,10 @@ static IEnumerable TargetMethods() foreach (var m in AccessTools.GetDeclaredMethods(typeof(Graphics))) if (m.Name == "DrawMesh" && m.GetParameters().Length == 12 && m.GetParameters()[1].Name == "matrix") yield return m; + + foreach (var m in AccessTools.GetDeclaredMethods(typeof(DrawBatch))) + if (m.Name == "DrawMesh") + yield return m; } static void Prefix(ref Matrix4x4 matrix, Material material) diff --git a/Source/PrintedDrawPatches.cs b/Source/PrintedDrawPatches.cs index 9a7da98..268c1ca 100644 --- a/Source/PrintedDrawPatches.cs +++ b/Source/PrintedDrawPatches.cs @@ -126,8 +126,7 @@ static IEnumerable Transpiler(IEnumerable inst static Material CacheMaterial(Material mat, Graphic graphic, Thing t) { - // For these Graphics, not an actual rotation but a texture switch is used for rotating - if (ShouldExchangeVerts(graphic)) + if (ShouldExchangeVertices(graphic)) { var outMat = mat; var rot = t.Rotation; @@ -154,8 +153,9 @@ static Material CacheMaterial(Material mat, Graphic graphic, Thing t) return mat; } - public static bool ShouldExchangeVerts(Graphic graphic) + public static bool ShouldExchangeVertices(Graphic graphic) { + // For these Graphics, not an actual rotation but a texture switch is used for rotating return graphic.GetType() == typeof(Graphic_Multi) && !graphic.ShouldDrawRotated; } @@ -218,7 +218,7 @@ static void Prefix(Graphic __instance, Thing thing, ref int __state) } if (PrintPlanePatch.currentThingData == null && - GraphicPrintPatch_TransformMats.ShouldExchangeVerts(__instance)) + GraphicPrintPatch_TransformMats.ShouldExchangeVertices(__instance)) { var multi = (Graphic_Multi)__instance; if (!graphicToInt.TryGetValue(multi, out var id))