1 | /* |
---|
2 | orxonox - the future of 3D-vertical-scrollers |
---|
3 | |
---|
4 | Copyright (C) 2006 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 |
---|
13 | */ |
---|
14 | |
---|
15 | #include "volfog_effect.h" |
---|
16 | |
---|
17 | #include "util/loading/load_param.h" |
---|
18 | #include "util/loading/factory.h" |
---|
19 | |
---|
20 | #include "p_node.h" |
---|
21 | #include "state.h" |
---|
22 | #include "shell_command.h" |
---|
23 | |
---|
24 | #include "glincl.h" |
---|
25 | #include "debug.h" |
---|
26 | |
---|
27 | |
---|
28 | |
---|
29 | #define GLX_GLXEXT_PROTOTYPES |
---|
30 | |
---|
31 | #include "class_id_DEPRECATED.h" |
---|
32 | ObjectListDefinitionID(VolFogEffect, CL_VOLFOG_EFFECT); |
---|
33 | CREATE_FACTORY(VolFogEffect); |
---|
34 | |
---|
35 | SHELL_COMMAND(activate, VolFogEffect, activateFog); |
---|
36 | SHELL_COMMAND(deactivate, VolFogEffect, deactivateFog); |
---|
37 | |
---|
38 | |
---|
39 | VolFogEffect::VolFogEffect(const TiXmlElement* root) { |
---|
40 | this->registerObject(this, VolFogEffect::_objectList); |
---|
41 | |
---|
42 | if (root != NULL) |
---|
43 | this->loadParams(root); |
---|
44 | |
---|
45 | // Initialize Effect |
---|
46 | this->init(); |
---|
47 | |
---|
48 | // Activate Effect |
---|
49 | if(fogActivate) |
---|
50 | this->activate(); |
---|
51 | } |
---|
52 | |
---|
53 | |
---|
54 | VolFogEffect::~VolFogEffect() { |
---|
55 | if(fogActivate) |
---|
56 | this->deactivate(); |
---|
57 | } |
---|
58 | |
---|
59 | void VolFogEffect::loadParams(const TiXmlElement* root) { |
---|
60 | WeatherEffect::loadParams(root); |
---|
61 | } |
---|
62 | |
---|
63 | void VolFogEffect::init() { |
---|
64 | PRINTF(0)("Initalize VolFogEffect\n"); |
---|
65 | |
---|
66 | fogActivate = false; |
---|
67 | } |
---|
68 | |
---|
69 | |
---|
70 | void VolFogEffect::activate() { |
---|
71 | PRINTF(0)("Activating VolFogEffect\n"); |
---|
72 | |
---|
73 | // Test whether the extension exists |
---|
74 | if (!glewIsSupported("GL_EXT_fog_coord")) |
---|
75 | { |
---|
76 | PRINTF(0)("Can't activate volumetric fog, GL_EXT_fog_coord extension is misssing\n"); |
---|
77 | return; |
---|
78 | } |
---|
79 | |
---|
80 | fogActivate = true; |
---|
81 | } |
---|
82 | |
---|
83 | void VolFogEffect::deactivate() { |
---|
84 | PRINTF(0)("Deactivating VolFogEffect\n"); |
---|
85 | |
---|
86 | fogActivate = false; |
---|
87 | } |
---|
88 | |
---|
89 | |
---|
90 | /** |
---|
91 | * draws the effect |
---|
92 | */ |
---|
93 | void VolFogEffect::draw() const { |
---|
94 | |
---|
95 | if(!fogActivate) |
---|
96 | return; |
---|
97 | } |
---|
98 | |
---|
99 | |
---|
100 | /** |
---|
101 | * ticks the effect if there is any time dependancy |
---|
102 | */ |
---|
103 | void VolFogEffect::tick(float dt) {} |
---|