1 | /* |
---|
2 | orxonox - the future of 3D-vertical-scrollers |
---|
3 | |
---|
4 | Copyright (C) 2004 orx |
---|
5 | |
---|
6 | This program is free software; you can redistribute it and/or modify |
---|
7 | it under the terms of the GNU General Public License as published by |
---|
8 | the Free Software Foundation; either version 2, or (at your option) |
---|
9 | any later version. |
---|
10 | |
---|
11 | ### File Specific: |
---|
12 | main-programmer: hdavid, amaechler |
---|
13 | */ |
---|
14 | |
---|
15 | #include "snow_effect.h" |
---|
16 | |
---|
17 | #include "util/loading/load_param.h" |
---|
18 | #include "util/loading/factory.h" |
---|
19 | |
---|
20 | #include "glincl.h" |
---|
21 | |
---|
22 | #include "state.h" |
---|
23 | #include "sprite_particles.h" |
---|
24 | #include "plane_emitter.h" |
---|
25 | |
---|
26 | #include "parser/tinyxml/tinyxml.h" |
---|
27 | |
---|
28 | using namespace std; |
---|
29 | |
---|
30 | CREATE_FACTORY(SnowEffect, CL_SNOW_EFFECT); |
---|
31 | |
---|
32 | SnowEffect::SnowEffect(const TiXmlElement* root) |
---|
33 | { |
---|
34 | this->setClassID(CL_SNOW_EFFECT, "SnowEffect"); |
---|
35 | |
---|
36 | // this->snowMode = GL_LINEAR; |
---|
37 | // this->snowDensity = 0.001f; |
---|
38 | // this->snowStart = 10.0f; |
---|
39 | // this->snowEnd = 1000.0f; |
---|
40 | |
---|
41 | if (root != NULL) |
---|
42 | this->loadParams(root); |
---|
43 | |
---|
44 | this->init(); |
---|
45 | |
---|
46 | this->activate(); |
---|
47 | } |
---|
48 | |
---|
49 | |
---|
50 | |
---|
51 | SnowEffect::~SnowEffect() |
---|
52 | { |
---|
53 | this->deactivate(); |
---|
54 | } |
---|
55 | |
---|
56 | SpriteParticles* SnowEffect::snowParticles = NULL; |
---|
57 | |
---|
58 | void SnowEffect::loadParams(const TiXmlElement* root) |
---|
59 | { |
---|
60 | WeatherEffect::loadParams(root); |
---|
61 | |
---|
62 | // LoadParam(root, "snow-mode", this, SnowEffect, setSnowMode); |
---|
63 | // LoadParam(root, "snow-density", this, SnowEffect, setSnowDensity); |
---|
64 | // LoadParam(root, "snow-color", this, SnowEffect, setSnowColor); |
---|
65 | |
---|
66 | |
---|
67 | } |
---|
68 | |
---|
69 | bool SnowEffect::init() |
---|
70 | { |
---|
71 | Vector2D size; |
---|
72 | size.x = 1200; |
---|
73 | size.y = 1200; |
---|
74 | this->emitter = new PlaneEmitter(size, 900, 40, 5); |
---|
75 | } |
---|
76 | |
---|
77 | |
---|
78 | |
---|
79 | bool SnowEffect::activate() |
---|
80 | { |
---|
81 | PRINTF(0)("Activating Snow Effect\n"); |
---|
82 | /* |
---|
83 | SnowEffect::snowParticles = new SpriteParticles(2000); |
---|
84 | SnowEffect::snowParticles->setName("SnowEffectTrailParticles"); |
---|
85 | SnowEffect::snowParticles->setMaterialTexture("maps/radial-trans-noise.png"); |
---|
86 | SnowEffect::snowParticles->setLifeSpan(1.0, .3); |
---|
87 | SnowEffect::snowParticles->setRadius(0.0, .5); |
---|
88 | SnowEffect::snowParticles->setRadius(0.2, 2.0); |
---|
89 | SnowEffect::snowParticles->setRadius(.5, .8); |
---|
90 | SnowEffect::snowParticles->setRadius(1.0, .8); |
---|
91 | SnowEffect::snowParticles->setColor(0.0, 1,0,0,.7); |
---|
92 | SnowEffect::snowParticles->setColor(0.2, .8,.8,0,.5); |
---|
93 | SnowEffect::snowParticles->setColor(0.5, .8,.8,.8,.8); |
---|
94 | SnowEffect::snowParticles->setColor(1.0, .8,.8,.8,.0); |
---|
95 | |
---|
96 | this->emitter->setSystem(SnowEffect::snowParticles); |
---|
97 | |
---|
98 | this->updateNode(0); |
---|
99 | this->emitter->setEmissionRate(45.0); |
---|
100 | this->emitter->setEmissionVelocity(0.0);*/ |
---|
101 | } |
---|
102 | |
---|
103 | |
---|
104 | bool SnowEffect::deactivate() |
---|
105 | { |
---|
106 | PRINTF(0)("Deactivating Snow Effect\n"); |
---|
107 | } |
---|
108 | |
---|
109 | void SnowEffect::draw() const |
---|
110 | { |
---|
111 | } |
---|
112 | |
---|
113 | void SnowEffect::tick(float dt) |
---|
114 | { |
---|
115 | } |
---|