A lighting model made for love 2d
Go to file
2014-11-05 23:05:21 -05:00
examples added remove method to light world to facilitate removal of items 2014-11-03 17:54:15 -05:00
gfx fixed the light drawing with translation and scaling 2014-10-28 20:47:46 -04:00
lib fixed inaccuracy of the inRange method in Light. also added it to the draw methods in light so that they wont draw if not needed 2014-11-05 23:05:21 -05:00
conf.lua change vsync 2014-03-06 16:58:28 +01:00
LICENSE had to add myself to the license 2014-10-24 14:36:00 -04:00
main.lua fixed spelling mistakes 2014-10-27 21:32:51 -04:00
README.md readme updated example 2014-10-27 22:04:25 -07:00

light_world.lua

This is the light modeling done by Priorblue here, only it has been largely refactored and edited to allow for scaling and proper translation.

Installation

Copy and rename the lib folder into your project.

How to use

local LightWorld = require "lib" --the path to where light_world is (in this repo "lib")

-- create light world
lightWorld = LightWorld({
  drawBackground = drawBackground, --the callback to use for drawing the background
  drawForeground = drawForeground, --the callback to use for drawing the foreground
  ambient = {55,55,55},         --the general ambient light in the environment
})

function love.draw()
  love.graphics.push()
    love.graphics.translate(x, y)
    love.graphics.scale(scale)
    lightWorld:draw(x,y,scale)
  love.graphics.pop()
end

For more information please check out the 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.

Features

  • Preview (Video)
  • polygon shadow calculation Preview
  • circle shadow calculation
  • image shadow calculation Preview
  • shadow blur
  • light color, range, smooth and glow Preview
  • ambient light
  • self shadowing on images with normal maps Preview
  • dynamic glow effect on images and circle/poly objects Preview Preview
  • generate flat or gradient normal maps Preview
  • convert height maps to normal maps Preview
  • generate a normal map directly from the image (usually gives poor results)
  • shadow color and alpha (glass) Preview
  • directional light Preview
  • refractions (moveable) Preview
  • chromatic aberration Preview
  • postshader with many included postshaders, plus easy to extend

License

A License has been included in this project