Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.cc @ 7562

Last change on this file since 7562 was 7562, checked in by amaechler, 18 years ago

branches/atmosphere_engine:

File size: 3.3 KB
Line 
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
31using namespace std;
32
33CREATE_FACTORY(RainEffect, CL_RAIN_EFFECT);
34
35RainEffect::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
52RainEffect::~RainEffect()
53{
54  this->deactivate();
55}
56
57
58void 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
69bool RainEffect::init()
70{}
71
72
73
74bool RainEffect::activate()
75{
76//   PRINTF(0)( "Enabling Rain Effect, mode: %i, density: %f, start: %f, end: %f, color %f, %f, %f\n", this->rainMode, this->rainDensity, this->rainStart, this->rainEnd, this->colorVector.x, this->colorVector.y, this->colorVector.z);
77//
78//   glEnable(GL_RAIN);
79//   {
80//     //GLfloat rainColor[4] = {0.7, 0.6, 0.6, 1.0};
81//     GLfloat rainColor[4] = { colorVector.x, colorVector.y, colorVector.z, 1.0};
82//
83//     glRaini(GL_RAIN_MODE, this->rainMode);
84//     glRainfv(GL_RAIN_COLOR, rainColor);
85//     glRainf(GL_RAIN_DENSITY, this->rainDensity);
86//     glHint(GL_RAIN_HINT, GL_DONT_CARE);
87//     glRainf(GL_RAIN_START, this->rainStart);
88//     glRainf(GL_RAIN_END, this->rainEnd);
89//
90//     //glRaini(GL_RAIN_COORDINATE_SOURCE, GL_RAIN_COORDINATE);
91//   }
92//   glClearColor(0.5, 0.5, 0.5, 1.0);
93}
94
95
96bool RainEffect::deactivate()
97{
98  PRINTF(0)("Deactivating Rain Effect\n");
99//      glDisable(GL_RAIN);
100}
101
102void RainEffect::draw() const
103{
104//  Particle* drawPart = ParticleSystem::particles;
105
106//   glDepthMask(GL_FALSE);
107//   glPushAttrib(GL_ENABLE_BIT);
108//
109//   glDisable(GL_LIGHTING);
110//   glDisable(GL_TEXTURE_2D);
111//
112//   glEnable(GL_LINE_SMOOTH);
113//   glEnable(GL_BLEND);
114//   glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);
115//
116//   glLineWidth(2.0);
117//   glBegin(GL_LINES);
118//   while (likely(drawPart != NULL))
119//   {
120//   //    printf("%f %f %f %f\n", drawPart->color[0], drawPart->color[1], drawPart->color[2], drawPart->color[3]);
121//     glColor4fv(drawPart->color);
122//     glVertex3f(drawPart->position.x,  drawPart->position.y,  drawPart->position.z);
123//     glVertex3f(drawPart->position.x - drawPart->velocity.x * drawPart->radius,
124//                drawPart->position.y - drawPart->velocity.y * drawPart->radius,
125//                drawPart->position.z - drawPart->velocity.z * drawPart->radius);
126//     drawPart = drawPart->next;
127//   }
128//   glEnd();
129//
130//   glDepthMask(GL_TRUE);
131//   glPopAttrib();
132}
Note: See TracBrowser for help on using the repository browser.