Its not just mortars as well, its also tank shells. Its all explosives, and in fact, its all weapons.
As far as I'm aware, cover works by one simple rule: which direction was the projectile originally fired from. When you realize this, it becomes a little bit more intuitive imo.
I'm just gonna make a small correction or addendum.
While cover is correctly taken into account for every source, not every source of damage has modifiers against every type of cover.
For example: rocket artillery and Howitzers vs heavy cover. Dmg modifier is 1.0 while against garrison it's 0.25
Most tanks are really less efficient against garrison than heavy cover (main gun).
Flamers "ignore" cover as in having AT LEAST 1.0 modifier against them. But infantry based flame weapons have a 1.25 dmg modifier against HEAVY cover and GARRISON while vehicles based ones only have it against garrison.
So under 10 range, green cover or no cover is the same? But Red cover still applies a debuff?
And trenches are garrison with green cover, do they behave like houses? Same question with bunkers
THAT'S a problem because i don't remember if they ever made a revision to make them all work in the same way. At one point in the game, different types of trenches have different properties. Some behaved as Garrison and others as heavy cover.