particles test

This commit is contained in:
Henrique Santiago 2011-12-18 21:44:49 -02:00
parent e3e6770957
commit ab9efe5a95
7 changed files with 87 additions and 27 deletions

View File

@ -45,5 +45,5 @@ void main()
} }
sum = sin(ticks/500.0)*sum; sum = sin(ticks/500.0)*sum;
gl_FragColor = pixel * color * opacity + sum; gl_FragColor = pixel * color * opacity;
} }

View File

@ -1,27 +1,87 @@
ParticleSystem ParticleSystem
AttractionAffector
delay: 0 // Fire
duration: 999
position: 200 200
acceleration: 64
velocity-reduction-percent: 0
Emitter Emitter
position: 200 264 position: 295 180
duration: 2 duration: 0.5
burstRate: 3 burstRate: 0.0166
burstCount: 1 burstCount: 6
delay: 0 delay: 0
particle-ignore-physics-after: 999 particle-min-duration: 0.3
particle-max-duration: 0.5
particle-duration: 12
particle-position-radius: 0 particle-position-radius: 0
particle-velocity: 32
particle-velocity-angle: 0 particle-min-velocity: 200
particle-max-velocity: 240
particle-min-velocity-angle: -5
particle-max-velocity-angle: 10
particle-acceleration: 0 particle-acceleration: 0
particle-start-size: 4 4
particle-final-size: 48 48 particle-start-size: 8 8
particle-colors: #00ff00ff #ff0000ff #0000ffff #00ff00ff #00ff0000 particle-final-size: 64 64
particle-colors-stops: 3 6 9 12
particle-colors: #ff8c00ff #e6660080 #1e1e1e00
particle-colors-stops: 0 0.15 0.3
particle-texture: circle2.png particle-texture: circle2.png
// Fire ball
Emitter
position: 200 200
duration: 0.7
burstRate: 0.0166
burstCount: 3
delay: 0
particle-min-duration: 0.5
particle-max-duration: 0.9
particle-position-radius: 0
particle-min-velocity: 80
particle-max-velocity: 110
particle-min-velocity-angle: -30
particle-max-velocity-angle: 30
particle-acceleration: 0
particle-start-size: 16 16
particle-final-size: 64 64
particle-colors: #19191980 #0f0f0f80 #00000000
particle-colors-stops: 0 0.45 0.9
particle-texture: circle2.png
// Smoke
Emitter
position: 200 200
duration: 0.1
burstRate: 0.0166
burstCount: 3
delay: 0
particle-min-duration: 0.1
particle-max-duration: 0.45
particle-position-radius: 0
particle-min-velocity: 60
particle-max-velocity: 80
particle-min-velocity-angle: -5
particle-max-velocity-angle: 10
particle-acceleration: 0
particle-start-size: 8 8
particle-final-size: 64 64
particle-colors: #555555ff #55555580 #55555500
particle-colors-stops: 0 0.225 0.45
particle-texture: circle2.png

View File

@ -111,11 +111,8 @@ void Application::init(const std::vector<std::string>& args, int appFlags)
if(m_appFlags & Fw::AppEnableModules) if(m_appFlags & Fw::AppEnableModules)
g_modules.discoverModulesPath(); g_modules.discoverModulesPath();
g_particleManager.load("particle.otpa");
} }
void Application::terminate() void Application::terminate()
{ {
// hide the window because there is no render anymore // hide the window because there is no render anymore

View File

@ -49,9 +49,9 @@ void Particle::render()
if(!m_texture) if(!m_texture)
g_painter.drawFilledRect(m_rect); g_painter.drawFilledRect(m_rect);
else { else {
//g_painter.setCompositionMode(Painter::CompositionMode_AdditiveSource); g_painter.setCompositionMode(Painter::CompositionMode_AdditiveSource);
g_painter.drawTexturedRect(m_rect, m_texture); g_painter.drawTexturedRect(m_rect, m_texture);
//g_painter.setCompositionMode(Painter::CompositionMode_SourceOver); g_painter.setCompositionMode(Painter::CompositionMode_SourceOver);
} }
} }

View File

@ -163,7 +163,8 @@ bool ParticleEmitter::load(const OTMLNodePtr& node)
if(m_pColors.empty()) if(m_pColors.empty())
m_pColors.push_back(Color(255, 255, 255, 128)); m_pColors.push_back(Color(255, 255, 255, 128));
m_pColorsStops.insert(m_pColorsStops.begin(), 0); if(m_pColorsStops.empty())
m_pColorsStops.push_back(0);
if(m_pColors.size() != m_pColorsStops.size()) { if(m_pColors.size() != m_pColorsStops.size()) {
logError("particle colors must be equal to colorstops-1"); logError("particle colors must be equal to colorstops-1");

View File

@ -530,7 +530,7 @@ void ProtocolGame::parseMagicEffect(InputMessage& msg)
tile->addEffect(effect); tile->addEffect(effect);
// TODO: check if particles effect exists, if not, play standard sprite effect. // TODO: check if particles effect exists, if not, play standard sprite effect.
g_particleManager.load("particle.otpa"); //g_particleManager.load("particle.otpa");
} }
void ProtocolGame::parseAnimatedText(InputMessage& msg) void ProtocolGame::parseAnimatedText(InputMessage& msg)

View File

@ -23,6 +23,7 @@
#include "uigame.h" #include "uigame.h"
#include <otclient/core/game.h> #include <otclient/core/game.h>
#include <framework/ui/uilineedit.h> #include <framework/ui/uilineedit.h>
#include <framework/graphics/particlemanager.h>
bool UIGame::onKeyPress(uchar keyCode, std::string keyText, int keyboardModifiers) bool UIGame::onKeyPress(uchar keyCode, std::string keyText, int keyboardModifiers)
{ {
@ -82,6 +83,7 @@ bool UIGame::onKeyPress(uchar keyCode, std::string keyText, int keyboardModifier
return true; return true;
} else if(keyCode == Fw::KeyRight || keyCode == Fw::KeyNumpad6) { } else if(keyCode == Fw::KeyRight || keyCode == Fw::KeyNumpad6) {
g_game.turn(Otc::East); g_game.turn(Otc::East);
g_particleManager.load("particle.otpa");
return true; return true;
} else if(keyCode == Fw::KeyDown || keyCode == Fw::KeyNumpad2) { } else if(keyCode == Fw::KeyDown || keyCode == Fw::KeyNumpad2) {
g_game.turn(Otc::South); g_game.turn(Otc::South);