/* orxonox - the future of 3D-vertical-scrollers Copyright (C) 2004 orx 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 2, or (at your option) any later version. ### File Specific: main-programmer: hdavid, amaechler */ #include "snow_effect.h" #include "util/loading/load_param.h" #include "util/loading/factory.h" #include "glincl.h" #include "debug.h" #include "state.h" #include "sprite_particles.h" #include "plane_emitter.h" #include "parser/tinyxml/tinyxml.h" //SHELL_COMMAND(activate, SnowEffect, activateSnow); using namespace std; CREATE_FACTORY(SnowEffect, CL_SNOW_EFFECT); SnowEffect::SnowEffect(const TiXmlElement* root) { this->setClassID(CL_SNOW_EFFECT, "SnowEffect"); if (root != NULL) this->loadParams(root); this->init(); this->activate(); } SnowEffect::~SnowEffect() { this->deactivate(); } SpriteParticles* SnowEffect::snowParticles = NULL; void SnowEffect::loadParams(const TiXmlElement* root) { WeatherEffect::loadParams(root); // LoadParam(root, "snow-mode", this, SnowEffect, setSnowMode); // LoadParam(root, "snow-density", this, SnowEffect, setSnowDensity); // LoadParam(root, "snow-color", this, SnowEffect, setSnowColor); } bool SnowEffect::init() { this->emitter = new PlaneEmitter(); } bool SnowEffect::activate() { PRINTF(0)("Activating SnowEffect\n"); SnowEffect::snowParticles = new SpriteParticles(10000); SnowEffect::snowParticles->setName("SnowEffectTrailParticles"); SnowEffect::snowParticles->setMaterialTexture("maps/snow_flake_01_32x32.png"); //SnowEffect::snowParticles->setSize(1); SnowEffect::snowParticles->setLifeSpan(8, 2); SnowEffect::snowParticles->setRadius(0.0, 5.0, 10.0); SnowEffect::snowParticles->setRadius(0.2, 5.0, 10); SnowEffect::snowParticles->setRadius(1.0, 5.0, 10); SnowEffect::snowParticles->setMass(0, 1.0, .3); SnowEffect::snowParticles->setColor(0,1, 1, 1,.5); SnowEffect::snowParticles->setColor(.5, .6, .6, .6, .2); SnowEffect::snowParticles->setColor(1, .0, .0, .0, .0); this->emitter->setSystem(SnowEffect::snowParticles); // this->updateNode(0); this->emitter->setEmissionRate(900); this->emitter->setEmissionVelocity(150, 50); this->emitter->setSpread(0, .3); this->emitter->setSize(1200, 1200); } bool SnowEffect::deactivate() { PRINTF(0)("Deactivating SnowEffect\n"); this->emitter->setSystem(NULL); } void SnowEffect::draw() const { } void SnowEffect::tick(float dt) { }