Optimizing texture data processing in Monogame
At the end of my post on C# garbage collection profiling I noted one additional problem generating a ton of garbage in EndlessClient: hovering the mouse over NPCs. In EndlessClient, a mouseover action on an NPC should show the NPC’s name if there is a visible pixel under the mouse pointer OR there are no visible pixels on the texture (in the case of invisible NPCs). The way we check the value of a pixel in Monogame is via the GetData method on a texture, by getting the pixel value at the exact coordinate of the mouse, projected onto the NPC texture as rendered to the NPC render target....