Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/ogre_src_v1-9-0/OgreMain/include/OgreLodListener.h @ 148

Last change on this file since 148 was 148, checked in by patricwi, 6 years ago

Added new dependencies for ogre1.9 and cegui0.8

File size: 7.6 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-2013 Torus Knot Software Ltd
8
9Permission is hereby granted, free of charge, to any person obtaining a copy
10of this software and associated documentation files (the "Software"), to deal
11in the Software without restriction, including without limitation the rights
12to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13copies of the Software, and to permit persons to whom the Software is
14furnished to do so, subject to the following conditions:
15
16The above copyright notice and this permission notice shall be included in
17all copies or substantial portions of the Software.
18
19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25THE SOFTWARE.
26-----------------------------------------------------------------------------
27*/
28
29#ifndef __LodListener_H__
30#define __LodListener_H__
31
32
33#include "OgrePrerequisites.h"
34
35namespace Ogre {
36
37        /** \addtogroup Core
38        *  @{
39        */
40        /** \addtogroup LOD
41        *  @{
42        */
43        /// Struct containing information about a LOD change event for movable objects.
44    struct MovableObjectLodChangedEvent
45    {
46        /// The movable object whose level of detail has changed.
47        MovableObject *movableObject;
48
49        /// The camera with respect to which the level of detail has changed.
50        Camera *camera;
51    };
52
53    /// Struct containing information about a mesh LOD change event for entities.
54    struct EntityMeshLodChangedEvent
55    {
56        /// The entity whose level of detail has changed.
57        Entity *entity;
58
59        /// The camera with respect to which the level of detail has changed.
60        Camera *camera;
61
62        /// LOD value as determined by LOD strategy.
63        Real lodValue;
64
65        /// Previous level of detail index.
66        ushort previousLodIndex;
67
68        /// New level of detail index.
69        ushort newLodIndex;
70    };
71
72    /// Struct containing information about a material LOD change event for entities.
73    struct EntityMaterialLodChangedEvent
74    {
75        /// The sub-entity whose material's level of detail has changed.
76        SubEntity *subEntity;
77
78        /// The camera with respect to which the level of detail has changed.
79        Camera *camera;
80
81        /// LOD value as determined by LOD strategy.
82        Real lodValue;
83
84        /// Previous level of detail index.
85        ushort previousLodIndex;
86
87        /// New level of detail index.
88        ushort newLodIndex;
89    };
90
91
92    /** A interface class defining a listener which can be used to receive
93        notifications of LOD events.
94        @remarks
95            A 'listener' is an interface designed to be called back when
96            particular events are called. This class defines the
97            interface relating to LOD events. In order to receive
98            notifications of LOD events, you should create a subclass of
99            LodListener and override the methods for which you would like
100            to customise the resulting processing. You should then call
101            SceneManager::addLodListener passing an instance of this class.
102            There is no limit to the number of LOD listeners you can register,
103            allowing you to register multiple listeners for different purposes.
104
105            For some uses, it may be advantageous to also subclass
106            RenderQueueListener as this interface makes available information
107            regarding render queue invocations.
108
109            It is important not to modify the scene graph during rendering, so,
110            for each event, there are two methods, a prequeue method and a
111            postqueue method.  The prequeue method is invoked during rendering,
112            and as such should not perform any changes, but if the event is
113            relevant, it may return true indicating the postqueue method should
114            also be called.  The postqueue method is invoked at an appropriate
115            time after rendering and scene changes may be safely made there.
116    */
117    class _OgreExport LodListener
118    {
119    public:
120
121        virtual ~LodListener() {}
122
123        /**
124        Called before a movable object's LOD has changed.
125        @remarks
126            Do not change the Ogre state from this method,
127            instead return true and perform changes in
128            postqueueMovableObjectLodChanged.
129        @return
130            True to indicate the event should be queued and
131            postqueueMovableObjectLodChanged called after
132            rendering is complete.
133        */
134        virtual bool prequeueMovableObjectLodChanged(const MovableObjectLodChangedEvent& evt)
135        { (void)evt; return false; }
136
137        /**
138        Called after a movable object's LOD has changed.
139        @remarks
140            May be called even if not requested from prequeueMovableObjectLodChanged
141            as only one event queue is maintained per SceneManger instance.
142        */
143        virtual void postqueueMovableObjectLodChanged(const MovableObjectLodChangedEvent& evt)
144        { (void)evt; }
145
146        /**
147        Called before an entity's mesh LOD has changed.
148        @remarks
149            Do not change the Ogre state from this method,
150            instead return true and perform changes in
151            postqueueEntityMeshLodChanged.
152
153            It is possible to change the event notification
154            and even alter the newLodIndex field (possibly to
155            prevent the LOD from changing, or to skip an
156            index).
157        @return
158            True to indicate the event should be queued and
159            postqueueEntityMeshLodChanged called after
160            rendering is complete.
161        */
162        virtual bool prequeueEntityMeshLodChanged(EntityMeshLodChangedEvent& evt)
163        { (void)evt; return false; }
164
165        /**
166        Called after an entity's mesh LOD has changed.
167        @remarks
168            May be called even if not requested from prequeueEntityMeshLodChanged
169            as only one event queue is maintained per SceneManger instance.
170        */
171        virtual void postqueueEntityMeshLodChanged(const EntityMeshLodChangedEvent& evt)
172        { (void)evt; }
173
174        /**
175        Called before an entity's material LOD has changed.
176        @remarks
177            Do not change the Ogre state from this method,
178            instead return true and perform changes in
179            postqueueMaterialLodChanged.
180
181            It is possible to change the event notification
182            and even alter the newLodIndex field (possibly to
183            prevent the LOD from changing, or to skip an
184            index).
185        @return
186            True to indicate the event should be queued and
187            postqueueMaterialLodChanged called after
188            rendering is complete.
189        */
190        virtual bool prequeueEntityMaterialLodChanged(EntityMaterialLodChangedEvent& evt)
191        { (void)evt; return false; }
192
193        /**
194        Called after an entity's material LOD has changed.
195        @remarks
196            May be called even if not requested from prequeueEntityMaterialLodChanged
197            as only one event queue is maintained per SceneManger instance.
198        */
199        virtual void postqueueEntityMaterialLodChanged(const EntityMaterialLodChangedEvent& evt)
200        { (void)evt; }
201
202    };
203        /** @} */
204        /** @} */
205}
206
207#endif
Note: See TracBrowser for help on using the repository browser.