libgdx / box2dlights

Fork of box2dlights by Kalle Hamalainen
Apache License 2.0
257 stars 82 forks source link

Added pseudo3d functionality from pseudo3d branch for directional light. #122

Closed kdenzel closed 8 months ago

kdenzel commented 3 years ago

Added (mainly for myself) the pseudo3d functionality for the directional light. Also tested it for my game i make. Would fix #68 and #40 i guess? Took some code from @rinold (good work tho) and altered it for my needs.

I saw in the pseudo3d branch that there are extra classes for handling pseudo3d but for my case i only needed the directional light and at the moment i guess this is the only light that really needs pseudo3d in my opinion. Dunno if pointlight or conelight needs this functionality (of course nice to have) cause in my top down shooter i use cone light only for flashlights and pointlights for street lamps, so they do not shine over the entire scene and therefore are finite and do not throw infinite shadows.

So i make this PR for discussion. Sorry for the whitespace issue, my IDE Netbeans auto formatted a lot of code. But you can compare the code with the w=1 switch in the URL.

Thanks for reviewing and hopefully i do not waste someones time. If you wanna see the sun cyclus you can run the DesktopLauncher from the test package and press F4 for directional light, but i guess you have to alter the path in the Box2DLightTest class to the resources cause Netbeans uses per default other path for resources.

lucashicks1 commented 11 months ago

pls merge

SimonIT commented 8 months ago

Merged #124