1 | /*
|
---|
2 | -----------------------------------------------------------------------------
|
---|
3 | This source file is part of OGRE
|
---|
4 | (Object-oriented Graphics Rendering Engine)
|
---|
5 | For the latest info, see http://www.ogre3d.org/
|
---|
6 |
|
---|
7 | Copyright (c) 2000-2005 The OGRE Team
|
---|
8 | Also see acknowledgements in Readme.html
|
---|
9 |
|
---|
10 | This program is free software; you can redistribute it and/or modify it under
|
---|
11 | the terms of the GNU Lesser General Public License as published by the Free Software
|
---|
12 | Foundation; either version 2 of the License, or (at your option) any later
|
---|
13 | version.
|
---|
14 |
|
---|
15 | This program is distributed in the hope that it will be useful, but WITHOUT
|
---|
16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
---|
17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
---|
18 |
|
---|
19 | You should have received a copy of the GNU Lesser General Public License along with
|
---|
20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
---|
21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to
|
---|
22 | http://www.gnu.org/copyleft/lesser.txt.
|
---|
23 | -----------------------------------------------------------------------------
|
---|
24 | */
|
---|
25 | #ifndef __RenderTargetListener_H__
|
---|
26 | #define __RenderTargetListener_H__
|
---|
27 |
|
---|
28 |
|
---|
29 | #include "OgrePrerequisites.h"
|
---|
30 |
|
---|
31 | namespace Ogre {
|
---|
32 |
|
---|
33 | /** Struct containing information about a RenderTarget event.
|
---|
34 | */
|
---|
35 | struct RenderTargetEvent
|
---|
36 | {
|
---|
37 | /// The source of the event being raised
|
---|
38 | RenderTarget* source;
|
---|
39 | };
|
---|
40 |
|
---|
41 | /** Struct containing information about a RenderTarget Viewport-specific event.
|
---|
42 | */
|
---|
43 | struct RenderTargetViewportEvent
|
---|
44 | {
|
---|
45 | /// The source of the event being raised
|
---|
46 | Viewport* source;
|
---|
47 | };
|
---|
48 |
|
---|
49 | /** A interface class defining a listener which can be used to receive
|
---|
50 | notifications of RenderTarget events.
|
---|
51 | @remarks
|
---|
52 | A 'listener' is an interface designed to be called back when
|
---|
53 | particular events are called. This class defines the
|
---|
54 | interface relating to RenderTarget events. In order to receive
|
---|
55 | notifications of RenderTarget events, you should create a subclass of
|
---|
56 | RenderTargetListener and override the methods for which you would like
|
---|
57 | to customise the resulting processing. You should then call
|
---|
58 | RenderTarget::addListener passing an instance of this class.
|
---|
59 | There is no limit to the number of RenderTarget listeners you can register,
|
---|
60 | allowing you to register multiple listeners for different purposes.
|
---|
61 | </p>
|
---|
62 | RenderTarget events occur before and after the target is updated as a whole,
|
---|
63 | and before and after each viewport on that target is updated. Each RenderTarget
|
---|
64 | holds it's own set of listeners, but you can register the same listener on
|
---|
65 | multiple render targets if you like since the event contains details of the
|
---|
66 | originating RenderTarget.
|
---|
67 | */
|
---|
68 | class _OgreExport RenderTargetListener
|
---|
69 | {
|
---|
70 | /*
|
---|
71 | Note that this could have been an abstract class, but I made
|
---|
72 | the explicit choice not to do this, because I wanted to give
|
---|
73 | people the option of only implementing the methods they wanted,
|
---|
74 | rather than having to create 'do nothing' implementations for
|
---|
75 | those they weren't interested in. As such this class follows
|
---|
76 | the 'Adapter' classes in Java rather than pure interfaces.
|
---|
77 | */
|
---|
78 | public:
|
---|
79 | virtual ~RenderTargetListener() {}
|
---|
80 | /** Called just before a RenderTarget is about to be rendered into.
|
---|
81 | @remarks
|
---|
82 | This event is raised just before any of the viewports on the target
|
---|
83 | are rendered to. You can perform manual rendering operations here if
|
---|
84 | you want, but please note that if the Viewport objects attached to this
|
---|
85 | target are set up to clear the background, you will lose whatever you
|
---|
86 | render. If you want some kind of backdrop in this event
|
---|
87 | you should turn off background clearing off on the viewports, and either
|
---|
88 | clear the viewports yourself in this event handler before doing your rendering
|
---|
89 | or just render over the top if you don't need to.
|
---|
90 | */
|
---|
91 | virtual void preRenderTargetUpdate(const RenderTargetEvent& evt) { }
|
---|
92 | /** Called just after a RenderTarget has been rendered to.
|
---|
93 | @remarks
|
---|
94 | This event is called just after all the viewports attached to the target
|
---|
95 | in question have been rendered to. You can perform your own manual rendering
|
---|
96 | commands in this event handler if you like, these will be composited with
|
---|
97 | the contents of the target already there (depending on the material settings
|
---|
98 | you use etc).
|
---|
99 | */
|
---|
100 | virtual void postRenderTargetUpdate(const RenderTargetEvent& evt) { }
|
---|
101 |
|
---|
102 | /* Called just before a Viewport on a RenderTarget is to be updated.
|
---|
103 | @remarks
|
---|
104 | This method is called before each viewport on the RenderTarget is
|
---|
105 | rendered to. You can use this to perform per-viewport settings changes,
|
---|
106 | such as showing / hiding particular overlays.
|
---|
107 | */
|
---|
108 | virtual void preViewportUpdate(const RenderTargetViewportEvent& evt) { }
|
---|
109 |
|
---|
110 | /* Called just after a Viewport on a RenderTarget is to be updated.
|
---|
111 | @remarks
|
---|
112 | This method is called after each viewport on the RenderTarget is
|
---|
113 | rendered to.
|
---|
114 | */
|
---|
115 | virtual void postViewportUpdate(const RenderTargetViewportEvent& evt) { }
|
---|
116 |
|
---|
117 | /** Called to notify listener that a Viewport has been added to the
|
---|
118 | target in question.
|
---|
119 | */
|
---|
120 | virtual void viewportAdded(const RenderTargetViewportEvent& evt) {}
|
---|
121 | /** Called to notify listener that a Viewport has been removed from the
|
---|
122 | target in question.
|
---|
123 | */
|
---|
124 | virtual void viewportRemoved(const RenderTargetViewportEvent& evt) {}
|
---|
125 | };
|
---|
126 | }
|
---|
127 |
|
---|
128 | #endif
|
---|