Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/ogre/OgreMain/include/OgreRenderTargetListener.h @ 11

Last change on this file since 11 was 5, checked in by anonymous, 17 years ago

=hoffentlich gehts jetzt

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