mirror of
https://github.com/tanema/light_world.lua.git
synced 2024-12-24 20:24:19 +00:00
just renaming some things
This commit is contained in:
parent
993e029a2f
commit
aa3675d7ad
@ -5,7 +5,7 @@ local util = require(_PACKAGE..'/util')
|
||||
|
||||
local light = class()
|
||||
|
||||
light.shader = love.graphics.newShader(_PACKAGE.."/shaders/poly_shadow.glsl")
|
||||
light.shineShader = love.graphics.newShader(_PACKAGE.."/shaders/shine.glsl")
|
||||
light.normalShader = love.graphics.newShader(_PACKAGE.."/shaders/normal.glsl")
|
||||
|
||||
function light:init(x, y, r, g, b, range)
|
||||
@ -142,14 +142,14 @@ function light:drawShadow(l,t,w,h,s,bodies, canvas)
|
||||
self.shadow:clear()
|
||||
util.drawto(self.shadow, l, t, s, function()
|
||||
|
||||
self.shader:send("lightPosition", {(self.x + l/s) * s, (h/s - (self.y + t/s)) * s, (self.z * 10)/255.0})
|
||||
self.shader:send("lightRange", self.range*s)
|
||||
self.shader:send("lightColor", {self.red / 255.0, self.green / 255.0, self.blue / 255.0})
|
||||
self.shader:send("lightSmooth", self.smooth)
|
||||
self.shader:send("lightGlow", {1.0 - self.glowSize, self.glowStrength})
|
||||
self.shader:send("lightAngle", math.pi - self.angle / 2.0)
|
||||
self.shader:send("lightDirection", self.direction)
|
||||
love.graphics.setShader(self.shader)
|
||||
self.shineShader:send("lightPosition", {(self.x + l/s) * s, (h/s - (self.y + t/s)) * s, (self.z * 10)/255.0})
|
||||
self.shineShader:send("lightRange", self.range*s)
|
||||
self.shineShader:send("lightColor", {self.red / 255.0, self.green / 255.0, self.blue / 255.0})
|
||||
self.shineShader:send("lightSmooth", self.smooth)
|
||||
self.shineShader:send("lightGlow", {1.0 - self.glowSize, self.glowStrength})
|
||||
self.shineShader:send("lightAngle", math.pi - self.angle / 2.0)
|
||||
self.shineShader:send("lightDirection", self.direction)
|
||||
love.graphics.setShader(self.shineShader)
|
||||
love.graphics.setInvertedStencil(stencils.shadow(shadow_geometry, bodies))
|
||||
love.graphics.setBlendMode("additive")
|
||||
love.graphics.rectangle("fill", -l/s,-t/s,w/s,h/s)
|
||||
@ -187,7 +187,7 @@ function light:drawShine(l,t,w,h,s,bodies,canvas)
|
||||
--update shine
|
||||
self.shine:clear(255, 255, 255)
|
||||
util.drawto(self.shine, l, t, s, function()
|
||||
love.graphics.setShader(self.shader)
|
||||
love.graphics.setShader(self.shineShader)
|
||||
love.graphics.setBlendMode("alpha")
|
||||
love.graphics.setStencil(stencils.shine(bodies))
|
||||
love.graphics.rectangle("fill", -l/s,-t/s,w/s,h/s)
|
||||
|
Loading…
Reference in New Issue
Block a user