updated LightWorld
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
local LightWorld = require "lib.light_world"
|
||||
local LightWorld = require "lib.LightWorld"
|
||||
require "lightWorldRectangleFix"
|
||||
|
||||
local Object = {}
|
||||
|
@@ -109,30 +109,9 @@ function body:setPosition(x, y)
|
||||
end
|
||||
end
|
||||
|
||||
-- set x position
|
||||
function body:setX(x)
|
||||
if x ~= self.x then
|
||||
self.x = x
|
||||
self:refresh()
|
||||
end
|
||||
end
|
||||
|
||||
-- set y position
|
||||
function body:setY(y)
|
||||
if y ~= self.y then
|
||||
self.y = y
|
||||
self:refresh()
|
||||
end
|
||||
end
|
||||
|
||||
-- get x position
|
||||
function body:getX()
|
||||
return self.x
|
||||
end
|
||||
|
||||
-- get y position
|
||||
function body:getY(y)
|
||||
return self.y
|
||||
function body:getPosition()
|
||||
return self.x, self.y
|
||||
end
|
||||
|
||||
-- get width
|
@@ -21,21 +21,24 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
]]
|
||||
local _PACKAGE = (...):match("^(.+)[%./][^%./]+") or ""
|
||||
local class = require(_PACKAGE..'/class')
|
||||
local Light = require(_PACKAGE..'/light')
|
||||
local Body = require(_PACKAGE..'/body')
|
||||
local util = require(_PACKAGE..'/util')
|
||||
local normal_map = require(_PACKAGE..'/normal_map')
|
||||
local PostShader = require(_PACKAGE..'/postshader')
|
||||
require(_PACKAGE..'/postshader')
|
||||
local _PACKAGE = string.gsub(...,"%.","/") or ""
|
||||
if string.len(_PACKAGE) > 0 then
|
||||
_PACKAGE = _PACKAGE .. "/"
|
||||
end
|
||||
local class = require(_PACKAGE..'class')
|
||||
local Light = require(_PACKAGE..'light')
|
||||
local Body = require(_PACKAGE..'body')
|
||||
local util = require(_PACKAGE..'util')
|
||||
local normal_map = require(_PACKAGE..'normal_map')
|
||||
local PostShader = require(_PACKAGE..'postshader')
|
||||
require(_PACKAGE..'postshader')
|
||||
|
||||
local light_world = class()
|
||||
|
||||
light_world.blurv = love.graphics.newShader(_PACKAGE.."/shaders/blurv.glsl")
|
||||
light_world.blurh = love.graphics.newShader(_PACKAGE.."/shaders/blurh.glsl")
|
||||
light_world.refractionShader = love.graphics.newShader(_PACKAGE.."/shaders/refraction.glsl")
|
||||
light_world.reflectionShader = love.graphics.newShader(_PACKAGE.."/shaders/reflection.glsl")
|
||||
light_world.blurv = love.graphics.newShader(_PACKAGE.."shaders/blurv.glsl")
|
||||
light_world.blurh = love.graphics.newShader(_PACKAGE.."shaders/blurh.glsl")
|
||||
light_world.refractionShader = love.graphics.newShader(_PACKAGE.."shaders/refraction.glsl")
|
||||
light_world.reflectionShader = love.graphics.newShader(_PACKAGE.."shaders/reflection.glsl")
|
||||
|
||||
function light_world:init(options)
|
||||
self.lights = {}
|
||||
@@ -43,7 +46,6 @@ function light_world:init(options)
|
||||
self.post_shader = PostShader()
|
||||
|
||||
self.ambient = {0, 0, 0}
|
||||
self.normalInvert = false
|
||||
|
||||
self.refractionStrength = 8.0
|
||||
self.reflectionStrength = 16.0
|
||||
@@ -51,6 +53,7 @@ function light_world:init(options)
|
||||
|
||||
self.blur = 2.0
|
||||
self.glowBlur = 1.0
|
||||
|
||||
self.glowTimer = 0.0
|
||||
self.glowDown = false
|
||||
|
||||
@@ -275,6 +278,11 @@ function light_world:newLight(x, y, red, green, blue, range)
|
||||
return self.lights[#self.lights]
|
||||
end
|
||||
|
||||
function light_world:clear()
|
||||
light_world:clearLights()
|
||||
light_world:clearBodys()
|
||||
end
|
||||
|
||||
-- clear lights
|
||||
function light_world:clearLights()
|
||||
self.lights = {}
|
||||
@@ -302,26 +310,6 @@ function light_world:setAmbientColor(red, green, blue)
|
||||
self.ambient = {red, green, blue}
|
||||
end
|
||||
|
||||
-- set ambient red
|
||||
function light_world:setAmbientRed(red)
|
||||
self.ambient[1] = red
|
||||
end
|
||||
|
||||
-- set ambient green
|
||||
function light_world:setAmbientGreen(green)
|
||||
self.ambient[2] = green
|
||||
end
|
||||
|
||||
-- set ambient blue
|
||||
function light_world:setAmbientBlue(blue)
|
||||
self.ambient[3] = blue
|
||||
end
|
||||
|
||||
-- set normal invert
|
||||
function light_world:setNormalInvert(invert)
|
||||
self.normalInvert = invert
|
||||
end
|
||||
|
||||
-- set blur
|
||||
function light_world:setBlur(blur)
|
||||
self.blur = blur
|
@@ -46,27 +46,8 @@ function light:setPosition(x, y, z)
|
||||
end
|
||||
|
||||
-- get x
|
||||
function light:getX()
|
||||
return self.x
|
||||
end
|
||||
|
||||
-- get y
|
||||
function light:getY()
|
||||
return self.y
|
||||
end
|
||||
|
||||
-- set x
|
||||
function light:setX(x)
|
||||
if x ~= self.x then
|
||||
self.x = x
|
||||
end
|
||||
end
|
||||
|
||||
-- set y
|
||||
function light:setY(y)
|
||||
if y ~= self.y then
|
||||
self.y = y
|
||||
end
|
||||
function light:getPosition()
|
||||
return self.x, self.y
|
||||
end
|
||||
|
||||
-- set color
|
Reference in New Issue
Block a user