public static void ApplySurfaceMapAReplacement(Texture2D surfaceMapA, bool updateMipmaps, TerrainPatch patch) { surfaceMapA.Apply(updateMipmaps); if (Settings.TempDisable || Settings.EraseClipping) { return; } var replacedSurfaceMapA = SubstituteTextureManager.GetOrCreateSubstituteTexture(patch); replacedSurfaceMapA.Apply(updateMipmaps); }
// maybe replace this with a transpiler that duplicates everything that is done to m_surfaceMapA? static void Postfix(TerrainPatch __instance) { if (Settings.TempDisable || Settings.EraseClipping.value) { return; } #if DEBUG Debug.Log("resizing patch (" + __instance.m_x + "|" + __instance.m_z + ")"); #endif Texture2D original = __instance.m_surfaceMapA; Texture2D replacement = SubstituteTextureManager.GetOrCreateSubstituteTexture(__instance); replacement.Resize(original.width, original.height, original.format, false); replacement.wrapMode = original.wrapMode; replacement.filterMode = original.filterMode; }
public static void SetSurfaceMapAPixelReplacement(Texture2D surfaceMapA, int x, int y, Color color, TerrainPatch patch) { if (Settings.TempDisable) { surfaceMapA.SetPixel(x, y, color); return; } var newcolor = ChangeColor(color); if (Settings.EraseClipping) { surfaceMapA.SetPixel(x, y, newcolor); } else { var replacedSurfaceMapA = SubstituteTextureManager.GetOrCreateSubstituteTexture(patch); replacedSurfaceMapA.SetPixel(x, y, newcolor); surfaceMapA.SetPixel(x, y, color); } }