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 RenderQueueListener.h |
---|
32 | @brief Definition of the RenderQueueListener class. |
---|
33 | */ |
---|
34 | |
---|
35 | #ifndef _ORenderQueueListener_H__ |
---|
36 | #define _ORenderQueueListener_H__ |
---|
37 | |
---|
38 | #include "OrxonoxPrereqs.h" |
---|
39 | |
---|
40 | #include <OgreRenderQueueListener.h> |
---|
41 | |
---|
42 | namespace orxonox |
---|
43 | { |
---|
44 | enum RenderQueueGroupID //!< these are IDs for render queues that are executed just after the main render queue defined by Ogre, we need more than one for Stencil Glow |
---|
45 | { |
---|
46 | RENDER_QUEUE_MAIN = Ogre::RENDER_QUEUE_MAIN, //reference to the main render queue |
---|
47 | RENDER_QUEUE_STENCIL_OBJECTS = RENDER_QUEUE_MAIN+1, |
---|
48 | RENDER_QUEUE_STENCIL_GLOW = RENDER_QUEUE_MAIN+2, |
---|
49 | RENDER_QUEUE_STENCIL_LAST = RENDER_QUEUE_STENCIL_GLOW //this is a reference to the last render queue to be affected by stencil glow effects |
---|
50 | }; |
---|
51 | |
---|
52 | const int STENCIL_VALUE_FOR_GLOW = 1; //!< this is a reference value for our mask, |
---|
53 | //!< if more than one type of stencil mask is to be used, each of them need their own value |
---|
54 | const int STENCIL_FULL_MASK = 0xFFFFFFFF; //!< this is a reference mask used in our stencil buffer |
---|
55 | |
---|
56 | /** |
---|
57 | @brief |
---|
58 | This class derives from the Ogre-Class RenderQueueListener and provides a way to define new rendering stages to enable use of e.g. stencil buffers |
---|
59 | to increase the number of shader effects we can create. Especially important for shader-based alpha blending. |
---|
60 | |
---|
61 | @author |
---|
62 | David 'davidsa' Salvisberg |
---|
63 | */ |
---|
64 | class _OrxonoxExport RenderQueueListener : public Ogre::RenderQueueListener |
---|
65 | { |
---|
66 | public: |
---|
67 | /** |
---|
68 | @brief |
---|
69 | This function is called just before a RenderQueueGroup is rendered, this function is called by Ogre automatically with the correct parameters. |
---|
70 | |
---|
71 | In this case we use it to set the stencil buffer parameters of the render system |
---|
72 | */ |
---|
73 | virtual void renderQueueStarted(Ogre::uint8 queueGroupId, const Ogre::String& invocation, bool& skipThisInvocation); |
---|
74 | /** |
---|
75 | @brief |
---|
76 | This function is called just after a RenderQueueGroup has been rendered, this function is called by Ogre automatically with the correct parameters. |
---|
77 | |
---|
78 | in this case we use it to unset the stencil buffer parameters, so the rest of the render queue is unaffected by it. |
---|
79 | */ |
---|
80 | virtual void renderQueueEnded(Ogre::uint8 queueGroupId, const Ogre::String& invocation, bool& repeatThisInvocation); |
---|
81 | }; |
---|
82 | } |
---|
83 | |
---|
84 | #endif /* _ORenderQueueListener_H__ */ |
---|