mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 03:24:55 +02:00
Minor graphics fixes
This commit is contained in:
@@ -40,10 +40,10 @@ function Client.init()
|
||||
scheduleEvent(function()
|
||||
g_window.show()
|
||||
|
||||
-- play startup music
|
||||
--g_sounds.playMusic("startup.ogg", 3)
|
||||
--connect(g_game, { onGameStart = function() g_sounds.stopMusic(3) end })
|
||||
--connect(g_game, { onGameEnd= function() g_sounds.playMusic("startup.ogg", 3) end })
|
||||
-- Play startup music (The Silver Tree, by Mattias Westlund)
|
||||
g_sounds.playMusic("startup.ogg", 3)
|
||||
connect(g_game, { onGameStart = function() g_sounds.stopMusic(3) end })
|
||||
connect(g_game, { onGameEnd= function() g_sounds.playMusic("startup.ogg", 3) end })
|
||||
end, 0)
|
||||
end, 0)
|
||||
end
|
||||
|
@@ -1,6 +1,6 @@
|
||||
local skin = {
|
||||
name = 'Example',
|
||||
|
||||
|
||||
styles = {
|
||||
'topmenu.otui'
|
||||
}
|
||||
|
@@ -25,7 +25,6 @@ local shadersPanel
|
||||
function Shaders.init()
|
||||
importStyle 'shaders.otui'
|
||||
|
||||
|
||||
Keyboard.bindKeyDown(HOTKEY, Shaders.toggle)
|
||||
|
||||
shadersPanel = createWidget('ShadersPanel', GameInterface.getMapPanel())
|
||||
@@ -37,6 +36,8 @@ function Shaders.init()
|
||||
map:setMapShader(g_shaders.getShader(option))
|
||||
end
|
||||
|
||||
if not g_graphics.canUseShaders() then return end
|
||||
|
||||
for _i,opts in pairs(MAP_SHADERS) do
|
||||
local shader = g_shaders.createFragmentShader(opts.name, opts.frag)
|
||||
|
||||
|
@@ -7,9 +7,6 @@ const float sampleStrength = 2.2;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
// some sample positions
|
||||
float samples[] = { -0.08,-0.05,-0.03,-0.02,-0.01,0.01,0.02,0.03,0.05,0.08 };
|
||||
|
||||
// 0.5,0.5 is the center of the screen
|
||||
// so substracting v_TexCoord from it will result in
|
||||
// a vector pointing to the middle of the screen
|
||||
@@ -29,8 +26,16 @@ void main(void)
|
||||
|
||||
// take 10 additional blur samples in the direction towards
|
||||
// the center of the screen
|
||||
for(int i = 0; i < 10; i++)
|
||||
sum += texture2D(u_Tex0, v_TexCoord + dir * samples[i] * sampleDist);
|
||||
sum += texture2D(u_Tex0, v_TexCoord - 0.08 * dir * sampleDist);
|
||||
sum += texture2D(u_Tex0, v_TexCoord - 0.05 * dir * sampleDist);
|
||||
sum += texture2D(u_Tex0, v_TexCoord - 0.03 * dir * sampleDist);
|
||||
sum += texture2D(u_Tex0, v_TexCoord - 0.02 * dir * sampleDist);
|
||||
sum += texture2D(u_Tex0, v_TexCoord - 0.01 * dir * sampleDist);
|
||||
sum += texture2D(u_Tex0, v_TexCoord + 0.01 * dir * sampleDist);
|
||||
sum += texture2D(u_Tex0, v_TexCoord + 0.02 * dir * sampleDist);
|
||||
sum += texture2D(u_Tex0, v_TexCoord + 0.03 * dir * sampleDist);
|
||||
sum += texture2D(u_Tex0, v_TexCoord + 0.05 * dir * sampleDist);
|
||||
sum += texture2D(u_Tex0, v_TexCoord + 0.08 * dir * sampleDist);
|
||||
|
||||
// we have taken eleven samples
|
||||
sum *= 1.0/11.0;
|
||||
@@ -42,4 +47,4 @@ void main(void)
|
||||
|
||||
//Blend the original color with the averaged pixels
|
||||
gl_FragColor = mix(color, sum, t);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user