1 | |
---|
2 | |
---|
3 | /* |
---|
4 | orxonox - the future of 3D-vertical-scrollers |
---|
5 | |
---|
6 | Copyright (C) 2004 orx |
---|
7 | |
---|
8 | This program is free software; you can redistribute it and/or modify |
---|
9 | it under the terms of the GNU General Public License as published by |
---|
10 | the Free Software Foundation; either version 2, or (at your option) |
---|
11 | any later version. |
---|
12 | |
---|
13 | ### File Specific: |
---|
14 | main-programmer: Patrick Boenzli |
---|
15 | */ |
---|
16 | |
---|
17 | #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS |
---|
18 | |
---|
19 | #include "lense_flare.h" |
---|
20 | |
---|
21 | #include "load_param.h" |
---|
22 | #include "factory.h" |
---|
23 | |
---|
24 | #include "glincl.h" |
---|
25 | #include "texture.h" |
---|
26 | |
---|
27 | #include "render2D/billboard.h" |
---|
28 | |
---|
29 | using namespace std; |
---|
30 | |
---|
31 | CREATE_FACTORY(LenseFlare, CL_LENSE_FLARE); |
---|
32 | |
---|
33 | |
---|
34 | |
---|
35 | /** |
---|
36 | * default constructor |
---|
37 | * @param root The XML-element to load the LenseFlare from |
---|
38 | */ |
---|
39 | LenseFlare::LenseFlare(const TiXmlElement* root) |
---|
40 | { |
---|
41 | if (root != NULL) |
---|
42 | this->loadParams(root); |
---|
43 | } |
---|
44 | |
---|
45 | |
---|
46 | /** |
---|
47 | * destroys a LenseFlare |
---|
48 | */ |
---|
49 | LenseFlare::~LenseFlare() |
---|
50 | { |
---|
51 | std::vector<Billboard*>::iterator it; |
---|
52 | for( it = flares.begin(); it != flares.end(); it++) |
---|
53 | delete (*it); |
---|
54 | } |
---|
55 | |
---|
56 | |
---|
57 | /** |
---|
58 | * @param root The XML-element to load the LenseFlare from |
---|
59 | */ |
---|
60 | void LenseFlare::loadParams(const TiXmlElement* root) |
---|
61 | { |
---|
62 | GraphicsEffect::loadParams(root); |
---|
63 | |
---|
64 | LoadParam(root, "add-flare-texture", this, LenseFlare, addFlare) |
---|
65 | .describe("adds a lensflare texture to the engine"); |
---|
66 | } |
---|
67 | |
---|
68 | |
---|
69 | /** |
---|
70 | * initializes the fog effect |
---|
71 | */ |
---|
72 | bool LenseFlare::init() |
---|
73 | {} |
---|
74 | |
---|
75 | |
---|
76 | /** |
---|
77 | * activates the fog effect |
---|
78 | */ |
---|
79 | bool LenseFlare::activate() |
---|
80 | { |
---|
81 | this->bActivated = true; |
---|
82 | } |
---|
83 | |
---|
84 | |
---|
85 | /** |
---|
86 | * deactivates the fog effect |
---|
87 | */ |
---|
88 | bool LenseFlare::deactivate() |
---|
89 | { |
---|
90 | this->bActivated = false; |
---|
91 | } |
---|
92 | |
---|
93 | |
---|
94 | /** |
---|
95 | * converts a gl mode char to a GLint |
---|
96 | * @param mode the mode character |
---|
97 | */ |
---|
98 | GLint LenseFlare::charToFogMode(const char* mode) |
---|
99 | {} |
---|
100 | |
---|
101 | |
---|
102 | /** |
---|
103 | * adds a texture flare |
---|
104 | * @param textureName the name of the flare texture |
---|
105 | * |
---|
106 | * 1st Flare: Texture of the Sun/Light source itself |
---|
107 | * 2nd Flare: Texture of the |
---|
108 | */ |
---|
109 | void LenseFlare::addFlare(const char* textureName) |
---|
110 | { |
---|
111 | Billboard* bb = new Billboard(NULL); |
---|
112 | bb->setTexture(textureName); |
---|
113 | this->flares.push_back(bb); |
---|
114 | } |
---|
115 | |
---|
116 | |
---|
117 | /** |
---|
118 | * draws the LenseFlares |
---|
119 | */ |
---|
120 | void LenseFlare::draw() const |
---|
121 | { |
---|
122 | if( !this->bActivated) |
---|
123 | return; |
---|
124 | |
---|
125 | |
---|
126 | } |
---|