diff --git a/game/modules/tome/class/Grid.lua b/game/modules/tome/class/Grid.lua index 99e0792ef1adc621a945edf6aac59308689c61e4..0ca8c7798c30d8a0ec89e663c305f068d27c3d68 100644 --- a/game/modules/tome/class/Grid.lua +++ b/game/modules/tome/class/Grid.lua @@ -201,6 +201,7 @@ function _M:makeTrees(base, max, bigheight_limit, tint) display_h = treeid < (bigheight_limit or 9) and 1 or 2, image = (base or "terrain/tree_alpha")..treeid..".png", tint = tint, + shader = "tree", } end diff --git a/game/modules/tome/data/general/grids/forest.lua b/game/modules/tome/data/general/grids/forest.lua index 88aa8729606d374679c5b887386a3993f01b4144..4aa3aa801015fe3d128e9ac091211964b24fc64d 100644 --- a/game/modules/tome/data/general/grids/forest.lua +++ b/game/modules/tome/data/general/grids/forest.lua @@ -136,6 +136,7 @@ newEntity{ change_level = 1, change_zone = "wilderness", nice_editer = grass_editer, + shader = "tree", } newEntity{ diff --git a/game/modules/tome/data/general/grids/jungle.lua b/game/modules/tome/data/general/grids/jungle.lua index 2e7a72b14f97223872f7922a2e930a2a9c947b00..0c9e0aee056c9bcafac0bc9b1e540cb55e9e22a6 100644 --- a/game/modules/tome/data/general/grids/jungle.lua +++ b/game/modules/tome/data/general/grids/jungle.lua @@ -41,7 +41,7 @@ for i = 1, 4 do newEntity{ base = "JUNGLE_GRASS", define_as = "JUNGLE_GRASS_PATCH"..(i+5+8+3), add_displays={class.new{z=3,image = "terrain/jungle/jungle_dirt_var_"..i.."_64_01.png"}} } end for i = 1, 4 do - newEntity{ base = "JUNGLE_GRASS", define_as = "JUNGLE_GRASS_PATCH"..(i+5+8+3+4), add_displays={class.new{z=3,image = "terrain/jungle/jungle_plant_0"..i..".png"}} } + newEntity{ base = "JUNGLE_GRASS", define_as = "JUNGLE_GRASS_PATCH"..(i+5+8+3+4), add_displays={class.new{z=3,image = "terrain/jungle/jungle_plant_0"..i..".png", shader="tree"}} } end newEntity{ diff --git a/game/modules/tome/data/gfx/shaders/tree.frag b/game/modules/tome/data/gfx/shaders/tree.frag new file mode 100644 index 0000000000000000000000000000000000000000..bf8f5e35c5a7e1eea44bff965329fead2f3a9de6 --- /dev/null +++ b/game/modules/tome/data/gfx/shaders/tree.frag @@ -0,0 +1,11 @@ +uniform sampler2D tex; +uniform float tick; +uniform vec2 mapCoord; + +void main(void) +{ + float time = tick / 1000.0; + vec2 xy = gl_TexCoord[0].xy; + if (xy.y <= 0.5) xy.x = xy.x + (0.5-xy.y) * sin(time + mapCoord.x / 40 + mapCoord.y) / 14.0; + gl_FragColor = texture2D(tex, xy) * gl_Color; +} diff --git a/game/modules/tome/data/gfx/shaders/tree.lua b/game/modules/tome/data/gfx/shaders/tree.lua new file mode 100644 index 0000000000000000000000000000000000000000..9e7b7a251e9d86d22a3ea1b8af5faa81d33b7f8e --- /dev/null +++ b/game/modules/tome/data/gfx/shaders/tree.lua @@ -0,0 +1,26 @@ +-- ToME - Tales of Maj'Eyal +-- Copyright (C) 2009 - 2014 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 = "tree", + vert = nil, + args = { + }, + clone = false, +}