mirror of
https://github.com/tanema/light_world.lua.git
synced 2024-12-11 01:14:26 +00:00
took out uneeded example now that normals are generated and updated my progress
This commit is contained in:
parent
ec19b3cadd
commit
224822de31
@ -1,6 +1,5 @@
|
||||
:todoing
|
||||
-make sure all draw calls check if the object is within range
|
||||
-add normal map to each object
|
||||
-refactor rectablges to be polygons to reduce code
|
||||
-handle polygons in a moveable way
|
||||
-optimize shadow body calculations and drawing methods
|
||||
|
@ -1,53 +0,0 @@
|
||||
-- Example: normal map generation testing
|
||||
local LightWorld = require "lib"
|
||||
local util = require "lib/util"
|
||||
local normal_map = require "lib/normal_map"
|
||||
|
||||
function love.load()
|
||||
z = 1
|
||||
lightWorld = LightWorld({
|
||||
drawBackground = drawBackground,
|
||||
drawForeground = drawForeground,
|
||||
ambient = {55,55,55},
|
||||
refractionStrength = 32.0,
|
||||
reflectionVisibility = 0.75,
|
||||
})
|
||||
|
||||
-- create light
|
||||
lightMouse = lightWorld:newLight(0, 0, 255, 127, 63, 300)
|
||||
lightMouse:setGlowStrength(0.3)
|
||||
|
||||
radius = 50
|
||||
circle_canvas = love.graphics.newCanvas(radius*2, radius*2)
|
||||
util.drawto(circle_canvas, 0, 0, 1, function()
|
||||
love.graphics.circle('fill', radius, radius, radius)
|
||||
end)
|
||||
circle_image = love.graphics.newImage(circle_canvas:getImageData())
|
||||
|
||||
local t = lightWorld:newImage(circle_image, 150, 150)
|
||||
t:setNormalMap(normal_map.generateFlat(circle_image, "top"))
|
||||
t:setShadowType('circle', 50)
|
||||
end
|
||||
|
||||
function love.mousepressed(x, y, c)
|
||||
if c == "wu" then
|
||||
z = z + 1
|
||||
elseif c == "wd" then
|
||||
z = z - 1
|
||||
end
|
||||
end
|
||||
|
||||
function love.update(dt)
|
||||
love.window.setTitle("Light vs. Shadow Engine (FPS:" .. love.timer.getFPS() .. ")")
|
||||
lightMouse:setPosition(love.mouse.getX(), love.mouse.getY(), z)
|
||||
end
|
||||
|
||||
function love.draw()
|
||||
lightWorld:draw(function(l, t, w, h, s)
|
||||
love.graphics.setColor(255, 255, 255)
|
||||
love.graphics.rectangle("fill", l, t, w, h)
|
||||
love.graphics.setColor(0, 255, 0)
|
||||
love.graphics.circle('fill', 150, 150, 50)
|
||||
end)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user