discosultan / penumbra

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

Possibility for light to ignore specific hulls #11

Closed Plutis closed 7 years ago

Plutis commented 7 years ago

Trying to achieve flashlight effect. Having 2 players, both have Hulls and both have Spotlights. Problem is that Player1 Hull blocks its own Spotlight, because Position is inside Hull. Would be nice, to set for color (or for hull), which object to ignore in calculations.

discosultan commented 7 years ago

I made a new branch to demonstrate how to easily enable ignoring Hulls for each light separately: https://github.com/discosultan/penumbra/commit/84ed5ef07dcf45c3ccd3121073804113d5b51083.

Note that this implementation doesn't work correctly atm when you add or remove hulls into the ignored list at runtime (shouldn't be the case for you) - it doesn't mark the dirty flag for the light.

discosultan commented 7 years ago

I pushed a new version of Penumbra (1.2.0) to Nuget with the feature enabled. (https://github.com/discosultan/penumbra/commit/1115be32d03f89fbb257326c56924eb9e7d13a17) (https://github.com/discosultan/penumbra/commit/df52dd37244386cf96234e54ae696128ac8afd7f)

Plutis commented 7 years ago

Thanks, it works nicely