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

Added options to disabled "advanced" and distorting shader effects

parent 9d1012e4
No related branches found
No related tags found
No related merge requests found
......@@ -29,10 +29,8 @@ _M.progs = {}
loadNoDelay = true
local allows = {
}
function core.shader.allow(kind)
return config.settings['shaders_kind_'..kind]
end
--- Make a shader
......@@ -45,6 +43,9 @@ function _M:init(name, args)
if args and args.require_shader then
if not core.shader.active(args.require_shader) then return end
end
if args and args.require_kind then
if not core.shader.allow(args.require_kind) then return end
end
if not core.shader.active() then return end
......@@ -143,6 +144,14 @@ function _M:loaded()
if not f and err then error(err) end
setfenv(f, setmetatable(self.args or {}, {__index=_G}))
local def = f()
if def.require_shader then
if not core.shader.active(def.require_shader) then return end
end
if def.require_kind then
if not core.shader.allow(def.require_kind) then return end
end
_M.progs[self.totalname] = self:createProgram(def)
self.shad = _M.progs[self.totalname]
......
......@@ -122,6 +122,24 @@ function _M:generateList()
self.c_list:drawItem(item)
end,}
local zone = Textzone.new{width=self.c_desc.w, height=self.c_desc.h, text=string.toTString"Activates advanced shaders.\nThis option allows for advanced effects (like water surfaces, ...). Disabling it can improve performance.\n\n#LIGHT_RED#You must restart the game for it to take effect.#WHITE#"}
list[#list+1] = { zone=zone, name=string.toTString"#GOLD##{bold}#OpenGL Shaders: Advanced#WHITE##{normal}#", status=function(item)
return tostring(config.settings.shaders_kind_adv and "enabled" or "disabled")
end, fct=function(item)
config.settings.shaders_kind_adv = not config.settings.shaders_kind_adv
game:saveSettings("shaders_kind_adv", ("shaders_kind_adv = %s\n"):format(tostring(config.settings.shaders_kind_adv)))
self.c_list:drawItem(item)
end,}
local zone = Textzone.new{width=self.c_desc.w, height=self.c_desc.h, text=string.toTString"Activates distorting shaders.\nThis option allows for distortion effects (like spell effects doing a visual distortion, ...). Disabling it can improve performance.\n\n#LIGHT_RED#You must restart the game for it to take effect.#WHITE#"}
list[#list+1] = { zone=zone, name=string.toTString"#GOLD##{bold}#OpenGL Shaders: Distortions#WHITE##{normal}#", status=function(item)
return tostring(config.settings.shaders_kind_distort and "enabled" or "disabled")
end, fct=function(item)
config.settings.shaders_kind_distort = not config.settings.shaders_kind_distort
game:saveSettings("shaders_kind_distort", ("shaders_kind_distort = %s\n"):format(tostring(config.settings.shaders_kind_distort)))
self.c_list:drawItem(item)
end,}
local zone = Textzone.new{width=self.c_desc.w, height=self.c_desc.h, text=string.toTString"Use the custom cursor.\nDisabling it will use your normal operating system cursor.#WHITE#"}
list[#list+1] = { zone=zone, name=string.toTString"#GOLD##{bold}#Mouse cursor#WHITE##{normal}#", status=function(item)
return tostring(config.settings.mouse_cursor and "enabled" or "disabled")
......
......@@ -53,6 +53,8 @@ audio.enable = true
aa_text = true
fbo_active = true
shaders_active = true
shaders_kind_distort = true
shaders_kind_adv = true
particles_density = 100
background_saves = false
mouse_cursor = true
......
......@@ -18,6 +18,7 @@
-- darkgod@te4.org
return {
require_kind = "adv",
frag = "water",
vert = nil,
args = {
......
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