2014-12-02 01:41:09 +00:00
:todoing
2014-12-04 00:22:45 +00:00
-isinlightrange still not working right
2014-12-03 19:08:44 +00:00
-add body animations
2014-12-02 15:05:52 +00:00
2014-10-24 18:32:12 +00:00
# light_world.lua
This is the light modeling done by Priorblue [here ](https://bitbucket.org/PriorBlue/love2d-light-and-shadow-engine ),
only it has been largely refactored and edited to allow for scaling and proper translation.
## Installation
2014-10-27 12:10:25 +00:00
Copy and rename the lib folder into your project.
2014-10-24 18:32:12 +00:00
## How to use
```lua
2014-10-28 05:04:25 +00:00
local LightWorld = require "lib" --the path to where light_world is (in this repo "lib")
2014-10-24 18:32:12 +00:00
-- create light world
lightWorld = LightWorld({
2014-10-26 03:01:57 +00:00
drawBackground = drawBackground, --the callback to use for drawing the background
2014-10-28 01:32:51 +00:00
drawForeground = drawForeground, --the callback to use for drawing the foreground
2014-10-26 03:01:57 +00:00
ambient = {55,55,55}, --the general ambient light in the environment
2014-10-24 18:32:12 +00:00
})
function love.draw()
love.graphics.push()
love.graphics.translate(x, y)
love.graphics.scale(scale)
lightWorld:draw(x,y,scale)
love.graphics.pop()
end
```
2014-10-27 12:11:24 +00:00
For more information please check out the [wiki ](https://github.com/tanema/light_world.lua/wiki ) and see the examples directory to see how it is fully used. This project can be run with love to see the demonstrations in action.
2014-10-27 12:09:45 +00:00
## Features ##
* **[Preview (Video)](https://www.youtube.com/watch?v=6V5Dtsa6Nd4)**
* polygon shadow calculation [Preview ](http://onepixelahead.de/love2d_polyshadow.png )
* circle shadow calculation
* image shadow calculation [Preview ](http://onepixelahead.de/love2d_polyshadow18.png )
* shadow blur
* light color, range, smooth and glow [Preview ](http://onepixelahead.de/love2d_polyshadow2.png )
* ambient light
* self shadowing on images with normal maps [Preview ](http://onepixelahead.de/love2d_polyshadow_pixelshadow.png )
* dynamic glow effect on images and circle/poly objects [Preview ](http://onepixelahead.de/love2d_polyshadow_glow.png ) [Preview ](http://onepixelahead.de/love2d_polyshadow15.gif )
* generate flat or gradient normal maps [Preview ](http://onepixelahead.de/love2d_polyshadow7.png )
* convert height maps to normal maps [Preview ](http://onepixelahead.de/love2d_polyshadow8.png )
* generate a normal map directly from the image (usually gives poor results)
* shadow color and alpha (glass) [Preview ](http://onepixelahead.de/love2d_polyshadow9.png )
* directional light [Preview ](http://onepixelahead.de/love2d_polyshadow12.png )
* refractions (moveable) [Preview ](http://onepixelahead.de/love2d_polyshadow13.gif )
* chromatic aberration [Preview ](http://onepixelahead.de/love2d_polyshadow16.gif )
* postshader with many included postshaders, plus easy to extend
2014-10-24 18:32:12 +00:00
## License
A License has been included in this project