The words "gloom," "gloaming," and "gloomy" seem to have an obscure etymology. According to the Online Etymological Dictionary, it seems to have originally been a word referring to the half-light of dusk.
Nowadays, it can still be used to refer to physical darkness without any necessary emotional connotation.
Even with the light on, the corners of the cellar are gloomy.
Obviously, a cellar cannot be emotionally depressed.
However, the word has also been associated for centuries with melancholy and thus frequently has emotional connotations that have nothing to do physical light.
He has been gloomy ever since his divorce.
This does not imply that he has not been in the sunshine since his divorce.
But sometimes the word is used to indicate the emotional effect of what is phyically dark.
He shuddered gloomily as entered the shadowed interior of the crypt
Here it would be natural to to interpret the sentence as explicitly referring to an emotion caused by a diminution of physical light.
In short, there is a meaning that is completely physical, another that is completely emotional, and a third that combines those senses. Which meaning is intended depends on context.