discosultan / penumbra

2D lighting with soft shadows for MonoGame
MIT License
321 stars 32 forks source link

Drawing non-affected Elements like in HelloPenumbra doesn't seem to work #41

Open BratPfanneTV opened 1 year ago

BratPfanneTV commented 1 year ago

Hello!

I have tried to implement Penumbra similarly to how it's done in HelloPenumbra.cs, meaning I call both PenumbraComponent.BeginDraw() and PenumbraComponent.Draw() in my Draw Method, so that I can exclude some things from being affected by Penumbra.

However, in that file, the PenumbraComponent is not added to the Components List (as far as I can tell), which when I try it causes Penumbra to not have any effect at all. If, however, I do add the PenumbraComponent to the Components List, then the base.Draw() call in my project causes things to break, as it attempts to call all Draw() functions of all Components, which won't work since Penumbra throws an exception if Draw() is called without BeginDraw() having been called beforehand. Inserting a second BeginDraw() before base.Draw() also doesn't work, since it seems to result in only a black screen. The only solution I can think of that might work would be to omit the base.Draw() call altogether, but surely that can't be right since that would cause other Components to no longer be drawn.

I can't tell what I'm doing wrong here. Any help would be appreciated!