light_world.lua/README.md
2014-10-25 20:01:57 -07:00

2.3 KiB

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.

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

Installation

copy the lib folder into your project at any path

How to use

local LightWorld = require "lib/light_world"

-- create light world
lightWorld = LightWorld({
  drawBackground = drawBackground, --the callback to use for drawing the background
  drawForground = drawForground, --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

please see the examples directory to see how it is fully used. also this project can be run to show you the deomnstrations.

License

A License has been included in this project