took out annoyance in naming

This commit is contained in:
Tim Anema 2014-11-28 10:55:43 -05:00
parent 7db34a4a02
commit 42c699590d
3 changed files with 14 additions and 15 deletions

View File

@ -447,7 +447,7 @@ function body:drawShadow(light)
end end
end end
function body:drawPixelShadow() function body:drawNormalShading()
if self.type == "image" and self.normalMesh then if self.type == "image" and self.normalMesh then
love.graphics.setColor(255, 255, 255) love.graphics.setColor(255, 255, 255)
love.graphics.draw(self.normalMesh, self.x - self.nx, self.y - self.ny) love.graphics.draw(self.normalMesh, self.x - self.nx, self.y - self.ny)

View File

@ -72,8 +72,8 @@ function light_world:refreshScreenSize(w, h)
self.render_buffer = love.graphics.newCanvas(w, h) self.render_buffer = love.graphics.newCanvas(w, h)
self.shadow = love.graphics.newCanvas(w, h) self.shadow = love.graphics.newCanvas(w, h)
self.shadow2 = love.graphics.newCanvas(w, h) self.shadow2 = love.graphics.newCanvas(w, h)
self.pixelShadow = love.graphics.newCanvas(w, h) self.normal = love.graphics.newCanvas(w, h)
self.pixelShadow2 = love.graphics.newCanvas(w, h) self.normal2 = love.graphics.newCanvas(w, h)
self.shine = love.graphics.newCanvas(w, h) self.shine = love.graphics.newCanvas(w, h)
self.shine2 = love.graphics.newCanvas(w, h) self.shine2 = love.graphics.newCanvas(w, h)
self.normalMap = love.graphics.newCanvas(w, h) self.normalMap = love.graphics.newCanvas(w, h)
@ -105,7 +105,7 @@ function light_world:draw(l,t,s)
self.drawForeground( l,t,w,h,s) self.drawForeground( l,t,w,h,s)
self:drawMaterial( l,t,w,h,s) self:drawMaterial( l,t,w,h,s)
self:drawShine( l,t,w,h,s) self:drawShine( l,t,w,h,s)
self:drawPixelShadow(l,t,w,h,s) self:drawNormalShading(l,t,w,h,s)
self:drawGlow( l,t,w,h,s) self:drawGlow( l,t,w,h,s)
self:drawRefraction( l,t,w,h,s) self:drawRefraction( l,t,w,h,s)
self:drawReflection( l,t,w,h,s) self:drawReflection( l,t,w,h,s)
@ -164,34 +164,33 @@ function light_world:drawShine(l,t,w,h,s)
util.drawCanvasToCanvas(self.shine, self.render_buffer, {blendmode = "multiplicative"}) util.drawCanvasToCanvas(self.shine, self.render_buffer, {blendmode = "multiplicative"})
end end
-- draw pixel shadow -- draw normal shading
function light_world:drawPixelShadow(l,t,w,h,s) function light_world:drawNormalShading(l,t,w,h,s)
if not self.isShadows then if not self.isShadows then
return return
end end
-- update pixel shadow
-- create normal map -- create normal map
self.normalMap:clear() self.normalMap:clear()
util.drawto(self.normalMap, l, t, s, function() util.drawto(self.normalMap, l, t, s, function()
for i = 1, #self.body do for i = 1, #self.body do
self.body[i]:drawPixelShadow() self.body[i]:drawNormalShading()
end end
end) end)
self.pixelShadow2:clear() self.normal2:clear()
for i = 1, #self.lights do for i = 1, #self.lights do
self.lights[i]:drawPixelShadow(l,t,w,h,s, self.normalMap, self.pixelShadow2) self.lights[i]:drawNormalShading(l,t,w,h,s, self.normalMap, self.normal2)
end end
self.pixelShadow:clear(255, 255, 255) self.normal:clear(255, 255, 255)
util.drawCanvasToCanvas(self.pixelShadow2, self.pixelShadow, {blendmode = "alpha"}) util.drawCanvasToCanvas(self.normal2, self.normal, {blendmode = "alpha"})
util.drawto(self.pixelShadow, l, t, s, function() util.drawto(self.normal, l, t, s, function()
love.graphics.setBlendMode("additive") love.graphics.setBlendMode("additive")
love.graphics.setColor({self.ambient[1], self.ambient[2], self.ambient[3]}) love.graphics.setColor({self.ambient[1], self.ambient[2], self.ambient[3]})
love.graphics.rectangle("fill", -l/s, -t/s, w/s,h/s) love.graphics.rectangle("fill", -l/s, -t/s, w/s,h/s)
end) end)
util.drawCanvasToCanvas(self.pixelShadow, self.render_buffer, {blendmode = "multiplicative"}) util.drawCanvasToCanvas(self.normal, self.render_buffer, {blendmode = "multiplicative"})
end end
-- draw material -- draw material

View File

@ -195,7 +195,7 @@ function light:drawShine(l,t,w,h,s,bodies,canvas)
end end
end end
function light:drawPixelShadow(l,t,w,h,s, normalMap, canvas) function light:drawNormalShading(l,t,w,h,s, normalMap, canvas)
if self.visible and self:inRange(l,t,w,h,s) then if self.visible and self:inRange(l,t,w,h,s) then
self.normalShader:send('lightColor', {self.red / 255.0, self.green / 255.0, self.blue / 255.0}) self.normalShader:send('lightColor', {self.red / 255.0, self.green / 255.0, self.blue / 255.0})
self.normalShader:send("lightPosition", {(self.x + l/s) * s, (h/s - (self.y + t/s)) * s, self.z / 255.0}) self.normalShader:send("lightPosition", {(self.x + l/s) * s, (h/s - (self.y + t/s)) * s, self.z / 255.0})