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 "rain_effect.h" |
---|
16 | |
---|
17 | #include "util/loading/load_param.h" |
---|
18 | #include "util/loading/factory.h" |
---|
19 | |
---|
20 | #include "glincl.h" |
---|
21 | |
---|
22 | // ***** |
---|
23 | |
---|
24 | #include "material.h" |
---|
25 | #include "state.h" |
---|
26 | #include "shell_command.h" |
---|
27 | |
---|
28 | #include "parser/tinyxml/tinyxml.h" |
---|
29 | #include <algorithm> |
---|
30 | |
---|
31 | using namespace std; |
---|
32 | |
---|
33 | CREATE_FACTORY(RainEffect, CL_RAIN_EFFECT); |
---|
34 | |
---|
35 | RainEffect::RainEffect(const TiXmlElement* root) |
---|
36 | { |
---|
37 | this->setClassID(CL_RAIN_EFFECT, "RainEffect"); |
---|
38 | |
---|
39 | // this->rainMode = GL_LINEAR; |
---|
40 | // this->rainDensity = 0.001f; |
---|
41 | // this->rainStart = 10.0f; |
---|
42 | // this->rainEnd = 1000.0f; |
---|
43 | |
---|
44 | if (root != NULL) |
---|
45 | this->loadParams(root); |
---|
46 | |
---|
47 | this->activate(); |
---|
48 | } |
---|
49 | |
---|
50 | |
---|
51 | |
---|
52 | RainEffect::~RainEffect() |
---|
53 | { |
---|
54 | this->deactivate(); |
---|
55 | } |
---|
56 | |
---|
57 | |
---|
58 | void RainEffect::loadParams(const TiXmlElement* root) |
---|
59 | { |
---|
60 | WeatherEffect::loadParams(root); |
---|
61 | |
---|
62 | // LoadParam(root, "rain-mode", this, RainEffect, setRainMode); |
---|
63 | // LoadParam(root, "rain-density", this, RainEffect, setRainDensity); |
---|
64 | // LoadParam(root, "rain-color", this, RainEffect, setRainColor); |
---|
65 | |
---|
66 | |
---|
67 | } |
---|
68 | |
---|
69 | bool RainEffect::init() |
---|
70 | {} |
---|
71 | |
---|
72 | |
---|
73 | |
---|
74 | bool RainEffect::activate() |
---|
75 | { |
---|
76 | PRINTF(0)("Activating Rain Effect\n"); |
---|
77 | } |
---|
78 | |
---|
79 | |
---|
80 | bool RainEffect::deactivate() |
---|
81 | { |
---|
82 | PRINTF(0)("Deactivating Rain Effect\n"); |
---|
83 | // glDisable(GL_RAIN); |
---|
84 | } |
---|
85 | |
---|
86 | void RainEffect::draw() const |
---|
87 | { |
---|
88 | // Particle* drawPart = ParticleSystem::particles; |
---|
89 | |
---|
90 | // glDepthMask(GL_FALSE); |
---|
91 | // glPushAttrib(GL_ENABLE_BIT); |
---|
92 | // |
---|
93 | // glDisable(GL_LIGHTING); |
---|
94 | // glDisable(GL_TEXTURE_2D); |
---|
95 | // |
---|
96 | // glEnable(GL_LINE_SMOOTH); |
---|
97 | // glEnable(GL_BLEND); |
---|
98 | // glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA); |
---|
99 | // |
---|
100 | // glLineWidth(2.0); |
---|
101 | // glBegin(GL_LINES); |
---|
102 | // while (likely(drawPart != NULL)) |
---|
103 | // { |
---|
104 | // // printf("%f %f %f %f\n", drawPart->color[0], drawPart->color[1], drawPart->color[2], drawPart->color[3]); |
---|
105 | // glColor4fv(drawPart->color); |
---|
106 | // glVertex3f(drawPart->position.x, drawPart->position.y, drawPart->position.z); |
---|
107 | // glVertex3f(drawPart->position.x - drawPart->velocity.x * drawPart->radius, |
---|
108 | // drawPart->position.y - drawPart->velocity.y * drawPart->radius, |
---|
109 | // drawPart->position.z - drawPart->velocity.z * drawPart->radius); |
---|
110 | // drawPart = drawPart->next; |
---|
111 | // } |
---|
112 | // glEnd(); |
---|
113 | // |
---|
114 | // glDepthMask(GL_TRUE); |
---|
115 | // glPopAttrib(); |
---|
116 | } |
---|