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

much shaderitude

New Actor:addParticles3D to automatically handle particles with "noup"
parent 222f085a
No related branches found
No related tags found
No related merge requests found
Showing
with 79 additions and 0 deletions
......@@ -22,6 +22,7 @@
-- Usually there is no need to use it directly, and it is better to use specific engine.Grid, engine.Actor or engine.Object
-- classes. Most modules will want to subclass those anyway to add new comportments
local Shader = require "engine.Shader"
local Particles = require "engine.Particles"
module(..., package.seeall, class.make)
......@@ -205,6 +206,27 @@ function _M:addParticles(ps)
return ps
end
--- Adds a particles emitter following the entity and duplicate it for the back
function _M:addParticles3D(def, args, shader)
local args1, args2 = table.clone(args or {}), table.clone(args or {})
args1.noup = 2
args2.noup = 1
local shader1, shader2 = nil, nil
if shader then
shader1, shader2 = table.clone(shader), table.clone(shader)
shader1.noup = 2
shader2.noup = 1
end
local ps1 = Particles.new(def, 1, args1, shader1)
ps1.toback = true
local ps2 = Particles.new(def, 1, args2, shader2)
self:addParticles(ps1)
self:addParticles(ps2)
return ps1, ps2
end
--- Removes a particles emitter following the entity
function _M:removeParticles(ps)
if not ps then return end
......
game/modules/tome/data/gfx/effects/ogre_fury.png

4.24 KiB

-- 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
use_shader = {type="volumetric/"..(kind or "volumetric"), noup=noup, coneAngle = coneAngle, topTransperency = topTransperency, twist = twist, isSphere = isSphere, growSpeed = growSpeed, cylinderRadius = cylinderRadius, cylinderHeight = cylinderHeight, shininess = shininess, density = density, scrollingSpeed = scrollingSpeed}
base_size = 32
local nb = 0
x = x or 0
y = y or 0
life = life or nil
local first = true
return {
blend_mode=additive and core.particles.BLEND_SHINY or nil,
system_rotation = base_rotation or 0, system_rotationv = rotation or 0,
generator = function()
local fs = 38 * (radius or 1)
return {
trail = 0,
life = life or 100,
size = fs, sizev = 0, sizea = 0,
x = x * base_size, xv = 0, xa = 0,
y = y * base_size, 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 = a or 1, av = 0, aa = 0,
}
end, },
function(self)
if first or not life then self.ps:emit(1) end
first = false
end,
1, "particles_images/volumetric/"..(img or "circles_01"), true
game/modules/tome/data/gfx/particles_images/volumetric/bright_cog.png

94.5 KiB

game/modules/tome/data/gfx/particles_images/volumetric/cake_01.png

75.8 KiB

game/modules/tome/data/gfx/particles_images/volumetric/circles2_01.png

68.7 KiB

game/modules/tome/data/gfx/particles_images/volumetric/circles_01.png

89.8 KiB

game/modules/tome/data/gfx/particles_images/volumetric/circles_circle_01.png

62.2 KiB

game/modules/tome/data/gfx/particles_images/volumetric/coggy_00.png

105 KiB

game/modules/tome/data/gfx/particles_images/volumetric/coggy_01_1.png

101 KiB

game/modules/tome/data/gfx/particles_images/volumetric/coggy_01_2.png

95.4 KiB

game/modules/tome/data/gfx/particles_images/volumetric/coggy_01_3.png

126 KiB

game/modules/tome/data/gfx/particles_images/volumetric/coggy_invert_01.png

81.7 KiB

game/modules/tome/data/gfx/particles_images/volumetric/coggy_invert_02.png

89.1 KiB

game/modules/tome/data/gfx/particles_images/volumetric/coggy_invert_outline_01.png

79.2 KiB

game/modules/tome/data/gfx/particles_images/volumetric/coggy_outline_01.png

79.9 KiB

game/modules/tome/data/gfx/particles_images/volumetric/coggy_outline_01_1.png

79.3 KiB

game/modules/tome/data/gfx/particles_images/volumetric/concentric_circles_01.png

64.1 KiB

game/modules/tome/data/gfx/particles_images/volumetric/concentric_circles_01_1.png

83.1 KiB

game/modules/tome/data/gfx/particles_images/volumetric/concentric_elipse_01.png

72.9 KiB

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