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

Particle systems can have a subparticle attached

New fireflash and flame effects
New Gravity Well effect
parent efea466d
No related branches found
No related tags found
No related merge requests found
Showing
with 725 additions and 6 deletions
......@@ -51,6 +51,7 @@ function _M:loaded()
local base_size = nil
local gl = nil
local islast = false
local sub_particle = nil
if type(self.def) == "string" then
local f, err = loadfile("/data/gfx/particles/"..self.def..".lua")
if not f and err then error(err) end
......@@ -61,6 +62,7 @@ function _M:loaded()
if t.use_shader then self.shader = t.use_shader end
if t.alterscreen then islast = true end
if t.sub_particle then sub_particle = t.sub_particle end
else error("unsupported particle type: "..type(self.def))
end
......@@ -89,6 +91,11 @@ function _M:loaded()
end
self.ps = core.particles.newEmitter("/data/gfx/particles/"..self.def..".lua", args, self.zoom, config.settings.particles_density or 100, gl, sha, islast)
if sub_particle then
self.subps = _M.new(sub_particle)
self.ps:setSub(self.subps.ps)
end
end
function _M:updateZoom()
......
......@@ -17,6 +17,41 @@
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
--------------------------------------------------------------------------------------
-- Advanced shaders
--------------------------------------------------------------------------------------
if core.shader.active(4) then
use_shader = {type="fireball"}
base_size = 64
return {
system_rotation = rng.range(0,359), system_rotationv = 3,
generator = function()
return {
life = 1000,
size = 40, sizev = 0, sizea = 0,
x = 0, xv = 0, xa = 0,
y = 0, yv = 0, ya = 0,
dir = 0, dirv = dirv, dira = 0,
vel = 0, velv = 0, vela = 0,
r = 1, rv = 0, ra = 0,
g = 1, gv = 0, ga = 0,
b = 1, bv = 0, ba = 0,
a = 1, av = 0, aa = 0,
}
end, },
function(self)
self.ps:emit(1)
end,
1
--------------------------------------------------------------------------------------
-- Default
--------------------------------------------------------------------------------------
else
return { generator = function()
local radius = 0
local sradius = (radius + 0.5) * (engine.Map.tile_w + engine.Map.tile_h) / 2
......@@ -49,3 +84,5 @@ function(self)
self.ps:emit(30)
end,
30*6
end
\ No newline at end of file
......@@ -17,6 +17,46 @@
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
--------------------------------------------------------------------------------------
-- Advanced shaders
--------------------------------------------------------------------------------------
if core.shader.active(4) then
use_shader = {type="fireball"}
base_size = 64
local nb = 0
return {
system_rotation = rng.range(0,359), system_rotationv = 5,
generator = function()
return {
life = 16,
size = 30, sizev = 2.1*64*radius/16, sizea = 0,
x = 0, xv = 0, xa = 0,
y = 0, yv = 0, ya = 0,
dir = 0, dirv = dirv, dira = 0,
vel = 0, velv = 0, vela = 0,
r = 1, rv = 0, ra = 0,
g = 1, gv = 0, ga = 0,
b = 1, bv = 0, ba = 0,
a = 0.4, av = 0.03, aa = 0,
}
end, },
function(self)
if nb < 1 then
self.ps:emit(1)
end
nb = nb + 1
end,
1
--------------------------------------------------------------------------------------
-- Default
--------------------------------------------------------------------------------------
else
local nb = 0
return { generator = function()
local radius = radius
......@@ -61,3 +101,5 @@ function(self)
end
end,
5*radius*266
end
......@@ -17,6 +17,65 @@
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
-- ToME - Tales of Maj'Eyal
-- Copyright (C) 2009, 2010, 2011, 2012, 2013 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
--------------------------------------------------------------------------------------
-- Advanced shaders
--------------------------------------------------------------------------------------
if core.shader.active(4) then
use_shader = {type="fireball"}
base_size = 64
local nb = 0
return {
system_rotation = rng.range(0,359), system_rotationv = 3,
generator = function()
return {
life = 10,
size = 30, sizev = 0, sizea = 0,
x = 0, xv = 0, xa = 0,
y = 0, yv = 0, ya = 0,
dir = 0, dirv = dirv, dira = 0,
vel = 0, velv = 0, vela = 0,
r = 1, rv = 0, ra = 0,
g = 1, gv = 0, ga = 0,
b = 1, bv = 0, ba = 0,
a = 0.5, av = -0.05, aa = 0,
}
end, },
function(self)
if nb < 1 then
self.ps:emit(1)
end
nb = nb + 1
end,
1
--------------------------------------------------------------------------------------
-- Default
--------------------------------------------------------------------------------------
else
local nb = 0
return { generator = function()
......@@ -54,3 +113,5 @@ function(self)
nb = nb + 1
end,
40
end
\ No newline at end of file
......@@ -17,7 +17,46 @@
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
base_size = 32
--------------------------------------------------------------------------------------
-- Advanced shaders
--------------------------------------------------------------------------------------
if core.shader.active(4) then
use_shader = {type="fireball"}
base_size = 64
local nb = 0
return {
system_rotation = rng.range(0,359), system_rotationv = 10,
generator = function()
return {
life = 8,
size = 5, sizev = 64/8, sizea = 0,
x = 0, xv = 0, xa = 0,
y = 0, yv = 0, ya = 0,
dir = 0, dirv = dirv, dira = 0,
vel = 0, velv = 0, vela = 0,
r = 1, rv = 0, ra = 0,
g = 1, gv = 0, ga = 0,
b = 1, bv = 0, ba = 0,
a = 0.7, av = 0.03, aa = 0,
}
end, },
function(self)
if nb < 1 then
self.ps:emit(1)
end
nb = nb + 1
end,
1
--------------------------------------------------------------------------------------
-- Default
--------------------------------------------------------------------------------------
else
base_size = 32
return {
base = 1000,
......@@ -38,3 +77,4 @@ return {
self.ps:emit(100)
end
end
end
\ No newline at end of file
-- ToME - Tales of Maj'Eyal
-- Copyright (C) 2009, 2010, 2011, 2012, 2013 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
if core.shader.active(4) then
sub_particle = "gravity_well2"
end
base_size = 32
return { generator = function()
local ad = rng.range(0, 360)
local a = math.rad(ad)
local dir = math.rad(ad + 90)
local r = rng.range(1, 20)
local dirv = math.rad(1)
return {
trail = 1,
life = 10,
size = 1, sizev = 0.5, sizea = 0,
x = r * math.cos(a), xv = -0.1, xa = 0,
y = r * math.sin(a), yv = -0.1, ya = 0,
dir = math.rad(rng.range(0, 360)), dirv = 0, dira = 0,
vel = 0.1, velv = 0, vela = 0,
r = rng.range(200, 230)/255, rv = 0, ra = 0,
g = rng.range(130, 160)/255, gv = 0, ga = 0,
b = rng.range(50, 70)/255, bv = 0, ba = 0,
a = rng.range(25, 220)/255, av = 0, aa = 0,
}
end, },
function(self)
self.ps:emit(4)
end,
40
-- ToME - Tales of Maj'Eyal
-- Copyright (C) 2009, 2010, 2011, 2012, 2013 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
use_shader = {type="distort", power=0.01, power_time=1000, blacken=0, power_amp=0.3} alterscreen = true
base_size = 64
return {
system_rotation = rng.range(0,359), system_rotationv = 1,
generator = function()
return {
trail = 0,
life = 32,
size = 70, sizev = 0, sizea = 0,
x = 0, xv = 0, xa = 0,
y = 0, yv = 0, ya = 0,
dir = 0, dirv = dirv, dira = 0,
vel = 0, velv = 0, vela = 0,
r = 1, rv = 0, ra = 0,
g = 1, gv = 0, ga = 0,
b = 1, bv = 0, ba = 0,
a = 1, av = 0, aa = 0,
}
end, },
function(self)
self.ps:emit(1)
end,
1, "particles_images/distort_singularity"
game/modules/tome/data/gfx/particles_images/distort_shield.png

4.62 KiB | W: | H:

game/modules/tome/data/gfx/particles_images/distort_shield.png

5.88 KiB | W: | H:

game/modules/tome/data/gfx/particles_images/distort_shield.png
game/modules/tome/data/gfx/particles_images/distort_shield.png
game/modules/tome/data/gfx/particles_images/distort_shield.png
game/modules/tome/data/gfx/particles_images/distort_shield.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -4,11 +4,12 @@ uniform sampler2D mainfbo;
uniform vec2 texSize;
uniform float power;
uniform float power_time;
uniform float power_amp;
uniform float blacken;
void main(void)
{
float distortionPower = power * cos(tick / power_time);
float distortionPower = power * (abs(cos(tick / power_time)) * power_amp + 1 - power_amp);
vec3 distortionColor = texture2D(tex, gl_TexCoord[0].xy);
vec2 distortionOffset = vec2(distortionColor.r - 0.5f, distortionColor.g - 0.5f) * distortionPower;
gl_FragColor = texture2D(mainfbo, gl_FragCoord.xy / texSize.xy + distortionOffset.xy) * (1.0 - length(distortionOffset) * blacken);
......
......@@ -25,6 +25,7 @@ return {
mainfbo = { texture = 1 },
power = power or 0.06,
power_time = power_time or 100,
power_amp = power_amp or 1,
blacken = blacken or 10,
},
clone = false,
......
// Fireball
// Awd
// @AlexWDunn
#ifdef GL_ES
precision highp float;
#endif
uniform float tick;
#define saturate(oo) clamp(oo, 0.0, 1.0)
// Quality Settings
#define MarchSteps 6
// Scene Settings
#define ExpPosition vec3(0.0)
#define Radius 2.0
#define Background vec4(0.0, 0.0, 0.0, 0.0)
// Noise Settings
#define NoiseSteps 4
#define NoiseAmplitude 0.15
#define NoiseFrequency 1.0
#define Animation vec3(0.0, -3.0, 0.5)
uniform float speed;
// Colour Gradient
uniform vec4 color1;
uniform vec4 color2;
uniform vec4 color3;
uniform vec4 color4;
/*
#define color1 vec4(0.0, 0.0, 0.0, 0.0)
#define color2 vec4(0.5, 0.2, 0.0, 0.5)
#define color3 vec4(0.7, 0.2, 0.0, 0.7)
#define color4 vec4(1.0, 0.8, 0.0, 1.0)
//*/
/*
#define color1 vec4(0.0, 0.0, 0.0, 0.0)
#define color2 vec4(.0, .0, 1.0, 0.3)
#define color3 vec4(0.0, 1.03, 1.0, 0.5)
#define color4 vec4(0.05, 0.02, 0.2, 0.8)
*/
/* Bright fel-green
#define color1 vec4(1.0, 1.0, 1.0, 1.0)
#define color2 vec4(1.0, 0.8, 0.2, 1.0)
#define color3 vec4(1.0, 0.8, 0.0, 1.0)
#define color4 vec4(0.6, 0.6, 0.1, 1.0)
*/
// Description : Array and textureless GLSL 2D/3D/4D simplex
// noise functions.
// Author : Ian McEwan, Ashima Arts.
// Maintainer : ijm
// Lastmod : 20110822 (ijm)
// License : Copyright (C) 2011 Ashima Arts. All rights reserved.
// Distributed under the MIT License. See LICENSE file.
// https://github.com/ashima/webgl-noise
//
vec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
vec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
vec4 permute(vec4 x) { return mod289(((x*34.0)+1.0)*x); }
vec4 taylorInvSqrt(vec4 r){ return 1.79284291400159 - 0.85373472095314 * r; }
float snoise(vec3 v)
{
const vec2 C = vec2(1.0/6.0, 1.0/3.0);
const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);
// First corner
vec3 i = floor(v + dot(v, C.yyy));
vec3 x0 = v - i + dot(i, C.xxx);
// Other corners
vec3 g = step(x0.yzx, x0.xyz);
vec3 l = 1.0 - g;
vec3 i1 = min(g.xyz, l.zxy);
vec3 i2 = max(g.xyz, l.zxy);
vec3 x1 = x0 - i1 + C.xxx;
vec3 x2 = x0 - i2 + C.yyy; // 2.0*C.x = 1/3 = C.y
vec3 x3 = x0 - D.yyy; // -1.0+3.0*C.x = -0.5 = -D.y
// Permutations
i = mod289(i);
vec4 p = permute( permute( permute( i.z + vec4(0.0, i1.z, i2.z, 1.0)) + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));
// Gradients: 7x7 points over a square, mapped onto an octahedron.
// The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)
float n_ = 0.142857142857; // 1.0/7.0
vec3 ns = n_ * D.wyz - D.xzx;
vec4 j = p - 49.0 * floor(p * ns.z * ns.z); // mod(p,7*7)
vec4 x_ = floor(j * ns.z);
vec4 y_ = floor(j - 7.0 * x_); // mod(j,N)
vec4 x = x_ *ns.x + ns.yyyy;
vec4 y = y_ *ns.x + ns.yyyy;
vec4 h = 1.0 - abs(x) - abs(y);
vec4 b0 = vec4(x.xy, y.xy);
vec4 b1 = vec4(x.zw, y.zw);
vec4 s0 = floor(b0) * 2.0 + 1.0;
vec4 s1 = floor(b1) * 2.0 + 1.0;
vec4 sh = -step(h, vec4(0.0));
vec4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;
vec4 a1 = b1.xzyw + s1.xzyw * sh.zzww;
vec3 p0 = vec3(a0.xy, h.x);
vec3 p1 = vec3(a0.zw, h.y);
vec3 p2 = vec3(a1.xy, h.z);
vec3 p3 = vec3(a1.zw, h.w);
//Normalise gradients
vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));
p0 *= norm.x;
p1 *= norm.y;
p2 *= norm.z;
p3 *= norm.w;
// Mix final noise value
vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);
m = m * m;
return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), dot(p2,x2), dot(p3,x3)));
}
float Turbulence(vec3 position, float minFreq, float maxFreq, float qWidth)
{
float value = 0.0;
float cutoff = clamp(0.5/qWidth, 0.0, maxFreq);
float fade;
float fOut = minFreq;
for(int i=NoiseSteps ; i>=0 ; i++)
{
if(fOut >= 0.5 * cutoff) break;
fOut *= 2.0;
value += abs(snoise(position * fOut))/fOut;
}
fade = clamp(2.0 * (cutoff-fOut)/cutoff, 0.0, 1.0);
value += fade * abs(snoise(position * fOut))/fOut;
return 1.0-value;
}
float SphereDist(vec3 position)
{
return length(position - ExpPosition) - Radius;
}
vec4 Shade(float distance)
{
float c1 = saturate(distance*5.0 + 0.5);
float c2 = saturate(distance*5.0);
float c3 = saturate(distance*3.4 - 0.5);
vec4 a = mix(color1,color2, c1);
vec4 b = mix(a, color3, c2);
return mix(b, color4, c3);
}
// Draws the scene
float RenderScene(vec3 position, out float distance)
{
float time = tick / speed;
float noise = Turbulence(position * NoiseFrequency + Animation*time, 0.1, 1.5, 0.03) * NoiseAmplitude;
noise = saturate(abs(noise));
distance = SphereDist(position) - noise;
return noise;
}
// Basic ray marching method.
vec4 March(vec3 rayOrigin, vec3 rayStep)
{
vec3 position = rayOrigin;
float distance;
float displacement;
for(int step = MarchSteps; step >=0 ; --step)
{
displacement = RenderScene(position, distance);
if(distance < 0.05) break;
position += rayStep * distance;
}
return mix(Shade(displacement), Background, float(distance >= 0.5));
}
bool IntersectSphere(vec3 ro, vec3 rd, vec3 pos, float radius, out vec3 intersectPoint)
{
vec3 relDistance = (ro - pos);
float b = dot(relDistance, rd);
float c = dot(relDistance, relDistance) - radius*radius;
float d = b*b - c;
intersectPoint = ro + rd*(-b - sqrt(d));
return d >= 0.0;
}
void main(void)
{
vec2 resolution = vec2(640.0, 640.0);
//vec2 p = (gl_FragCoord.xy / resolution.xy) * 2.0 - 1.0;
vec2 p = gl_TexCoord[0].xy - 0.5;
p.x *= resolution.x/resolution.y;
float rotx = 0.00;
float roty = 0.0;
float zoom = 9.0;
// camera
vec3 ro = zoom * normalize(vec3(cos(roty), cos(rotx), sin(roty)));
vec3 ww = normalize(vec3(0.0, 0.0, 0.0) - ro);
vec3 uu = normalize(cross( vec3(0.0, 1.0, 0.0), ww));
vec3 vv = normalize(cross(ww, uu));
vec3 rd = normalize(p.x*uu + p.y*vv + 1.5*ww);
vec4 col = Background;
vec3 origin;
if(IntersectSphere(ro, rd, ExpPosition, Radius + NoiseAmplitude*6.0, origin))
{
col = March(origin, rd);
}
gl_FragColor = col * gl_Color;
}
-- ToME - Tales of Maj'Eyal
-- Copyright (C) 2009, 2010, 2011, 2012, 2013 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 = "fireball",
vert = nil,
args = {
resolution = resolution or {128,128},
zoom = zoom or 1,
speed = 400,
color1 = {1.0, 1.0, 1.0, 0.85},
color2 = {1.0, 0.9, 0.1, 0.85},
color3 = {1.0, 0.4, 0.0, 0.85},
color4 = {0.6, 0.1, 0.0, 0.85},
},
clone = false,
}
// fuck that shit.
// CBS
// ported from https://www.shadertoy.com/view/lslGWr
// Added some stars: Thanks to http://glsl.heroku.com/e#6904.0
#ifdef GL_ES
precision mediump float;
#endif
uniform float tick;
// http://www.fractalforums.com/new-theories-and-research/very-simple-formula-for-fractal-patterns/
float field(in vec3 p)
{
float time = tick / 100.0;
float strength = 7. + .03 * log(1.e-6 + fract(sin(time) * 4373.11));
float accum = 0.;
float prev = 0.;
float tw = 0.;
for (int i = 0; i < 32; ++i)
{
float mag = dot(p, p);
p = abs(p) / mag + vec3(-.21, -.4, -1.3);
float w = exp(-float(i) / 7.);
accum += w * exp(-strength * pow(abs(mag - prev), 2.3));
tw += w;
prev = mag;
}
return max(0.1, 5. * accum / tw - .4);
}
vec3 nrand3(vec2 co)
{
vec3 a = fract(cos(co.x*8.3e-3 + co.y)*vec3(1.3e5, 4.7e5, 2.9e5));
vec3 b = fract(sin(co.x*0.3e-3 + co.y)*vec3(8.1e5, 1.0e5, 0.1e5));
vec3 c = mix(a, b, 10.5);
return c;
}
void main()
{
float time = tick / 100.0;
vec2 resolution = vec2(640.0, 640.0);
vec2 uv = 1.0 * gl_FragCoord.xy / resolution.xy - 1.0;
vec2 uvs = uv * resolution.xy / max(resolution.x, resolution.y);
vec3 p = vec3(uvs / 4., 0) + vec3(2., -1.3, -1.);
p += .15 * vec3(sin(time / 16.), sin(time / 12.), sin(time / 128.));
vec3 p2 = vec3(uvs / (4.+sin(time*0.11)*0.2+0.2+sin(time*0.15)*0.3+0.4), 1.5) + vec3(2., -1.3, -1.);
p2 += 0.15 * vec3(sin(time / 16.), sin(time / 12.), sin(time / 128.));
float t = field(p);
float t2 = field(p2);
float v = (1. - exp((abs(uv.x) - 10.) / 6.)) * (1. - exp((abs(uv.y) - 1.) * 6.));
vec4 c1 = mix(.4, 1., v) * vec4(1.8 * t * t * t, 1.4 * t * t, t, 1.0);
vec4 c2 = mix(.4, 1., v) * vec4(1.4 * t2 * t2 * t2, 1.* t2 * t2, t2, 1.0);
// c1.b *= mod(gl_FragCoord.y+1.0, 2.0)*1.4;
// c2.r *= mod(gl_FragCoord.y, 2.0)*7.4;
c2.r *= 9.0;
gl_FragColor = c1 + c2;
gl_FragColor.a = gl_FragColor.b;
}
uniform sampler2D tex;
uniform vec2 textSize;
uniform vec4 outlineColor;
void main(void)
{
vec2 off = 1.0 / textSize;
vec2 tc = gl_TexCoord[0].st;
vec4 c = texture2D(tex, tc);
vec4 n = texture2D(tex, vec2(tc.x, max(0.0, tc.y - off.y)));
vec4 e = texture2D(tex, vec2(min(1.0, tc.x + off.x), tc.y));
vec4 s = texture2D(tex, vec2(tc.x, min(1.0, tc.y + off.y)));
vec4 w = texture2D(tex, vec2(min(0.0, tc.x - off.x), tc.y));
vec4 origColor = c * gl_Color;
float ua = 0.0;
ua = mix(ua, 1.0, c.a);
ua = mix(ua, 1.0, n.a);
ua = mix(ua, 1.0, e.a);
ua = mix(ua, 1.0, s.a);
ua = mix(ua, 1.0, w.a);
vec4 underColor = outlineColor * vec4(ua);
gl_FragColor = underColor;
gl_FragColor = mix(gl_FragColor, origColor, origColor.a);
gl_FragColor.a = max(sqrt(gl_FragColor.a / 2.0), c.a);
// if (gl_FragColor.r + gl_FragColor.g + gl_FragColor.b <= 0.0) gl_FragColor.a = 0.0;
}
\ No newline at end of file
-- ToME - Tales of Maj'Eyal
-- Copyright (C) 2009, 2010, 2011, 2012, 2013 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 = "textoutline",
vert = nil,
args = {
tex = { texture = 0 },
textSize = textSize or {1, 1},
outlineColor = outlineColor or {0,0,0,0.4},
},
clone = false,
}
......@@ -182,7 +182,7 @@ newTalent{
DamageType.GRAVITYPIN, dam,
radius,
5, nil,
{type="quake"},
{type="gravity_well"},
nil, self:spellFriendlyFire()
)
game:playSoundNear(self, "talents/earth")
......
......@@ -125,11 +125,21 @@ static int particles_new(lua_State *L)
ps->texture = *texture;
ps->shader = s;
ps->fboalter = fboalter;
ps->sub = NULL;
thread_add(ps);
return 1;
}
static int particles_set_sub(lua_State *L)
{
particles_type *ps = (particles_type*)auxiliar_checkclass(L, "core{particles}", 1);
particles_type *subps = (particles_type*)auxiliar_checkclass(L, "core{particles}", 2);
ps->sub = subps;
return 0;
}
// Runs into main thread
static int particles_free(lua_State *L)
{
......@@ -251,8 +261,21 @@ static int particles_to_screen(lua_State *L)
pdls_head = pdl;
return 0;
}
particles_draw(ps, x, y, zoom);
if (ps->sub) {
ps = ps->sub;
if (ps->fboalter) {
particle_draw_last *pdl = malloc(sizeof(particle_draw_last));
pdl->ps = ps;
pdl->x = x;
pdl->y = y;
pdl->zoom = zoom;
pdl->next = pdls_head;
pdls_head = pdl;
}
else particles_draw(ps, x, y, zoom);
}
return 0;
}
......@@ -561,6 +584,7 @@ static const struct luaL_Reg particles_reg[] =
{"__gc", particles_free},
{"toScreen", particles_to_screen},
{"isAlive", particles_is_alive},
{"setSub", particles_set_sub},
{"die", particles_die},
{NULL, NULL},
};
......
......@@ -36,7 +36,7 @@ typedef struct {
struct s_plist;
typedef struct {
struct s_particles_type {
SDL_mutex *lock;
// Read only by main
......@@ -85,8 +85,11 @@ typedef struct {
bool fboalter;
struct s_particles_type *sub;
struct s_plist *l;
} particles_type;
};
typedef struct s_particles_type particles_type;
//To draw last linked list
struct s_particle_draw_last {
......
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