1 | /* |
---|
2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
3 | * > www.orxonox.net < |
---|
4 | * |
---|
5 | * |
---|
6 | * License notice: |
---|
7 | * |
---|
8 | * This program is free software; you can redistribute it and/or |
---|
9 | * modify it under the terms of the GNU General Public License |
---|
10 | * as published by the Free Software Foundation; either version 2 |
---|
11 | * of the License, or (at your option) any later version. |
---|
12 | * |
---|
13 | * This program is distributed in the hope that it will be useful, |
---|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | * GNU General Public License for more details. |
---|
17 | * |
---|
18 | * You should have received a copy of the GNU General Public License |
---|
19 | * along with this program; if not, write to the Free Software |
---|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
21 | * |
---|
22 | * Author: |
---|
23 | * Fabian 'x3n' Landau |
---|
24 | * Reto Grieder (physics) |
---|
25 | * Co-authors: |
---|
26 | * ... |
---|
27 | * |
---|
28 | */ |
---|
29 | |
---|
30 | /** |
---|
31 | @file LensFlare.h |
---|
32 | @brief Definition of the LensFlare class. |
---|
33 | */ |
---|
34 | |
---|
35 | #ifndef _LensFlare_H__ |
---|
36 | #define _LensFlare_H__ |
---|
37 | |
---|
38 | #include "OrxonoxPrereqs.h" |
---|
39 | |
---|
40 | #include "OgreBillboardSet.h" |
---|
41 | |
---|
42 | #include "core/GraphicsManager.h" |
---|
43 | #include "util/Math.h" |
---|
44 | #include "worldentities/StaticEntity.h" |
---|
45 | #include "graphics/Billboard.h" |
---|
46 | |
---|
47 | namespace orxonox |
---|
48 | { |
---|
49 | /** |
---|
50 | @brief |
---|
51 | This class adds a configurable LensFlare effect by adding multiple billboards for the several components of lens flare. |
---|
52 | It uses orxonox::Billboard to render this effect, the used images can be changed in lensflare.material |
---|
53 | |
---|
54 | @author |
---|
55 | David 'davidsa' Salvisberg |
---|
56 | */ |
---|
57 | //TODO: The Hardware Occlusion only works properly for a single Flare on the screen, |
---|
58 | // if we have multiple strong lights it'll become way more complicated to determine how much of every object is occluded individually |
---|
59 | // there's below a 100 render queue groups, so maybe we should take turns for each object to be tested, so we only have one of the objects rendered at a time |
---|
60 | // obviously we shouldn't use too much of these effects anyways, since they use a lot of performance, so not sure whether it's worth implementing a solution that works for multiple lens flares on screen |
---|
61 | class _OrxonoxExport LensFlare : public StaticEntity, public Tickable |
---|
62 | { |
---|
63 | public: |
---|
64 | LensFlare(BaseObject* creator); |
---|
65 | virtual ~LensFlare(); |
---|
66 | |
---|
67 | inline void setScale(float scale) |
---|
68 | { this->scale_=scale; } |
---|
69 | inline float getScale() |
---|
70 | { return this->scale_; } |
---|
71 | |
---|
72 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
---|
73 | |
---|
74 | virtual void tick(float dt); |
---|
75 | |
---|
76 | virtual void changedVisibility(); |
---|
77 | |
---|
78 | private: |
---|
79 | void registerVariables(); |
---|
80 | |
---|
81 | void createBillboards(); |
---|
82 | |
---|
83 | void updateBillboardPositions(); |
---|
84 | |
---|
85 | Billboard* occlusionBillboard_; |
---|
86 | unsigned int cameraDistance_; |
---|
87 | float scale_; |
---|
88 | }; |
---|
89 | } |
---|
90 | |
---|
91 | #endif /* _LensFlare_H__ */ |
---|