Skip to content
Snippets Groups Projects
Commit fda124a7 authored by DarkGod's avatar DarkGod
Browse files

When a shader is missing, it'll use a default fallback (prevents loading game...

When a shader is missing, it'll use a default fallback (prevents loading game with missing DLCs/addons)
parent 0af1f703
No related branches found
No related tags found
No related merge requests found
uniform sampler2D tex;
void main(void) {
gl_FragColor = texture2D(tex, gl_TexCoord[0].xy) * gl_Color;
}
-- TE4 - T-Engine 4
-- Copyright (C) 2009 - 2018 Nicolas Casalini
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
return {
frag = "fallback",
vert = nil,
args = {},
clone = false,
permanent = true,
}
......@@ -177,7 +177,14 @@ function _M:loaded()
else
print("[SHADER] Loading from /data/gfx/shaders/"..self.name..".lua")
local f, err = loadfile("/data/gfx/shaders/"..self.name..".lua")
if not f and err then error(err) end
if not f and err then
if config.settings.cheat then
error(err)
else
print("[SHADER] "..self.name.." not found, using fallback")
f, err = loadfile("/data/gfx/shaders/fallback.lua")
end
end
setfenv(f, setmetatable(self.args or {}, {__index=_G}))
local def = f()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment