-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshaders.lua2p
63 lines (56 loc) · 1.67 KB
/
shaders.lua2p
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
local Log = require("modules.log.log")
local Shaders = {}
Shaders.paths = {
blur = "shaders/blur.glsl",
dissolve = "shaders/dissolve.glsl",
dither_gradient = "shaders/dither_gradient.glsl",
motion_blur = "shaders/motion_blur.glsl",
film_grain = "shaders/film_grain.glsl",
fog = "shaders/fog.glsl",
glitch = "shaders/glitch.glsl",
ngrading = true,
ngrading_old = "shaders/ngrading_old.glsl",
ngrading_volume = "shaders/ngrading_volume.glsl",
ngrading_volume_multi = "shaders/ngrading_volume_multi.glsl",
ngrading_effect = [[
vec4 effect(vec4 color, Image tex, vec2 tc, vec2 sc)
{
return ngrading(tex, tc) * color;
}
]],
!if _GLSL_NORMALS then
df_geometry = "shaders/geometry_pass.glsl",
df_lighting = "shaders/lighting_pass.glsl",
!else
df_lighting = "shaders/lighting_pass_basic.glsl",
!end
}
function Shaders.init()
local is_mobile = !(_PLATFORM ~= "desktop")
Log.debug("Validating shaders... GL ES:", is_mobile)
for k, path in pairs(Shaders.paths) do
if type(path) == "string" and not stringx.starts_with(k, "ngrading_") then
Log.debug("checking:", path)
local status, message = love.graphics.validateShader(is_mobile, path)
if not status then
error(path .. "- error with validateShader: " .. message)
end
local shader = love.graphics.newShader(path)
if not shader then
error(path .. "- error with newShader: " .. message)
end
end
end
end
function Shaders.load_shaders()
local base = "shaders."
for k in pairs(Shaders.paths) do
local path = base .. k
local exists = love.filesystem.getInfo("shaders/" .. k .. ".lua")
if exists then
local shader = require(path)
Shaders[shader.__type] = shader
end
end
end
return Shaders